[cfe-commits] r39398 - in /cfe/cfe/trunk: Lex/Pragma.cpp Lex/Preprocessor.cpp include/clang/Basic/DiagnosticKinds.def

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:43:57 PDT 2007


Author: clattner
Date: Wed Jul 11 11:43:57 2007
New Revision: 39398

URL: http://llvm.org/viewvc/llvm-project?rev=39398&view=rev
Log:
Include the filename being looked up in an error message.  This gives us stuff
like this:
t3.c:5:10: error: 'vers2.h' file not found
#include xstr(INCFILE(2).h)
         ^

instead of:

t3.c:5:10: error: file not found
#include xstr(INCFILE(2).h)
         ^

which is useful if the #include name is generated through macro expansion.

Modified:
    cfe/cfe/trunk/Lex/Pragma.cpp
    cfe/cfe/trunk/Lex/Preprocessor.cpp
    cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def

Modified: cfe/cfe/trunk/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Pragma.cpp?rev=39398&r1=39397&r2=39398&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Pragma.cpp (original)
+++ cfe/cfe/trunk/Lex/Pragma.cpp Wed Jul 11 11:43:57 2007
@@ -272,7 +272,8 @@
   const FileEntry *File = LookupFile(FilenameStart, FilenameEnd,
                                      isAngled, 0, CurDir);
   if (File == 0)
-    return Diag(FilenameTok, diag::err_pp_file_not_found);
+    return Diag(FilenameTok, diag::err_pp_file_not_found,
+                std::string(FilenameStart, FilenameEnd));
   
   unsigned FileID = getCurrentFileLexer()->getCurFileID();
   const FileEntry *CurFile = SourceMgr.getFileEntryForFileID(FileID);

Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=39398&r1=39397&r2=39398&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:43:57 2007
@@ -1573,7 +1573,8 @@
   const FileEntry *File = LookupFile(FilenameStart, FilenameEnd,
                                      isAngled, LookupFrom, CurDir);
   if (File == 0)
-    return Diag(FilenameTok, diag::err_pp_file_not_found);
+    return Diag(FilenameTok, diag::err_pp_file_not_found,
+                std::string(FilenameStart, FilenameEnd));
   
   // Ask HeaderInfo if we should enter this #include file.
   if (!HeaderInfo.ShouldEnterIncludeFile(File, isImport)) {
@@ -1584,7 +1585,8 @@
   // Look up the file, create a File ID for it.
   unsigned FileID = SourceMgr.createFileID(File, FilenameTok.getLocation());
   if (FileID == 0)
-    return Diag(FilenameTok, diag::err_pp_file_not_found);
+    return Diag(FilenameTok, diag::err_pp_file_not_found,
+                std::string(FilenameStart, FilenameEnd));
 
   // Finally, if all is good, enter the new file!
   EnterSourceFile(FileID, CurDir);

Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=39398&r1=39397&r2=39398&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:43:57 2007
@@ -156,7 +156,7 @@
 DIAG(err_pp_hash_error, ERROR,
      "#error%s")
 DIAG(err_pp_file_not_found, ERROR,
-     "file not found")
+     "'%s' file not found")
 DIAG(err_pp_empty_filename, ERROR,
      "empty filename")
 DIAG(err_pp_include_too_deep, ERROR,





More information about the cfe-commits mailing list