r248376 - [DeclPrinter] Don't crash when printing a using decl with a special name

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 06:43:17 PDT 2015


Author: d0k
Date: Wed Sep 23 08:43:16 2015
New Revision: 248376

URL: http://llvm.org/viewvc/llvm-project?rev=248376&view=rev
Log:
[DeclPrinter] Don't crash when printing a using decl with a special name

Fixes PR24872.

Modified:
    cfe/trunk/lib/AST/DeclPrinter.cpp
    cfe/trunk/test/SemaCXX/ast-print.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=248376&r1=248375&r2=248376&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Sep 23 08:43:16 2015
@@ -1299,7 +1299,7 @@ void DeclPrinter::VisitUnresolvedUsingVa
   if (!D->isAccessDeclaration())
     Out << "using ";
   D->getQualifier()->print(Out, Policy);
-  Out << D->getName();
+  Out << D->getDeclName();
 }
 
 void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) {

Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=248376&r1=248375&r2=248376&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Wed Sep 23 08:43:16 2015
@@ -219,3 +219,11 @@ struct CXXFunctionalCastExprPrint {} fce
 
 // CHECK: struct CXXTemporaryObjectExprPrint toe = CXXTemporaryObjectExprPrint{};
 struct CXXTemporaryObjectExprPrint { CXXTemporaryObjectExprPrint(); } toe = CXXTemporaryObjectExprPrint{};
+
+namespace PR24872 {
+// CHECK: template <typename T> struct Foo : T {
+// CHECK: using T::operator-;
+template <typename T> struct Foo : T {
+  using T::operator-;
+};
+}




More information about the cfe-commits mailing list