From: Sam Weinig Date: Sun, 6 Dec 2009 23:55:13 +0000 (+0000) Subject: Don't print a void return type for C++ constructors and destructors when generating... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a1ce1ed0f5686384e712837bad28c576622e442;p=clang Don't print a void return type for C++ constructors and destructors when generating a predefined expr for them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90725 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index c5fb98dbcb..db7d94dba6 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -203,7 +203,8 @@ std::string PredefinedExpr::ComputeName(ASTContext &Context, IdentType IT, } Proto += ")"; - AFT->getResultType().getAsStringInternal(Proto, Policy); + if (!isa(FD) && !isa(FD)) + AFT->getResultType().getAsStringInternal(Proto, Policy); Out << Proto; diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp index 95bc255bdd..45b4e9f540 100644 --- a/test/CodeGenCXX/predefined-expr.cpp +++ b/test/CodeGenCXX/predefined-expr.cpp @@ -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"