r285625 - DebugInfo: support for DW_TAG_atomic_type

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 12:41:42 PDT 2016


> On Oct 31, 2016, at 12:09 PM, Victor Leschuk via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
> Author: vleschuk
> Date: Mon Oct 31 14:09:47 2016
> New Revision: 285625
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=285625&view=rev
> Log:
> DebugInfo: support for DW_TAG_atomic_type
> 
> Mark C11 _Atomic variables with DW_TAG_atomic_type tag.
> 
> Differential Revision: https://reviews.llvm.org/D26145
> 
> Added:
>    cfe/trunk/test/CodeGen/debug-info-atomic.c
> Modified:
>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=285625&r1=285624&r2=285625&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Oct 31 14:09:47 2016
> @@ -2287,9 +2287,8 @@ llvm::DIType *CGDebugInfo::CreateType(co
> }
> 
> llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
> -  // Ignore the atomic wrapping
> -  // FIXME: What is the correct representation?
> -  return getOrCreateType(Ty->getValueType(), U);
> +  auto *FromTy = getOrCreateType(Ty->getValueType(), U);
> +  return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy);
> }
> 
> llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty,
> 
> Added: cfe/trunk/test/CodeGen/debug-info-atomic.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-atomic.c?rev=285625&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGen/debug-info-atomic.c (added)
> +++ cfe/trunk/test/CodeGen/debug-info-atomic.c Mon Oct 31 14:09:47 2016
> @@ -0,0 +1,7 @@
> +// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
> +
> +// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true)
> +// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6)
> +// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7)
> +// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)

Please use FileCheck variables like ![[TYPE:[0-9]+]] instead of hardcoding the numbers. This is bound to break soon otherwise.

-- adrian

> +_Atomic const int i;
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list