[llvm-branch-commits] [clang] 4683a45 - Fix assert during the call to getCanonicalDecl.
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 15 00:32:27 PDT 2022
Author: Jennifer Yu
Date: 2022-08-15T09:30:40+02:00
New Revision: 4683a4561c2513ae7384aa9fd752f45a72eecc83
URL: https://github.com/llvm/llvm-project/commit/4683a4561c2513ae7384aa9fd752f45a72eecc83
DIFF: https://github.com/llvm/llvm-project/commit/4683a4561c2513ae7384aa9fd752f45a72eecc83.diff
LOG: Fix assert during the call to getCanonicalDecl.
https://github.com/llvm/llvm-project/issues/56884
The root 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.
Differential Revision: https://reviews.llvm.org/D131024
(cherry picked from commit a7bca18bc50cd2483fded0c77706980b2721ce6a)
Added:
Modified:
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/parallel_default_messages.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index dc1470bf7a9d1..a92fec6a02323 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -2270,6 +2270,9 @@ bool Sema::isInOpenMPTargetExecutionDirective() const {
}
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,
diff --git a/clang/test/OpenMP/parallel_default_messages.cpp b/clang/test/OpenMP/parallel_default_messages.cpp
index 7db15d7267317..65e0d92c32fc2 100644
--- a/clang/test/OpenMP/parallel_default_messages.cpp
+++ b/clang/test/OpenMP/parallel_default_messages.cpp
@@ -49,3 +49,10 @@ int main(int argc, char **argv) {
return 0;
}
+
+class A{
+ void a() {
+ #pragma omp parallel
+ a(b); // expected-error {{use of undeclared identifier 'b'}}
+ }
+};
More information about the llvm-branch-commits
mailing list