clang  3.9.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::MacroDirective Class Reference

Encapsulates changes to the "macros namespace" (the location where the macro name became active, the location where it was undefined, etc.). More...

#include <MacroInfo.h>

Inheritance diagram for clang::MacroDirective:
[legend]
Collaboration diagram for clang::MacroDirective:
[legend]

Classes

class  DefInfo
 

Public Types

enum  Kind { MD_Define, MD_Undefine, MD_Visibility }
 

Public Member Functions

Kind getKind () const
 
SourceLocation getLocation () const
 
void setPrevious (MacroDirective *Prev)
 Set previous definition of the macro with the same name. More...
 
const MacroDirectivegetPrevious () const
 Get previous definition of the macro with the same name. More...
 
MacroDirectivegetPrevious ()
 Get previous definition of the macro with the same name. More...
 
bool isFromPCH () const
 Return true if the macro directive was loaded from a PCH file. More...
 
void setIsFromPCH ()
 
DefInfo getDefinition ()
 Traverses the macro directives history and returns the next macro definition directive along with info about its undefined location (if there is one) and if it is public or private. More...
 
const DefInfo getDefinition () const
 
bool isDefined () const
 
const MacroInfogetMacroInfo () const
 
MacroInfogetMacroInfo ()
 
const DefInfo findDirectiveAtLoc (SourceLocation L, SourceManager &SM) const
 Find macro definition active in the specified source location. More...
 
void dump () const
 

Static Public Member Functions

static bool classof (const MacroDirective *)
 

Protected Member Functions

 MacroDirective (Kind K, SourceLocation Loc)
 

Protected Attributes

MacroDirectivePrevious
 Previous macro directive for the same identifier, or NULL. More...
 
SourceLocation Loc
 
unsigned MDKind: 2
 MacroDirective kind. More...
 
unsigned IsFromPCH: 1
 True if the macro directive was loaded from a PCH file. More...
 
unsigned IsPublic: 1
 Whether the macro has public visibility (when described in a module). More...
 

Detailed Description

Encapsulates changes to the "macros namespace" (the location where the macro name became active, the location where it was undefined, etc.).

MacroDirectives, associated with an identifier, are used to model the macro history. Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but #pragma push_macro / pop_macro can create additional DefMacroDirectives for the same MacroInfo.

Definition at line 307 of file MacroInfo.h.

Member Enumeration Documentation

Enumerator
MD_Define 
MD_Undefine 
MD_Visibility 

Definition at line 309 of file MacroInfo.h.

Constructor & Destructor Documentation

clang::MacroDirective::MacroDirective ( Kind  K,
SourceLocation  Loc 
)
inlineprotected

Definition at line 329 of file MacroInfo.h.

Member Function Documentation

static bool clang::MacroDirective::classof ( const MacroDirective )
inlinestatic

Definition at line 414 of file MacroInfo.h.

LLVM_DUMP_METHOD void MacroDirective::dump ( ) const

Definition at line 212 of file MacroInfo.cpp.

References getKind(), getPrevious(), IsFromPCH, IsPublic, MD_Define, MD_Undefine, and MD_Visibility.

const MacroDirective::DefInfo MacroDirective::findDirectiveAtLoc ( SourceLocation  L,
SourceManager SM 
) const

Find macro definition active in the specified source location.

If this macro was not defined there, return NULL.

Definition at line 200 of file MacroInfo.cpp.

References getDefinition(), clang::MacroDirective::DefInfo::getPreviousDefinition(), clang::SourceManager::isBeforeInTranslationUnit(), and clang::SourceLocation::isValid().

MacroDirective::DefInfo MacroDirective::getDefinition ( )

Traverses the macro directives history and returns the next macro definition directive along with info about its undefined location (if there is one) and if it is public or private.

Definition at line 176 of file MacroInfo.cpp.

References getPrevious(), and clang::VisibilityMacroDirective::isPublic().

Referenced by findDirectiveAtLoc(), getDefinition(), getMacroInfo(), and isDefined().

const DefInfo clang::MacroDirective::getDefinition ( ) const
inline

Definition at line 393 of file MacroInfo.h.

References getDefinition().

Kind clang::MacroDirective::getKind ( ) const
inline
SourceLocation clang::MacroDirective::getLocation ( ) const
inline

Definition at line 336 of file MacroInfo.h.

References Loc.

Referenced by clang::MacroDirective::DefInfo::getLocation(), and shouldIgnoreMacro().

const MacroInfo* clang::MacroDirective::getMacroInfo ( ) const
inline

Definition at line 403 of file MacroInfo.h.

References getDefinition(), and clang::MacroDirective::DefInfo::getMacroInfo().

Referenced by shouldIgnoreMacro().

MacroInfo* clang::MacroDirective::getMacroInfo ( )
inline

Definition at line 406 of file MacroInfo.h.

References getDefinition(), and clang::MacroDirective::DefInfo::getMacroInfo().

const MacroDirective* clang::MacroDirective::getPrevious ( ) const
inline

Get previous definition of the macro with the same name.

Definition at line 342 of file MacroInfo.h.

References Previous.

Referenced by clang::Preprocessor::appendMacroDirective(), dump(), and getDefinition().

MacroDirective* clang::MacroDirective::getPrevious ( )
inline

Get previous definition of the macro with the same name.

Definition at line 345 of file MacroInfo.h.

References Previous.

bool clang::MacroDirective::isDefined ( ) const
inline
bool clang::MacroDirective::isFromPCH ( ) const
inline

Return true if the macro directive was loaded from a PCH file.

Definition at line 348 of file MacroInfo.h.

References IsFromPCH.

void clang::MacroDirective::setIsFromPCH ( )
inline

Definition at line 350 of file MacroInfo.h.

References IsFromPCH.

void clang::MacroDirective::setPrevious ( MacroDirective Prev)
inline

Set previous definition of the macro with the same name.

Definition at line 339 of file MacroInfo.h.

References Previous.

Referenced by clang::Preprocessor::appendMacroDirective(), and clang::ASTReader::resolvePendingMacro().

Member Data Documentation

unsigned clang::MacroDirective::IsFromPCH
protected

True if the macro directive was loaded from a PCH file.

Definition at line 321 of file MacroInfo.h.

Referenced by dump(), isFromPCH(), and setIsFromPCH().

unsigned clang::MacroDirective::IsPublic
protected

Whether the macro has public visibility (when described in a module).

Definition at line 327 of file MacroInfo.h.

Referenced by dump(), clang::VisibilityMacroDirective::isPublic(), and clang::VisibilityMacroDirective::VisibilityMacroDirective().

SourceLocation clang::MacroDirective::Loc
protected

Definition at line 315 of file MacroInfo.h.

Referenced by getLocation().

unsigned clang::MacroDirective::MDKind
protected

MacroDirective kind.

Definition at line 318 of file MacroInfo.h.

Referenced by getKind().

MacroDirective* clang::MacroDirective::Previous
protected

Previous macro directive for the same identifier, or NULL.

Definition at line 313 of file MacroInfo.h.

Referenced by getPrevious(), and setPrevious().


The documentation for this class was generated from the following files: