[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 13:15:29 PST 2018


xazax.hun added inline comments.


================
Comment at: lib/StaticAnalyzer/Core/PathDiagnostic.cpp:418-423
     SourceLocation XDL = XD->getLocation();
     SourceLocation YDL = YD->getLocation();
     if (XDL != YDL) {
       const SourceManager &SM = XL.getManager();
-      return SM.isBeforeInTranslationUnit(XDL, YDL);
+      return compareCrossTUSourceLocs(FullSourceLoc(XDL, SM),
+                                      FullSourceLoc(YDL, SM));
----------------
NoQ wrote:
> It seems to me that `XDL` and `YDL` are exactly the same as `XL` and `YL` we've seen at the beginning of the function.
> 
> ...we still have only one `SourceManager`, right?
Is this true? 
One is the location associated with the PathDiagnostic the other is the location of the Decl associated with the issue. I do not have deep understanding of this part of the code but not sure if these are guaranteed to be the same.


https://reviews.llvm.org/D30691





More information about the cfe-commits mailing list