r260370 - Fix PR26543: add a check for definition in CXXRecordDecl.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 02:50:13 PST 2016


Author: abataev
Date: Wed Feb 10 04:50:12 2016
New Revision: 260370

URL: http://llvm.org/viewvc/llvm-project?rev=260370&view=rev
Log:
Fix PR26543: add a check for definition in CXXRecordDecl.

Modified:
    cfe/trunk/lib/Sema/SemaOpenMP.cpp
    cfe/trunk/test/OpenMP/parallel_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=260370&r1=260369&r2=260370&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Feb 10 04:50:12 2016
@@ -669,7 +669,8 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
     if (auto *CTD = CTSD->getSpecializedTemplate())
       RD = CTD->getTemplatedDecl();
   if (IsConstant &&
-      !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
+      !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasDefinition() &&
+        RD->hasMutableFields())) {
     // Variables with const-qualified type having no mutable member may be
     // listed in a firstprivate clause, even if they are static data members.
     DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),

Modified: cfe/trunk/test/OpenMP/parallel_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_messages.cpp?rev=260370&r1=260369&r2=260370&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_messages.cpp Wed Feb 10 04:50:12 2016
@@ -5,7 +5,12 @@ void foo() {
 
 #pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}}
 
+struct S;
+S& bar();
 int main(int argc, char **argv) {
+  S &s = bar();
+  #pragma omp parallel
+  (void)&s;
   #pragma omp parallel { // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
   foo();
   #pragma omp parallel ( // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}




More information about the cfe-commits mailing list