35 lines · cpp
1//RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder -analyzer-config debug.AnalysisOrder:EndFunction=true %s 2>&1 | FileCheck %s2 3// At the end of a function, we can only obtain a ReturnStmt if the last4// CFGElement in the CFGBlock is either a CFGStmt or a CFGAutomaticObjDtor.5 6void noReturnStmt() {}7 8struct S {9 S();10 ~S();11};12 13int dtorAfterReturnStmt() {14 S s;15 return 0;16}17 18S endsWithReturnStmt() {19 return S();20}21 22// endsWithReturnStmt()23// CHECK: EndFunction24// CHECK-NEXT: ReturnStmt: yes25// CHECK-NEXT: CFGElement: CFGStmt26 27// dtorAfterReturnStmt()28// CHECK: EndFunction29// CHECK-NEXT: ReturnStmt: yes30// CHECK-NEXT: CFGElement: CFGAutomaticObjDtor31 32// noReturnStmt()33// CHECK: EndFunction34// CHECK-NEXT: ReturnStmt: no35