I think this should be all that's needed:
// - System headers: don't run any checks.
SourceManager &SM = Ctx->getSourceManager();
- SourceLocation SL = SM.getExpansionLoc(D->getLocation());
+
+ SourceLocation SL = D->hasBody() ? D->getBody()->getLocStart()
+ : D->getLocation();
+ SL = SM.getExpansionLoc(SL);
+
if (!Opts->AnalyzeAll && !SM.isWrittenInMainFile(SL)) {
There are 2 differences from your patch:
1. I am not sure why the second if statement is added in your patch.
2. Getting the ExpansionLoc for the body. (In case it's a macro, it won't get
analyzed.) Would be great if you add the macro test case as well.
Thanks!
Anna.
================
Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:603
@@ -595,1 +602,3 @@
+ if (SM.isInMainFile(SL))
+ return Mode;
return Mode & ~AM_Path;
----------------
I don't think this if-statement is needed.
http://reviews.llvm.org/D10156
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits