If I understand the issue correctly, and from reading PR17053, the problem is 
that the main file in the translation unit would have a structure similar to a 
header guard but it should not be considered a header guard.  This patch does 
not fix that issue.  Instead, it looks at the edit distance between #define and 
#ifndef macro names.  This only coincidentally fixes the examples given.  The 
test case also does not follow the examples as it is still inside a header, not 
the main file.

  It would be better to detect if the lexer is at the top most file and skip 
the diagnostic then.


================
Comment at: lib/Lex/PPLexerChange.cpp:280
@@ +279,3 @@
+              << ControllingMacro
+              << FixItHint::CreateReplacement(
+                                              
CurPPLexer->MIOpt.GetDefinedLocation(),
----------------
Ismail Pazarbasi wrote:
> I haven't tried thoroughly, but I guess it'd be better to print the fix-it on 
> the warning instead of the note, because clang-check will ignore the note 
> (and I need clang-check to apply the fixit).
This seems like a valid point.  There is only one suggestion, so it should be 
placed in the warning instead of the note, but that change should go in a 
separate patch.


http://llvm-reviews.chandlerc.com/D1506
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to