|
clang 24.0.0git
|
Encapsulates changes to the "macros namespace" (the location where the macro name became active, the location where it was undefined, etc.). More...
#include "clang/Lex/MacroInfo.h"
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. | |
| const MacroDirective * | getPrevious () const |
| Get previous definition of the macro with the same name. | |
| MacroDirective * | getPrevious () |
| Get previous definition of the macro with the same name. | |
| 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. | |
| const DefInfo | getDefinition () const |
| bool | isDefined () const |
| const MacroInfo * | getMacroInfo () const |
| MacroInfo * | getMacroInfo () |
| const DefInfo | findDirectiveAtLoc (SourceLocation L, const SourceManager &SM) const |
| Find macro definition active in the specified source location. | |
| void | dump () const |
| void | dump (const SourceManager *SM) const |
Static Public Member Functions | |
| static bool | classof (const MacroDirective *) |
Protected Member Functions | |
| MacroDirective (Kind K, SourceLocation Loc) | |
Protected Attributes | |
| MacroDirective * | Previous = nullptr |
| Previous macro directive for the same identifier, or nullptr. | |
| SourceLocation | Loc |
| unsigned | MDKind: 2 |
| MacroDirective kind. | |
| unsigned | IsPublic: 1 |
| Whether the macro has public visibility (when described in a module). | |
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 315 of file MacroInfo.h.
| Enumerator | |
|---|---|
| MD_Define | |
| MD_Undefine | |
| MD_Visibility | |
Definition at line 317 of file MacroInfo.h.
|
inlineprotected |
Definition at line 340 of file MacroInfo.h.
References IsPublic, Loc, MacroDirective(), MDKind, and true.
Referenced by clang::DefMacroDirective::classof(), classof(), clang::UndefMacroDirective::classof(), clang::VisibilityMacroDirective::classof(), clang::DefMacroDirective::DefMacroDirective(), getDefinition(), getDefinition(), getPrevious(), getPrevious(), MacroDirective(), setPrevious(), clang::UndefMacroDirective::UndefMacroDirective(), and clang::VisibilityMacroDirective::VisibilityMacroDirective().
|
inlinestatic |
Definition at line 422 of file MacroInfo.h.
References MacroDirective().
| LLVM_DUMP_METHOD void MacroDirective::dump | ( | ) | const |
| LLVM_DUMP_METHOD void MacroDirective::dump | ( | const SourceManager * | SM | ) | const |
Definition at line 235 of file MacroInfo.cpp.
References getKind(), getPrevious(), clang::isa(), IsPublic, Loc, MD_Define, MD_Undefine, and MD_Visibility.
| const MacroDirective::DefInfo MacroDirective::findDirectiveAtLoc | ( | SourceLocation | L, |
| const SourceManager & | SM ) const |
Find macro definition active in the specified source location.
If this macro was not defined there, return NULL.
Definition at line 220 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 198 of file MacroInfo.cpp.
References clang::cast(), getPrevious(), clang::VisibilityMacroDirective::isPublic(), and MacroDirective().
Referenced by findDirectiveAtLoc(), getDefinition(), getMacroInfo(), getMacroInfo(), and isDefined().
|
inline |
Definition at line 399 of file MacroInfo.h.
References getDefinition(), and MacroDirective().
|
inline |
Definition at line 344 of file MacroInfo.h.
References MDKind.
Referenced by clang::DefMacroDirective::classof(), clang::UndefMacroDirective::classof(), clang::VisibilityMacroDirective::classof(), and dump().
|
inline |
|
inline |
Definition at line 412 of file MacroInfo.h.
References getDefinition(), and clang::MacroDirective::DefInfo::getMacroInfo().
|
inline |
Definition at line 409 of file MacroInfo.h.
References getDefinition(), and clang::MacroDirective::DefInfo::getMacroInfo().
Referenced by clang::MacroPPCallbacks::MacroDefined(), InjectRootSignatureCallback::MacroDefined(), and shouldIgnoreMacro().
|
inline |
Get previous definition of the macro with the same name.
Definition at line 355 of file MacroInfo.h.
References MacroDirective(), and Previous.
|
inline |
Get previous definition of the macro with the same name.
Definition at line 352 of file MacroInfo.h.
References MacroDirective(), and Previous.
Referenced by clang::Preprocessor::appendMacroDirective(), dump(), getDefinition(), and clang::Preprocessor::LeaveSubmodule().
|
inline |
Definition at line 403 of file MacroInfo.h.
References getDefinition().
Referenced by clang::Preprocessor::appendMacroDirective(), and clang::Preprocessor::setLoadedMacroDirective().
|
inline |
Set previous definition of the macro with the same name.
Definition at line 349 of file MacroInfo.h.
References MacroDirective(), and Previous.
Referenced by clang::Preprocessor::appendMacroDirective(), clang::ASTReader::resolvePendingMacro(), and clang::Preprocessor::setLoadedMacroDirective().
|
protected |
Whether the macro has public visibility (when described in a module).
Definition at line 338 of file MacroInfo.h.
Referenced by dump(), clang::VisibilityMacroDirective::isPublic(), MacroDirective(), and clang::VisibilityMacroDirective::VisibilityMacroDirective().
|
protected |
Definition at line 327 of file MacroInfo.h.
Referenced by clang::DefMacroDirective::DefMacroDirective(), dump(), getLocation(), MacroDirective(), and clang::VisibilityMacroDirective::VisibilityMacroDirective().
|
protected |
MacroDirective kind.
Definition at line 331 of file MacroInfo.h.
Referenced by getKind(), and MacroDirective().
|
protected |
Previous macro directive for the same identifier, or nullptr.
Definition at line 325 of file MacroInfo.h.
Referenced by getPrevious(), getPrevious(), and setPrevious().