forked from OSchip/llvm-project
Diagnostics coming from a memory buffer (e.g. pragmas) don't have a
corresponding file buffer, don't dereference null pointers. This fixes a regression on test/Preprocessor/_Pragma-syshdr.c llvm-svn: 39611
This commit is contained in:
parent
1abbd417be
commit
c84413e0a8
|
@ -145,10 +145,12 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
|
|||
Level == Diagnostic::Note) {
|
||||
SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Pos);
|
||||
const FileEntry *F = SourceMgr.getFileEntryForFileID(PhysLoc.getFileID());
|
||||
DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
|
||||
if (DirInfo == DirectoryLookup::SystemHeaderDir ||
|
||||
DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
|
||||
return;
|
||||
if (F) {
|
||||
DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
|
||||
if (DirInfo == DirectoryLookup::SystemHeaderDir ||
|
||||
DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// First, if this diagnostic is not in the main file, print out the
|
||||
|
|
Loading…
Reference in New Issue