[PATCH] D25871: Include full filename range for missing includes

Erik Verbruggen via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 07:28:47 PDT 2016


erikjv created this revision.
erikjv added reviewers: bkramer, klimek.
erikjv added a subscriber: cfe-commits.

For the purpose of highlighting in an IDE.


https://reviews.llvm.org/D25871

Files:
  lib/Lex/PPDirectives.cpp
  test/Preprocessor/missing-include-range-check.h


Index: test/Preprocessor/missing-include-range-check.h
===================================================================
--- /dev/null
+++ 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 <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
Index: lib/Lex/PPDirectives.cpp
===================================================================
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -1847,7 +1847,8 @@
 
       // 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;
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25871.75423.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161021/410635e4/attachment.bin>


More information about the cfe-commits mailing list