[PATCH] D46421: [analyzer][CrossTU] Extend CTU to VarDecls with initializer

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 1 06:36:47 PST 2019


xazax.hun added a comment.
Herald added a project: clang.

In D46421#1375147 <https://reviews.llvm.org/D46421#1375147>, @r.stahl wrote:

> 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
>  
>


I know you probably tired of me making you split all the patches but I think if it is independent of CTU we should submit this fix as a separate commit. This way we could be more focused having one commit doing one thing.


Repository:
  rC Clang

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

https://reviews.llvm.org/D46421





More information about the cfe-commits mailing list