summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/DeclarationName.cpp16
-rw-r--r--test/CXX/class.access/p4.cpp4
-rw-r--r--test/CXX/class.access/p6.cpp2
-rw-r--r--test/CXX/special/class.dtor/p10-0x.cpp2
-rw-r--r--test/Index/load-classes.cpp2
-rw-r--r--test/SemaCXX/undefined-internal.cpp2
-rw-r--r--unittests/AST/DeclPrinterTest.cpp2
7 files changed, 19 insertions, 11 deletions
diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp
index 56b7574600..e5019ab8d9 100644
--- a/lib/AST/DeclarationName.cpp
+++ b/lib/AST/DeclarationName.cpp
@@ -150,7 +150,9 @@ raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
QualType ClassType = N.getCXXNameType();
if (const RecordType *ClassRec = ClassType->getAs<RecordType>())
return OS << *ClassRec->getDecl();
- return OS << ClassType.getAsString();
+ LangOptions LO;
+ LO.CPlusPlus = true;
+ return OS << ClassType.getAsString(PrintingPolicy(LO));
}
case DeclarationName::CXXDestructorName: {
@@ -158,7 +160,9 @@ raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
QualType Type = N.getCXXNameType();
if (const RecordType *Rec = Type->getAs<RecordType>())
return OS << *Rec->getDecl();
- return OS << Type.getAsString();
+ LangOptions LO;
+ LO.CPlusPlus = true;
+ return OS << Type.getAsString(PrintingPolicy(LO));
}
case DeclarationName::CXXOperatorName: {
@@ -185,7 +189,9 @@ raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
QualType Type = N.getCXXNameType();
if (const RecordType *Rec = Type->getAs<RecordType>())
return OS << *Rec->getDecl();
- return OS << Type.getAsString();
+ LangOptions LO;
+ LO.CPlusPlus = true;
+ return OS << Type.getAsString(PrintingPolicy(LO));
}
case DeclarationName::CXXUsingDirective:
return OS << "<using-directive>";
@@ -538,7 +544,9 @@ void DeclarationNameInfo::printName(raw_ostream &OS) const {
OS << '~';
else if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName)
OS << "operator ";
- OS << TInfo->getType().getAsString();
+ LangOptions LO;
+ LO.CPlusPlus = true;
+ OS << TInfo->getType().getAsString(PrintingPolicy(LO));
} else
OS << Name;
return;
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 0564a52b6d..435b09920d 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -79,8 +79,8 @@ namespace test1 {
-ca;
// These are all surrogate calls
ca(pub);
- ca(prot); // expected-error {{'operator void (*)(class Protected &)' is a protected member}}
- ca(priv); // expected-error {{'operator void (*)(class Private &)' is a private member}}
+ ca(prot); // expected-error {{'operator void (*)(Protected &)' is a protected member}}
+ ca(priv); // expected-error {{'operator void (*)(Private &)' is a private member}}
}
}
diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp
index 5007263a35..f9b95f0851 100644
--- a/test/CXX/class.access/p6.cpp
+++ b/test/CXX/class.access/p6.cpp
@@ -177,7 +177,7 @@ namespace test8 {
};
void test(A &a) {
- if (a) return; // expected-error-re {{'operator void *(class test8::A::*)(void){{( __attribute__\(\(thiscall\)\))?}} const' is a private member of 'test8::A'}}
+ if (a) return; // expected-error-re {{'operator void *(test8::A::*)(){{( __attribute__\(\(thiscall\)\))?}} const' is a private member of 'test8::A'}}
}
}
diff --git a/test/CXX/special/class.dtor/p10-0x.cpp b/test/CXX/special/class.dtor/p10-0x.cpp
index e10afb52e2..029cbd6ceb 100644
--- a/test/CXX/special/class.dtor/p10-0x.cpp
+++ b/test/CXX/special/class.dtor/p10-0x.cpp
@@ -7,7 +7,7 @@ template<typename T>
void b(const T *x, const A *y) {
x->~decltype(T())();
x->~decltype(*x)(); // expected-error{{the type of object expression ('const int') does not match the type being destroyed ('decltype(*x)' (aka 'const int &')) in pseudo-destructor expression}} \
- expected-error{{no member named '~const struct A &' in 'A'}}
+ expected-error{{no member named '~const A &' in 'A'}}
x->~decltype(int())(); // expected-error{{no member named '~int' in 'A'}}
y->~decltype(*y)(); // expected-error{{destructor type 'decltype(*y)' (aka 'const A &') in object destruction expression does not match the type 'const A' of the object being destroyed}}
diff --git a/test/Index/load-classes.cpp b/test/Index/load-classes.cpp
index db7b48f7ef..9790d9e6f4 100644
--- a/test/Index/load-classes.cpp
+++ b/test/Index/load-classes.cpp
@@ -23,7 +23,7 @@ X::X(int value) {
// CHECK: load-classes.cpp:5:11: TypeRef=struct X:3:8 Extent=[5:11 - 5:12]
// CHECK: load-classes.cpp:7:3: CXXDestructor=~X:7:3 Extent=[7:3 - 7:7] [access=protected]
// FIXME: missing TypeRef in the destructor name
-// CHECK: load-classes.cpp:9:3: CXXConversion=operator struct X *:9:3 Extent=[9:3 - 9:16] [access=private]
+// CHECK: load-classes.cpp:9:3: CXXConversion=operator X *:9:3 Extent=[9:3 - 9:16] [access=private]
// CHECK: load-classes.cpp:9:12: TypeRef=struct X:3:8 Extent=[9:12 - 9:13]
// CHECK: load-classes.cpp:12:4: CXXConstructor=X:12:4 (Definition) Extent=[12:1 - 13:2] [access=public]
// CHECK: load-classes.cpp:12:1: TypeRef=struct X:3:8 Extent=[12:1 - 12:2]
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp
index fdfa43b982..9d3048dc2e 100644
--- a/test/SemaCXX/undefined-internal.cpp
+++ b/test/SemaCXX/undefined-internal.cpp
@@ -288,7 +288,7 @@ namespace test12 {
virtual operator T3&() = 0;
operator T4(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T4' has internal linkage but is not defined}}
operator T5(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator T5' has internal linkage but is not defined}}
- operator T6&(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator class test12::T6 &' has internal linkage but is not defined}}
+ operator T6&(); // expected-warning {{function 'test12::<anonymous namespace>::Cls::operator test12::T6 &' has internal linkage but is not defined}}
};
struct Cls2 {
diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp
index 33c51363e9..ade55aaee3 100644
--- a/unittests/AST/DeclPrinterTest.cpp
+++ b/unittests/AST/DeclPrinterTest.cpp
@@ -558,7 +558,7 @@ TEST(DeclPrinter, TestCXXConversionDecl3) {
" operator Z();"
"};",
methodDecl(ofClass(hasName("A"))).bind("id"),
- "Z operator struct Z()"));
+ "Z operator Z()"));
// WRONG; Should be: "operator Z();"
}