r.stahl added a comment.

In D46421#1374807 <https://reviews.llvm.org/D46421#1374807>, @NoQ wrote:

> At the same time, i don't have any test cases for the actual change in 
> behavior that such canonicalization causes. If the test case that you had in 
> mind is indeed demonstrating this problem, i'd love to have it. If it turns 
> out that your test case doesn't allow us to demonstrate the problem without 
> CTU, then probably it has something to do with `ASTImporter` accidentally 
> canonicalizing the the declaration in `DeclRefExpr` more rarely than the 
> vanilla AST.


This seems unrelated to CTU. The following subset of my test demonstrates this:

  // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection 
-verify %s
  
  void clang_analyzer_eval(int);
  
  extern const int extInt;
  
  int main()
  {
      clang_analyzer_eval(extInt == 2); // expected-warning{{TRUE}}
  }
  
  extern const int extInt = 2;



  Breakpoint 1, (anonymous namespace)::RegionStoreManager::getBindingForVar 
(this=0xa7b420, B=..., R=0xa7d348)
      at 
/data/work/commitllvm/llvm/tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1948
  1948        if (const Expr *Init = VD->getAnyInitializer()) {
  (gdb) p VD->getInit()
  $1 = (const clang::Expr *) 0x0
  (gdb) p VD->getAnyInitializer()
  $2 = (const clang::Expr *) 0xa4b630


Repository:
  rC Clang

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

https://reviews.llvm.org/D46421



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

Reply via email to