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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 13:25:24 PST 2018


NoQ 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));
----------------
xazax.hun wrote:
> 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.
Whoops, you're totally right, never mind.

Comments might have probably helped me understand that faster.


https://reviews.llvm.org/D30691





More information about the cfe-commits mailing list