summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
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/CGDebugInfo.cpp
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/CGDebugInfo.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp36
1 files changed, 14 insertions, 22 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();