aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorelizabethandrews <elizabeth.andrews@intel.com>2023-11-13 16:39:40 -0500
committerGitHub <noreply@github.com>2023-11-13 16:39:40 -0500
commit7fb606e9feb9a4f23acf96ccf73ae676ca883828 (patch)
treef05ff811ac67b1ec044121441a78712057caacd3 /clang/lib
parent29fd3e2aa8ea09264037c278648c9033250843e0 (diff)
downloadllvm-7fb606e9feb9a4f23acf96ccf73ae676ca883828.zip
llvm-7fb606e9feb9a4f23acf96ccf73ae676ca883828.tar.gz
llvm-7fb606e9feb9a4f23acf96ccf73ae676ca883828.tar.bz2
[Clang] Fix a crash when using ast-dump=json (#70224)
CXXDeductionGuideDecl inherits from FunctionDecl. For FunctionDecls, the JSONVisitor includes a call to visit NamedDecl in order to provide mangled names in the dump. This did not correctly exclude CXXDeductionGuideDecl, which resulted in an assert being hit.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/JSONNodeDumper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp
index ace5178..637d06c 100644
--- a/clang/lib/AST/JSONNodeDumper.cpp
+++ b/clang/lib/AST/JSONNodeDumper.cpp
@@ -823,6 +823,10 @@ void JSONNodeDumper::VisitNamedDecl(const NamedDecl *ND) {
if (VD && VD->hasLocalStorage())
return;
+ // Do not mangle template deduction guides.
+ if (isa<CXXDeductionGuideDecl>(ND))
+ return;
+
std::string MangledName = ASTNameGen.getName(ND);
if (!MangledName.empty())
JOS.attribute("mangledName", MangledName);