Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72747 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index b2ee58f..f573744 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1410,7 +1410,7 @@
if (getNumArgs())
S += ", ";
S += "...";
- } else if (getNumArgs() == 0) {
+ } else if (getNumArgs() == 0 && !Policy.CPlusPlus) {
// Do not emit int() if we have a proto, emit 'int(void)'.
S += "void";
}
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 1212d07..e3cea5b 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -60,7 +60,7 @@
// Not va_list.
Ty.getUnqualifiedType() != Context.getBuiltinVaListType()) {
S = "'"+S+"' (aka '";
- S += DesugaredTy.getAsString();
+ S += DesugaredTy.getAsString(Context.PrintingPolicy);
S += "')";
Output.append(S.begin(), S.end());
return;