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.
For the below test:
_Pragma("clang optimize off")
void foo(int p) {
auto lambda = [&p]() { ++p; };
lambda();
}
_Pragma("clang optimize on")At -O1 the attributes for the 'foo' function are:
attributes #0 = { noinline nounwind optnone uwtable ... }At -O1 the attributes for the lambda function are:
attributes #1 = { inlinehint norecurse nounwind uwtable ... }The incorrect attribute causes the lambda function to be considered
for inlining ignoring the given _Pragma.
Should thi sonly happen if this is a definition? Additionally, does this negate the need for the other call to this in ActOnFunctionDeclarator?