[llvm-branch-commits] [clang] 57f70e3 - [Concepts] Fix ConceptSpecializationExpr profiling crash

Saar Raz via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 23 17:09:17 PST 2020


Author: Saar Raz
Date: 2020-01-24T02:28:20+02:00
New Revision: 57f70e387e362d988937b6627461d781ecf09e50

URL: https://github.com/llvm/llvm-project/commit/57f70e387e362d988937b6627461d781ecf09e50
DIFF: https://github.com/llvm/llvm-project/commit/57f70e387e362d988937b6627461d781ecf09e50.diff

LOG: [Concepts] Fix ConceptSpecializationExpr profiling crash

ConceptSpecializationExprs (CSEs) were being created with nullptr
TemplateArgsAsWritten during TemplateTemplateParmDecl canonicalization, and
we were relying on them during profiling which caused sporadic crashes
in test/CXX/.../temp.arg.template/p3-2a.cpp introduced in D44352.

Change profiling of CSEs to instead rely on the actual converted template
arguments and concept named.

(cherry picked from commit 8a3446746098ba29348bb8f85357dd0b466a6d6e)

Added: 
    

Modified: 
    clang/lib/AST/StmtProfile.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index 2aa5106e90fa..c0b0f3b0b064 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -1335,9 +1335,9 @@ void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
 void StmtProfiler::VisitConceptSpecializationExpr(
                                            const ConceptSpecializationExpr *S) {
   VisitExpr(S);
-  VisitDecl(S->getFoundDecl());
-  VisitTemplateArguments(S->getTemplateArgsAsWritten()->getTemplateArgs(),
-                         S->getTemplateArgsAsWritten()->NumTemplateArgs);
+  VisitDecl(S->getNamedConcept());
+  for (const TemplateArgument &Arg : S->getTemplateArguments())
+    VisitTemplateArgument(Arg);
 }
 
 static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,


        


More information about the llvm-branch-commits mailing list