forked from OSchip/llvm-project
[modules] Fix findDirectiveAtLoc to not call a member function on a null pointer.
This is exercised by existing tests, and fixes a failure with -fsanitize=null. No observable change otherwise; the code happened to do the right thing in practice under recent versions of Clang and GCC because MacroDirective::getDefinition happens to check whether this == null. llvm-svn: 240691
This commit is contained in:
parent
198337bf42
commit
396f18f302
clang/include/clang/Lex
|
@ -454,7 +454,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) {
|
||||
|
|
Loading…
Reference in New Issue