[cfe-commits] r39611 - /cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:14 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:13 2007
New Revision: 39611
URL: http://llvm.org/viewvc/llvm-project?rev=39611&view=rev
Log:
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
Modified:
cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp
Modified: cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/cfe/trunk/Driver/TextDiagnosticPrinter.cpp Wed Jul 11 11:46:13 2007
@@ -145,10 +145,12 @@
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
More information about the cfe-commits
mailing list