jyu2 created this revision. Herald added subscribers: guansong, yaxunl. Herald added a project: All. jyu2 requested review of this revision. Herald added a reviewer: jdoerfert. Herald added subscribers: cfe-commits, sstefan1. Herald added a project: clang.
This is to fix https://github.com/llvm/llvm-project/issues/56884 The problem is in isOpenMPRebuildMemberExpr, it is only need to rebuild for field expression. No need for member function call. The fix is to check field for member expression and skip rebuild for member function call Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D131024 Files: clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/parallel_default_messages.cpp Index: clang/test/OpenMP/parallel_default_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_default_messages.cpp +++ clang/test/OpenMP/parallel_default_messages.cpp @@ -49,3 +49,10 @@ return 0; } + +class A{ + void a() { + #pragma omp parallel + a(b); // expected-error {{use of undeclared identifier 'b'}} + } +}; Index: clang/lib/Sema/SemaOpenMP.cpp =================================================================== --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -2270,6 +2270,9 @@ } bool Sema::isOpenMPRebuildMemberExpr(ValueDecl *D) { + // Only rebuild for Field. + if (!dyn_cast<FieldDecl>(D)) + return false; DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( D, [](OpenMPClauseKind C, bool AppliedToPointee,
Index: clang/test/OpenMP/parallel_default_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_default_messages.cpp +++ clang/test/OpenMP/parallel_default_messages.cpp @@ -49,3 +49,10 @@ return 0; } + +class A{ + void a() { + #pragma omp parallel + a(b); // expected-error {{use of undeclared identifier 'b'}} + } +}; Index: clang/lib/Sema/SemaOpenMP.cpp =================================================================== --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -2270,6 +2270,9 @@ } bool Sema::isOpenMPRebuildMemberExpr(ValueDecl *D) { + // Only rebuild for Field. + if (!dyn_cast<FieldDecl>(D)) + return false; DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( D, [](OpenMPClauseKind C, bool AppliedToPointee,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits