[libclang] Make sure we do a correct invalid check in clang_getExpansionLocation.

llvm-svn: 142430
This commit is contained in:
Argyrios Kyrtzidis 2011-10-18 21:59:54 +00:00
parent b2a703d352
commit 72a3cf0a4a
2 changed files with 5 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}