From ecb156aba2cecd53f5153ca2f36d22e36b6f836d Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 15 Sep 2015 17:23:56 +0000 Subject: [OPENMP] Emit an additional note during analysis of 'if' clause. Patch adds emission of additional note for 'if' clauses with name modifiers in case if 'if' clause without name modified was specified or 'if' clause with the same name modifier was specified. llvm-svn: 247706 --- clang/lib/Sema/SemaOpenMP.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaOpenMP.cpp') diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index cf7ce23866d..22170f3dde5 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2015,6 +2015,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind, unsigned NamedModifiersNumber = 0; SmallVector FoundNameModifiers( OMPD_unknown + 1); + SmallVector NameModifierLoc; for (const auto *C : Clauses) { if (const auto *IC = dyn_cast_or_null(C)) { // At most one if clause without a directive-name-modifier can appear on @@ -2025,8 +2026,10 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind, << getOpenMPDirectiveName(Kind) << getOpenMPClauseName(OMPC_if) << (CurNM != OMPD_unknown) << getOpenMPDirectiveName(CurNM); ErrorFound = true; - } else if (CurNM != OMPD_unknown) + } else if (CurNM != OMPD_unknown) { + NameModifierLoc.push_back(IC->getNameModifierLoc()); ++NamedModifiersNumber; + } FoundNameModifiers[CurNM] = IC; if (CurNM == OMPD_unknown) continue; @@ -2079,6 +2082,9 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind, diag::err_omp_unnamed_if_clause) << (TotalAllowedNum > 1) << Values; } + for (auto Loc : NameModifierLoc) { + S.Diag(Loc, diag::note_omp_previous_named_if_clause); + } ErrorFound = true; } return ErrorFound; -- cgit v1.2.3