summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2017-09-28 18:37:02 +0000
committerPaul Robinson <paul.robinson@sony.com>2017-09-28 18:37:02 +0000
commit1787f8122125762fb4e492f72e7c886e6e80d019 (patch)
treefb7a77dfefd9aa3ba2ad247ebb36360ca94fe760 /clang/lib
parent2095e6085124aeedf3de1511ec16e2a29845500d (diff)
downloadbcm5719-llvm-1787f8122125762fb4e492f72e7c886e6e80d019.tar.gz
bcm5719-llvm-1787f8122125762fb4e492f72e7c886e6e80d019.zip
[DWARF] Allow forward declarations of a class template instantiation
to have child entries describing the template parameters. This will be on by default for SCE tuning. Differential Revision: https://reviews.llvm.org/D14358 llvm-svn: 314444
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp4
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp5
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp1
3 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 5581d76c20c..a73e4a98b3c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -833,6 +833,10 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty,
llvm::DICompositeType *RetTy = DBuilder.createReplaceableCompositeType(
getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,
llvm::DINode::FlagFwdDecl, FullName);
+ if (CGM.getCodeGenOpts().DebugFwdTemplateParams)
+ if (auto *TSpecial = dyn_cast<ClassTemplateSpecializationDecl>(RD))
+ DBuilder.replaceArrays(RetTy, llvm::DINodeArray(),
+ CollectCXXTemplateParams(TSpecial, DefUnit));
ReplaceMap.emplace_back(
std::piecewise_construct, std::make_tuple(Ty),
std::make_tuple(static_cast<llvm::Metadata *>(RetTy)));
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 8cb598ad0bd..90d912511e9 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2969,6 +2969,11 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
CmdArgs.push_back("-generate-type-units");
}
+ // Decide how to render forward declarations of template instantiations.
+ // SCE wants full descriptions, others just get them in the name.
+ if (DebuggerTuning == llvm::DebuggerKind::SCE)
+ CmdArgs.push_back("-debug-forward-template-params");
+
RenderDebugInfoCompressionArgs(Args, CmdArgs, D);
}
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index c4e8976cf3a..e1b14d0c156 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -528,6 +528,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
Opts.DebugExplicitImport = Triple.isPS4CPU();
+ Opts.DebugFwdTemplateParams = Args.hasArg(OPT_debug_forward_template_params);
for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
OpenPOWER on IntegriCloud