[PATCH] D122670: [Clang][CodeGen]Remove anonymous tag locations
Wang Yihan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 10:44:53 PDT 2022
yihanaa created this revision.
yihanaa added reviewers: erichkeane, aaron.ballman.
Herald added a project: All.
yihanaa requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Remove anonymous tag locations, powered by 'PrintingPolicy', @aaron.ballman once suggested removing this extra information in https://reviews.llvm.org/D122248
struct:
struct S {
int a;
struct /* Anonymous*/ {
int x;
} b;
int c;
};
Before:
struct S {
int a = 0
struct S::(unnamed at ./builtin_dump_struct.c:20:3) {
int x = 0
}
int c = 0
}
After:
struct S {
int a = 0
struct S::(unnamed) {
int x = 0
}
int c = 0
}
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122670
Files:
clang/lib/CodeGen/CGBuiltin.cpp
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -2050,8 +2050,10 @@
RecordDecl *RD = RType->castAs<RecordType>()->getDecl()->getDefinition();
std::string Pad = std::string(Lvl * 4, ' ');
+ PrintingPolicy Policy(Context.getLangOpts());
+ Policy.AnonymousTagLocations = false;
Value *GString =
- CGF.Builder.CreateGlobalStringPtr(RType.getAsString() + " {\n");
+ CGF.Builder.CreateGlobalStringPtr(RType.getAsString(Policy) + " {\n");
Value *Res = CGF.Builder.CreateCall(Func, {GString});
static llvm::DenseMap<QualType, const char *> Types;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122670.418927.patch
Type: text/x-patch
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220329/087fda43/attachment.bin>
More information about the cfe-commits
mailing list