Skip to content

Commit

Permalink
Include full filename range for missing includes
Browse files Browse the repository at this point in the history
For the purpose of highlighting in an IDE.

llvm-svn: 285057
  • Loading branch information
erikjv committed Oct 25, 2016
1 parent 4908237 commit 4544954
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,8 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,

// If the file is still not found, just go with the vanilla diagnostic
if (!File)
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename
<< FilenameRange;
}
}

Expand Down
8 changes: 8 additions & 0 deletions clang/test/Preprocessor/missing-include-range-check.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: env CINDEXTEST_KEEP_GOING=1 c-index-test -test-load-source all %s > /dev/null 2> %t.err
// RUN: FileCheck < %t.err -check-prefix=CHECK-RANGE %s

#include <foobar.h>
#include "moozegnarf.h"

// CHECK-RANGE: rewrite-includes-missing.c:4:10:{4:10-4:19}: fatal error: 'foobar.h' file not found
// CHECK-RANGE: rewrite-includes-missing.c:5:10:{5:10-5:24}: fatal error: 'moozegnarf.h' file not found

0 comments on commit 4544954

Please sign in to comment.