Index: cfe/trunk/include/clang/Basic/TargetInfo.h =================================================================== --- cfe/trunk/include/clang/Basic/TargetInfo.h +++ cfe/trunk/include/clang/Basic/TargetInfo.h @@ -21,13 +21,14 @@ #include "clang/Basic/TargetCXXABI.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/VersionTuple.h" -#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/APInt.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" +#include "llvm/IR/DataLayout.h" #include "llvm/Support/DataTypes.h" #include #include @@ -74,8 +75,7 @@ unsigned short MaxVectorAlign; unsigned short MaxTLSAlign; unsigned short SimdDefaultAlign; - const char *DataLayoutString; - const char *UserLabelPrefix; + std::unique_ptr DataLayout; const char *MCountName; const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, *LongDoubleFormat; @@ -95,6 +95,10 @@ // TargetInfo Constructor. Default initializes all fields. TargetInfo(const llvm::Triple &T); + void resetDataLayout(StringRef DL) { + DataLayout.reset(new llvm::DataLayout(DL)); + } + public: /// \brief Construct a target for the given options. /// @@ -426,14 +430,6 @@ return PointerWidth; } - /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro, - /// which is the prefix given to user symbols by default. - /// - /// On most platforms this is "_", but it is "" on some, and "." on others. - const char *getUserLabelPrefix() const { - return UserLabelPrefix; - } - /// \brief Returns the name of the mcount instrumentation function. const char *getMCountName() const { return MCountName; @@ -721,9 +717,9 @@ return Triple; } - const char *getDataLayoutString() const { - assert(DataLayoutString && "Uninitialized DataLayoutString!"); - return DataLayoutString; + const llvm::DataLayout &getDataLayout() const { + assert(DataLayout && "Uninitialized DataLayout!"); + return *DataLayout; } struct GCCRegAlias { Index: cfe/trunk/include/clang/CodeGen/BackendUtil.h =================================================================== --- cfe/trunk/include/clang/CodeGen/BackendUtil.h +++ cfe/trunk/include/clang/CodeGen/BackendUtil.h @@ -35,8 +35,8 @@ void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, const LangOptions &LOpts, - StringRef TDesc, llvm::Module *M, BackendAction Action, - raw_pwrite_stream *OS); + const llvm::DataLayout &TDesc, llvm::Module *M, + BackendAction Action, raw_pwrite_stream *OS); } #endif Index: cfe/trunk/lib/AST/Mangle.cpp =================================================================== --- cfe/trunk/lib/AST/Mangle.cpp +++ cfe/trunk/lib/AST/Mangle.cpp @@ -126,9 +126,9 @@ // llvm mangler on ELF is a nop, so we can just avoid adding the \01 // marker. We also avoid adding the marker if this is an alias for an // LLVM intrinsic. - StringRef UserLabelPrefix = - getASTContext().getTargetInfo().getUserLabelPrefix(); - if (!UserLabelPrefix.empty() && !ALA->getLabel().startswith("llvm.")) + char GlobalPrefix = + getASTContext().getTargetInfo().getDataLayout().getGlobalPrefix(); + if (GlobalPrefix && !ALA->getLabel().startswith("llvm.")) Out << '\01'; // LLVM IR Marker for __asm("foo") Out << ALA->getLabel(); Index: cfe/trunk/lib/Basic/TargetInfo.cpp =================================================================== --- cfe/trunk/lib/Basic/TargetInfo.cpp +++ cfe/trunk/lib/Basic/TargetInfo.cpp @@ -72,8 +72,6 @@ FloatFormat = &llvm::APFloat::IEEEsingle; DoubleFormat = &llvm::APFloat::IEEEdouble; LongDoubleFormat = &llvm::APFloat::IEEEdouble; - DataLayoutString = nullptr; - UserLabelPrefix = "_"; MCountName = "mcount"; RegParmMax = 0; SSERegParmMax = 0; Index: cfe/trunk/lib/Basic/Targets.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -102,9 +102,7 @@ public: CloudABITargetInfo(const llvm::Triple &Triple) - : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - } + : OSTargetInfo(Triple) {} }; static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, @@ -284,8 +282,6 @@ public: DragonFlyBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -327,8 +323,6 @@ } public: FreeBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -368,9 +362,7 @@ } public: KFreeBSDTargetInfo(const llvm::Triple &Triple) - : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - } + : OSTargetInfo(Triple) {} }; // Minix Target @@ -392,9 +384,7 @@ DefineStd(Builder, "unix", Opts); } public: - MinixTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - } + MinixTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) {} }; // Linux target @@ -422,7 +412,6 @@ } public: LinuxTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->WIntType = TargetInfo::UnsignedInt; switch (Triple.getArch()) { @@ -467,7 +456,6 @@ } public: NetBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->MCountName = "_mcount"; } }; @@ -488,7 +476,6 @@ } public: OpenBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->TLSSupported = false; switch (Triple.getArch()) { @@ -536,7 +523,6 @@ } public: BitrigTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->MCountName = "__mcount"; } }; @@ -554,9 +540,7 @@ Builder.defineMacro("__ELF__"); } public: - PSPTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - } + PSPTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) {} }; // PS3 PPU Target @@ -576,13 +560,12 @@ } public: PS3PPUTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->LongWidth = this->LongAlign = 32; this->PointerWidth = this->PointerAlign = 32; this->IntMaxType = TargetInfo::SignedLongLong; this->Int64Type = TargetInfo::SignedLongLong; this->SizeType = TargetInfo::UnsignedInt; - this->DataLayoutString = "E-m:e-p:32:32-i64:64-n32:64"; + this->resetDataLayout("E-m:e-p:32:32-i64:64-n32:64"); } }; @@ -604,7 +587,6 @@ // On PS4, TLS variable cannot be aligned to more than 32 bytes (256 bits). this->MaxTLSAlign = 256; - this->UserLabelPrefix = ""; // On PS4, do not honor explicit bit field alignment, // as in "__attribute__((aligned(2))) int b : 1;". @@ -647,7 +629,6 @@ } public: SolarisTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->WCharType = this->SignedInt; // FIXME: WIntType should be SignedLong } @@ -728,7 +709,6 @@ public: NaClTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; this->LongAlign = 32; this->LongWidth = 32; this->PointerAlign = 32; @@ -748,14 +728,14 @@ if (Triple.getArch() == llvm::Triple::arm) { // Handled in ARM's setABI(). } else if (Triple.getArch() == llvm::Triple::x86) { - this->DataLayoutString = "e-m:e-p:32:32-i64:64-n8:16:32-S128"; + this->resetDataLayout("e-m:e-p:32:32-i64:64-n8:16:32-S128"); } else if (Triple.getArch() == llvm::Triple::x86_64) { - this->DataLayoutString = "e-m:e-p:32:32-i64:64-n8:16:32:64-S128"; + this->resetDataLayout("e-m:e-p:32:32-i64:64-n8:16:32:64-S128"); } else if (Triple.getArch() == llvm::Triple::mipsel) { - // Handled on mips' setDataLayoutString. + // Handled on mips' setDataLayout. } else { assert(Triple.getArch() == llvm::Triple::le32); - this->DataLayoutString = "e-p:32:32-i64:64"; + this->resetDataLayout("e-p:32:32-i64:64"); } } }; @@ -782,7 +762,6 @@ explicit WebAssemblyOSTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { this->MCountName = "__mcount"; - this->UserLabelPrefix = ""; this->TheCXXABI.set(TargetCXXABI::WebAssembly); } }; @@ -1495,7 +1474,7 @@ class PPC32TargetInfo : public PPCTargetInfo { public: PPC32TargetInfo(const llvm::Triple &Triple) : PPCTargetInfo(Triple) { - DataLayoutString = "E-m:e-p:32:32-i64:64-n32"; + resetDataLayout("E-m:e-p:32:32-i64:64-n32"); switch (getTriple().getOS()) { case llvm::Triple::Linux: @@ -1534,10 +1513,10 @@ Int64Type = SignedLong; if ((Triple.getArch() == llvm::Triple::ppc64le)) { - DataLayoutString = "e-m:e-i64:64-n32:64"; + resetDataLayout("e-m:e-i64:64-n32:64"); ABI = "elfv2"; } else { - DataLayoutString = "E-m:e-i64:64-n32:64"; + resetDataLayout("E-m:e-i64:64-n32:64"); ABI = "elfv1"; } @@ -1580,7 +1559,7 @@ PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726 LongLongAlign = 32; SuitableAlign = 128; - DataLayoutString = "E-m:o-p:32:32-f64:32:64-n32"; + resetDataLayout("E-m:o-p:32:32-f64:32:64-n32"); } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::CharPtrBuiltinVaList; @@ -1594,7 +1573,7 @@ : DarwinTargetInfo(Triple) { HasAlignMac68kSupport = true; SuitableAlign = 128; - DataLayoutString = "E-m:o-i64:64-n32:64"; + resetDataLayout("E-m:o-i64:64-n32:64"); } }; @@ -1736,7 +1715,7 @@ SizeType = TargetInfo::UnsignedInt; PtrDiffType = TargetInfo::SignedInt; IntPtrType = TargetInfo::SignedInt; - DataLayoutString = "e-p:32:32-i64:64-v16:16-v32:32-n16:32:64"; + resetDataLayout("e-p:32:32-i64:64-v16:16-v32:32-n16:32:64"); } }; @@ -1747,7 +1726,7 @@ SizeType = TargetInfo::UnsignedLong; PtrDiffType = TargetInfo::SignedLong; IntPtrType = TargetInfo::SignedLong; - DataLayoutString = "e-i64:64-v16:16-v32:32-n16:32:64"; + resetDataLayout("e-i64:64-v16:16-v32:32-n16:32:64"); } }; @@ -1806,13 +1785,13 @@ : TargetInfo(Triple) { if (Triple.getArch() == llvm::Triple::amdgcn) { - DataLayoutString = DataLayoutStringSI; + resetDataLayout(DataLayoutStringSI); GPU = GK_SOUTHERN_ISLANDS; hasFP64 = true; hasFMAF = true; hasLDEXPF = true; } else { - DataLayoutString = DataLayoutStringR600; + resetDataLayout(DataLayoutStringR600); GPU = GK_R600; hasFP64 = false; hasFMAF = false; @@ -1946,7 +1925,7 @@ case GK_R700: case GK_EVERGREEN: case GK_NORTHERN_ISLANDS: - DataLayoutString = DataLayoutStringR600; + resetDataLayout(DataLayoutStringR600); hasFP64 = false; hasFMAF = false; hasLDEXPF = false; @@ -1955,7 +1934,7 @@ case GK_R700_DOUBLE_OPS: case GK_EVERGREEN_DOUBLE_OPS: case GK_CAYMAN: - DataLayoutString = DataLayoutStringR600DoubleOps; + resetDataLayout(DataLayoutStringR600DoubleOps); hasFP64 = true; hasFMAF = true; hasLDEXPF = false; @@ -1963,7 +1942,7 @@ case GK_SOUTHERN_ISLANDS: case GK_SEA_ISLANDS: case GK_VOLCANIC_ISLANDS: - DataLayoutString = DataLayoutStringSI; + resetDataLayout(DataLayoutStringSI); hasFP64 = true; hasFMAF = true; hasLDEXPF = true; @@ -3749,7 +3728,7 @@ LongDoubleWidth = 96; LongDoubleAlign = 32; SuitableAlign = 128; - DataLayoutString = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"; + resetDataLayout("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"); SizeType = UnsignedInt; PtrDiffType = SignedInt; IntPtrType = SignedInt; @@ -3846,7 +3825,7 @@ UseSignedCharForObjCBool = false; SizeType = UnsignedLong; IntPtrType = SignedLong; - DataLayoutString = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"; + resetDataLayout("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"); HasAlignMac68kSupport = true; } @@ -3871,9 +3850,9 @@ DoubleAlign = LongLongAlign = 64; bool IsWinCOFF = getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); - DataLayoutString = IsWinCOFF - ? "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" - : "e-m:e-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"; + resetDataLayout(IsWinCOFF + ? "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" + : "e-m:e-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -3952,7 +3931,7 @@ : X86_32TargetInfo(Triple) { WCharType = UnsignedShort; DoubleAlign = LongLongAlign = 64; - DataLayoutString = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"; + resetDataLayout("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -3975,7 +3954,6 @@ IntPtrType = SignedLong; PtrDiffType = SignedLong; ProcessIDType = SignedLong; - this->UserLabelPrefix = ""; this->TLSSupported = false; } void getTargetDefines(const LangOptions &Opts, @@ -3992,9 +3970,7 @@ MCUX86_32TargetInfo(const llvm::Triple &Triple) : X86_32TargetInfo(Triple) { LongDoubleWidth = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble; - DataLayoutString = - "e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32"; - UserLabelPrefix = ""; + resetDataLayout("e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32"); WIntType = UnsignedInt; } @@ -4029,8 +4005,6 @@ public: RTEMSTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { - this->UserLabelPrefix = ""; - switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -4057,7 +4031,6 @@ SizeType = UnsignedLong; IntPtrType = SignedLong; PtrDiffType = SignedLong; - this->UserLabelPrefix = ""; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -4088,10 +4061,10 @@ RegParmMax = 6; // Pointers are 32-bit in x32. - DataLayoutString = IsX32 ? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" - : IsWinCOFF - ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128" - : "e-m:e-i64:64-f80:128-n8:16:32:64-S128"; + resetDataLayout(IsX32 + ? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" + : IsWinCOFF ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128" + : "e-m:e-i64:64-f80:128-n8:16:32:64-S128"); // Use fpret only for long double. RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble); @@ -4168,7 +4141,6 @@ SizeType = UnsignedLongLong; PtrDiffType = SignedLongLong; IntPtrType = SignedLongLong; - this->UserLabelPrefix = ""; } void getTargetDefines(const LangOptions &Opts, @@ -4246,7 +4218,6 @@ : X86_64TargetInfo(Triple) { TLSSupported = false; WCharType = UnsignedShort; - UserLabelPrefix = ""; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -4274,7 +4245,7 @@ llvm::Triple T = llvm::Triple(Triple); if (T.isiOS()) UseSignedCharForObjCBool = false; - DataLayoutString = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"; + resetDataLayout("e-m:o-i64:64-f80:128-n8:16:32:64-S128"); } bool handleTargetFeatures(std::vector &Features, @@ -4413,26 +4384,26 @@ // Thumb1 add sp, #imm requires the immediate value be multiple of 4, // so set preferred for small types to 32. if (T.isOSBinFormatMachO()) { - DataLayoutString = - BigEndian ? "E-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" - : "e-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"; + resetDataLayout(BigEndian + ? "E-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" + : "e-m:o-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"); } else if (T.isOSWindows()) { assert(!BigEndian && "Windows on ARM does not support big endian"); - DataLayoutString = "e" - "-m:w" - "-p:32:32" - "-i64:64" - "-v128:64:128" - "-a:0:32" - "-n32" - "-S64"; + resetDataLayout("e" + "-m:w" + "-p:32:32" + "-i64:64" + "-v128:64:128" + "-a:0:32" + "-n32" + "-S64"); } else if (T.isOSNaCl()) { assert(!BigEndian && "NaCl on ARM does not support big endian"); - DataLayoutString = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S128"; + resetDataLayout("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S128"); } else { - DataLayoutString = - BigEndian ? "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" - : "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"; + resetDataLayout(BigEndian + ? "E-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" + : "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"); } // FIXME: Enumerated types are variable width in straight AAPCS. @@ -4468,17 +4439,17 @@ if (T.isOSBinFormatMachO() && IsAAPCS16) { assert(!BigEndian && "AAPCS16 does not support big-endian"); - DataLayoutString = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128"; + resetDataLayout("e-m:o-p:32:32-i64:64-a:0:32-n32-S128"); } else if (T.isOSBinFormatMachO()) - DataLayoutString = + resetDataLayout( BigEndian ? "E-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" - : "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"; + : "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"); else - DataLayoutString = + resetDataLayout( BigEndian ? "E-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" - : "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"; + : "e-m:e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"); // FIXME: Override "preferred align" for double and long long. } @@ -5243,7 +5214,6 @@ : WindowsTargetInfo(Triple), Triple(Triple) { WCharType = UnsignedShort; SizeType = UnsignedInt; - UserLabelPrefix = ""; } void getVisualStudioDefines(const LangOptions &Opts, MacroBuilder &Builder) const { @@ -5339,7 +5309,7 @@ TLSSupported = false; WCharType = UnsignedShort; DoubleAlign = LongLongAlign = 64; - DataLayoutString = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"; + resetDataLayout("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -5386,7 +5356,7 @@ }; class AArch64TargetInfo : public TargetInfo { - virtual void setDataLayoutString() = 0; + virtual void setDataLayout() = 0; static const TargetInfo::GCCRegAlias GCCRegAliases[]; static const char *const GCCRegNames[]; @@ -5567,7 +5537,7 @@ V8_1A = 1; } - setDataLayoutString(); + setDataLayout(); return true; } @@ -5727,11 +5697,11 @@ }; class AArch64leTargetInfo : public AArch64TargetInfo { - void setDataLayoutString() override { + void setDataLayout() override { if (getTriple().isOSBinFormatMachO()) - DataLayoutString = "e-m:o-i64:64-i128:128-n32:64-S128"; + resetDataLayout("e-m:o-i64:64-i128:128-n32:64-S128"); else - DataLayoutString = "e-m:e-i64:64-i128:128-n32:64-S128"; + resetDataLayout("e-m:e-i64:64-i128:128-n32:64-S128"); } public: @@ -5747,9 +5717,9 @@ }; class AArch64beTargetInfo : public AArch64TargetInfo { - void setDataLayoutString() override { + void setDataLayout() override { assert(!getTriple().isOSBinFormatMachO()); - DataLayoutString = "E-m:e-i64:64-i128:128-n32:64-S128"; + resetDataLayout("E-m:e-i64:64-i128:128-n32:64-S128"); } public: @@ -5811,9 +5781,9 @@ // Specify the vector alignment explicitly. For v512x1, the calculated // alignment would be 512*alignment(i1), which is 512 bytes, instead of // the required minimum of 64 bytes. - DataLayoutString = "e-m:e-p:32:32:32-a:0-n16:32-" + resetDataLayout("e-m:e-p:32:32:32-a:0-n16:32-" "i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-" - "v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"; + "v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"); SizeType = UnsignedInt; PtrDiffType = SignedInt; IntPtrType = SignedInt; @@ -6168,7 +6138,7 @@ class SparcV8TargetInfo : public SparcTargetInfo { public: SparcV8TargetInfo(const llvm::Triple &Triple) : SparcTargetInfo(Triple) { - DataLayoutString = "E-m:e-p:32:32-i64:64-f128:64-n32-S64"; + resetDataLayout("E-m:e-p:32:32-i64:64-f128:64-n32-S64"); // NetBSD / OpenBSD use long (same as llvm default); everyone else uses int. switch (getTriple().getOS()) { default: @@ -6209,7 +6179,7 @@ class SparcV8elTargetInfo : public SparcV8TargetInfo { public: SparcV8elTargetInfo(const llvm::Triple &Triple) : SparcV8TargetInfo(Triple) { - DataLayoutString = "e-m:e-p:32:32-i64:64-f128:64-n32-S64"; + resetDataLayout("e-m:e-p:32:32-i64:64-f128:64-n32-S64"); BigEndian = false; } }; @@ -6219,7 +6189,7 @@ public: SparcV9TargetInfo(const llvm::Triple &Triple) : SparcTargetInfo(Triple) { // FIXME: Support Sparc quad-precision long double? - DataLayoutString = "E-m:e-i64:64-n32:64-S128"; + resetDataLayout("E-m:e-i64:64-n32:64-S128"); // This is an LP64 platform. LongWidth = LongAlign = PointerWidth = PointerAlign = 64; @@ -6280,7 +6250,7 @@ LongDoubleFormat = &llvm::APFloat::IEEEquad; DefaultAlignForAttributeAligned = 64; MinGlobalAlign = 16; - DataLayoutString = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"; + resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"); MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; } void getTargetDefines(const LangOptions &Opts, @@ -6355,8 +6325,8 @@ // If we use the vector ABI, vector types are 64-bit aligned. if (HasVector) { MaxVectorAlign = 64; - DataLayoutString = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64" - "-v128:64-a:8:16-n32:64"; + resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64" + "-v128:64-a:8:16-n32:64"); } return true; } @@ -6446,7 +6416,7 @@ IntPtrType = SignedInt; PtrDiffType = SignedInt; SigAtomicType = SignedLong; - DataLayoutString = "e-m:e-p:16:16-i32:16:32-a:16-n8:16"; + resetDataLayout("e-m:e-p:16:16-i32:16:32-a:16-n8:16"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -6539,8 +6509,8 @@ FloatFormat = &llvm::APFloat::IEEEsingle; DoubleFormat = &llvm::APFloat::IEEEsingle; LongDoubleFormat = &llvm::APFloat::IEEEsingle; - DataLayoutString = "E-p:32:32-i8:8:32-i16:16:32-i64:32" - "-f64:32-v64:32-v128:32-a:0:32-n32"; + resetDataLayout("E-p:32:32-i8:8:32-i16:16:32-i64:32" + "-f64:32-v64:32-v128:32-a:0:32-n32"); AddrSpaceMap = &TCEOpenCLAddrSpaceMap; UseAddrSpaceMapMangling = true; } @@ -6580,10 +6550,10 @@ RegParmMax = 5; if (Triple.getArch() == llvm::Triple::bpfeb) { BigEndian = true; - DataLayoutString = "E-m:e-p:64:64-i64:64-n32:64-S128"; + resetDataLayout("E-m:e-p:64:64-i64:64-n32:64-S128"); } else { BigEndian = false; - DataLayoutString = "e-m:e-p:64:64-i64:64-n32:64-S128"; + resetDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128"); } MaxAtomicPromoteWidth = 64; MaxAtomicInlineWidth = 64; @@ -6618,7 +6588,7 @@ }; class MipsTargetInfoBase : public TargetInfo { - virtual void setDataLayoutString() = 0; + virtual void setDataLayout() = 0; static const Builtin::Info BuiltinInfo[]; std::string CPU; @@ -6914,7 +6884,7 @@ IsNan2008 = false; } - setDataLayoutString(); + setDataLayout(); return true; } @@ -7021,8 +6991,8 @@ }; class Mips32EBTargetInfo : public Mips32TargetInfoBase { - void setDataLayoutString() override { - DataLayoutString = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"; + void setDataLayout() override { + resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); } public: @@ -7038,8 +7008,8 @@ }; class Mips32ELTargetInfo : public Mips32TargetInfoBase { - void setDataLayoutString() override { - DataLayoutString = "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"; + void setDataLayout() override { + resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); } public: @@ -7179,12 +7149,11 @@ }; class Mips64EBTargetInfo : public Mips64TargetInfoBase { - void setDataLayoutString() override { + void setDataLayout() override { if (ABI == "n32") - DataLayoutString = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"; + resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else - DataLayoutString = "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"; - + resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); } public: @@ -7199,11 +7168,11 @@ }; class Mips64ELTargetInfo : public Mips64TargetInfoBase { - void setDataLayoutString() override { + void setDataLayout() override { if (ABI == "n32") - DataLayoutString = "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"; + resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else - DataLayoutString = "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"; + resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); } public: Mips64ELTargetInfo(const llvm::Triple &Triple) @@ -7223,7 +7192,6 @@ public: PNaClTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) { BigEndian = false; - this->UserLabelPrefix = ""; this->LongAlign = 32; this->LongWidth = 32; this->PointerAlign = 32; @@ -7295,7 +7263,7 @@ NoAsmVariants = true; LongWidth = LongAlign = PointerWidth = PointerAlign = 64; MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; - DataLayoutString = "e-m:e-v128:32-v16:16-v32:32-v96:32-n8:16:32:64-S128"; + resetDataLayout("e-m:e-v128:32-v16:16-v32:32-v96:32-n8:16:32:64-S128"); } void getTargetDefines(const LangOptions &Opts, @@ -7444,7 +7412,7 @@ explicit WebAssembly32TargetInfo(const llvm::Triple &T) : WebAssemblyTargetInfo(T) { MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; - DataLayoutString = "e-m:e-p:32:32-i64:64-n32:64-S128"; + resetDataLayout("e-m:e-p:32:32-i64:64-n32:64-S128"); } protected: @@ -7462,7 +7430,7 @@ LongAlign = LongWidth = 64; PointerAlign = PointerWidth = 64; MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; - DataLayoutString = "e-m:e-p:64:64-i64:64-n32:64-S128"; + resetDataLayout("e-m:e-p:64:64-i64:64-n32:64-S128"); } protected: @@ -7542,8 +7510,8 @@ PointerWidth = PointerAlign = 32; SizeType = TargetInfo::UnsignedInt; PtrDiffType = IntPtrType = TargetInfo::SignedInt; - DataLayoutString = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" - "v96:128-v192:256-v256:256-v512:512-v1024:1024"; + resetDataLayout("e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" + "v96:128-v192:256-v256:256-v512:512-v1024:1024"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -7557,8 +7525,8 @@ PointerWidth = PointerAlign = 64; SizeType = TargetInfo::UnsignedLong; PtrDiffType = IntPtrType = TargetInfo::SignedLong; - DataLayoutString = "e-i64:64-v16:16-v24:32-v32:32-v48:64-" - "v96:128-v192:256-v256:256-v512:512-v1024:1024"; + resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-" + "v96:128-v192:256-v256:256-v512:512-v1024:1024"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -7581,8 +7549,8 @@ WCharType = UnsignedChar; WIntType = UnsignedInt; UseZeroLengthBitfieldAlignment = true; - DataLayoutString = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32" - "-f64:32-a:0:32-n32"; + resetDataLayout("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32" + "-f64:32-a:0:32-n32"); } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp =================================================================== --- cfe/trunk/lib/CodeGen/BackendUtil.cpp +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp @@ -710,22 +710,22 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts, const clang::TargetOptions &TOpts, - const LangOptions &LOpts, StringRef TDesc, + const LangOptions &LOpts, const llvm::DataLayout &TDesc, Module *M, BackendAction Action, raw_pwrite_stream *OS) { EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M); AsmHelper.EmitAssembly(Action, OS); - // If an optional clang TargetInfo description string was passed in, use it to - // verify the LLVM TargetMachine's DataLayout. - if (AsmHelper.TM && !TDesc.empty()) { + // Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's + // DataLayout. + if (AsmHelper.TM) { std::string DLDesc = M->getDataLayout().getStringRepresentation(); - if (DLDesc != TDesc) { + if (DLDesc != TDesc.getStringRepresentation()) { unsigned DiagID = Diags.getCustomDiagID( DiagnosticsEngine::Error, "backend data layout '%0' does not match " "expected target description '%1'"); - Diags.Report(DiagID) << DLDesc << TDesc; + Diags.Report(DiagID) << DLDesc << TDesc.getStringRepresentation(); } } } Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenAction.cpp +++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp @@ -174,7 +174,7 @@ } EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts, - C.getTargetInfo().getDataLayoutString(), + C.getTargetInfo().getDataLayout(), getModule(), Action, AsmOutStream); Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext); @@ -813,7 +813,7 @@ LLVMContext &Ctx = TheModule->getContext(); Ctx.setInlineAsmDiagnosticHandler(BitcodeInlineAsmDiagHandler); EmitBackendOutput(CI.getDiagnostics(), CI.getCodeGenOpts(), TargetOpts, - CI.getLangOpts(), CI.getTarget().getDataLayoutString(), + CI.getLangOpts(), CI.getTarget().getDataLayout(), TheModule.get(), BA, OS); return; } Index: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp =================================================================== --- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp +++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp @@ -98,7 +98,7 @@ Ctx = &Context; M->setTargetTriple(Ctx->getTargetInfo().getTriple().getTriple()); - M->setDataLayout(Ctx->getTargetInfo().getDataLayoutString()); + M->setDataLayout(Ctx->getTargetInfo().getDataLayout()); Builder.reset(new CodeGen::CodeGenModule(Context, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags, CoverageInfo)); Index: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp =================================================================== --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -162,7 +162,7 @@ Ctx = &Context; VMContext.reset(new llvm::LLVMContext()); M.reset(new llvm::Module(MainFileName, *VMContext)); - M->setDataLayout(Ctx->getTargetInfo().getDataLayoutString()); + M->setDataLayout(Ctx->getTargetInfo().getDataLayout()); Builder.reset(new CodeGen::CodeGenModule( *Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags)); @@ -226,7 +226,7 @@ return; M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple()); - M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString()); + M->setDataLayout(Ctx.getTargetInfo().getDataLayout()); // PCH files don't have a signature field in the control block, // but LLVM detects DWO CUs by looking for a non-zero DWO id. @@ -272,15 +272,15 @@ llvm::SmallString<0> Buffer; llvm::raw_svector_ostream OS(Buffer); clang::EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts, - Ctx.getTargetInfo().getDataLayoutString(), - M.get(), BackendAction::Backend_EmitLL, &OS); + Ctx.getTargetInfo().getDataLayout(), M.get(), + BackendAction::Backend_EmitLL, &OS); llvm::dbgs() << Buffer; }); // Use the LLVM backend to emit the pch container. clang::EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts, - Ctx.getTargetInfo().getDataLayoutString(), - M.get(), BackendAction::Backend_EmitObj, OS); + Ctx.getTargetInfo().getDataLayout(), M.get(), + BackendAction::Backend_EmitObj, OS); // Make sure the pch container hits disk. OS->flush(); Index: cfe/trunk/lib/Frontend/InitPreprocessor.cpp =================================================================== --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp @@ -793,8 +793,8 @@ DefineFastIntType(64, true, TI, Builder); DefineFastIntType(64, false, TI, Builder); - if (const char *Prefix = TI.getUserLabelPrefix()) - Builder.defineMacro("__USER_LABEL_PREFIX__", Prefix); + char UserLabelPrefix[2] = {TI.getDataLayout().getGlobalPrefix(), 0}; + Builder.defineMacro("__USER_LABEL_PREFIX__", UserLabelPrefix); if (LangOpts.FastMath || LangOpts.FiniteMathOnly) Builder.defineMacro("__FINITE_MATH_ONLY__", "1"); Index: cfe/trunk/lib/Index/CodegenNameGenerator.cpp =================================================================== --- cfe/trunk/lib/Index/CodegenNameGenerator.cpp +++ cfe/trunk/lib/Index/CodegenNameGenerator.cpp @@ -31,7 +31,7 @@ Implementation(ASTContext &Ctx) : MC(Ctx.createMangleContext()), - DL(Ctx.getTargetInfo().getDataLayoutString()) {} + DL(Ctx.getTargetInfo().getDataLayout()) {} bool writeName(const Decl *D, raw_ostream &OS) { // First apply frontend mangling. @@ -76,8 +76,6 @@ ASTContext &Ctx = ND->getASTContext(); std::unique_ptr M(Ctx.createMangleContext()); - std::unique_ptr DL( - new llvm::DataLayout(Ctx.getTargetInfo().getDataLayoutString())); std::vector Manglings; Index: cfe/trunk/test/Preprocessor/init.c =================================================================== --- cfe/trunk/test/Preprocessor/init.c +++ cfe/trunk/test/Preprocessor/init.c @@ -423,7 +423,7 @@ // AARCH64:#define __UINT_LEAST64_TYPE__ long unsigned int // AARCH64:#define __UINT_LEAST8_MAX__ 255 // AARCH64:#define __UINT_LEAST8_TYPE__ unsigned char -// AARCH64:#define __USER_LABEL_PREFIX__ _ +// AARCH64:#define __USER_LABEL_PREFIX__ // AARCH64:#define __WCHAR_MAX__ 4294967295U // AARCH64:#define __WCHAR_TYPE__ unsigned int // AARCH64:#define __WCHAR_UNSIGNED__ 1 @@ -614,7 +614,7 @@ // AARCH64-BE:#define __UINT_LEAST64_TYPE__ long unsigned int // AARCH64-BE:#define __UINT_LEAST8_MAX__ 255 // AARCH64-BE:#define __UINT_LEAST8_TYPE__ unsigned char -// AARCH64-BE:#define __USER_LABEL_PREFIX__ _ +// AARCH64-BE:#define __USER_LABEL_PREFIX__ // AARCH64-BE:#define __WCHAR_MAX__ 4294967295U // AARCH64-BE:#define __WCHAR_TYPE__ unsigned int // AARCH64-BE:#define __WCHAR_UNSIGNED__ 1 @@ -1381,7 +1381,7 @@ // ARM:#define __UINT_LEAST64_TYPE__ long long unsigned int // ARM:#define __UINT_LEAST8_MAX__ 255 // ARM:#define __UINT_LEAST8_TYPE__ unsigned char -// ARM:#define __USER_LABEL_PREFIX__ _ +// ARM:#define __USER_LABEL_PREFIX__ // ARM:#define __WCHAR_MAX__ 4294967295U // ARM:#define __WCHAR_TYPE__ unsigned int // ARM:#define __WCHAR_WIDTH__ 32 @@ -1571,7 +1571,7 @@ // ARM-BE:#define __UINT_LEAST64_TYPE__ long long unsigned int // ARM-BE:#define __UINT_LEAST8_MAX__ 255 // ARM-BE:#define __UINT_LEAST8_TYPE__ unsigned char -// ARM-BE:#define __USER_LABEL_PREFIX__ _ +// ARM-BE:#define __USER_LABEL_PREFIX__ // ARM-BE:#define __WCHAR_MAX__ 4294967295U // ARM-BE:#define __WCHAR_TYPE__ unsigned int // ARM-BE:#define __WCHAR_WIDTH__ 32 @@ -2407,7 +2407,7 @@ // I386:#define __UINT_LEAST64_TYPE__ long long unsigned int // I386:#define __UINT_LEAST8_MAX__ 255 // I386:#define __UINT_LEAST8_TYPE__ unsigned char -// I386:#define __USER_LABEL_PREFIX__ _ +// I386:#define __USER_LABEL_PREFIX__ // I386:#define __WCHAR_MAX__ 2147483647 // I386:#define __WCHAR_TYPE__ int // I386:#define __WCHAR_WIDTH__ 32 @@ -2998,7 +2998,7 @@ // MIPS32BE:#define __UINT_LEAST64_TYPE__ long long unsigned int // MIPS32BE:#define __UINT_LEAST8_MAX__ 255 // MIPS32BE:#define __UINT_LEAST8_TYPE__ unsigned char -// MIPS32BE:#define __USER_LABEL_PREFIX__ _ +// MIPS32BE:#define __USER_LABEL_PREFIX__ // MIPS32BE:#define __WCHAR_MAX__ 2147483647 // MIPS32BE:#define __WCHAR_TYPE__ int // MIPS32BE:#define __WCHAR_WIDTH__ 32 @@ -3204,7 +3204,7 @@ // MIPS32EL:#define __UINT_LEAST64_TYPE__ long long unsigned int // MIPS32EL:#define __UINT_LEAST8_MAX__ 255 // MIPS32EL:#define __UINT_LEAST8_TYPE__ unsigned char -// MIPS32EL:#define __USER_LABEL_PREFIX__ _ +// MIPS32EL:#define __USER_LABEL_PREFIX__ // MIPS32EL:#define __WCHAR_MAX__ 2147483647 // MIPS32EL:#define __WCHAR_TYPE__ int // MIPS32EL:#define __WCHAR_WIDTH__ 32 @@ -3507,7 +3507,7 @@ // MIPSN32BE: #define __UINT_LEAST8_FMTx__ "hhx" // MIPSN32BE: #define __UINT_LEAST8_MAX__ 255 // MIPSN32BE: #define __UINT_LEAST8_TYPE__ unsigned char -// MIPSN32BE: #define __USER_LABEL_PREFIX__ _ +// MIPSN32BE: #define __USER_LABEL_PREFIX__ // MIPSN32BE: #define __WCHAR_MAX__ 2147483647 // MIPSN32BE: #define __WCHAR_TYPE__ int // MIPSN32BE: #define __WCHAR_WIDTH__ 32 @@ -3813,7 +3813,7 @@ // MIPSN32EL: #define __UINT_LEAST8_FMTx__ "hhx" // MIPSN32EL: #define __UINT_LEAST8_MAX__ 255 // MIPSN32EL: #define __UINT_LEAST8_TYPE__ unsigned char -// MIPSN32EL: #define __USER_LABEL_PREFIX__ _ +// MIPSN32EL: #define __USER_LABEL_PREFIX__ // MIPSN32EL: #define __WCHAR_MAX__ 2147483647 // MIPSN32EL: #define __WCHAR_TYPE__ int // MIPSN32EL: #define __WCHAR_WIDTH__ 32 @@ -4023,7 +4023,7 @@ // MIPS64BE:#define __UINT_LEAST64_TYPE__ long unsigned int // MIPS64BE:#define __UINT_LEAST8_MAX__ 255 // MIPS64BE:#define __UINT_LEAST8_TYPE__ unsigned char -// MIPS64BE:#define __USER_LABEL_PREFIX__ _ +// MIPS64BE:#define __USER_LABEL_PREFIX__ // MIPS64BE:#define __WCHAR_MAX__ 2147483647 // MIPS64BE:#define __WCHAR_TYPE__ int // MIPS64BE:#define __WCHAR_WIDTH__ 32 @@ -4232,7 +4232,7 @@ // MIPS64EL:#define __UINT_LEAST64_TYPE__ long unsigned int // MIPS64EL:#define __UINT_LEAST8_MAX__ 255 // MIPS64EL:#define __UINT_LEAST8_TYPE__ unsigned char -// MIPS64EL:#define __USER_LABEL_PREFIX__ _ +// MIPS64EL:#define __USER_LABEL_PREFIX__ // MIPS64EL:#define __WCHAR_MAX__ 2147483647 // MIPS64EL:#define __WCHAR_TYPE__ int // MIPS64EL:#define __WCHAR_WIDTH__ 32 @@ -4652,7 +4652,7 @@ // MSP430:#define __UINT_LEAST64_TYPE__ long long unsigned int // MSP430:#define __UINT_LEAST8_MAX__ 255 // MSP430:#define __UINT_LEAST8_TYPE__ unsigned char -// MSP430:#define __USER_LABEL_PREFIX__ _ +// MSP430:#define __USER_LABEL_PREFIX__ // MSP430:#define __WCHAR_MAX__ 32767 // MSP430:#define __WCHAR_TYPE__ int // MSP430:#define __WCHAR_WIDTH__ 16 @@ -4840,7 +4840,7 @@ // NVPTX32:#define __UINT_LEAST64_TYPE__ long long unsigned int // NVPTX32:#define __UINT_LEAST8_MAX__ 255 // NVPTX32:#define __UINT_LEAST8_TYPE__ unsigned char -// NVPTX32:#define __USER_LABEL_PREFIX__ _ +// NVPTX32:#define __USER_LABEL_PREFIX__ // NVPTX32:#define __WCHAR_MAX__ 2147483647 // NVPTX32:#define __WCHAR_TYPE__ int // NVPTX32:#define __WCHAR_WIDTH__ 32 @@ -5027,7 +5027,7 @@ // NVPTX64:#define __UINT_LEAST64_TYPE__ long unsigned int // NVPTX64:#define __UINT_LEAST8_MAX__ 255 // NVPTX64:#define __UINT_LEAST8_TYPE__ unsigned char -// NVPTX64:#define __USER_LABEL_PREFIX__ _ +// NVPTX64:#define __USER_LABEL_PREFIX__ // NVPTX64:#define __WCHAR_MAX__ 2147483647 // NVPTX64:#define __WCHAR_TYPE__ int // NVPTX64:#define __WCHAR_WIDTH__ 32 @@ -5219,7 +5219,7 @@ // PPC603E:#define __UINT_LEAST64_TYPE__ long long unsigned int // PPC603E:#define __UINT_LEAST8_MAX__ 255 // PPC603E:#define __UINT_LEAST8_TYPE__ unsigned char -// PPC603E:#define __USER_LABEL_PREFIX__ _ +// PPC603E:#define __USER_LABEL_PREFIX__ // PPC603E:#define __WCHAR_MAX__ 2147483647 // PPC603E:#define __WCHAR_TYPE__ int // PPC603E:#define __WCHAR_WIDTH__ 32 @@ -5419,7 +5419,7 @@ // PPC64:#define __UINT_LEAST64_TYPE__ long unsigned int // PPC64:#define __UINT_LEAST8_MAX__ 255 // PPC64:#define __UINT_LEAST8_TYPE__ unsigned char -// PPC64:#define __USER_LABEL_PREFIX__ _ +// PPC64:#define __USER_LABEL_PREFIX__ // PPC64:#define __WCHAR_MAX__ 2147483647 // PPC64:#define __WCHAR_TYPE__ int // PPC64:#define __WCHAR_WIDTH__ 32 @@ -5622,7 +5622,7 @@ // PPC64LE:#define __UINT_LEAST64_TYPE__ long unsigned int // PPC64LE:#define __UINT_LEAST8_MAX__ 255 // PPC64LE:#define __UINT_LEAST8_TYPE__ unsigned char -// PPC64LE:#define __USER_LABEL_PREFIX__ _ +// PPC64LE:#define __USER_LABEL_PREFIX__ // PPC64LE:#define __WCHAR_MAX__ 2147483647 // PPC64LE:#define __WCHAR_TYPE__ int // PPC64LE:#define __WCHAR_WIDTH__ 32 @@ -6209,7 +6209,7 @@ // PPC:#define __UINT_LEAST64_TYPE__ long long unsigned int // PPC:#define __UINT_LEAST8_MAX__ 255 // PPC:#define __UINT_LEAST8_TYPE__ unsigned char -// PPC:#define __USER_LABEL_PREFIX__ _ +// PPC:#define __USER_LABEL_PREFIX__ // PPC:#define __WCHAR_MAX__ 2147483647 // PPC:#define __WCHAR_TYPE__ int // PPC:#define __WCHAR_WIDTH__ 32 @@ -6788,7 +6788,7 @@ // S390X:#define __UINT_LEAST64_TYPE__ long unsigned int // S390X:#define __UINT_LEAST8_MAX__ 255 // S390X:#define __UINT_LEAST8_TYPE__ unsigned char -// S390X:#define __USER_LABEL_PREFIX__ _ +// S390X:#define __USER_LABEL_PREFIX__ // S390X:#define __WCHAR_MAX__ 2147483647 // S390X:#define __WCHAR_TYPE__ int // S390X:#define __WCHAR_WIDTH__ 32 @@ -6797,7 +6797,10 @@ // S390X:#define __s390__ 1 // S390X:#define __s390x__ 1 // -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines -check-prefix SPARC %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-DEFAULT %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-rtems-elf < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-DEFAULT %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-netbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-NETOPENBSD %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC -check-prefix SPARC-NETOPENBSD %s // // SPARC-NOT:#define _LP64 // SPARC:#define __BIGGEST_ALIGNMENT__ 8 @@ -6861,10 +6864,14 @@ // SPARC:#define __INTMAX_MAX__ 9223372036854775807LL // SPARC:#define __INTMAX_TYPE__ long long int // SPARC:#define __INTMAX_WIDTH__ 64 -// SPARC:#define __INTPTR_FMTd__ "d" -// SPARC:#define __INTPTR_FMTi__ "i" -// SPARC:#define __INTPTR_MAX__ 2147483647 -// SPARC:#define __INTPTR_TYPE__ int +// SPARC-DEFAULT:#define __INTPTR_FMTd__ "d" +// SPARC-DEFAULT:#define __INTPTR_FMTi__ "i" +// SPARC-DEFAULT:#define __INTPTR_MAX__ 2147483647 +// SPARC-DEFAULT:#define __INTPTR_TYPE__ int +// SPARC-NETOPENBSD:#define __INTPTR_FMTd__ "ld" +// SPARC-NETOPENBSD:#define __INTPTR_FMTi__ "li" +// SPARC-NETOPENBSD:#define __INTPTR_MAX__ 2147483647L +// SPARC-NETOPENBSD:#define __INTPTR_TYPE__ long int // SPARC:#define __INTPTR_WIDTH__ 32 // SPARC:#define __INT_FAST16_FMTd__ "hd" // SPARC:#define __INT_FAST16_FMTi__ "hi" @@ -6916,7 +6923,8 @@ // SPARC:#define __LONG_MAX__ 2147483647L // SPARC-NOT:#define __LP64__ // SPARC:#define __POINTER_WIDTH__ 32 -// SPARC:#define __PTRDIFF_TYPE__ int +// SPARC-DEFAULT:#define __PTRDIFF_TYPE__ int +// SPARC-NETOPENBSD:#define __PTRDIFF_TYPE__ long int // SPARC:#define __PTRDIFF_WIDTH__ 32 // SPARC:#define __REGISTER_PREFIX__ // SPARC:#define __SCHAR_MAX__ 127 @@ -6935,8 +6943,10 @@ // SPARC:#define __SIZEOF_SIZE_T__ 4 // SPARC:#define __SIZEOF_WCHAR_T__ 4 // SPARC:#define __SIZEOF_WINT_T__ 4 -// SPARC:#define __SIZE_MAX__ 4294967295U -// SPARC:#define __SIZE_TYPE__ unsigned int +// SPARC-DEFAULT:#define __SIZE_MAX__ 4294967295U +// SPARC-DEFAULT:#define __SIZE_TYPE__ unsigned int +// SPARC-NETOPENBSD:#define __SIZE_MAX__ 4294967295UL +// SPARC-NETOPENBSD:#define __SIZE_TYPE__ long unsigned int // SPARC:#define __SIZE_WIDTH__ 32 // SPARC:#define __UINT16_C_SUFFIX__ // SPARC:#define __UINT16_MAX__ 65535 @@ -6954,8 +6964,10 @@ // SPARC:#define __UINTMAX_MAX__ 18446744073709551615ULL // SPARC:#define __UINTMAX_TYPE__ long long unsigned int // SPARC:#define __UINTMAX_WIDTH__ 64 -// SPARC:#define __UINTPTR_MAX__ 4294967295U -// SPARC:#define __UINTPTR_TYPE__ unsigned int +// SPARC-DEFAULT:#define __UINTPTR_MAX__ 4294967295U +// SPARC-DEFAULT:#define __UINTPTR_TYPE__ unsigned int +// SPARC-NETOPENBSD:#define __UINTPTR_MAX__ 4294967295UL +// SPARC-NETOPENBSD:#define __UINTPTR_TYPE__ long unsigned int // SPARC:#define __UINTPTR_WIDTH__ 32 // SPARC:#define __UINT_FAST16_MAX__ 65535 // SPARC:#define __UINT_FAST16_TYPE__ unsigned short @@ -6973,7 +6985,7 @@ // SPARC:#define __UINT_LEAST64_TYPE__ long long unsigned int // SPARC:#define __UINT_LEAST8_MAX__ 255 // SPARC:#define __UINT_LEAST8_TYPE__ unsigned char -// SPARC:#define __USER_LABEL_PREFIX__ _ +// SPARC:#define __USER_LABEL_PREFIX__ // SPARC:#define __VERSION__ "4.2.1 Compatible{{.*}} // SPARC:#define __WCHAR_MAX__ 2147483647 // SPARC:#define __WCHAR_TYPE__ int @@ -6984,16 +6996,6 @@ // SPARC:#define __sparc__ 1 // SPARC:#define __sparcv8 1 // SPARC:#define sparc 1 -// -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-netbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC-NETOPENBSD %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix SPARC-NETOPENBSD %s -// SPARC-NETOPENBSD:#define __INTPTR_FMTd__ "ld" -// SPARC-NETOPENBSD:#define __INTPTR_FMTi__ "li" -// SPARC-NETOPENBSD:#define __INTPTR_MAX__ 2147483647L -// SPARC-NETOPENBSD:#define __INTPTR_TYPE__ long int -// SPARC-NETOPENBSD:#define __PTRDIFF_TYPE__ long int -// SPARC-NETOPENBSD:#define __SIZE_TYPE__ long unsigned int -// SPARC-NETOPENBSD:#define __UINTPTR_TYPE__ long unsigned int // RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -match-full-lines -check-prefix TCE %s // @@ -7152,7 +7154,7 @@ // TCE:#define __UINT_LEAST32_TYPE__ unsigned int // TCE:#define __UINT_LEAST8_MAX__ 255 // TCE:#define __UINT_LEAST8_TYPE__ unsigned char -// TCE:#define __USER_LABEL_PREFIX__ _ +// TCE:#define __USER_LABEL_PREFIX__ // TCE:#define __WCHAR_MAX__ 2147483647 // TCE:#define __WCHAR_TYPE__ int // TCE:#define __WCHAR_WIDTH__ 32 @@ -7346,7 +7348,7 @@ // X86_64:#define __UINT_LEAST64_TYPE__ long unsigned int // X86_64:#define __UINT_LEAST8_MAX__ 255 // X86_64:#define __UINT_LEAST8_TYPE__ unsigned char -// X86_64:#define __USER_LABEL_PREFIX__ _ +// X86_64:#define __USER_LABEL_PREFIX__ // X86_64:#define __WCHAR_MAX__ 2147483647 // X86_64:#define __WCHAR_TYPE__ int // X86_64:#define __WCHAR_WIDTH__ 32 @@ -7548,7 +7550,7 @@ // X32:#define __UINT_LEAST64_TYPE__ long long unsigned int // X32:#define __UINT_LEAST8_MAX__ 255 // X32:#define __UINT_LEAST8_TYPE__ unsigned char -// X32:#define __USER_LABEL_PREFIX__ _ +// X32:#define __USER_LABEL_PREFIX__ // X32:#define __WCHAR_MAX__ 2147483647 // X32:#define __WCHAR_TYPE__ int // X32:#define __WCHAR_WIDTH__ 32 Index: cfe/trunk/unittests/Basic/SourceManagerTest.cpp =================================================================== --- cfe/trunk/unittests/Basic/SourceManagerTest.cpp +++ cfe/trunk/unittests/Basic/SourceManagerTest.cpp @@ -23,7 +23,6 @@ #include "llvm/Config/llvm-config.h" #include "gtest/gtest.h" -using namespace llvm; using namespace clang; namespace { @@ -73,7 +72,8 @@ const char *source = "#define M(x) [x]\n" "M(foo)"; - std::unique_ptr Buf = MemoryBuffer::getMemBuffer(source); + std::unique_ptr Buf = + llvm::MemoryBuffer::getMemBuffer(source); FileID mainFileID = SourceMgr.createFileID(std::move(Buf)); SourceMgr.setMainFileID(mainFileID); @@ -126,7 +126,8 @@ "int x;\n" "int y;"; - std::unique_ptr Buf = MemoryBuffer::getMemBuffer(Source); + std::unique_ptr Buf = + llvm::MemoryBuffer::getMemBuffer(Source); FileID MainFileID = SourceMgr.createFileID(std::move(Buf)); SourceMgr.setMainFileID(MainFileID); @@ -185,8 +186,10 @@ "#define CONCAT(X, Y) X##Y\n" "CONCAT(1,1)\n"; - std::unique_ptr HeaderBuf = MemoryBuffer::getMemBuffer(header); - std::unique_ptr MainBuf = MemoryBuffer::getMemBuffer(main); + std::unique_ptr HeaderBuf = + llvm::MemoryBuffer::getMemBuffer(header); + std::unique_ptr MainBuf = + llvm::MemoryBuffer::getMemBuffer(main); FileID mainFileID = SourceMgr.createFileID(std::move(MainBuf)); SourceMgr.setMainFileID(mainFileID); @@ -284,8 +287,10 @@ "#define INC2 \n" "#include M(INC2)\n"; - std::unique_ptr HeaderBuf = MemoryBuffer::getMemBuffer(header); - std::unique_ptr MainBuf = MemoryBuffer::getMemBuffer(main); + std::unique_ptr HeaderBuf = + llvm::MemoryBuffer::getMemBuffer(header); + std::unique_ptr MainBuf = + llvm::MemoryBuffer::getMemBuffer(main); SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(MainBuf))); const FileEntry *headerFile = FileMgr.getVirtualFile("/test-header.h", Index: cfe/trunk/unittests/Lex/LexerTest.cpp =================================================================== --- cfe/trunk/unittests/Lex/LexerTest.cpp +++ cfe/trunk/unittests/Lex/LexerTest.cpp @@ -22,7 +22,6 @@ #include "clang/Lex/PreprocessorOptions.h" #include "gtest/gtest.h" -using namespace llvm; using namespace clang; namespace { @@ -61,7 +60,8 @@ std::vector CheckLex(StringRef Source, ArrayRef ExpectedTokens) { - std::unique_ptr Buf = MemoryBuffer::getMemBuffer(Source); + std::unique_ptr Buf = + llvm::MemoryBuffer::getMemBuffer(Source); SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf))); VoidModuleLoader ModLoader; Index: cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp =================================================================== --- cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp +++ cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp @@ -22,7 +22,6 @@ #include "clang/Lex/PreprocessorOptions.h" #include "gtest/gtest.h" -using namespace llvm; using namespace clang; namespace { @@ -89,7 +88,8 @@ "#endif\n" "9\n"; - std::unique_ptr Buf = MemoryBuffer::getMemBuffer(source); + std::unique_ptr Buf = + llvm::MemoryBuffer::getMemBuffer(source); SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf))); VoidModuleLoader ModLoader;