1 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.AnalysisOrder -analyzer-config debug.AnalysisOrder:Bind=true -analyzer-config debug.AnalysisOrder:RegionChanges=true %s 2>&1 | FileCheck %s
2 
3 struct Super {
4   virtual void m();
5 };
6 struct Sub : Super {
7   virtual void m() {}
8 };
9 
10 void testTemporaries() {
11   // This triggers RegionChanges twice:
12   // - Once for zero-initialization of the structure.
13   // - Once for creating a temporary region and copying the structure there.
14   // FIXME: This code shouldn't really produce the extra temporary, however
15   // that's how we behave for now.
16   Sub().m();
17 }
18 
19 void seeIfCheckBindWorks() {
20   // This should trigger checkBind. The rest of the code shouldn't.
21   // This also triggers checkRegionChanges after that.
22   // Note that this function is analyzed first, so the messages would be on top.
23   int x = 1;
24 }
25 
26 // seeIfCheckBindWorks():
27 // CHECK: Bind
28 // CHECK-NEXT: RegionChanges
29 
30 // testTemporaries():
31 // CHECK-NEXT: RegionChanges
32 // CHECK-NEXT: RegionChanges
33 
34 // Make sure there's no further output.
35 // CHECK-NOT: Bind
36 // CHECK-NOT: RegionChanges
37