38 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder,debug.ExprInspection -analyzer-config debug.AnalysisOrder:PreCall=true,debug.AnalysisOrder:PostCall=true,debug.AnalysisOrder:LiveSymbols=true %s 2>&1 | FileCheck %s2 3// This test ensures that check::LiveSymbols is called as many times on the4// path through the second "return" as it is through the first "return"5// (three), and therefore the two paths were not merged prematurely before the6// respective return statement is evaluated.7// The paths would still be merged later, so we'd have only one post-call for8// foo(), but it is incorrect to merge them in the middle of evaluating two9// different statements.10int coin();11 12void foo() {13 int x = coin();14 if (x > 0)15 return;16 else17 return;18}19 20void bar() {21 foo();22}23 24// CHECK: LiveSymbols25// CHECK-NEXT: LiveSymbols26// CHECK-NEXT: PreCall (foo)27// CHECK-NEXT: LiveSymbols28// CHECK-NEXT: LiveSymbols29// CHECK-NEXT: PreCall (coin)30// CHECK-NEXT: PostCall (coin)31// CHECK-NEXT: LiveSymbols32// CHECK-NEXT: LiveSymbols33// CHECK-NEXT: LiveSymbols34// CHECK-NEXT: PostCall (foo)35// CHECK-NEXT: LiveSymbols36// CHECK-NEXT: LiveSymbols37// CHECK-NEXT: LiveSymbols38