r175864 - Teach -ast-print how to print trailing-return-types.
Richard Smith
richard-llvm at metafoo.co.uk
Thu Feb 21 21:54:52 PST 2013
Author: rsmith
Date: Thu Feb 21 23:54:51 2013
New Revision: 175864
URL: http://llvm.org/viewvc/llvm-project?rev=175864&view=rev
Log:
Teach -ast-print how to print trailing-return-types.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=175864&r1=175863&r2=175864&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Thu Feb 21 23:54:51 2013
@@ -542,9 +542,13 @@ void DeclPrinter::VisitFunctionDecl(Func
}
if (!Proto.empty())
Out << Proto;
- }
- else
+ } else {
+ if (FT && FT->hasTrailingReturn()) {
+ Out << "auto " << Proto << " -> ";
+ Proto.clear();
+ }
AFT->getResultType().print(Out, Policy, Proto);
+ }
} else {
Ty.print(Out, Policy, Proto);
}
Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=175864&r1=175863&r2=175864&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Thu Feb 21 23:54:51 2013
@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -std=c++11 -ast-print %s | FileCheck %s
-// FIXME: Print the trailing-return-type properly.
-// CHECK: decltype(nullptr) operator "" _foo(const char *p, decltype(sizeof(int)));
+// CHECK: auto operator "" _foo(const char *p, decltype(sizeof(int))) -> decltype(nullptr);
auto operator"" _foo(const char *p, decltype(sizeof(int))) -> decltype(nullptr);
// CHECK: decltype(""_foo) operator "" _bar(unsigned long long);
More information about the cfe-commits
mailing list