[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager

I'm currently working on including macro expansions in the Static Analyzer's
plist output, where I can only access a const SourceManager.

Differential Revision: https://reviews.llvm.org/D53940

llvm-svn: 345741
This commit is contained in:
Kristof Umann 2018-10-31 17:19:20 +00:00
parent 8763c0c5b7
commit 714a03ad3b
2 changed files with 4 additions and 2 deletions

View File

@ -395,7 +395,8 @@ public:
/// Find macro definition active in the specified source location. If /// Find macro definition active in the specified source location. If
/// this macro was not defined there, return NULL. /// this macro was not defined there, return NULL.
const DefInfo findDirectiveAtLoc(SourceLocation L, SourceManager &SM) const; const DefInfo findDirectiveAtLoc(SourceLocation L,
const SourceManager &SM) const;
void dump() const; void dump() const;

View File

@ -200,7 +200,8 @@ MacroDirective::DefInfo MacroDirective::getDefinition() {
} }
const MacroDirective::DefInfo const MacroDirective::DefInfo
MacroDirective::findDirectiveAtLoc(SourceLocation L, SourceManager &SM) const { MacroDirective::findDirectiveAtLoc(SourceLocation L,
const SourceManager &SM) const {
assert(L.isValid() && "SourceLocation is invalid."); assert(L.isValid() && "SourceLocation is invalid.");
for (DefInfo Def = getDefinition(); Def; Def = Def.getPreviousDefinition()) { for (DefInfo Def = getDefinition(); Def; Def = Def.getPreviousDefinition()) {
if (Def.getLocation().isInvalid() || // For macros defined on the command line. if (Def.getLocation().isInvalid() || // For macros defined on the command line.