diff options
Diffstat (limited to 'test/CodeGenCXX/optnone-pragma-optimize-off.cpp')
-rw-r--r-- | test/CodeGenCXX/optnone-pragma-optimize-off.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGenCXX/optnone-pragma-optimize-off.cpp b/test/CodeGenCXX/optnone-pragma-optimize-off.cpp new file mode 100644 index 0000000000000..d750c4c2848cb --- /dev/null +++ b/test/CodeGenCXX/optnone-pragma-optimize-off.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -triple %itanium_abi_triple -O1 -disable-llvm-passes -emit-llvm -o - | FileCheck %s + +// Test the attributes for the lambda function contains 'optnone' as result of +// the _Pragma("clang optimize off"). + +_Pragma("clang optimize off") + +void foo(int p) { + auto lambda = [&p]() { ++p; }; + lambda(); + // CHECK: define {{.*}} @"_ZZ3fooiENK3$_0clEv"({{.*}}) #[[LAMBDA_ATR:[0-9]+]] +} + +_Pragma("clang optimize on") + +// CHECK: attributes #[[LAMBDA_ATR]] = { {{.*}} optnone {{.*}} }
\ No newline at end of file |