blob: 9570117448e2a094d86b18eb94cf4d34ddb662a1 [file] [log] [blame]
Dario Domizioli13a0a382014-05-23 12:13:25 +00001// Test this without pch.
2// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
3
4// Test with pch.
5// RUN: %clang_cc1 %s -emit-pch -o %t
6// RUN: %clang_cc1 %s -emit-llvm -include-pch %t -o - | FileCheck %s
7
Dario Domizioli6260cce2014-07-28 14:33:17 +00008// The first run line creates a pch, and since at that point HEADER is not
9// defined, the only thing contained in the pch is the pragma. The second line
10// 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 that
12// includes the pch.
13
Dario Domizioli13a0a382014-05-23 12:13:25 +000014// expected-no-diagnostics
15
16#ifndef HEADER
17#define HEADER
18#pragma clang optimize off
19
20#else
21
22int a;
23
24void f() {
25 a = 12345;
26}
27
28// Check that the function is decorated with optnone
29
30// CHECK-DAG: @f() [[ATTRF:#[0-9]+]]
31// CHECK-DAG: attributes [[ATTRF]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
32
33#endif