vleschuk created this revision.
vleschuk added reviewers: mehdi_amini, echristo, dblaikie, aprantl.
vleschuk added a subscriber: cfe-commits.

Mark C11 _Atomic variables with DW_TAG_atomic_type tag.

This is the simplest way to achieve the goal: modifying Qualifiers results in 
much more changes and putting emission of tag into CreateQualifiedType() along 
with DW_TAG_const_type and friends seems more logic but requires way more 
changes and could break something else (my first attempt to add atomic to 
qualifiers resulted in lots of failures in OpenCL tests for some reason).


https://reviews.llvm.org/D26145

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGen/debug-info-atomic.c


Index: test/CodeGen/debug-info-atomic.c
===================================================================
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,5 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 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,


Index: test/CodeGen/debug-info-atomic.c
===================================================================
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,5 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 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,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to