Skip to content

Commit 21f0b76

Browse files
sudo-pandavgvassilev
authored andcommitted
Prevent printing anon tag locs in GetCompleteName
1 parent 042f484 commit 21f0b76

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/Interpreter/CppInterOp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ namespace Cpp {
394394
PrintingPolicy Policy = C.getPrintingPolicy();
395395
Policy.SuppressUnwrittenScope = true;
396396
Policy.SuppressScope = true;
397+
Policy.AnonymousTagLocations = false;
397398
QT.getAsStringInternal(type_name, Policy);
398399

399400
return type_name;

unittests/CppInterOp/ScopeReflectionTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ TEST(ScopeReflectionTest, GetCompleteName) {
253253
template<typename T>
254254
class A {};
255255
A<int> a;
256+
257+
enum { enum1 };
256258
)";
257259
GetAllTopLevelDecls(code, Decls);
258260

@@ -268,6 +270,7 @@ TEST(ScopeReflectionTest, GetCompleteName) {
268270
EXPECT_EQ(Cpp::GetCompleteName(Cpp::GetScopeFromType(
269271
Cpp::GetVariableType(
270272
Decls[9]))), "A<int>");
273+
EXPECT_EQ(Cpp::GetCompleteName(Decls[10]), "(unnamed)");
271274
}
272275

273276
TEST(ScopeReflectionTest, GetQualifiedName) {

0 commit comments

Comments
 (0)