forked from OSchip/llvm-project
Sanity checks in SourceManager::getFileEntryForID() and SourceManager::getFileEntryForSLocEntry()
to make sure we do not crash. rdar://10594186 llvm-svn: 147576
This commit is contained in:
parent
a59dc2f8f0
commit
e6e9d8f6a7
|
@ -750,13 +750,19 @@ public:
|
|||
if (MyInvalid || !Entry.isFile())
|
||||
return 0;
|
||||
|
||||
return Entry.getFile().getContentCache()->OrigEntry;
|
||||
const SrcMgr::ContentCache *Content = Entry.getFile().getContentCache();
|
||||
if (!Content)
|
||||
return 0;
|
||||
return Content->OrigEntry;
|
||||
}
|
||||
|
||||
/// Returns the FileEntry record for the provided SLocEntry.
|
||||
const FileEntry *getFileEntryForSLocEntry(const SrcMgr::SLocEntry &sloc) const
|
||||
{
|
||||
return sloc.getFile().getContentCache()->OrigEntry;
|
||||
const SrcMgr::ContentCache *Content = sloc.getFile().getContentCache();
|
||||
if (!Content)
|
||||
return 0;
|
||||
return Content->OrigEntry;
|
||||
}
|
||||
|
||||
/// getBufferData - Return a StringRef to the source buffer data for the
|
||||
|
|
Loading…
Reference in New Issue