forked from OSchip/llvm-project
Thread the 'Invalid' out parameter through SourceManager::getSLocEntry() and callees of SourceManager::getSLocEntryByID().
Also add an 'Invalid' check in SourceManager::computeMacroArgsCache(). llvm-svn: 183538
This commit is contained in:
parent
158d8069ad
commit
fe68302fe8
|
@ -1483,7 +1483,7 @@ public:
|
|||
if (Invalid) *Invalid = true;
|
||||
return LocalSLocEntryTable[0];
|
||||
}
|
||||
return getSLocEntryByID(FID.ID);
|
||||
return getSLocEntryByID(FID.ID, Invalid);
|
||||
}
|
||||
|
||||
unsigned getNextLocalOffset() const { return NextLocalOffset; }
|
||||
|
@ -1547,11 +1547,11 @@ private:
|
|||
const SrcMgr::SLocEntry &loadSLocEntry(unsigned Index, bool *Invalid) const;
|
||||
|
||||
/// \brief Get the entry with the given unwrapped FileID.
|
||||
const SrcMgr::SLocEntry &getSLocEntryByID(int ID) const {
|
||||
const SrcMgr::SLocEntry &getSLocEntryByID(int ID, bool *Invalid = 0) const {
|
||||
assert(ID != -1 && "Using FileID sentinel value");
|
||||
if (ID < 0)
|
||||
return getLoadedSLocEntryByID(ID);
|
||||
return getLocalSLocEntry(static_cast<unsigned>(ID));
|
||||
return getLoadedSLocEntryByID(ID, Invalid);
|
||||
return getLocalSLocEntry(static_cast<unsigned>(ID), Invalid);
|
||||
}
|
||||
|
||||
const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID,
|
||||
|
|
|
@ -1808,7 +1808,10 @@ void SourceManager::computeMacroArgsCache(MacroArgsMap *&CachePtr,
|
|||
return;
|
||||
}
|
||||
|
||||
const SrcMgr::SLocEntry &Entry = getSLocEntryByID(ID);
|
||||
bool Invalid = false;
|
||||
const SrcMgr::SLocEntry &Entry = getSLocEntryByID(ID, &Invalid);
|
||||
if (Invalid)
|
||||
return;
|
||||
if (Entry.isFile()) {
|
||||
SourceLocation IncludeLoc = Entry.getFile().getIncludeLoc();
|
||||
if (IncludeLoc.isInvalid())
|
||||
|
|
Loading…
Reference in New Issue