summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
-rw-r--r--clang/test/CodeGen/debug-info-atomic.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 6a6b83e3314..c1396bde4ac 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@ llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
}
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,
diff --git a/clang/test/CodeGen/debug-info-atomic.c b/clang/test/CodeGen/debug-info-atomic.c
new file mode 100644
index 00000000000..06b9546908c
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-atomic.c
@@ -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)
+_Atomic const int i;
OpenPOWER on IntegriCloud