diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-09-30 20:00:18 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-09-30 20:00:18 +0000 |
commit | c28ce3aba646d0ea24ab584b9bac88e3a2a7374e (patch) | |
tree | 6905ba39906cfd0275cda91407d0e6f1a03211ff /clang/lib/Lex | |
parent | c110c0b99a2b1ef9f5bbad280abc42664971dc80 (diff) | |
download | bcm5719-llvm-c28ce3aba646d0ea24ab584b9bac88e3a2a7374e.tar.gz bcm5719-llvm-c28ce3aba646d0ea24ab584b9bac88e3a2a7374e.zip |
Avoid a crash after loading an #undef'd macro in code completion
In code-completion, don't assume there is a MacroInfo for everything,
since we aren't serializing the def corresponding to a later #undef in
the same module. Also setup the HadMacro bit correctly for undefs to
avoid an assertion failure.
rdar://18416901
llvm-svn: 218694
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 62d2da56ba9..e875860f820 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -49,7 +49,10 @@ void Preprocessor::appendMacroDirective(IdentifierInfo *II, MacroDirective *MD){ MacroDirective *&StoredMD = Macros[II]; MD->setPrevious(StoredMD); StoredMD = MD; - II->setHasMacroDefinition(MD->isDefined()); + // Setup the identifier as having associated macro history. + II->setHasMacroDefinition(true); + if (!MD->isDefined()) + II->setHasMacroDefinition(false); bool isImportedMacro = isa<DefMacroDirective>(MD) && cast<DefMacroDirective>(MD)->isImported(); if (II->isFromAST() && !isImportedMacro) |