NoQ added a comment.

Nice!!



================
Comment at: 
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:225-226
   // FIXME: constexpr initialization isn't supported by MSVC2013.
-  static const char *const GenericTrueMessage;
-  static const char *const GenericFalseMessage;
+  static llvm::StringLiteral GenericTrueMessage;
+  static llvm::StringLiteral GenericFalseMessage;
 
----------------
https://llvm.org/doxygen/classllvm_1_1StringLiteral.html:
> In order to avoid the invocation of a global constructor, `StringLiteral` 
> should only be used in a `constexpr` context


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:192-194
+  if (const auto *DRE = dyn_cast<DeclRefExpr>(CondVarExpr))
+    if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
+      return State->getSVal(State->getLValue(VD, LCtx));
----------------
Ugh, so this code intentionally avoids the complexity of 
`ExprEngine::VisitCommonDeclRefExpr()` so that to work differently with 
references. Okay.

@xazax.hun, do you think this works correctly with lambda captures? (when the 
`DeclRefExpr` to a variable might evaluate to a field within the lambda at 
run-time).


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:208
+  if (Optional<SVal> V = getSValForVar(CondVarExpr, N))
+    if (auto DeclCI = V->getAs<nonloc::ConcreteInt>())
+      return &DeclCI->getValue();
----------------
`Decl`? I guess it made sense in the original code but there's no longer an 
obvious `Decl` floating around.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65724



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

Reply via email to