diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-25 02:41:16 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-25 02:41:16 +0000 |
| commit | 335c5a42e9cfa70436bce30a6867cb722cac339c (patch) | |
| tree | 2997d3c3e38d4ef6959250e95ceeff79713fb470 /clang/lib/Lex | |
| parent | ef31f376bb7f16f010db30359740a810c2681819 (diff) | |
| download | bcm5719-llvm-335c5a42e9cfa70436bce30a6867cb722cac339c.tar.gz bcm5719-llvm-335c5a42e9cfa70436bce30a6867cb722cac339c.zip | |
Don't record nested macro expansions in the preprocessing record,
it can only bring pain when dealing with preprocessor abuse (see: boost).
rdar://10898986
llvm-svn: 151427
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/PreprocessingRecord.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index 6c36e73ad33..c87088d2dec 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -37,10 +37,8 @@ InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec, this->FileName = StringRef(Memory, FileName.size()); } -PreprocessingRecord::PreprocessingRecord(SourceManager &SM, - bool IncludeNestedMacroExpansions) - : SourceMgr(SM), IncludeNestedMacroExpansions(IncludeNestedMacroExpansions), - ExternalSource(0) +PreprocessingRecord::PreprocessingRecord(SourceManager &SM) + : SourceMgr(SM), ExternalSource(0) { } @@ -331,7 +329,8 @@ MacroDefinition *PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) { void PreprocessingRecord::MacroExpands(const Token &Id, const MacroInfo* MI, SourceRange Range) { - if (!IncludeNestedMacroExpansions && Id.getLocation().isMacroID()) + // We don't record nested macro expansions. + if (Id.getLocation().isMacroID()) return; if (MI->isBuiltinMacro()) diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 75ab89d4d9b..96dfe360069 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -654,12 +654,10 @@ CommentHandler::~CommentHandler() { } CodeCompletionHandler::~CodeCompletionHandler() { } -void Preprocessor::createPreprocessingRecord( - bool IncludeNestedMacroExpansions) { +void Preprocessor::createPreprocessingRecord() { if (Record) return; - Record = new PreprocessingRecord(getSourceManager(), - IncludeNestedMacroExpansions); + Record = new PreprocessingRecord(getSourceManager()); addPPCallbacks(Record); } |

