[PATCH] D94735: CGDebugInfo CreatedLimitedType: Drop file/line for RecordType with invalid location

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 14:39:57 PST 2021


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

Couple of optional pieces.



================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3338-3340
+  const SourceLocation Loc = RD->getLocation();
+  llvm::DIFile *DefUnit = Loc.isValid() ? getOrCreateFile(Loc) : nullptr;
+  const unsigned Line = getLineNumber(Loc);
----------------
Might be more readable, even though it provides the same behavior, with something like:
```
  llvm::DIFile *DefUnit = nullptr;
  unsigned Line = 0;
  if (SourceLocation Loc = RD->getLocation(); Loc.isValid()) {
    DefUnit = getOrCreateFile(Loc);
    Line = getLineNumber(Loc);
  }
```


================
Comment at: clang/test/CodeGen/X86/x86_64-arguments.c:550
+/// The synthesized __va_list_tag does not have file/line fields.
+// CHECK: = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__va_list_tag", size:
----------------
Perhaps CHECK-NOT would be a more explicit way to do that rather than relying on field ordering/the fact that 'size' comes after the file/line fields.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94735/new/

https://reviews.llvm.org/D94735



More information about the cfe-commits mailing list