bool OldVal;
public:
- ParsingOpenMPDirectiveRAII(Parser &P)
+ ParsingOpenMPDirectiveRAII(Parser &P, bool Value = true)
: P(P), OldVal(P.OpenMPDirectiveParsing) {
- P.OpenMPDirectiveParsing = true;
+ P.OpenMPDirectiveParsing = Value;
}
/// This can be used to restore the state early, before the dtor
const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy();
Sema::TagUseKind TUK;
- if (isDefiningTypeSpecifierContext(DSC) == AllowDefiningTypeSpec::No)
+ if (isDefiningTypeSpecifierContext(DSC) == AllowDefiningTypeSpec::No ||
+ (getLangOpts().OpenMP && OpenMPDirectiveParsing))
TUK = Sema::TUK_Reference;
else if (Tok.is(tok::l_brace) ||
(getLangOpts().CPlusPlus && Tok.is(tok::colon)) ||
// Skip last tokens.
skipUntilPragmaOpenMPEnd(OMPD_begin_declare_variant);
+ ParsingOpenMPDirectiveRAII NormalScope(*this, /*Value=*/false);
+
VariantMatchInfo VMI;
ASTContext &ASTCtx = Actions.getASTContext();
TI.getAsVariantMatchInfo(ASTCtx, VMI);
if (!Actions.ActOnStartOpenMPDeclareTargetDirective(DTLoc))
return DeclGroupPtrTy();
+ ParsingOpenMPDirectiveRAII NormalScope(*this, /*Value=*/false);
llvm::SmallVector<Decl *, 4> Decls;
DKind = parseOpenMPDirectiveKind(*this);
while (DKind != OMPD_end_declare_target && Tok.isNot(tok::eof) &&
// FIXME: We create a bogus CompoundStmt scope to hold the contents of
// the captured region. Code elsewhere assumes that any FunctionScopeInfo
// should have at least one compound statement scope within it.
+ ParsingOpenMPDirectiveRAII NormalScope(*this, /*Value=*/false);
AssociatedStmt = (Sema::CompoundScopeRAII(Actions), ParseStatement());
AssociatedStmt = Actions.ActOnOpenMPRegionEnd(AssociatedStmt, Clauses);
} else if (DKind == OMPD_target_update || DKind == OMPD_target_enter_data ||
{
struct A { int a; A() : a(0) {} };
#pragma omp declare reduction(+: A : bar(omp_out, omp_in))
-};
+ #pragma omp declare reduction(-: struct A : bar(omp_out, omp_in))
+}
+// CHECK: namespace N1 {
+// CHECK: #pragma omp declare reduction (+ : N1::A : bar(omp_out, omp_in))
+// CHECK: #pragma omp declare reduction (- : struct A : bar(omp_out, omp_in))
#pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
// CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in){{$}}