This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG18f087c21cdb: [DebugInfo][Clang] record the access flag for class/struct/union types. (authored by Esme).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115503/new/ https://reviews.llvm.org/D115503 Files: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/debug-info-access.cpp Index: clang/test/CodeGenCXX/debug-info-access.cpp =================================================================== --- clang/test/CodeGenCXX/debug-info-access.cpp +++ clang/test/CodeGenCXX/debug-info-access.cpp @@ -25,6 +25,43 @@ void priv_default(); }; +class C { +public: + // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "D",{{.*}} flags: DIFlagPublic | DIFlagTypePassByValue, + struct D { + }; +protected: + // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "E",{{.*}} flags: DIFlagProtected | DIFlagTypePassByValue, + union E { + }; +private: + // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "J",{{.*}} flags: DIFlagTypePassByValue, + struct J { + }; +public: + D d; + E e; + J j; +}; + +struct F { +private: + // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "G",{{.*}} flags: DIFlagPrivate | DIFlagTypePassByValue, + union G { + }; +public: + G g; +}; + +union H { +private: + // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "I",{{.*}} flags: DIFlagPrivate | DIFlagTypePassByValue, + class I { + }; +public: + I i; +}; + union U { // CHECK-DAG: !DISubprogram(name: "union_pub_default",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagPrototyped, void union_pub_default(); @@ -33,7 +70,6 @@ int union_priv; }; - // CHECK: !DISubprogram(name: "free", // CHECK-SAME: flags: DIFlagPrototyped, // CHECK-SAME: spFlags: DISPFlagDefinition @@ -42,3 +78,6 @@ U u; A a; B b; +C c; +F f; +H h; Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -3633,6 +3633,9 @@ // Record exports it symbols to the containing structure. if (CXXRD->isAnonymousStructOrUnion()) Flags |= llvm::DINode::FlagExportSymbols; + + Flags |= getAccessFlag(CXXRD->getAccess(), + dyn_cast<CXXRecordDecl>(CXXRD->getDeclContext())); } llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
Index: clang/test/CodeGenCXX/debug-info-access.cpp =================================================================== --- clang/test/CodeGenCXX/debug-info-access.cpp +++ clang/test/CodeGenCXX/debug-info-access.cpp @@ -25,6 +25,43 @@ void priv_default(); }; +class C { +public: + // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "D",{{.*}} flags: DIFlagPublic | DIFlagTypePassByValue, + struct D { + }; +protected: + // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "E",{{.*}} flags: DIFlagProtected | DIFlagTypePassByValue, + union E { + }; +private: + // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "J",{{.*}} flags: DIFlagTypePassByValue, + struct J { + }; +public: + D d; + E e; + J j; +}; + +struct F { +private: + // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "G",{{.*}} flags: DIFlagPrivate | DIFlagTypePassByValue, + union G { + }; +public: + G g; +}; + +union H { +private: + // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "I",{{.*}} flags: DIFlagPrivate | DIFlagTypePassByValue, + class I { + }; +public: + I i; +}; + union U { // CHECK-DAG: !DISubprogram(name: "union_pub_default",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagPrototyped, void union_pub_default(); @@ -33,7 +70,6 @@ int union_priv; }; - // CHECK: !DISubprogram(name: "free", // CHECK-SAME: flags: DIFlagPrototyped, // CHECK-SAME: spFlags: DISPFlagDefinition @@ -42,3 +78,6 @@ U u; A a; B b; +C c; +F f; +H h; Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -3633,6 +3633,9 @@ // Record exports it symbols to the containing structure. if (CXXRD->isAnonymousStructOrUnion()) Flags |= llvm::DINode::FlagExportSymbols; + + Flags |= getAccessFlag(CXXRD->getAccess(), + dyn_cast<CXXRecordDecl>(CXXRD->getDeclContext())); } llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits