[PATCH] D97411: [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 14:25:04 PST 2021


aaron.ballman added a comment.

Can you also add semantic tests that verify the attribute only works in C++, only appertains to a record (as opposed to other kinds of declarations like functions), and doesn't accept arguments. Some other tests that may be interesting:

  // Should test redeclaration behavior.
  struct [[clang::standalone_debug]] redecl;
  struct redecl {};
  
  struct [[clang::standalone_debug]] S; // Does this make sense on forward declare that's never defined?
  
  struct foo {
    struct [[clang::standalone_debug]] { // anonymous types?
      int x;
    };
  };
  
  union [[clang::standalone_debug]] U { // Non-struct record types?
    int x;
    float f;
  };
  
  union [[clang::standalone_debug]] Oof { // Non-struct record types with a constructor?
    Oof() {}
    int x;
    float f;
  };



================
Comment at: clang/include/clang/Basic/Attr.td:1666
+  let Subjects = SubjectList<[CXXRecord]>;
+  let Documentation = [Undocumented];
+  let SimpleHandler = 1;
----------------
rnk wrote:
> I understand that this patch is mainly to open discussion, but we should document the attribute before landing the patch.
+1 to this (no new undocumented attributes, please).


================
Comment at: clang/test/CodeGenCXX/force-debug-attribute.cpp:1
+// RUN: %clang_cc1 -DSETATTR=0 -emit-llvm -std=c++14 -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
+// RUN: %clang_cc1 -DSETATTR=1 -emit-llvm -std=c++14 -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
----------------
Is there something C++14 specific about the test, or should that be dropped?

Should we specify a triple? (I have no idea if debug info is target-specific.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97411



More information about the cfe-commits mailing list