r188123 - Correctly profile CXXPseudoDestructorExprs.

Eli Friedman eli.friedman at gmail.com
Fri Aug 9 16:37:06 PDT 2013


Author: efriedma
Date: Fri Aug  9 18:37:05 2013
New Revision: 188123

URL: http://llvm.org/viewvc/llvm-project?rev=188123&view=rev
Log:
Correctly profile CXXPseudoDestructorExprs.

CXXPseudoDestructorExprs may not contain a type.  PR16852.

Modified:
    cfe/trunk/lib/AST/StmtProfile.cpp
    cfe/trunk/test/SemaTemplate/destructor-template.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=188123&r1=188122&r2=188123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Aug  9 18:37:05 2013
@@ -910,7 +910,14 @@ StmtProfiler::VisitCXXPseudoDestructorEx
   VisitExpr(S);
   ID.AddBoolean(S->isArrow());
   VisitNestedNameSpecifier(S->getQualifier());
-  VisitType(S->getDestroyedType());
+  ID.AddBoolean(S->getScopeTypeInfo() != 0);
+  if (S->getScopeTypeInfo())
+    VisitType(S->getScopeTypeInfo()->getType());
+  ID.AddBoolean(S->getDestroyedTypeInfo() != 0);
+  if (S->getDestroyedTypeInfo())
+    VisitType(S->getDestroyedType());
+  else
+    ID.AddPointer(S->getDestroyedTypeIdentifier());
 }
 
 void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {

Modified: cfe/trunk/test/SemaTemplate/destructor-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/destructor-template.cpp?rev=188123&r1=188122&r2=188123&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/destructor-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/destructor-template.cpp Fri Aug  9 18:37:05 2013
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 template<typename A> class s0 {
 
@@ -76,3 +76,9 @@ namespace rdar13140795 {
     Marshal<int>::gc();
   }
 }
+
+namespace PR16852 {
+  template<typename T> struct S { int a; T x; };
+  template<typename T> decltype(S<T>().~S()) f(); // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
+  void g() { f(); } // expected-error {{no matching function for call to 'f'}}
+}





More information about the cfe-commits mailing list