summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/CodeGen
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-09-01 16:27:59 +0000
committerpatrick <patrick@openbsd.org>2019-09-01 16:27:59 +0000
commitb19884b112052f3bf5ff9551374fbd840e2339f2 (patch)
tree9e4127bb2a982bb6f8c89d0d7b393e3fac3aee2c /gnu/llvm/tools/clang/lib/CodeGen
parentAdd amlmmc(4), a driver for the SD/MMC controller found on various (diff)
downloadwireguard-openbsd-b19884b112052f3bf5ff9551374fbd840e2339f2.tar.xz
wireguard-openbsd-b19884b112052f3bf5ff9551374fbd840e2339f2.zip
Import LLVM 8.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/CodeGen')
-rw-r--r--gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp36
-rw-r--r--gnu/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp5
2 files changed, 17 insertions, 24 deletions
diff --git a/gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp b/gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
index 41f8721468a..ad1a9157a12 100644
--- a/gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1817,32 +1817,24 @@ CGDebugInfo::CollectFunctionTemplateParams(const FunctionDecl *FD,
}
llvm::DINodeArray CGDebugInfo::CollectVarTemplateParams(const VarDecl *VL,
- llvm::DIFile *Unit) {
- if (auto *TS = dyn_cast<VarTemplateSpecializationDecl>(VL)) {
- auto T = TS->getSpecializedTemplateOrPartial();
- auto TA = TS->getTemplateArgs().asArray();
- // Collect parameters for a partial specialization
- if (T.is<VarTemplatePartialSpecializationDecl *>()) {
- const TemplateParameterList *TList =
- T.get<VarTemplatePartialSpecializationDecl *>()
- ->getTemplateParameters();
- return CollectTemplateParams(TList, TA, Unit);
- }
-
- // Collect parameters for an explicit specialization
- if (T.is<VarTemplateDecl *>()) {
- const TemplateParameterList *TList = T.get<VarTemplateDecl *>()
- ->getTemplateParameters();
- return CollectTemplateParams(TList, TA, Unit);
- }
- }
- return llvm::DINodeArray();
+ llvm::DIFile *Unit) {
+ // Always get the full list of parameters, not just the ones from the
+ // specialization. A partial specialization may have fewer parameters than
+ // there are arguments.
+ auto *TS = dyn_cast<VarTemplateSpecializationDecl>(VL);
+ if (!TS)
+ return llvm::DINodeArray();
+ VarTemplateDecl *T = TS->getSpecializedTemplate();
+ const TemplateParameterList *TList = T->getTemplateParameters();
+ auto TA = TS->getTemplateArgs().asArray();
+ return CollectTemplateParams(TList, TA, Unit);
}
llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(
const ClassTemplateSpecializationDecl *TSpecial, llvm::DIFile *Unit) {
- // Always get the full list of parameters, not just the ones from
- // the specialization.
+ // Always get the full list of parameters, not just the ones from the
+ // specialization. A partial specialization may have fewer parameters than
+ // there are arguments.
TemplateParameterList *TPList =
TSpecial->getSpecializedTemplate()->getTemplateParameters();
const TemplateArgumentList &TAList = TSpecial->getTemplateArgs();
diff --git a/gnu/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp b/gnu/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp
index eb1304d8934..44dc1cdee0b 100644
--- a/gnu/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/gnu/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1518,8 +1518,9 @@ void CodeGenFunction::EmitOMPPrivateLoopCounters(
I < E; ++I) {
const auto *DRE = cast<DeclRefExpr>(C->getLoopCounter(I));
const auto *VD = cast<VarDecl>(DRE->getDecl());
- // Override only those variables that are really emitted already.
- if (LocalDeclMap.count(VD)) {
+ // Override only those variables that can be captured to avoid re-emission
+ // of the variables declared within the loops.
+ if (DRE->refersToEnclosingVariableOrCapture()) {
(void)LoopScope.addPrivate(VD, [this, DRE, VD]() {
return CreateMemTemp(DRE->getType(), VD->getName());
});