[PATCH] D52706: [CodeView] Only add the Scoped flag for an enum type when it has an immediate function scope to match MSVC

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 13:35:52 PDT 2018


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, thanks!



================
Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1815-1816
 
-  // Put the Scoped flag on function-local types.
-  for (const DIScope *Scope = ImmediateScope; Scope != nullptr;
-       Scope = Scope->getScope().resolve()) {
-    if (isa<DISubprogram>(Scope)) {
+  // Put the Scoped flag on function-local types. MSVC puts this flag for enum
+  // type only when it has an immediate function scope.
+  if (Ty->getTag() == dwarf::DW_TAG_enumeration_type) {
----------------
Please add a comment to indicate that clang never puts enums inside DILexicalBlock scopes. Enum types, as generated by clang, are always in function, class, or file scopes.


Repository:
  rL LLVM

https://reviews.llvm.org/D52706





More information about the llvm-commits mailing list