34 lines · c
1// Test this without pch.2// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only3 4// Test with pch.5// RUN: %clang_cc1 %s -emit-pch -o %t6// RUN: %clang_cc1 %s -emit-llvm -include-pch %t -o - | FileCheck %s7 8// The first run line creates a pch, and since at that point HEADER is not9// defined, the only thing contained in the pch is the pragma. The second line10// then includes that pch, so HEADER is defined and the actual code is compiled.11// The check then makes sure that the pragma is in effect in the file that12// includes the pch.13 14// expected-no-diagnostics15 16#ifndef HEADER17#define HEADER18#pragma clang optimize off19 20#else21 22int a;23 24void f(void) {25 a = 12345;26}27 28// Check that the function is decorated with optnone29 30// CHECK-DAG: @f() [[ATTRF:#[0-9]+]]31// CHECK-DAG: attributes [[ATTRF]] = { {{.*}}noinline{{.*}}optnone{{.*}} }32 33#endif34