diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-26 17:17:01 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-26 17:17:01 +0000 |
commit | c56fff7fd231aebf4b152f60f8f11ef91835c48a (patch) | |
tree | 22119f54c12ae692e50e7ed4930160f950e37f2f /lib/Lex/PreprocessingRecord.cpp | |
parent | 1232e279b4a0d98885b9672d3bb5905488360e49 (diff) |
[Preprocessor/Modules] Separate the macro directives kinds into their own MacroDirective's subclasses.
For each macro directive (define, undefine, visibility) have a separate object that gets chained
to the macro directive history. This has several benefits:
-No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like
PPMutationListener become unnecessary.
-No need to keep extra source locations for the undef/visibility locations for the define directive object
(which is the majority of the directives)
-Much easier to hide/unhide a section in the macro directive history.
-Easier to track the effects of the directives across different submodules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PreprocessingRecord.cpp')
-rw-r--r-- | lib/Lex/PreprocessingRecord.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp index b834d6cfb8..b10e7f7bee 100644 --- a/lib/Lex/PreprocessingRecord.cpp +++ b/lib/Lex/PreprocessingRecord.cpp @@ -385,31 +385,34 @@ void PreprocessingRecord::Ifdef(SourceLocation Loc, const Token &MacroNameTok, const MacroDirective *MD) { // This is not actually a macro expansion but record it as a macro reference. if (MD) - addMacroExpansion(MacroNameTok, MD->getInfo(), MacroNameTok.getLocation()); + addMacroExpansion(MacroNameTok, MD->getMacroInfo(), + MacroNameTok.getLocation()); } void PreprocessingRecord::Ifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDirective *MD) { // This is not actually a macro expansion but record it as a macro reference. if (MD) - addMacroExpansion(MacroNameTok, MD->getInfo(), MacroNameTok.getLocation()); + addMacroExpansion(MacroNameTok, MD->getMacroInfo(), + MacroNameTok.getLocation()); } void PreprocessingRecord::Defined(const Token &MacroNameTok, const MacroDirective *MD) { // This is not actually a macro expansion but record it as a macro reference. if (MD) - addMacroExpansion(MacroNameTok, MD->getInfo(), MacroNameTok.getLocation()); + addMacroExpansion(MacroNameTok, MD->getMacroInfo(), + MacroNameTok.getLocation()); } void PreprocessingRecord::MacroExpands(const Token &Id,const MacroDirective *MD, SourceRange Range) { - addMacroExpansion(Id, MD->getInfo(), Range); + addMacroExpansion(Id, MD->getMacroInfo(), Range); } void PreprocessingRecord::MacroDefined(const Token &Id, const MacroDirective *MD) { - const MacroInfo *MI = MD->getInfo(); + const MacroInfo *MI = MD->getMacroInfo(); SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc()); MacroDefinition *Def = new (*this) MacroDefinition(Id.getIdentifierInfo(), R); @@ -421,7 +424,7 @@ void PreprocessingRecord::MacroUndefined(const Token &Id, const MacroDirective *MD) { // Note: MI may be null (when #undef'ining an undefined macro). if (MD) - MacroDefinitions.erase(MD->getInfo()); + MacroDefinitions.erase(MD->getMacroInfo()); } void PreprocessingRecord::InclusionDirective( |