[cfe-commits] r90725 - in /cfe/trunk: lib/AST/Expr.cpp test/CodeGenCXX/predefined-expr.cpp

Sam Weinig sam.weinig at gmail.com
Sun Dec 6 15:55:13 PST 2009


Author: weinig
Date: Sun Dec  6 17:55:13 2009
New Revision: 90725

URL: http://llvm.org/viewvc/llvm-project?rev=90725&view=rev
Log:
Don't print a void return type for C++ constructors and destructors when generating a predefined expr for them.

Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/CodeGenCXX/predefined-expr.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=90725&r1=90724&r2=90725&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sun Dec  6 17:55:13 2009
@@ -203,7 +203,8 @@
     }
     Proto += ")";
 
-    AFT->getResultType().getAsStringInternal(Proto, Policy);
+    if (!isa<CXXConstructorDecl>(FD) && !isa<CXXDestructorDecl>(FD))
+      AFT->getResultType().getAsStringInternal(Proto, Policy);
 
     Out << Proto;
 

Modified: cfe/trunk/test/CodeGenCXX/predefined-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/predefined-expr.cpp?rev=90725&r1=90724&r2=90725&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/predefined-expr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/predefined-expr.cpp Sun Dec  6 17:55:13 2009
@@ -12,12 +12,12 @@
 // CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
 
 // CHECK: private constant [12 x i8] c"~Destructor\00"
-// CHECK: private constant [35 x i8] c"void NS::Destructor::~Destructor()\00"
+// CHECK: private constant [30 x i8] c"NS::Destructor::~Destructor()\00"
 
 // CHECK: private constant [12 x i8] c"Constructor\00"
-// CHECK: private constant [46 x i8] c"void NS::Constructor::Constructor(NS::Base *)\00"
-// CHECK: private constant [39 x i8] c"void NS::Constructor::Constructor(int)\00"
-// CHECK: private constant [36 x i8] c"void NS::Constructor::Constructor()\00"
+// CHECK: private constant [41 x i8] c"NS::Constructor::Constructor(NS::Base *)\00"
+// CHECK: private constant [34 x i8] c"NS::Constructor::Constructor(int)\00"
+// CHECK: private constant [31 x i8] c"NS::Constructor::Constructor()\00"
 
 // CHECK: private constant [16 x i8] c"virtualFunction\00"
 // CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"





More information about the cfe-commits mailing list