summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp
diff options
context:
space:
mode:
authorCarlos Alberto Enciso <carlos.alberto.enciso@gmail.com>2018-03-26 13:48:03 +0000
committerCarlos Alberto Enciso <carlos.alberto.enciso@gmail.com>2018-03-26 13:48:03 +0000
commit01ae6f2c5f0e48f42f9e8a66f2c9a02106034696 (patch)
tree623a366f934aea3caeeb69e1ddba3193d20b8fcc /clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp
parentff9c1092b708d39f9dc99855f31d75b50c809c63 (diff)
downloadbcm5719-llvm-01ae6f2c5f0e48f42f9e8a66f2c9a02106034696.tar.gz
bcm5719-llvm-01ae6f2c5f0e48f42f9e8a66f2c9a02106034696.zip
[SemaCXX] _Pragma("clang optimize off") not affecting lambda.
Declaring "_Pragma("clang optimize off")" before the body of a function with a lambda leads to the lambda functions in the body not being affected. Differential Revision: https://reviews.llvm.org/D43821 llvm-svn: 328494
Diffstat (limited to 'clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp')
-rw-r--r--clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp b/clang/test/CodeGenCXX/optnone-pragma-optimize-off.cpp
new file mode 100644
index 00000000000..d750c4c2848
--- /dev/null
+++ b/clang/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
OpenPOWER on IntegriCloud