[cfe-commits] r167308 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info.c test/CodeGenCXX/debug-info-class.cpp
Eric Christopher
echristo at gmail.com
Fri Nov 2 13:53:36 PDT 2012
Looks good so far :)
-eric
On Fri, Nov 2, 2012 at 1:49 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Fri Nov 2 15:49:01 2012
> New Revision: 167308
>
> URL: http://llvm.org/viewvc/llvm-project?rev=167308&view=rev
> Log:
> Fix debug tag type of forward declarations of struct/class in C++.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/test/CodeGen/debug-info.c
> cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=167308&r1=167307&r2=167308&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Nov 2 15:49:01 2012
> @@ -518,21 +518,17 @@
> llvm::DIDescriptor Ctx) {
> llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
> unsigned Line = getLineNumber(RD->getLocation());
> - StringRef RDName = RD->getName();
> + StringRef RDName = getClassName(RD);
>
> - // Get the tag.
> - const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD);
> unsigned Tag = 0;
> - if (CXXDecl) {
> - RDName = getClassName(RD);
> - Tag = llvm::dwarf::DW_TAG_class_type;
> - }
> - else if (RD->isStruct() || RD->isInterface())
> + if (RD->isStruct() || RD->isInterface())
> Tag = llvm::dwarf::DW_TAG_structure_type;
> else if (RD->isUnion())
> Tag = llvm::dwarf::DW_TAG_union_type;
> - else
> - llvm_unreachable("Unknown RecordDecl type!");
> + else {
> + assert(RD->isClass());
> + Tag = llvm::dwarf::DW_TAG_class_type;
> + }
>
> // Create the type.
> return DBuilder.createForwardDecl(Tag, RDName, Ctx, DefUnit, Line);
>
> Modified: cfe/trunk/test/CodeGen/debug-info.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info.c?rev=167308&r1=167307&r2=167308&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/debug-info.c (original)
> +++ cfe/trunk/test/CodeGen/debug-info.c Fri Nov 2 15:49:01 2012
> @@ -1,5 +1,4 @@
> -// RUN: %clang_cc1 -triple x86_64-unk-unk -o %t -emit-llvm -g %s
> -// RUN: FileCheck --input-file=%t %s
> +// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
>
> // PR3023
> void convert(void) {
> @@ -8,7 +7,7 @@
>
>
> // PR2784
> -struct OPAQUE;
> +struct OPAQUE; // CHECK: DW_TAG_structure_type
> typedef struct OPAQUE *PTR;
> PTR p;
>
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class.cpp?rev=167308&r1=167307&r2=167308&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-class.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-class.cpp Fri Nov 2 15:49:01 2012
> @@ -1,12 +1,24 @@
> -// RUN: %clang -emit-llvm -g -S %s -o - | grep HdrSize
> -struct A {
> +// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
> +struct foo;
> +void func(foo *f) { // CHECK: DW_TAG_structure_type
> +}
> +class bar;
> +void func(bar *f) { // CHECK: DW_TAG_class_type
> +}
> +union baz;
> +void func(baz *f) { // CHECK: DW_TAG_union_type
> +}
> +struct A { // FIXME: we're still emitting this as DW_TAG_class_type
> int one;
> - static const int HdrSize = 52;
> + static const int HdrSize = 52; // CHECK: HdrSize
> int two;
> A() {
> int x = 1;
> }
> };
> +class B { // CHECK: DW_TAG_class_type
> +};
> int main() {
> A a;
> + B b;
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list