steakhal added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:599-603
+  const SourceLocation Loc = [&SM](Decl *D) -> SourceLocation {
+    const Stmt *Body = D->getBody();
+    SourceLocation SL = Body ? Body->getBeginLoc() : D->getLocation();
+    return SM.getExpansionLoc(SL);
+  }(D);
----------------
ASDenysPetrov wrote:
> Why don't just leave this snippet as it was but add `const SourceLocation 
> Loc` instead of re-assigning `SL`? Your construction made me stumbled for a 
> while. As this patch is meant to bring readability, I wouldn't like to see 
> such a code-trick. I see your intention to hide `SL` but IMO let compiler do 
> this for us. See suggested.
Hm, you are probably right. The main idea was to reduce the number of unrelated 
declarations in the scope by nesting them into the calculation of the important 
ones.
However, we could relax in this case. I agree that would be even better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114441/new/

https://reviews.llvm.org/D114441

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to