32 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder -analyzer-config debug.AnalysisOrder:Bind=true -analyzer-config debug.AnalysisOrder:RegionChanges=true %s 2>&1 | FileCheck %s2 3struct Super {4 virtual void m();5};6struct Sub : Super {7 virtual void m() {}8};9 10void testTemporaries() {11 // This triggers RegionChanges once for zero-initialization of the structure.12 Sub().m();13}14 15void 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: Bind24// CHECK-NEXT: RegionChanges25 26// testTemporaries():27// CHECK-NEXT: RegionChanges28 29// Make sure there's no further output.30// CHECK-NOT: Bind31// CHECK-NOT: RegionChanges32