summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-08-22 17:54:52 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-08-22 17:54:52 +0000
commit6a71f364f175a94a92cb26908b36d972734a611d (patch)
tree77037ca5b4040397e681d8951cddc290b944665a /clang/lib/CodeGen/CGStmtOpenMP.cpp
parent6bfeba24d39ed0915ebb5867df650ac7db3eb5dd (diff)
downloadbcm5719-llvm-6a71f364f175a94a92cb26908b36d972734a611d.tar.gz
bcm5719-llvm-6a71f364f175a94a92cb26908b36d972734a611d.zip
[OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
of class fails to map class static variable. If the global variable is captured and it has several redeclarations, sometimes it may lead to a compiler crash. Patch fixes this by working only with canonical declarations. llvm-svn: 311479
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 1b148828435..4de88bc9d4e 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -65,6 +65,8 @@ public:
for (auto &C : CS->captures()) {
if (C.capturesVariable() || C.capturesVariableByCopy()) {
auto *VD = C.getCapturedVar();
+ assert(VD == VD->getCanonicalDecl() &&
+ "Canonical decl must be captured.");
DeclRefExpr DRE(const_cast<VarDecl *>(VD),
isCapturedVar(CGF, VD) ||
(CGF.CapturedStmtInfo &&
OpenPOWER on IntegriCloud