]> granicus.if.org Git - clang/commitdiff
-fcatch-undefined-behavior: store the type name directly at the end of a type descrip...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 9 Oct 2012 23:55:19 +0000 (23:55 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 9 Oct 2012 23:55:19 +0000 (23:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165572 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index 3f15692e035995756848e8139717bb53e26520f8..8b169410ce498a7e2cf4cbca6e56fd80995697f4 100644 (file)
@@ -1941,11 +1941,11 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
 /// format of a type descriptor is
 ///
 /// \code
-///   { i8* Name, i16 TypeKind, i16 TypeInfo }
+///   { i16 TypeKind, i16 TypeInfo }
 /// \endcode
 ///
-/// where TypeKind is 0 for an integer, 1 for a floating point value, and -1 for
-/// anything else.
+/// followed by an array of i8 containing the type name. TypeKind is 0 for an
+/// integer, 1 for a floating point value, and -1 for anything else.
 llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
   // FIXME: Only emit each type's descriptor once.
   uint16_t TypeKind = -1;
@@ -1969,8 +1969,8 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
                                     ArrayRef<intptr_t>());
 
   llvm::Constant *Components[] = {
-    cast<llvm::Constant>(Builder.CreateGlobalStringPtr(Buffer)),
-    Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo)
+    Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo),
+    llvm::ConstantDataArray::getString(getLLVMContext(), Buffer)
   };
   llvm::Constant *Descriptor = llvm::ConstantStruct::getAnon(Components);