forked from OSchip/llvm-project
[libclang] Make sure we do a correct invalid check in clang_getExpansionLocation.
llvm-svn: 142430
This commit is contained in:
parent
b2a703d352
commit
72a3cf0a4a
|
@ -1213,6 +1213,10 @@ public:
|
|||
}
|
||||
|
||||
const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const {
|
||||
if (FID.ID == 0 || FID.ID == -1) {
|
||||
if (Invalid) *Invalid = true;
|
||||
return LocalSLocEntryTable[0];
|
||||
}
|
||||
return getSLocEntryByID(FID.ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -2814,7 +2814,7 @@ void clang_getExpansionLocation(CXSourceLocation location,
|
|||
FileID fileID = SM.getFileID(ExpansionLoc);
|
||||
bool Invalid = false;
|
||||
const SrcMgr::SLocEntry &sloc = SM.getSLocEntry(fileID, &Invalid);
|
||||
if (!sloc.isFile() || Invalid) {
|
||||
if (Invalid || !sloc.isFile()) {
|
||||
createNullLocation(file, line, column, offset);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue