[PATCH] D11778: Improvements on Diagnostic in Macro Expansions

Zhengkai Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 18:19:44 PDT 2015


zhengkai added a comment.

The helper function checkRangesForMacroArgExpansion is to check if the current Loc and Ranges are expansions of a macro's arguments.
If so, the IgnoredEnd will record this position and thus omitting all later expanded macros (Later expanded macros are showed on top of the stack though).

Two test cases are added. 
The reduced-diags-macros-backtrace.cpp is to show that my method works correctly with the option -fmacro-backtrace-limit
The reduced-diags-macros.cpp is to show that my method reduced verbose information printed indeed.

There are still a lot of other cases in which my method still works as the old version did. 
And I think there are several bugs in the existing functions like "emitDiagnostic" and "mapDiagnosticRanges".
This is issued as a bug, the link is https://llvm.org/bugs/show_bug.cgi?id=24423.
Future work will be done to improve the current result.


================
Comment at: test/Misc/reduced-diags-macros.cpp:14-15
@@ +13,4 @@
+// CHECK-NEXT: #define NO_INITIATION(x) int a = x * 2
+// CHECK-NEXT:                                  ^
+
+// CHECK: {{.*}}:7:15: error: use of undeclared identifier 'b'
----------------
Yes.
This works like the old version, should be improved later


http://reviews.llvm.org/D11778





More information about the cfe-commits mailing list