[cfe-commits] [PATCH] Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.
Alexander Kornienko
reviews at llvm-reviews.chandlerc.com
Thu Sep 27 08:38:51 PDT 2012
================
Comment at: tools/clang/lib/Lex/MacroInfo.cpp:64
@@ +63,3 @@
+ for (const MacroInfo *MI = this; MI; MI = MI->PreviousDefinition) {
+ if (!SM.getFileEntryForID(SM.getFileID(MI->Location)) ||
+ SM.isBeforeInTranslationUnit(MI->Location, L))
----------------
Richard Smith wrote:
> Alexander Kornienko wrote:
> > Richard Smith wrote:
> > > Under what circumstances is this test necessary?
> > It's intended to handle a case when a macro is defined via command line. Does isBeforeInTranslationUnit handle this case?
> Yes, isBeforeInTranslationUnit should handle that.
Checking isValid, as command-line macros have no valid location.
================
Comment at: tools/clang/lib/Sema/AnalysisBasedWarnings.cpp:748
@@ +747,3 @@
+ Tokens.push_back(T);
+ T.setFlag(Token::DisableExpand);
+ Tokens.push_back(T);
----------------
This hack is used to pass to information, that we need hasLeadingSpace check, to MacroDefinitionEquals.
Is there a better way to do this?
http://llvm-reviews.chandlerc.com/D50
More information about the cfe-commits
mailing list