• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {
mSub7   virtual void m() {}
8 };
9 
testTemporaries()10 void testTemporaries() {
11   // This triggers RegionChanges once for zero-initialization of the structure.
12   Sub().m();
13 }
14 
seeIfCheckBindWorks()15 void seeIfCheckBindWorks() {
16   // This should trigger checkBind. The rest of the code shouldn't.
17   // This also triggers checkRegionChanges after that.
18   // Note that this function is analyzed first, so the messages would be on top.
19   int x = 1;
20 }
21 
22 // seeIfCheckBindWorks():
23 // CHECK: Bind
24 // CHECK-NEXT: RegionChanges
25 
26 // testTemporaries():
27 // CHECK-NEXT: RegionChanges
28 
29 // Make sure there's no further output.
30 // CHECK-NOT: Bind
31 // CHECK-NOT: RegionChanges
32