aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-22 05:54:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-22 05:54:51 +0000
commit425663a16cc0d1bbd6764300f8a59251057dffe8 (patch)
tree0a33fc041a20cae7cc9b56ccba3b65fd32e2fa68
parentb04a2387ac23adfa063de03844cb16c0d77fb405 (diff)
Teach -ast-print how to print trailing-return-types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclPrinter.cpp8
-rw-r--r--test/SemaCXX/cxx11-ast-print.cpp3
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index 333e321d40..dce4f9af25 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -542,9 +542,13 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
}
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);
}
diff --git a/test/SemaCXX/cxx11-ast-print.cpp b/test/SemaCXX/cxx11-ast-print.cpp
index afabf88bd5..66ff0f064a 100644
--- a/test/SemaCXX/cxx11-ast-print.cpp
+++ b/test/SemaCXX/cxx11-ast-print.cpp
@@ -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);