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.

llvm-svn: 39398
This commit is contained in:
Chris Lattner 2007-04-10 06:02:46 +00:00
parent 86054a9634
commit 7c718bd5a4
3 changed files with 7 additions and 4 deletions

View File

@ -272,7 +272,8 @@ void Preprocessor::HandlePragmaDependency(LexerToken &DependencyTok) {
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);

View File

@ -1573,7 +1573,8 @@ void Preprocessor::HandleIncludeDirective(LexerToken &IncludeTok,
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 @@ void Preprocessor::HandleIncludeDirective(LexerToken &IncludeTok,
// 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);

View File

@ -156,7 +156,7 @@ DIAG(err_pp_invalid_directive, ERROR,
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,