Why are you committing while all the builds are broken? This isn't right. Eli
On Fri, Jun 20, 2014 at 5:43 AM, Oliver Stannard <[email protected]> wrote: > Author: olista01 > Date: Fri Jun 20 07:43:07 2014 > New Revision: 211354 > > URL: http://llvm.org/viewvc/llvm-project?rev=211354&view=rev > Log: > Add module flags metadata to record the settings for enum and wchar width > > Add module flags metadata to record the settings for enum and wchar width, > to allow correct ARM build attribute generation > > > Added: > cfe/trunk/test/CodeGen/arm-metadata.c > Modified: > cfe/trunk/lib/CodeGen/CodeGenModule.cpp > > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=211354&r1=211353&r2=211354&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Jun 20 07:43:07 2014 > @@ -352,6 +352,23 @@ void CodeGenModule::Release() { > getModule().addModuleFlag(llvm::Module::Warning, "Debug Info Version", > llvm::DEBUG_METADATA_VERSION); > > + // We need to record the widths of enums and wchar_t, so that we can > generate > + // the correct build attributes in the ARM backend. > + llvm::Triple::ArchType Arch = > Context.getTargetInfo().getTriple().getArch(); > + if ( Arch == llvm::Triple::arm > + || Arch == llvm::Triple::armeb > + || Arch == llvm::Triple::thumb > + || Arch == llvm::Triple::thumbeb) { > + // Width of wchar_t in bytes > + uint64_t WCharWidth = > + > Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity(); > + getModule().addModuleFlag(llvm::Module::Error, "wchar_size", > WCharWidth); > + > + // The minimum width of an enum in bytes > + uint64_t EnumWidth = Context.getLangOpts().ShortEnums ? 1 : 4; > + getModule().addModuleFlag(llvm::Module::Error, "min_enum_size", > EnumWidth); > + } > + > SimplifyPersonality(); > > if (getCodeGenOpts().EmitDeclMetadata) > > Added: cfe/trunk/test/CodeGen/arm-metadata.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-metadata.c?rev=211354&view=auto > > ============================================================================== > --- cfe/trunk/test/CodeGen/arm-metadata.c (added) > +++ cfe/trunk/test/CodeGen/arm-metadata.c Fri Jun 20 07:43:07 2014 > @@ -0,0 +1,13 @@ > +// REQUIRES: arm-registered-target > +// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s | > FileCheck -check-prefix=DEFAULT %s > +// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s > -fshort-enums | FileCheck -check-prefix=SHORT-ENUM %s > +// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s > -fshort-wchar | FileCheck -check-prefix=SHORT-WCHAR %s > + > +// DEFAULT: !{{[0-9]+}} = metadata !{i32 1, metadata !"wchar_size", i32 > 4} > +// DEFAULT: !{{[0-9]+}} = metadata !{i32 1, metadata !"min_enum_size", > i32 4} > + > +// SHORT-WCHAR: !{{[0-9]+}} = metadata !{i32 1, metadata !"wchar_size", > i32 2} > +// SHORT-WCHAR: !{{[0-9]+}} = metadata !{i32 1, metadata > !"min_enum_size", i32 4} > + > +// SHORT_ENUM: !{{[0-9]+}} = metadata !{i32 1, metadata !"wchar_size", > i32 4} > +// SHORT-ENUM: !{{[0-9]+}} = metadata !{i32 1, metadata > !"min_enum_size", i32 1} > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
