summaryrefslogtreecommitdiffstats
path: root/include/clang/Lex/Preprocessor.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r--include/clang/Lex/Preprocessor.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 439a280..bba0c38 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -394,7 +394,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
const IdentifierInfo *II) const {
// FIXME: Find a spare bit on IdentifierInfo and store a
// HasModuleMacros flag.
- if (!II->hasMacroDefinition() || !PP.getLangOpts().Modules ||
+ if (!II->hasMacroDefinition() ||
+ (!PP.getLangOpts().Modules &&
+ !PP.getLangOpts().ModulesLocalVisibility) ||
!PP.CurSubmoduleState->VisibleModules.getGeneration())
return nullptr;
@@ -454,7 +456,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
SourceManager &SourceMgr) const {
// FIXME: Incorporate module macros into the result of this.
- return getLatest()->findDirectiveAtLoc(Loc, SourceMgr);
+ if (auto *Latest = getLatest())
+ return Latest->findDirectiveAtLoc(Loc, SourceMgr);
+ return MacroDirective::DefInfo();
}
void overrideActiveModuleMacros(Preprocessor &PP, IdentifierInfo *II) {
OpenPOWER on IntegriCloud