mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 20:46:05 +00:00

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
16 lines
496 B
C++
16 lines
496 B
C++
// 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 {{.*}} }
|