xref: /aosp_15_r20/external/clang/test/PCH/cxx11-statement-attributes.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Sanity check.
2*67e74705SXin Li // RUN: %clang_cc1 -include %S/Inputs/cxx11-statement-attributes.h -std=c++11 -Wimplicit-fallthrough -fsyntax-only %s -o - -verify
3*67e74705SXin Li // RUN: %clang_cc1 -include %S/Inputs/cxx11-statement-attributes.h -std=c++1z -Wimplicit-fallthrough -fsyntax-only %s -o - -verify
4*67e74705SXin Li // Run the same tests, this time with the attributes loaded from the PCH file.
5*67e74705SXin Li // RUN: %clang_cc1 -x c++-header -emit-pch -std=c++11 -o %t %S/Inputs/cxx11-statement-attributes.h
6*67e74705SXin Li // RUN: %clang_cc1 -include-pch %t -std=c++11 -Wimplicit-fallthrough -fsyntax-only %s -o - -verify
7*67e74705SXin Li // RUN: %clang_cc1 -x c++-header -emit-pch -std=c++1z -o %t %S/Inputs/cxx11-statement-attributes.h
8*67e74705SXin Li // RUN: %clang_cc1 -include-pch %t -std=c++1z -Wimplicit-fallthrough -fsyntax-only %s -o - -verify
9*67e74705SXin Li 
10*67e74705SXin Li // expected-warning@Inputs/cxx11-statement-attributes.h:10 {{unannotated fall-through}}
11*67e74705SXin Li // expected-note-re@Inputs/cxx11-statement-attributes.h:10 {{insert '[[{{(clang::)?}}fallthrough]];'}}
12*67e74705SXin Li // expected-note@Inputs/cxx11-statement-attributes.h:10 {{insert 'break;'}}
13*67e74705SXin Li 
g(int n)14*67e74705SXin Li void g(int n) {
15*67e74705SXin Li   f<1>(n);  // expected-note {{in instantiation of function template specialization 'f<1>' requested here}}
16*67e74705SXin Li }
17