From: Richard Smith Date: Tue, 9 Oct 2012 23:55:19 +0000 (+0000) Subject: -fcatch-undefined-behavior: store the type name directly at the end of a type descrip... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc47bdc43c62bf2ff01bc71c811a66cb5376d318;p=clang -fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165572 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3f15692e03..8b169410ce 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -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()); llvm::Constant *Components[] = { - cast(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);