whisperity added subscribers: dcoughlin, rjmccall, rsmith.
whisperity added a comment.

What will happen with the ability to analyse a translation unit whose target 
was not part of `LLVM_TARGETS_TO_BUILD` of the current `clang` binary? Will it 
break, because the binary lacks the information on how to generate for the 
given target?



================
Comment at: clang/include/clang/StaticAnalyzer/Core/IRContext.h:39-41
+  // Get the LLVM code for a function. We use the complete versions of the
+  // constructors and desctructors in this overload. Use the other overload to
+  // get the base object ctor/dtor.
----------------
Aren't documentation comments in LLVM `///`?


================
Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:127
         PP(CI.getPreprocessor()), OutDir(outdir), Opts(std::move(opts)),
-        Plugins(plugins), Injector(injector), CTU(CI) {
+        Plugins(plugins), Injector(injector), CTU(CI), IRCtx(CG) {
     DigestAnalyzerOptions();
----------------
Where's this `CG` defined?


================
Comment at: clang/lib/StaticAnalyzer/Frontend/FrontendActions.cpp:53-57
+    LLVMCtx = std::make_shared<llvm::LLVMContext>();
+    auto CGConsumer = BuildCodeGen(CI, *LLVMCtx, *CodeGenDiags);
+    AConsumer->setCodeGen(CGConsumer.get());
+    ASTConsumers.push_back(std::move(CGConsumer));
+  }
----------------
Isn't there a lifetime issue here? `LLVMCtx` is given as a raw reference to the 
`BuildCodeGen` and the shared pointer leaves scope at the end of the branch.


================
Comment at: clang/test/Analysis/ircontext.cpp:17-18
+  int l = 0;
+  foo(&l);
+  clang_analyzer_eval(g == 3); // expected-warning{{TRUE}}
+}
----------------
What are we testing here? Without the ability to read the pureness of `foo` 
from the IR, the knowledge about `g`'s value would be scrapped at the call? 
`foo` is defined in the current TU.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85319

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

Reply via email to