aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorZequan Wu <zequanwu@google.com>2022-12-06 07:58:28 +0800
committerZequan Wu <zequanwu@google.com>2022-12-06 08:29:55 +0800
commitbb5bcddcdbc151119f449be2d1e0d90f2e9c4258 (patch)
tree4d01ff801a56ee62f9dd0bb8a3345c9e5172d155 /clang/lib/CodeGen/CGDebugInfo.cpp
parentdd3fe52492e90a67e63d9f33b5fafaeb3942066d (diff)
downloadllvm-bb5bcddcdbc151119f449be2d1e0d90f2e9c4258.zip
llvm-bb5bcddcdbc151119f449be2d1e0d90f2e9c4258.tar.gz
llvm-bb5bcddcdbc151119f449be2d1e0d90f2e9c4258.tar.bz2
[CodeView] Don't generate dummy unnamed strcut/class/union type.
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index b0fe96d..2a67f58 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1653,10 +1653,15 @@ void CGDebugInfo::CollectRecordFields(
} else if (CGM.getCodeGenOpts().EmitCodeView) {
// Debug info for nested types is included in the member list only for
// CodeView.
- if (const auto *nestedType = dyn_cast<TypeDecl>(I))
+ if (const auto *nestedType = dyn_cast<TypeDecl>(I)) {
+ // MSVC doesn't generate nested type for anonymous struct/union.
+ if (isa<RecordDecl>(I) &&
+ cast<RecordDecl>(I)->isAnonymousStructOrUnion())
+ continue;
if (!nestedType->isImplicit() &&
nestedType->getDeclContext() == record)
CollectRecordNestedType(nestedType, elements);
+ }
}
}
}