Clang Project

clang_source_code/test/CodeGenCXX/optnone-pragma-optimize-off.cpp
1// RUN: %clang_cc1 %s -triple %itanium_abi_triple -O1 -disable-llvm-passes -emit-llvm -o - | FileCheck %s
2
3// Test the attributes for the lambda function contains 'optnone' as result of
4// the _Pragma("clang optimize off").
5
6_Pragma("clang optimize off")
7
8void foo(int p) {
9  auto lambda = [&p]() { ++p; };
10  lambda();
11  // CHECK: define {{.*}} @"_ZZ3fooiENK3$_0clEv"({{.*}}) #[[LAMBDA_ATR:[0-9]+]]
12}
13
14_Pragma("clang optimize on")
15
16// CHECK: attributes #[[LAMBDA_ATR]] = { {{.*}} optnone {{.*}} }