diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-04 02:25:31 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-04 02:25:31 +0000 |
commit | 66a8186ed415f4f385ea28201ac87b0350d92714 (patch) | |
tree | 1a216031d7df787c8732a073ef6bd7de622a519b /clang/lib/Lex | |
parent | 949d55d87ac6675023893b3ca5aa95a6cd277920 (diff) | |
download | bcm5719-llvm-66a8186ed415f4f385ea28201ac87b0350d92714.tar.gz bcm5719-llvm-66a8186ed415f4f385ea28201ac87b0350d92714.zip |
Rename MacroDefinition -> MacroDefinitionRecord, Preprocessor::MacroDefinition -> MacroDefinition.
clang::MacroDefinition now models the currently-defined value of a macro. The
previous MacroDefinition type, which represented a record of a macro definition
directive for a detailed preprocessing record, is now called MacroDefinitionRecord.
llvm-svn: 236400
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/PPExpressions.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Lex/PreprocessingRecord.cpp | 29 |
2 files changed, 17 insertions, 16 deletions
diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp index d05ec672c8b..411a5012241 100644 --- a/clang/lib/Lex/PPExpressions.cpp +++ b/clang/lib/Lex/PPExpressions.cpp @@ -108,9 +108,9 @@ static bool EvaluateDefined(PPValue &Result, Token &PeekTok, DefinedTracker &DT, // Otherwise, we got an identifier, is it defined to something? IdentifierInfo *II = PeekTok.getIdentifierInfo(); - Preprocessor::MacroDefinition Macro = PP.getMacroDefinition(II); + MacroDefinition Macro = PP.getMacroDefinition(II); Result.Val = !!Macro; - Result.Val.setIsUnsigned(false); // Result is signed intmax_t. + Result.Val.setIsUnsigned(false); // Result is signed intmax_t. // If there is a macro, mark it used. if (Result.Val != 0 && ValueLive) diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index dafcbbe58c9..fd4bed17797 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -246,10 +246,11 @@ PreprocessingRecord::addPreprocessedEntity(PreprocessedEntity *Entity) { assert(Entity); SourceLocation BeginLoc = Entity->getSourceRange().getBegin(); - if (isa<MacroDefinition>(Entity)) { + if (isa<MacroDefinitionRecord>(Entity)) { assert((PreprocessedEntities.empty() || - !SourceMgr.isBeforeInTranslationUnit(BeginLoc, - PreprocessedEntities.back()->getSourceRange().getBegin())) && + !SourceMgr.isBeforeInTranslationUnit( + BeginLoc, + PreprocessedEntities.back()->getSourceRange().getBegin())) && "a macro definition was encountered out-of-order"); PreprocessedEntities.push_back(Entity); return getPPEntityID(PreprocessedEntities.size()-1, /*isLoaded=*/false); @@ -318,7 +319,7 @@ unsigned PreprocessingRecord::allocateLoadedEntities(unsigned NumEntities) { } void PreprocessingRecord::RegisterMacroDefinition(MacroInfo *Macro, - MacroDefinition *Def) { + MacroDefinitionRecord *Def) { MacroDefinitions[Macro] = Def; } @@ -355,9 +356,10 @@ PreprocessingRecord::getLoadedPreprocessedEntity(unsigned Index) { return Entity; } -MacroDefinition *PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) { - llvm::DenseMap<const MacroInfo *, MacroDefinition *>::iterator Pos - = MacroDefinitions.find(MI); +MacroDefinitionRecord * +PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) { + llvm::DenseMap<const MacroInfo *, MacroDefinitionRecord *>::iterator Pos = + MacroDefinitions.find(MI); if (Pos == MacroDefinitions.end()) return nullptr; @@ -372,11 +374,10 @@ void PreprocessingRecord::addMacroExpansion(const Token &Id, return; if (MI->isBuiltinMacro()) - addPreprocessedEntity( - new (*this) MacroExpansion(Id.getIdentifierInfo(),Range)); - else if (MacroDefinition *Def = findMacroDefinition(MI)) - addPreprocessedEntity( - new (*this) MacroExpansion(Def, Range)); + addPreprocessedEntity(new (*this) + MacroExpansion(Id.getIdentifierInfo(), Range)); + else if (MacroDefinitionRecord *Def = findMacroDefinition(MI)) + addPreprocessedEntity(new (*this) MacroExpansion(Def, Range)); } void PreprocessingRecord::Ifdef(SourceLocation Loc, const Token &MacroNameTok, @@ -418,8 +419,8 @@ void PreprocessingRecord::MacroDefined(const Token &Id, const MacroDirective *MD) { const MacroInfo *MI = MD->getMacroInfo(); SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc()); - MacroDefinition *Def - = new (*this) MacroDefinition(Id.getIdentifierInfo(), R); + MacroDefinitionRecord *Def = + new (*this) MacroDefinitionRecord(Id.getIdentifierInfo(), R); addPreprocessedEntity(Def); MacroDefinitions[MI] = Def; } |