[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / APINotes / lifetimebound.cpp
blob3cdba0136a5282e59c055147fcad3480856a75c0
1 // RUN: rm -rf %t && mkdir -p %t
2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Lifetimebound -fdisable-module-hash -fapinotes-modules -fsyntax-only -I %S/Inputs/Headers %s -x c++
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Lifetimebound -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -ast-dump -ast-dump-filter funcToAnnotate -x c++ | FileCheck --check-prefix=CHECK-PARAM %s
4 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Lifetimebound -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -ast-dump -ast-dump-filter annotateThis -x c++ | FileCheck --check-prefix=CHECK-METHOD-THIS %s
5 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Lifetimebound -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -ast-dump -ast-dump-filter methodToAnnotate -x c++ | FileCheck --check-prefix=CHECK-METHOD %s
6 #include "Lifetimebound.h"
8 // CHECK-PARAM: FunctionDecl {{.+}} funcToAnnotate
9 // CHECK-PARAM-NEXT: ParmVarDecl {{.+}} p
10 // CHECK-PARAM-NEXT: LifetimeBoundAttr
12 // CHECK-METHOD: CXXMethodDecl {{.+}} methodToAnnotate
13 // CHECK-METHOD-NEXT: ParmVarDecl {{.+}} p
14 // CHECK-METHOD-NEXT: LifetimeBoundAttr
16 // CHECK-METHOD-THIS: CXXMethodDecl {{.+}} annotateThis 'int *() {{\[\[}}clang::lifetimebound{{\]\]}}'