From: Erik Verbruggen Date: Tue, 25 Oct 2016 10:13:10 +0000 (+0000) Subject: Include full filename range for missing includes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afabcbf1746303c8dc068fe6b4d95520a72b1a3f;p=clang Include full filename range for missing includes For the purpose of highlighting in an IDE. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285057 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 22d6cc9606..3bfbf16ae3 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -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; } } diff --git a/test/Preprocessor/missing-include-range-check.h b/test/Preprocessor/missing-include-range-check.h new file mode 100644 index 0000000000..6b3f7d3561 --- /dev/null +++ b/test/Preprocessor/missing-include-range-check.h @@ -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 +#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