summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2015-03-04 16:03:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2015-03-04 16:03:07 +0000
commit5c585253e5f66affee0ce1d3db18ea2cfdfcdd82 (patch)
tree21bd2bb236386eb8d64bc5e446312e2c5b412132 /clang/lib/Lex/Preprocessor.cpp
parentf14889ee3474354e81bf58fe1c4f87739f1f22b5 (diff)
downloadbcm5719-llvm-5c585253e5f66affee0ce1d3db18ea2cfdfcdd82.tar.gz
bcm5719-llvm-5c585253e5f66affee0ce1d3db18ea2cfdfcdd82.zip
[Modules] Fix crash in Preprocessor::getLastMacroWithSpelling().
Macro names that got undefined inside a module may not have their MacroInfo set. llvm-svn: 231251
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index b2a6d933a0f..51a038ac728 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -321,11 +321,11 @@ StringRef Preprocessor::getLastMacroWithSpelling(
StringRef BestSpelling;
for (Preprocessor::macro_iterator I = macro_begin(), E = macro_end();
I != E; ++I) {
- if (!I->second->getMacroInfo()->isObjectLike())
- continue;
const MacroDirective::DefInfo
Def = I->second->findDirectiveAtLoc(Loc, SourceMgr);
- if (!Def)
+ if (!Def || !Def.getMacroInfo())
+ continue;
+ if (!Def.getMacroInfo()->isObjectLike())
continue;
if (!MacroDefinitionEquals(Def.getMacroInfo(), Tokens))
continue;
OpenPOWER on IntegriCloud