1*0a6a1f1dSLionel Sambuc // Test this without pch. 2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -include %s -verify -fsyntax-only 3*0a6a1f1dSLionel Sambuc 4*0a6a1f1dSLionel Sambuc // Test with pch. 5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -emit-pch -o %t 6*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -include-pch %t -o - | FileCheck %s 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc // The first run line creates a pch, and since at that point HEADER is not 9*0a6a1f1dSLionel Sambuc // defined, the only thing contained in the pch is the pragma. The second line 10*0a6a1f1dSLionel Sambuc // then includes that pch, so HEADER is defined and the actual code is compiled. 11*0a6a1f1dSLionel Sambuc // The check then makes sure that the pragma is in effect in the file that 12*0a6a1f1dSLionel Sambuc // includes the pch. 13*0a6a1f1dSLionel Sambuc 14*0a6a1f1dSLionel Sambuc // expected-no-diagnostics 15*0a6a1f1dSLionel Sambuc 16*0a6a1f1dSLionel Sambuc #ifndef HEADER 17*0a6a1f1dSLionel Sambuc #define HEADER 18*0a6a1f1dSLionel Sambuc #pragma clang optimize off 19*0a6a1f1dSLionel Sambuc 20*0a6a1f1dSLionel Sambuc #else 21*0a6a1f1dSLionel Sambuc 22*0a6a1f1dSLionel Sambuc int a; 23*0a6a1f1dSLionel Sambuc f()24*0a6a1f1dSLionel Sambucvoid f() { 25*0a6a1f1dSLionel Sambuc a = 12345; 26*0a6a1f1dSLionel Sambuc } 27*0a6a1f1dSLionel Sambuc 28*0a6a1f1dSLionel Sambuc // Check that the function is decorated with optnone 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc // CHECK-DAG: @f() [[ATTRF:#[0-9]+]] 31*0a6a1f1dSLionel Sambuc // CHECK-DAG: attributes [[ATTRF]] = { {{.*}}noinline{{.*}}optnone{{.*}} } 32*0a6a1f1dSLionel Sambuc 33*0a6a1f1dSLionel Sambuc #endif 34