diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-31 19:28:59 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-31 19:28:59 +0000 |
commit | 9e435806aaf5bd7e974d317ef247f200200ad686 (patch) | |
tree | 950414edc74ebec2c62ac1b5fd10e799f0204b5b | |
parent | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (diff) |
Vendor import of clang RELEASE_360/rc2 tag r227651 (effectively, 3.6.0 RC2):vendor/clang/clang-release_360-r227651
Notes
Notes:
svn path=/vendor/clang/dist/; revision=277994
svn path=/vendor/clang/clang-release_360-r227651/; revision=277995; tag=vendor/clang/clang-release_360-r227651
52 files changed, 1101 insertions, 492 deletions
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 8c47d693ed37..dd22954ca966 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -12,7 +12,7 @@ Written by the `LLVM Team <http://llvm.org/>`_ These are in-progress notes for the upcoming Clang 3.6 release. You may prefer the `Clang 3.5 Release Notes - <http://llvm.org/releases/3.5/tools/clang/docs/ReleaseNotes.html>`_. + <http://llvm.org/releases/3.5.0/tools/clang/docs/ReleaseNotes.html>`_. Introduction ============ @@ -53,9 +53,11 @@ Major New Features __has_declspec_attribute, this allows for more precise coverage of attribute syntax querying. +- clang-format now supports formatting Java code. + Improvements to Clang's diagnostics -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +----------------------------------- Clang's diagnostics are constantly being improved to catch more issues, explain them more clearly, and provide more accurate source information @@ -68,6 +70,21 @@ New Compiler Flags The option .... +The __EXCEPTIONS macro +---------------------- +``__EXCEPTIONS`` is now defined when landing pads are emitted, not when c++ exceptions are enabled. The two can be different in Objective-C files: If C++ exceptions are disabled but Objective-C exceptions are enabled, landing pads will be emitted. Clang 3.6 is switching the behavior of ``__EXCEPTIONS``. Clang 3.5 confusingly changed the behavior of ``has_feature(cxx_exceptions)``, which used to be set if landing pads were emitted, but is now set if C++ exceptions are enabled. So there are 3 cases: + +Clang before 3.5: + ``__EXCEPTIONS`` is set if C++ exceptions are enabled, ``cxx_exceptions`` enabled if C++ or ObjC exceptions are enabled + +Clang 3.5: + ``__EXCEPTIONS`` is set if C++ exceptions are enabled, ``cxx_exceptions`` enabled if C++ exceptions are enabled + +Clang 3.6: + ``__EXCEPTIONS`` is set if C++ or ObjC exceptions are enabled, ``cxx_exceptions`` enabled if C++ exceptions are enabled + +To reliably test if C++ exceptions are enabled, use ``__EXCEPTIONS && __has_feature(cxx_exceptions)``, else things won't work in all versions of clang in Objective-C++ files. + New Pragmas in Clang ----------------------- @@ -77,7 +94,9 @@ Clang now supports the ... Windows Support --------------- -Clang's support for building native Windows programs ... +- Many, many bug fixes + +- Basic support for DWARF debug information in COFF files C Language Changes in Clang @@ -93,7 +112,11 @@ C11 Feature Support C++ Language Changes in Clang ----------------------------- -- ... +- Clang now supports putting identical constructors and destructors in + the C5/D5 comdat, reducing code duplication. + +- Clang will put individual ``.init_array/.ctors`` sections in + comdats, reducing code duplication and speeding up startup. C++11 Feature Support ^^^^^^^^^^^^^^^^^^^^^ diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 843746111463..3ed7f8d6b170 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -224,14 +224,12 @@ class SubjectList<list<AttrSubject> subjects, SubjectDiag diag = WarnDiag, string CustomDiag = customDiag; } -class LangOpt<string name, bit negated = 0> { +class LangOpt<string name> { string Name = name; - bit Negated = negated; } def MicrosoftExt : LangOpt<"MicrosoftExt">; def Borland : LangOpt<"Borland">; def CUDA : LangOpt<"CUDA">; -def COnly : LangOpt<"CPlusPlus", 1>; // Defines targets for target-specific attributes. The list of strings should // specify architectures for which the target applies, based off the ArchType @@ -709,25 +707,6 @@ def MinSize : InheritableAttr { let Documentation = [Undocumented]; } -def FlagEnum : InheritableAttr { - let Spellings = [GNU<"flag_enum">]; - let Subjects = SubjectList<[Enum]>; - let Documentation = [FlagEnumDocs]; - let LangOpts = [COnly]; - let AdditionalMembers = [{ -private: - llvm::APInt FlagBits; -public: - llvm::APInt &getFlagBits() { - return FlagBits; - } - - const llvm::APInt &getFlagBits() const { - return FlagBits; - } -}]; -} - def Flatten : InheritableAttr { let Spellings = [GCC<"flatten">]; let Subjects = SubjectList<[Function], ErrorDiag>; diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index 918abb6072ea..530c6e7d1013 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -1196,16 +1196,6 @@ behavior of the program is undefined. }]; } -def FlagEnumDocs : Documentation { - let Category = DocCatType; - let Content = [{ -This attribute can be added to an enumerator to signal to the compiler that it -is intended to be used as a flag type. This will cause the compiler to assume -that the range of the type includes all of the values that you can get by -manipulating bits of the enumerator when issuing warnings. - }]; -} - def MSInheritanceDocs : Documentation { let Category = DocCatType; let Heading = "__single_inhertiance, __multiple_inheritance, __virtual_inheritance"; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 75d40b17a67c..5edd3ddbc85c 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -190,7 +190,6 @@ def OverloadedShiftOpParentheses: DiagGroup<"overloaded-shift-op-parentheses">; def DanglingElse: DiagGroup<"dangling-else">; def DanglingField : DiagGroup<"dangling-field">; def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">; -def FlagEnum : DiagGroup<"flag-enum">; def InfiniteRecursion : DiagGroup<"infinite-recursion">; def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 8966c55d0963..2afe77055bdc 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -2236,7 +2236,7 @@ def warn_attribute_wrong_decl_type : Warning< "%0 attribute only applies to %select{functions|unions|" "variables and functions|functions and methods|parameters|" "functions, methods and blocks|functions, methods, and classes|" - "functions, methods, and parameters|classes|enums|variables|methods|" + "functions, methods, and parameters|classes|variables|methods|" "variables, functions and labels|fields and global variables|structs|" "variables and typedefs|thread-local variables|" "variables and fields|variables, data members and tag types|" @@ -4059,9 +4059,6 @@ def ext_enum_too_large : ExtWarn< def ext_enumerator_increment_too_large : ExtWarn< "incremented enumerator value %0 is not representable in the " "largest integer type">, InGroup<EnumTooLarge>; -def warn_flag_enum_constant_out_of_range : Warning< - "enumeration value %0 is out of range of flags in enumeration type %1">, - InGroup<FlagEnum>; def warn_illegal_constant_array_size : Extension< "size of static array must be an integer constant expression">; @@ -6162,6 +6159,8 @@ let CategoryName = "Inline Assembly Issue" in { "invalid lvalue in asm input for constraint '%0'">; def err_asm_invalid_input_constraint : Error< "invalid input constraint '%0' in asm">; + def err_asm_immediate_expected : Error<"constraint '%0' expects " + "an integer constant expression">; def err_asm_invalid_type_in_input : Error< "invalid type %0 in asm input for constraint '%1'">; def err_asm_tying_incompatible_types : Error< diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 4daddba332d7..b68a46bad84b 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1209,6 +1209,8 @@ def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">, Group<m_aarch64_Features_Group>, HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">; +def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>, + HelpText<"Reserve the x18 register (AArch64 only)">; def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>; def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>; diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h index dc85f5d2084c..5e543a5fa540 100644 --- a/include/clang/Sema/AttributeList.h +++ b/include/clang/Sema/AttributeList.h @@ -822,7 +822,6 @@ enum AttributeDeclKind { ExpectedFunctionMethodOrClass, ExpectedFunctionMethodOrParameter, ExpectedClass, - ExpectedEnum, ExpectedVariable, ExpectedMethod, ExpectedVariableFunctionOrLabel, diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 74efa60c9366..bba7c3683498 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -7971,12 +7971,6 @@ public: Expr *SrcExpr, AssignmentAction Action, bool *Complained = nullptr); - /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag - /// enum. If AllowMask is true, then we also allow the complement of a valid - /// value, to be used as a mask. - bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, - bool AllowMask) const; - /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant /// integer not in the range of enum values. void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h index 045bacf21360..005d882c341b 100644 --- a/include/clang/Sema/SemaInternal.h +++ b/include/clang/Sema/SemaInternal.h @@ -101,7 +101,7 @@ public: DeclContext *MemberContext, bool EnteringContext) : Typo(TypoName.getName().getAsIdentifierInfo()), CurrentTCIndex(0), - SemaRef(SemaRef), S(S), + SavedTCIndex(0), SemaRef(SemaRef), S(S), SS(SS ? llvm::make_unique<CXXScopeSpec>(*SS) : nullptr), CorrectionValidator(std::move(CCC)), MemberContext(MemberContext), Result(SemaRef, TypoName, LookupKind), @@ -187,6 +187,17 @@ public: CurrentTCIndex >= ValidatedCorrections.size(); } + /// \brief Save the current position in the correction stream (overwriting any + /// previously saved position). + void saveCurrentPosition() { + SavedTCIndex = CurrentTCIndex; + } + + /// \brief Restore the saved position in the correction stream. + void restoreSavedPosition() { + CurrentTCIndex = SavedTCIndex; + } + ASTContext &getContext() const { return SemaRef.Context; } const LookupResult &getLookupResult() const { return Result; } @@ -267,6 +278,7 @@ private: SmallVector<TypoCorrection, 4> ValidatedCorrections; size_t CurrentTCIndex; + size_t SavedTCIndex; Sema &SemaRef; Scope *S; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 4c64a02b5b8a..bf60bbf3fd9f 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -5901,6 +5901,8 @@ public: : MipsTargetInfoBase(Triple, "o32", "mips32r2") { SizeType = UnsignedInt; PtrDiffType = SignedInt; + Int64Type = SignedLongLong; + IntMaxType = Int64Type; MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; } bool setABI(const std::string &Name) override { @@ -5922,6 +5924,8 @@ public: Builder.defineMacro("__mips_isa_rev", "1"); else if (CPUStr == "mips32r2") Builder.defineMacro("__mips_isa_rev", "2"); + else if (CPUStr == "mips32r6") + Builder.defineMacro("__mips_isa_rev", "6"); if (ABI == "o32") { Builder.defineMacro("__mips_o32"); @@ -6028,6 +6032,8 @@ public: PointerWidth = PointerAlign = 64; SizeType = UnsignedLong; PtrDiffType = SignedLong; + Int64Type = SignedLong; + IntMaxType = Int64Type; } void setN32ABITypes() { @@ -6035,6 +6041,8 @@ public: PointerWidth = PointerAlign = 32; SizeType = UnsignedInt; PtrDiffType = SignedInt; + Int64Type = SignedLongLong; + IntMaxType = Int64Type; } bool setABI(const std::string &Name) override { @@ -6065,6 +6073,8 @@ public: Builder.defineMacro("__mips_isa_rev", "1"); else if (CPUStr == "mips64r2") Builder.defineMacro("__mips_isa_rev", "2"); + else if (CPUStr == "mips64r6") + Builder.defineMacro("__mips_isa_rev", "6"); if (ABI == "n32") { Builder.defineMacro("__mips_n32"); diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 766d2aa6ffb8..15a1a7fb5f12 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -206,9 +206,6 @@ llvm::Constant *CodeGenModule::getOrCreateStaticVarDecl( GV->setAlignment(getContext().getDeclAlign(&D).getQuantity()); setGlobalVisibility(GV, &D); - if (supportsCOMDAT() && GV->isWeakForLinker()) - GV->setComdat(TheModule.getOrInsertComdat(GV->getName())); - if (D.getTLSKind()) setTLSMode(GV, D); diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 3b379b7d258b..19e4bdd00cfe 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -267,7 +267,15 @@ void CodeGenModule::EmitPointerToInitFunc(const VarDecl *D, addUsedGlobal(PtrArray); // If the GV is already in a comdat group, then we have to join it. - if (llvm::Comdat *C = GV->getComdat()) + llvm::Comdat *C = GV->getComdat(); + + // LinkOnce and Weak linkage are lowered down to a single-member comdat group. + // Make an explicit group so we can join it. + if (!C && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())) { + C = TheModule.getOrInsertComdat(GV->getName()); + GV->setComdat(C); + } + if (C) PtrArray->setComdat(C); } diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 8981bfe89cb4..1b07160908ad 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1928,31 +1928,6 @@ void CodeGenModule::MaybeHandleStaticInExternC(const SomeDecl *D, R.first->second = nullptr; } -static bool shouldBeInCOMDAT(CodeGenModule &CGM, const Decl &D) { - if (!CGM.supportsCOMDAT()) - return false; - - if (D.hasAttr<SelectAnyAttr>()) - return true; - - GVALinkage Linkage; - if (auto *VD = dyn_cast<VarDecl>(&D)) - Linkage = CGM.getContext().GetGVALinkageForVariable(VD); - else - Linkage = CGM.getContext().GetGVALinkageForFunction(cast<FunctionDecl>(&D)); - - switch (Linkage) { - case GVA_Internal: - case GVA_AvailableExternally: - case GVA_StrongExternal: - return false; - case GVA_DiscardableODR: - case GVA_StrongODR: - return true; - } - llvm_unreachable("No such linkage"); -} - void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { llvm::Constant *Init = nullptr; QualType ASTTy = D->getType(); @@ -2096,9 +2071,6 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { setTLSMode(GV, *D); } - if (shouldBeInCOMDAT(*this, *D)) - GV->setComdat(TheModule.getOrInsertComdat(GV->getName())); - // Emit the initializer function if necessary. if (NeedsGlobalCtor || NeedsGlobalDtor) EmitCXXGlobalVarDeclInitFunc(D, GV, NeedsGlobalCtor); @@ -2433,9 +2405,6 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, MaybeHandleStaticInExternC(D, Fn); - if (shouldBeInCOMDAT(*this, *D)) - Fn->setComdat(TheModule.getOrInsertComdat(Fn->getName())); - CodeGenFunction(*this).GenerateCode(D, Fn, FI); setFunctionDefinitionAttributes(D, Fn); diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index f2ffabcf3e9d..deebab858399 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -1711,12 +1711,11 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF, // The ABI says: It is suggested that it be emitted in the same COMDAT group // as the associated data object - llvm::Comdat *C = var->getComdat(); - if (!D.isLocalVarDecl() && C) { + if (!D.isLocalVarDecl() && var->isWeakForLinker() && CGM.supportsCOMDAT()) { + llvm::Comdat *C = CGM.getModule().getOrInsertComdat(var->getName()); guard->setComdat(C); + var->setComdat(C); CGF.CurFn->setComdat(C); - } else if (CGM.supportsCOMDAT() && guard->isWeakForLinker()) { - guard->setComdat(CGM.getModule().getOrInsertComdat(guard->getName())); } CGM.setStaticLocalDeclGuardAddress(&D, guard); diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index c80db7d18a1b..c067fab1e921 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1534,6 +1534,12 @@ llvm::Function *MicrosoftCXXABI::EmitVirtualMemPtrThunk( CGM.SetLLVMFunctionAttributes(MD, FnInfo, ThunkFn); CGM.SetLLVMFunctionAttributesForDefinition(MD, ThunkFn); + // Add the "thunk" attribute so that LLVM knows that the return type is + // meaningless. These thunks can be used to call functions with differing + // return types, and the caller is required to cast the prototype + // appropriately to extract the correct value. + ThunkFn->addFnAttr("thunk"); + // These thunks can be compared, so they are not unnamed. ThunkFn->setUnnamedAddr(false); @@ -1829,10 +1835,18 @@ void MicrosoftCXXABI::EmitThreadLocalInitFuncs( llvm::Function *F = CXXThreadLocalInits[I]; // If the GV is already in a comdat group, then we have to join it. - if (llvm::Comdat *C = GV->getComdat()) + llvm::Comdat *C = GV->getComdat(); + + // LinkOnce and Weak linkage are lowered down to a single-member comdat + // group. + // Make an explicit group so we can join it. + if (!C && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())) { + C = CGM.getModule().getOrInsertComdat(GV->getName()); + GV->setComdat(C); AddToXDU(F)->setComdat(C); - else + } else { NonComdatInits.push_back(F); + } } if (!NonComdatInits.empty()) { diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index d625c0e3e2f6..28c46f636ef9 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -958,6 +958,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, if (A->getOption().matches(options::OPT_mno_global_merge)) CmdArgs.push_back("-mno-global-merge"); } + + if (Args.hasArg(options::OPT_ffixed_x18)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-aarch64-reserve-x18"); + } } // Get CPU and ABI names. They are not independent @@ -5418,6 +5423,20 @@ const char *arm::getLLVMArchSuffixForARM(StringRef CPU) { .Default(""); } +void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple) { + if (Args.hasArg(options::OPT_r)) + return; + + StringRef Suffix = getLLVMArchSuffixForARM(getARMCPUForMArch(Args, Triple)); + const char *LinkFlag = llvm::StringSwitch<const char *>(Suffix) + .Cases("v4", "v4t", "v5", "v5e", nullptr) + .Cases("v6", "v6t2", nullptr) + .Default("--be8"); + + if (LinkFlag) + CmdArgs.push_back(LinkFlag); +} + bool mips::hasMipsAbiArg(const ArgList &Args, const char *Value) { Arg *A = Args.getLastArg(options::OPT_mabi_EQ); return A && (A->getValue() == StringRef(Value)); @@ -6881,6 +6900,7 @@ void netbsd::Link::ConstructJob(Compilation &C, const JobAction &JA, break; case llvm::Triple::armeb: case llvm::Triple::thumbeb: + arm::appendEBLinkFlags(Args, CmdArgs, getToolChain().getTriple()); CmdArgs.push_back("-m"); switch (getToolChain().getTriple().getEnvironment()) { case llvm::Triple::EABI: @@ -7431,6 +7451,10 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_s)) CmdArgs.push_back("-s"); + if (ToolChain.getArch() == llvm::Triple::armeb || + ToolChain.getArch() == llvm::Triple::thumbeb) + arm::appendEBLinkFlags(Args, CmdArgs, getToolChain().getTriple()); + for (const auto &Opt : ToolChain.ExtraOpts) CmdArgs.push_back(Opt.c_str()); diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index 6647f39ce817..5aea8258d251 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -228,6 +228,8 @@ namespace arm { const char* getARMCPUForMArch(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); const char* getLLVMArchSuffixForARM(StringRef CPU); + + void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple); } namespace mips { diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 9fc2bec23b1b..fdc136ccbd23 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -1340,6 +1340,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult, << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } + if (IsC11 && ValType->isPointerType() && + RequireCompleteType(Ptr->getLocStart(), ValType->getPointeeType(), + diag::err_incomplete_type)) { + return ExprError(); + } } else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType()) { // For __atomic_*_n operations, the value type must be a scalar integral or // pointer type which is 1, 2, 4, 8 or 16 bytes in length. diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 007470344f19..b556f18b7632 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8828,11 +8828,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, }); if (Res.isInvalid()) { VDecl->setInvalidDecl(); - return; - } - if (Res.get() != Args[Idx]) + } else if (Res.get() != Args[Idx]) { Args[Idx] = Res.get(); + } } + if (VDecl->isInvalidDecl()) + return; InitializationSequence InitSeq(*this, Entity, Kind, Args); ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT); @@ -13519,49 +13520,6 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements, } } -bool -Sema::IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, - bool AllowMask) const { - FlagEnumAttr *FEAttr = ED->getAttr<FlagEnumAttr>(); - assert(FEAttr && "looking for value in non-flag enum"); - - llvm::APInt FlagMask = ~FEAttr->getFlagBits(); - unsigned Width = FlagMask.getBitWidth(); - - // We will try a zero-extended value for the regular check first. - llvm::APInt ExtVal = Val.zextOrSelf(Width); - - // A value is in a flag enum if either its bits are a subset of the enum's - // flag bits (the first condition) or we are allowing masks and the same is - // true of its complement (the second condition). When masks are allowed, we - // allow the common idiom of ~(enum1 | enum2) to be a valid enum value. - // - // While it's true that any value could be used as a mask, the assumption is - // that a mask will have all of the insignificant bits set. Anything else is - // likely a logic error. - if (!(FlagMask & ExtVal)) - return true; - - if (AllowMask) { - // Try a one-extended value instead. This can happen if the enum is wider - // than the constant used, in C with extensions to allow for wider enums. - // The mask will still have the correct behaviour, so we give the user the - // benefit of the doubt. - // - // FIXME: This heuristic can cause weird results if the enum was extended - // to a larger type and is signed, because then bit-masks of smaller types - // that get extended will fall out of range (e.g. ~0x1u). We currently don't - // detect that case and will get a false positive for it. In most cases, - // though, it can be fixed by making it a signed type (e.g. ~0x1), so it may - // be fine just to accept this as a warning. - ExtVal |= llvm::APInt::getHighBitsSet(Width, Width - Val.getBitWidth()); - if (!(FlagMask & ~ExtVal)) - return true; - } - - return false; -} - void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, SourceLocation RBraceLoc, Decl *EnumDeclX, ArrayRef<Decl *> Elements, @@ -13647,8 +13605,10 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, BestPromotionType = Context.getPromotedIntegerType(BestType); else BestPromotionType = BestType; - - BestWidth = Context.getIntWidth(BestType); + // We don't need to set BestWidth, because BestType is going to be the type + // of the enumerators, but we do anyway because otherwise some compilers + // warn that it might be used uninitialized. + BestWidth = CharWidth; } else if (NumNegativeBits) { // If there is a negative value, figure out the smallest integer type (of @@ -13713,15 +13673,10 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, } } - FlagEnumAttr *FEAttr = Enum->getAttr<FlagEnumAttr>(); - if (FEAttr) - FEAttr->getFlagBits() = llvm::APInt(BestWidth, 0); - // Loop over all of the enumerator constants, changing their types to match - // the type of the enum if needed. If we have a flag type, we also prepare the - // FlagBits cache. - for (auto *D : Elements) { - auto *ECD = cast_or_null<EnumConstantDecl>(D); + // the type of the enum if needed. + for (unsigned i = 0, e = Elements.size(); i != e; ++i) { + EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(Elements[i]); if (!ECD) continue; // Already issued a diagnostic. // Standard C says the enumerators have int type, but we allow, as an @@ -13751,7 +13706,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, // enum-specifier, each enumerator has the type of its // enumeration. ECD->setType(EnumType); - goto flagbits; + continue; } else { NewTy = BestType; NewWidth = BestWidth; @@ -13778,32 +13733,8 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, ECD->setType(EnumType); else ECD->setType(NewTy); - -flagbits: - // Check to see if we have a constant with exactly one bit set. Note that x - // & (x - 1) will be nonzero if and only if x has more than one bit set. - if (FEAttr) { - llvm::APInt ExtVal = InitVal.zextOrSelf(BestWidth); - if (ExtVal != 0 && !(ExtVal & (ExtVal - 1))) { - FEAttr->getFlagBits() |= ExtVal; - } - } - } - - if (FEAttr) { - for (Decl *D : Elements) { - EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(D); - if (!ECD) continue; // Already issued a diagnostic. - - llvm::APSInt InitVal = ECD->getInitVal(); - if (InitVal != 0 && !IsValueInFlagEnum(Enum, InitVal, true)) - Diag(ECD->getLocation(), diag::warn_flag_enum_constant_out_of_range) - << ECD << Enum; - } } - - Enum->completeDefinition(BestType, BestPromotionType, NumPositiveBits, NumNegativeBits); diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 17a849ea7af0..dcab25e7fe72 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -4395,9 +4395,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_OptimizeNone: handleOptimizeNoneAttr(S, D, Attr); break; - case AttributeList::AT_FlagEnum: - handleSimpleAttribute<FlagEnumAttr>(S, D, Attr); - break; case AttributeList::AT_Flatten: handleSimpleAttribute<FlattenAttr>(S, D, Attr); break; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index fba7a2d23ffd..091fd27db85d 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4762,12 +4762,8 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, VK_RValue, RParenLoc); // Bail out early if calling a builtin with custom typechecking. - if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) { - ExprResult Res = CorrectDelayedTyposInExpr(TheCall); - if (!Res.isUsable() || !isa<CallExpr>(Res.get())) - return Res; - return CheckBuiltinFunctionCall(FDecl, BuiltinID, cast<CallExpr>(Res.get())); - } + if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) + return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall); retry: const FunctionType *FuncT; @@ -5785,15 +5781,6 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprObjectKind &OK, SourceLocation QuestionLoc) { - if (!getLangOpts().CPlusPlus) { - // C cannot handle TypoExpr nodes on either side of a binop because it - // doesn't handle dependent types properly, so make sure any TypoExprs have - // been dealt with before checking the operands. - ExprResult CondResult = CorrectDelayedTyposInExpr(Cond); - if (!CondResult.isUsable()) return QualType(); - Cond = CondResult; - } - ExprResult LHSResult = CheckPlaceholderExpr(LHS.get()); if (!LHSResult.isUsable()) return QualType(); LHS = LHSResult; @@ -6173,6 +6160,15 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr) { + if (!getLangOpts().CPlusPlus) { + // C cannot handle TypoExpr nodes in the condition because it + // doesn't handle dependent types properly, so make sure any TypoExprs have + // been dealt with before checking the operands. + ExprResult CondResult = CorrectDelayedTyposInExpr(CondExpr); + if (!CondResult.isUsable()) return ExprError(); + CondExpr = CondResult.get(); + } + // If this is the gnu "x ?: y" extension, analyze the types as though the LHS // was the condition. OpaqueValueExpr *opaqueValue = nullptr; @@ -9457,6 +9453,18 @@ static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R, } } +static NamedDecl *getDeclFromExpr(Expr *E) { + if (!E) + return nullptr; + if (auto *DRE = dyn_cast<DeclRefExpr>(E)) + return DRE->getDecl(); + if (auto *ME = dyn_cast<MemberExpr>(E)) + return ME->getMemberDecl(); + if (auto *IRE = dyn_cast<ObjCIvarRefExpr>(E)) + return IRE->getDecl(); + return nullptr; +} + /// CreateBuiltinBinOp - Creates a new built-in binary operation with /// operator @p Opc at location @c TokLoc. This routine only supports /// built-in operations; ActOnBinOp handles overloaded operators. @@ -9494,7 +9502,13 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, // doesn't handle dependent types properly, so make sure any TypoExprs have // been dealt with before checking the operands. LHS = CorrectDelayedTyposInExpr(LHSExpr); - RHS = CorrectDelayedTyposInExpr(RHSExpr); + RHS = CorrectDelayedTyposInExpr(RHSExpr, [Opc, LHS](Expr *E) { + if (Opc != BO_Assign) + return ExprResult(E); + // Avoid correcting the RHS to the same Expr as the LHS. + Decl *D = getDeclFromExpr(E); + return (D && D == getDeclFromExpr(LHS.get())) ? ExprError() : E; + }); if (!LHS.isUsable() || !RHS.isUsable()) return ExprError(); } diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 422398ebeb1e..3e2a2de5b406 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -6143,12 +6143,6 @@ public: ExprResult TransformLambdaExpr(LambdaExpr *E) { return Owned(E); } - ExprResult TransformOpaqueValueExpr(OpaqueValueExpr *E) { - if (Expr *SE = E->getSourceExpr()) - return TransformExpr(SE); - return BaseTransform::TransformOpaqueValueExpr(E); - } - ExprResult Transform(Expr *E) { ExprResult Res; while (true) { @@ -6168,15 +6162,18 @@ public: while (!AmbiguousTypoExprs.empty()) { auto TE = AmbiguousTypoExprs.back(); auto Cached = TransformCache[TE]; - AmbiguousTypoExprs.pop_back(); + auto &State = SemaRef.getTypoExprState(TE); + State.Consumer->saveCurrentPosition(); TransformCache.erase(TE); if (!TryTransform(E).isInvalid()) { - SemaRef.getTypoExprState(TE).Consumer->resetCorrectionStream(); + State.Consumer->resetCorrectionStream(); TransformCache.erase(TE); Res = ExprError(); break; - } else - TransformCache[TE] = Cached; + } + AmbiguousTypoExprs.remove(TE); + State.Consumer->restoreSavedPosition(); + TransformCache[TE] = Cached; } // Ensure that all of the TypoExprs within the current Expr have been found. @@ -6235,8 +6232,12 @@ ExprResult Sema::CorrectDelayedTyposInExpr( if (E && !ExprEvalContexts.empty() && ExprEvalContexts.back().NumTypos && (E->isTypeDependent() || E->isValueDependent() || E->isInstantiationDependent())) { + auto TyposInContext = ExprEvalContexts.back().NumTypos; + assert(TyposInContext < ~0U && "Recursive call of CorrectDelayedTyposInExpr"); + ExprEvalContexts.back().NumTypos = ~0U; auto TyposResolved = DelayedTypos.size(); auto Result = TransformTypos(*this, Filter).Transform(E); + ExprEvalContexts.back().NumTypos = TyposInContext; TyposResolved -= DelayedTypos.size(); if (Result.isInvalid() || Result.get() != E) { ExprEvalContexts.back().NumTypos -= TyposResolved; diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 3445264461f7..a6cd653e89b4 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -3587,7 +3587,7 @@ retry_lookup: QualifiedResults.push_back(Candidate); break; } - Candidate.setCorrectionRange(TempSS, Result.getLookupNameInfo()); + Candidate.setCorrectionRange(SS.get(), Result.getLookupNameInfo()); return true; } return false; diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 22ed93082065..0d1da4540eb3 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -687,39 +687,26 @@ static void checkCaseValue(Sema &S, SourceLocation Loc, const llvm::APSInt &Val, } } -typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl*>, 64> EnumValsTy; - /// Returns true if we should emit a diagnostic about this case expression not /// being a part of the enum used in the switch controlling expression. -static bool ShouldDiagnoseSwitchCaseNotInEnum(const Sema &S, +static bool ShouldDiagnoseSwitchCaseNotInEnum(const ASTContext &Ctx, const EnumDecl *ED, - const Expr *CaseExpr, - EnumValsTy::iterator &EI, - EnumValsTy::iterator &EIEnd, - const llvm::APSInt &Val) { - bool FlagType = ED->hasAttr<FlagEnumAttr>(); - - if (const DeclRefExpr *DRE = - dyn_cast<DeclRefExpr>(CaseExpr->IgnoreParenImpCasts())) { + const Expr *CaseExpr) { + // Don't warn if the 'case' expression refers to a static const variable of + // the enum type. + CaseExpr = CaseExpr->IgnoreParenImpCasts(); + if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CaseExpr)) { if (const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl())) { + if (!VD->hasGlobalStorage()) + return true; QualType VarType = VD->getType(); - QualType EnumType = S.Context.getTypeDeclType(ED); - if (VD->hasGlobalStorage() && VarType.isConstQualified() && - S.Context.hasSameUnqualifiedType(EnumType, VarType)) + if (!VarType.isConstQualified()) + return true; + QualType EnumType = Ctx.getTypeDeclType(ED); + if (Ctx.hasSameUnqualifiedType(EnumType, VarType)) return false; } } - - if (FlagType) { - return !S.IsValueInFlagEnum(ED, Val, false); - } else { - while (EI != EIEnd && EI->first < Val) - EI++; - - if (EI != EIEnd && EI->first == Val) - return false; - } - return true; } @@ -1059,6 +1046,8 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, // If switch has default case, then ignore it. if (!CaseListIsErroneous && !HasConstantCond && ET) { const EnumDecl *ED = ET->getDecl(); + typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl*>, 64> + EnumValsTy; EnumValsTy EnumVals; // Gather all enum values, set their type and sort them, @@ -1069,48 +1058,57 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, EnumVals.push_back(std::make_pair(Val, EDI)); } std::stable_sort(EnumVals.begin(), EnumVals.end(), CmpEnumVals); - auto EI = EnumVals.begin(), EIEnd = + EnumValsTy::iterator EIend = std::unique(EnumVals.begin(), EnumVals.end(), EqEnumVals); // See which case values aren't in enum. + EnumValsTy::const_iterator EI = EnumVals.begin(); for (CaseValsTy::const_iterator CI = CaseVals.begin(); - CI != CaseVals.end(); CI++) { - Expr *CaseExpr = CI->second->getLHS(); - if (ShouldDiagnoseSwitchCaseNotInEnum(*this, ED, CaseExpr, EI, EIEnd, - CI->first)) - Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) - << CondTypeBeforePromotion; + CI != CaseVals.end(); CI++) { + while (EI != EIend && EI->first < CI->first) + EI++; + if (EI == EIend || EI->first > CI->first) { + Expr *CaseExpr = CI->second->getLHS(); + if (ShouldDiagnoseSwitchCaseNotInEnum(Context, ED, CaseExpr)) + Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) + << CondTypeBeforePromotion; + } } - // See which of case ranges aren't in enum EI = EnumVals.begin(); for (CaseRangesTy::const_iterator RI = CaseRanges.begin(); - RI != CaseRanges.end(); RI++) { - Expr *CaseExpr = RI->second->getLHS(); - if (ShouldDiagnoseSwitchCaseNotInEnum(*this, ED, CaseExpr, EI, EIEnd, - RI->first)) - Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) - << CondTypeBeforePromotion; + RI != CaseRanges.end() && EI != EIend; RI++) { + while (EI != EIend && EI->first < RI->first) + EI++; + + if (EI == EIend || EI->first != RI->first) { + Expr *CaseExpr = RI->second->getLHS(); + if (ShouldDiagnoseSwitchCaseNotInEnum(Context, ED, CaseExpr)) + Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) + << CondTypeBeforePromotion; + } llvm::APSInt Hi = RI->second->getRHS()->EvaluateKnownConstInt(Context); AdjustAPSInt(Hi, CondWidth, CondIsSigned); - - CaseExpr = RI->second->getRHS(); - if (ShouldDiagnoseSwitchCaseNotInEnum(*this, ED, CaseExpr, EI, EIEnd, - Hi)) - Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) - << CondTypeBeforePromotion; + while (EI != EIend && EI->first < Hi) + EI++; + if (EI == EIend || EI->first != Hi) { + Expr *CaseExpr = RI->second->getRHS(); + if (ShouldDiagnoseSwitchCaseNotInEnum(Context, ED, CaseExpr)) + Diag(CaseExpr->getExprLoc(), diag::warn_not_in_enum) + << CondTypeBeforePromotion; + } } // Check which enum vals aren't in switch - auto CI = CaseVals.begin(); - auto RI = CaseRanges.begin(); + CaseValsTy::const_iterator CI = CaseVals.begin(); + CaseRangesTy::const_iterator RI = CaseRanges.begin(); bool hasCasesNotInSwitch = false; SmallVector<DeclarationName,8> UnhandledNames; - for (EI = EnumVals.begin(); EI != EIEnd; EI++){ + for (EI = EnumVals.begin(); EI != EIend; EI++){ // Drop unneeded case values while (CI != CaseVals.end() && CI->first < EI->first) CI++; @@ -1197,37 +1195,30 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, llvm::APSInt RhsVal = SrcExpr->EvaluateKnownConstInt(Context); AdjustAPSInt(RhsVal, DstWidth, DstIsSigned); const EnumDecl *ED = ET->getDecl(); - - if (ED->hasAttr<FlagEnumAttr>()) { - if (!IsValueInFlagEnum(ED, RhsVal, true)) - Diag(SrcExpr->getExprLoc(), diag::warn_not_in_enum_assignment) + typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64> + EnumValsTy; + EnumValsTy EnumVals; + + // Gather all enum values, set their type and sort them, + // allowing easier comparison with rhs constant. + for (auto *EDI : ED->enumerators()) { + llvm::APSInt Val = EDI->getInitVal(); + AdjustAPSInt(Val, DstWidth, DstIsSigned); + EnumVals.push_back(std::make_pair(Val, EDI)); + } + if (EnumVals.empty()) + return; + std::stable_sort(EnumVals.begin(), EnumVals.end(), CmpEnumVals); + EnumValsTy::iterator EIend = + std::unique(EnumVals.begin(), EnumVals.end(), EqEnumVals); + + // See which values aren't in the enum. + EnumValsTy::const_iterator EI = EnumVals.begin(); + while (EI != EIend && EI->first < RhsVal) + EI++; + if (EI == EIend || EI->first != RhsVal) { + Diag(SrcExpr->getExprLoc(), diag::warn_not_in_enum_assignment) << DstType.getUnqualifiedType(); - } else { - typedef SmallVector<std::pair<llvm::APSInt, EnumConstantDecl *>, 64> - EnumValsTy; - EnumValsTy EnumVals; - - // Gather all enum values, set their type and sort them, - // allowing easier comparison with rhs constant. - for (auto *EDI : ED->enumerators()) { - llvm::APSInt Val = EDI->getInitVal(); - AdjustAPSInt(Val, DstWidth, DstIsSigned); - EnumVals.push_back(std::make_pair(Val, EDI)); - } - if (EnumVals.empty()) - return; - std::stable_sort(EnumVals.begin(), EnumVals.end(), CmpEnumVals); - EnumValsTy::iterator EIend = - std::unique(EnumVals.begin(), EnumVals.end(), EqEnumVals); - - // See which values aren't in the enum. - EnumValsTy::const_iterator EI = EnumVals.begin(); - while (EI != EIend && EI->first < RhsVal) - EI++; - if (EI == EIend || EI->first != RhsVal) { - Diag(SrcExpr->getExprLoc(), diag::warn_not_in_enum_assignment) - << DstType.getUnqualifiedType(); - } } } } diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index 286c7619ed40..0d32581e8daa 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -230,9 +230,8 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, llvm::APSInt Result; if (!InputExpr->EvaluateAsInt(Result, Context)) return StmtError( - Diag(InputExpr->getLocStart(), diag::err_asm_invalid_type_in_input) - << InputExpr->getType() << Info.getConstraintStr() - << InputExpr->getSourceRange()); + Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) + << Info.getConstraintStr() << InputExpr->getSourceRange()); if (Result.slt(Info.getImmConstantMin()) || Result.sgt(Info.getImmConstantMax())) return StmtError(Diag(InputExpr->getLocStart(), diff --git a/lib/Tooling/ArgumentsAdjusters.cpp b/lib/Tooling/ArgumentsAdjusters.cpp index 5a67db0e176f..1722ede08a86 100644 --- a/lib/Tooling/ArgumentsAdjusters.cpp +++ b/lib/Tooling/ArgumentsAdjusters.cpp @@ -78,7 +78,9 @@ ArgumentsAdjuster getInsertArgumentAdjuster(const char *Extra, ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First, ArgumentsAdjuster Second) { - return std::bind(Second, std::bind(First, std::placeholders::_1)); + return [First, Second](const CommandLineArguments &Args) { + return Second(First(Args)); + }; } } // end namespace tooling diff --git a/test/CodeGen/ms-declspecs.c b/test/CodeGen/ms-declspecs.c index 328fc835d347..5dc7787b8fb9 100644 --- a/test/CodeGen/ms-declspecs.c +++ b/test/CodeGen/ms-declspecs.c @@ -2,8 +2,8 @@ __declspec(selectany) int x1 = 1; const __declspec(selectany) int x2 = 2; -// CHECK: @x1 = weak_odr global i32 1, comdat, align 4 -// CHECK: @x2 = weak_odr constant i32 2, comdat, align 4 +// CHECK: @x1 = weak_odr global i32 1, align 4 +// CHECK: @x2 = weak_odr constant i32 2, align 4 struct __declspec(align(16)) S { char x; diff --git a/test/CodeGenCXX/cxx11-exception-spec.cpp b/test/CodeGenCXX/cxx11-exception-spec.cpp index 3fb5c15c2ab5..75f939f93f0f 100644 --- a/test/CodeGenCXX/cxx11-exception-spec.cpp +++ b/test/CodeGenCXX/cxx11-exception-spec.cpp @@ -22,9 +22,9 @@ template<> void S<short>::f() { h(); } // CHECK: define {{.*}} @_ZN1SIA2_sE1fEv() [[NUW]] template<> void S<short[2]>::f() noexcept { h(); } -// CHECK: define {{.*}} @_Z1fIDsEvv() [[NONE]] comdat { +// CHECK: define {{.*}} @_Z1fIDsEvv() [[NONE]] { template void f<char16_t>(); -// CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] comdat { +// CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] { template void f<char16_t[2]>(); // CHECK: define {{.*}} @_ZN1SIDsE1fEv() @@ -34,9 +34,9 @@ template void S<char16_t>::f(); template void S<char16_t[2]>::f(); void h() { - // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] { f<int>(); - // CHECK: define {{.*}} @_Z1fIA2_iEvv() [[NONE]] comdat { + // CHECK: define {{.*}} @_Z1fIA2_iEvv() [[NONE]] { f<int[2]>(); // CHECK: define {{.*}} @_ZN1SIiE1fEv() [[NUW]] @@ -45,9 +45,9 @@ void h() { // CHECK-NOT: [[NUW]] S<int[2]>::f(); - // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] { void (*f1)() = &f<float>; - // CHECK: define {{.*}} @_Z1fIdEvv() [[NONE]] comdat { + // CHECK: define {{.*}} @_Z1fIdEvv() [[NONE]] { void (*f2)() = &f<double>; // CHECK: define {{.*}} @_ZN1SIfE1fEv() [[NUW]] @@ -56,9 +56,9 @@ void h() { // CHECK-NOT: [[NUW]] void (*f4)() = &S<double>::f; - // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] comdat { + // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] { (void)&f<char[4]>; - // CHECK: define {{.*}} @_Z1fIcEvv() [[NONE]] comdat { + // CHECK: define {{.*}} @_Z1fIcEvv() [[NONE]] { (void)&f<char>; // CHECK: define {{.*}} @_ZN1SIA4_cE1fEv() [[NUW]] diff --git a/test/CodeGenCXX/dllexport-members.cpp b/test/CodeGenCXX/dllexport-members.cpp index 5b2af1e04bd7..d913c09ec7be 100644 --- a/test/CodeGenCXX/dllexport-members.cpp +++ b/test/CodeGenCXX/dllexport-members.cpp @@ -110,9 +110,9 @@ public: // MSC-DAG: @"\01?StaticField@ExportMembers@@2HA" = dllexport global i32 1, align 4 // MSC-DAG: @"\01?StaticConstField@ExportMembers@@2HB" = dllexport constant i32 1, align 4 - // MSC-DAG: @"\01?StaticConstFieldEqualInit@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 - // MSC-DAG: @"\01?StaticConstFieldBraceInit@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 - // MSC-DAG: @"\01?ConstexprField@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 + // MSC-DAG: @"\01?StaticConstFieldEqualInit@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 + // MSC-DAG: @"\01?StaticConstFieldBraceInit@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 + // MSC-DAG: @"\01?ConstexprField@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers11StaticFieldE = dllexport global i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers16StaticConstFieldE = dllexport constant i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers25StaticConstFieldEqualInitE = dllexport constant i32 1, align 4 @@ -233,9 +233,9 @@ public: // MSC-DAG: @"\01?StaticField@Nested@ExportMembers@@2HA" = dllexport global i32 1, align 4 // MSC-DAG: @"\01?StaticConstField@Nested@ExportMembers@@2HB" = dllexport constant i32 1, align 4 - // MSC-DAG: @"\01?StaticConstFieldEqualInit@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 - // MSC-DAG: @"\01?StaticConstFieldBraceInit@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 - // MSC-DAG: @"\01?ConstexprField@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 + // MSC-DAG: @"\01?StaticConstFieldEqualInit@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 + // MSC-DAG: @"\01?StaticConstFieldBraceInit@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 + // MSC-DAG: @"\01?ConstexprField@Nested@ExportMembers@@2HB" = weak_odr dllexport constant i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers6Nested11StaticFieldE = dllexport global i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers6Nested16StaticConstFieldE = dllexport constant i32 1, align 4 // GNU-DAG: @_ZN13ExportMembers6Nested25StaticConstFieldEqualInitE = dllexport constant i32 1, align 4 @@ -599,21 +599,21 @@ template<typename T> const int MemVarTmpl::StaticVar; template<typename T> const int MemVarTmpl::ExportedStaticVar; // Export implicit instantiation of an exported member variable template. -// MSC-DAG: @"\01??$ExportedStaticVar@UImplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 -// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ImplicitInst_ExportedEE = weak_odr dllexport constant i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedStaticVar@UImplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, align 4 +// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ImplicitInst_ExportedEE = weak_odr dllexport constant i32 1, align 4 int useMemVarTmpl() { return MemVarTmpl::ExportedStaticVar<ImplicitInst_Exported>; } // Export explicit instantiation declaration of an exported member variable // template. -// MSC-DAG: @"\01??$ExportedStaticVar@UExplicitDecl_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 -// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ExplicitDecl_ExportedEE = weak_odr dllexport constant i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedStaticVar@UExplicitDecl_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, align 4 +// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ExplicitDecl_ExportedEE = weak_odr dllexport constant i32 1, align 4 extern template const int MemVarTmpl::ExportedStaticVar<ExplicitDecl_Exported>; template const int MemVarTmpl::ExportedStaticVar<ExplicitDecl_Exported>; // Export explicit instantiation definition of an exported member variable // template. -// MSC-DAG: @"\01??$ExportedStaticVar@UExplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 -// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ExplicitInst_ExportedEE = weak_odr dllexport constant i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedStaticVar@UExplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, align 4 +// GNU-DAG: @_ZN10MemVarTmpl17ExportedStaticVarI21ExplicitInst_ExportedEE = weak_odr dllexport constant i32 1, align 4 template const int MemVarTmpl::ExportedStaticVar<ExplicitInst_Exported>; // Export specialization of an exported member variable template. @@ -630,15 +630,15 @@ template<> const int MemVarTmpl::ExportedStaticVar<ExplicitSpec_NotExported> = 1 // Export explicit instantiation declaration of a non-exported member variable // template. -// MSC-DAG: @"\01??$StaticVar@UExplicitDecl_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 -// GNU-DAG: @_ZN10MemVarTmpl9StaticVarI21ExplicitDecl_ExportedEE = weak_odr dllexport constant i32 1, comdat, align 4 +// MSC-DAG: @"\01??$StaticVar@UExplicitDecl_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, align 4 +// GNU-DAG: @_ZN10MemVarTmpl9StaticVarI21ExplicitDecl_ExportedEE = weak_odr dllexport constant i32 1, align 4 extern template __declspec(dllexport) const int MemVarTmpl::StaticVar<ExplicitDecl_Exported>; template __declspec(dllexport) const int MemVarTmpl::StaticVar<ExplicitDecl_Exported>; // Export explicit instantiation definition of a non-exported member variable // template. -// MSC-DAG: @"\01??$StaticVar@UExplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, comdat, align 4 -// GNU-DAG: @_ZN10MemVarTmpl9StaticVarI21ExplicitInst_ExportedEE = weak_odr dllexport constant i32 1, comdat, align 4 +// MSC-DAG: @"\01??$StaticVar@UExplicitInst_Exported@@@MemVarTmpl@@2HB" = weak_odr dllexport constant i32 1, align 4 +// GNU-DAG: @_ZN10MemVarTmpl9StaticVarI21ExplicitInst_ExportedEE = weak_odr dllexport constant i32 1, align 4 template __declspec(dllexport) const int MemVarTmpl::StaticVar<ExplicitInst_Exported>; // Export specialization of a non-exported member variable template. diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 93bd1f5fe99c..cfbc7e10078a 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -110,43 +110,43 @@ template<typename T> __declspec(dllexport) int VarTmplImplicitDef; USEVAR(VarTmplImplicitDef<ImplicitInst_Exported>) // Export definition. -// MSC-DAG: @"\01??$VarTmplInit1@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z12VarTmplInit1I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmplInit1@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z12VarTmplInit1I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template<typename T> __declspec(dllexport) int VarTmplInit1 = 1; INSTVAR(VarTmplInit1<ExplicitInst_Exported>) -// MSC-DAG: @"\01??$VarTmplInit2@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z12VarTmplInit2I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmplInit2@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z12VarTmplInit2I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template<typename T> int __declspec(dllexport) VarTmplInit2 = 1; INSTVAR(VarTmplInit2<ExplicitInst_Exported>) // Declare, then export definition. -// MSC-DAG: @"\01??$VarTmplDeclInit@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z15VarTmplDeclInitI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmplDeclInit@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z15VarTmplDeclInitI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template<typename T> __declspec(dllexport) extern int VarTmplDeclInit; template<typename T> int VarTmplDeclInit = 1; INSTVAR(VarTmplDeclInit<ExplicitInst_Exported>) // Redeclarations -// MSC-DAG: @"\01??$VarTmplRedecl1@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z14VarTmplRedecl1I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmplRedecl1@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z14VarTmplRedecl1I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template<typename T> __declspec(dllexport) extern int VarTmplRedecl1; template<typename T> __declspec(dllexport) int VarTmplRedecl1 = 1; INSTVAR(VarTmplRedecl1<ExplicitInst_Exported>) -// MSC-DAG: @"\01??$VarTmplRedecl2@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z14VarTmplRedecl2I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmplRedecl2@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z14VarTmplRedecl2I21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template<typename T> __declspec(dllexport) extern int VarTmplRedecl2; template<typename T> int VarTmplRedecl2 = 1; INSTVAR(VarTmplRedecl2<ExplicitInst_Exported>) -// MSC-DAG: @"\01??$ExternalVarTmpl@UExplicitInst_Exported@@@ns@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_ZN2ns15ExternalVarTmplI21ExplicitInst_ExportedEE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExternalVarTmpl@UExplicitInst_Exported@@@ns@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_ZN2ns15ExternalVarTmplI21ExplicitInst_ExportedEE = weak_odr dllexport global i32 1, align 4 namespace ns { template<typename T> __declspec(dllexport) int ExternalVarTmpl = 1; } INSTVAR(ns::ExternalVarTmpl<ExplicitInst_Exported>) -// MSC-DAG: @"\01??$ExternalAutoTypeVarTmpl@UExplicitInst_Exported@@@@3UExternal@@A" = weak_odr dllexport global %struct.External zeroinitializer, comdat, align 4 -// GNU-DAG: @_Z23ExternalAutoTypeVarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global %struct.External zeroinitializer, comdat, align 4 +// MSC-DAG: @"\01??$ExternalAutoTypeVarTmpl@UExplicitInst_Exported@@@@3UExternal@@A" = weak_odr dllexport global %struct.External zeroinitializer, align 4 +// GNU-DAG: @_Z23ExternalAutoTypeVarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global %struct.External zeroinitializer, align 4 template<typename T> __declspec(dllexport) auto ExternalAutoTypeVarTmpl = External(); template External ExternalAutoTypeVarTmpl<ExplicitInst_Exported>; @@ -155,19 +155,19 @@ template<typename T> int VarTmpl = 1; template<typename T> __declspec(dllexport) int ExportedVarTmpl = 1; // Export implicit instantiation of an exported variable template. -// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z15ExportedVarTmplI21ImplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z15ExportedVarTmplI21ImplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 USEVAR(ExportedVarTmpl<ImplicitInst_Exported>) // Export explicit instantiation declaration of an exported variable template. -// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z15ExportedVarTmplI21ExplicitDecl_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z15ExportedVarTmplI21ExplicitDecl_ExportedE = weak_odr dllexport global i32 1, align 4 extern template int ExportedVarTmpl<ExplicitDecl_Exported>; template int ExportedVarTmpl<ExplicitDecl_Exported>; // Export explicit instantiation definition of an exported variable template. -// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z15ExportedVarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$ExportedVarTmpl@UImplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z15ExportedVarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template __declspec(dllexport) int ExportedVarTmpl<ExplicitInst_Exported>; // Export specialization of an exported variable template. @@ -187,14 +187,14 @@ template<> int ExportedVarTmpl<ExplicitSpec_NotExported>; // Export explicit instantiation declaration of a non-exported variable template. -// MSC-DAG: @"\01??$VarTmpl@UExplicitDecl_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z7VarTmplI21ExplicitDecl_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmpl@UExplicitDecl_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z7VarTmplI21ExplicitDecl_ExportedE = weak_odr dllexport global i32 1, align 4 extern template __declspec(dllexport) int VarTmpl<ExplicitDecl_Exported>; template __declspec(dllexport) int VarTmpl<ExplicitDecl_Exported>; // Export explicit instantiation definition of a non-exported variable template. -// MSC-DAG: @"\01??$VarTmpl@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, comdat, align 4 -// GNU-DAG: @_Z7VarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, comdat, align 4 +// MSC-DAG: @"\01??$VarTmpl@UExplicitInst_Exported@@@@3HA" = weak_odr dllexport global i32 1, align 4 +// GNU-DAG: @_Z7VarTmplI21ExplicitInst_ExportedE = weak_odr dllexport global i32 1, align 4 template __declspec(dllexport) int VarTmpl<ExplicitInst_Exported>; // Export specialization of a non-exported variable template. diff --git a/test/CodeGenCXX/dllimport.cpp b/test/CodeGenCXX/dllimport.cpp index e5b9f64dcca6..ddd390ad6f36 100644 --- a/test/CodeGenCXX/dllimport.cpp +++ b/test/CodeGenCXX/dllimport.cpp @@ -243,7 +243,7 @@ __declspec(dllimport) __attribute__((noinline)) inline void noinline() {} USE(noinline) // MSC2-NOT: @"\01?alwaysInline@@YAXXZ"() -// GNU-DAG: define linkonce_odr void @_Z12alwaysInlinev() {{.*}} comdat { +// GNU2-NOT: @_Z12alwaysInlinev() __declspec(dllimport) __attribute__((always_inline)) inline void alwaysInline() {} USE(alwaysInline) diff --git a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp index b5db7c7881b5..937c4c0332e9 100644 --- a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp +++ b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp @@ -62,6 +62,7 @@ void f() { // Thunk for calling the 1st virtual function in C with no parameters. // CHECK32-LABEL: define linkonce_odr x86_thiscallcc void @"\01??_9C@@$BA@AE"(%struct.C* %this, ...) +// CHECK32: #[[ATTR:[0-9]+]] // CHECK32-NOT: unnamed_addr // CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 0 // CHECK32: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] @@ -70,6 +71,7 @@ void f() { // CHECK32: } // // CHECK64-LABEL: define linkonce_odr void @"\01??_9C@@$BA@AA"(%struct.C* %this, ...) +// CHECK64: #[[ATTR:[0-9]+]] // CHECK64-NOT: unnamed_addr // CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 0 // CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] @@ -79,6 +81,7 @@ void f() { // Thunk for calling the 2nd virtual function in C, taking int and double as parameters, returning int. // CHECK32-LABEL: define linkonce_odr x86_thiscallcc void @"\01??_9C@@$B3AE"(%struct.C* %this, ...) +// CHECK32: #[[ATTR]] // CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 1 // CHECK32: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] // CHECK32: musttail call x86_thiscallcc void (%struct.C*, ...)* [[CALLEE]](%struct.C* %{{.*}}, ...) @@ -86,6 +89,7 @@ void f() { // CHECK32: } // // CHECK64-LABEL: define linkonce_odr void @"\01??_9C@@$B7AA"(%struct.C* %this, ...) +// CHECK64: #[[ATTR]] // CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 1 // CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] // CHECK64: musttail call void (%struct.C*, ...)* [[CALLEE]](%struct.C* %{{.*}}, ...) @@ -94,6 +98,7 @@ void f() { // Thunk for calling the 3rd virtual function in C, taking an int parameter, returning a struct. // CHECK32-LABEL: define linkonce_odr x86_thiscallcc void @"\01??_9C@@$B7AE"(%struct.C* %this, ...) +// CHECK32: #[[ATTR]] // CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 2 // CHECK32: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] // CHECK32: musttail call x86_thiscallcc void (%struct.C*, ...)* [[CALLEE]](%struct.C* %{{.*}}, ...) @@ -101,6 +106,7 @@ void f() { // CHECK32: } // // CHECK64-LABEL: define linkonce_odr void @"\01??_9C@@$BBA@AA"(%struct.C* %this, ...) +// CHECK64: #[[ATTR]] // CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%struct.C*, ...)** %{{.*}}, i64 2 // CHECK64: [[CALLEE:%.*]] = load void (%struct.C*, ...)** [[VPTR]] // CHECK64: musttail call void (%struct.C*, ...)* [[CALLEE]](%struct.C* %{{.*}}, ...) @@ -109,6 +115,7 @@ void f() { // Thunk for calling the virtual function in internal class D. // CHECK32-LABEL: define internal x86_thiscallcc void @"\01??_9D@?A@@$BA@AE"(%"struct.(anonymous namespace)::D"* %this, ...) +// CHECK32: #[[ATTR]] // CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*, ...)** %{{.*}}, i64 0 // CHECK32: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*, ...)** [[VPTR]] // CHECK32: musttail call x86_thiscallcc void (%"struct.(anonymous namespace)::D"*, ...)* [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}}, ...) @@ -116,6 +123,7 @@ void f() { // CHECK32: } // // CHECK64-LABEL: define internal void @"\01??_9D@?A@@$BA@AA"(%"struct.(anonymous namespace)::D"* %this, ...) +// CHECK64: #[[ATTR]] // CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*, ...)** %{{.*}}, i64 0 // CHECK64: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*, ...)** [[VPTR]] // CHECK64: musttail call void (%"struct.(anonymous namespace)::D"*, ...)* [[CALLEE]](%"struct.(anonymous namespace)::D"* %{{.*}}, ...) @@ -137,3 +145,5 @@ void f() { // CHECK64: musttail call void (%struct.C*, ...)* [[CALLEE]](%struct.C* %{{.*}}, ...) // CHECK64: ret void // CHECK64: } + +// CHECK32: #[[ATTR]] = {{{.*}}"thunk"{{.*}}} diff --git a/test/CodeGenCXX/ms-integer-static-data-members-exported.cpp b/test/CodeGenCXX/ms-integer-static-data-members-exported.cpp index 78bb3a2b1afa..3f868f36ff66 100644 --- a/test/CodeGenCXX/ms-integer-static-data-members-exported.cpp +++ b/test/CodeGenCXX/ms-integer-static-data-members-exported.cpp @@ -17,6 +17,6 @@ struct __declspec(dllexport) S { }; }; -// CHECK: @"\01?x@S@@2FB" = weak_odr dllexport constant i16 42, comdat, align 2 -// CHECK: @"\01?y@S@@2W4Enum@@B" = weak_odr dllexport constant i32 2, comdat, align 4 +// CHECK: @"\01?x@S@@2FB" = weak_odr dllexport constant i16 42, align 2 +// CHECK: @"\01?y@S@@2W4Enum@@B" = weak_odr dllexport constant i32 2, align 4 // CHECK-NOT: NonExported diff --git a/test/CodeGenCXX/ms-integer-static-data-members.cpp b/test/CodeGenCXX/ms-integer-static-data-members.cpp index 4965f7319187..b02b679d71a1 100644 --- a/test/CodeGenCXX/ms-integer-static-data-members.cpp +++ b/test/CodeGenCXX/ms-integer-static-data-members.cpp @@ -26,7 +26,7 @@ const int S::x = 5; // Inline initialization. -// CHECK-INLINE: @"\01?x@S@@2HB" = linkonce_odr constant i32 5, comdat, align 4 +// CHECK-INLINE: @"\01?x@S@@2HB" = linkonce_odr constant i32 5, align 4 // Out-of-line initialization. // CHECK-OUTOFLINE: @"\01?x@S@@2HB" = constant i32 5, align 4 diff --git a/test/CodeGenCXX/split-stacks.cpp b/test/CodeGenCXX/split-stacks.cpp index 76e1b79b8f1a..3e120344d6b6 100644 --- a/test/CodeGenCXX/split-stacks.cpp +++ b/test/CodeGenCXX/split-stacks.cpp @@ -18,7 +18,7 @@ int nosplit() { // CHECK-SEGSTK: define i32 @_Z3foov() [[SS:#[0-9]+]] { // CHECK-SEGSTK: define i32 @_Z7nosplitv() [[NSS1:#[0-9]+]] { -// CHECK-SEGSTK: define linkonce_odr i32 @_Z8tnosplitIiEiv() [[NSS2:#[0-9]+]] comdat { +// CHECK-SEGSTK: define linkonce_odr i32 @_Z8tnosplitIiEiv() [[NSS2:#[0-9]+]] { // CHECK-SEGSTK-NOT: [[NSS1]] = { {{.*}} "split-stack" {{.*}} } // CHECK-SEGSTK-NOT: [[NSS2]] = { {{.*}} "split-stack" {{.*}} } // CHECK-SEGSTK: [[SS]] = { {{.*}} "split-stack" {{.*}} } @@ -27,7 +27,7 @@ int nosplit() { // CHECK-NOSEGSTK: define i32 @_Z3foov() [[NSS0:#[0-9]+]] { // CHECK-NOSEGSTK: define i32 @_Z7nosplitv() [[NSS1:#[0-9]+]] { -// CHECK-NOSEGSTK: define linkonce_odr i32 @_Z8tnosplitIiEiv() [[NSS2:#[0-9]+]] comdat { +// CHECK-NOSEGSTK: define linkonce_odr i32 @_Z8tnosplitIiEiv() [[NSS2:#[0-9]+]] { // CHECK-NOSEGSTK-NOT: [[NSS1]] = { {{.*}} "split-stack" {{.*}} } // CHECK-NOSEGSTK-NOT: [[NSS2]] = { {{.*}} "split-stack" {{.*}} } // CHECK-NOSEGSTK-NOT: [[NSS3]] = { {{.*}} "split-stack" {{.*}} } diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp index 66ff5b3fbabd..a9debe3de765 100644 --- a/test/CodeGenCXX/static-init.cpp +++ b/test/CodeGenCXX/static-init.cpp @@ -7,8 +7,10 @@ // CHECK: @_ZZN5test31BC1EvE1u = internal global { i8, [3 x i8] } { i8 97, [3 x i8] undef }, align 4 // CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 -// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0, comdat, align -// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0, comdat{{$}} +// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0 +// CHECK-NOT: comdat +// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0 +// CHECK-NOT: comdat struct A { A(); @@ -35,7 +37,8 @@ void h() { static const int i = a(); } -// CHECK: define linkonce_odr void @_Z2h2v() {{.*}} comdat { +// CHECK: define linkonce_odr void @_Z2h2v() +// CHECK-NOT: comdat inline void h2() { static int i = a(); } diff --git a/test/Driver/aarch64-fixed-x18.c b/test/Driver/aarch64-fixed-x18.c new file mode 100644 index 000000000000..35d0caf03217 --- /dev/null +++ b/test/Driver/aarch64-fixed-x18.c @@ -0,0 +1,4 @@ +// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s + +// CHECK-FIXED-X18: "-backend-option" "-aarch64-reserve-x18" diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 1ce923b61ac3..871d226bc68c 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -1397,3 +1397,21 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \ // RUN: | FileCheck --check-prefix=CHECK-u %s // CHECK-u: "-u" "asdf" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armeb-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMEB %s +// CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ARMEB-NOT: "--be8" +// CHECK-ARMEB: "-m" "armebelf_linux_eabi" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armebv7-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s +// CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ARMV7EB: "--be8" +// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi" diff --git a/test/Driver/netbsd.c b/test/Driver/netbsd.c index eded7f52df7e..612935d9819e 100644 --- a/test/Driver/netbsd.c +++ b/test/Driver/netbsd.c @@ -19,6 +19,15 @@ // RUN: %clang -no-canonical-prefixes -target armeb--netbsd-eabi \ // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=ARMEB %s +// RUN: %clang -no-canonical-prefixes -target armeb--netbsd-eabi -march=armv7 \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=ARMV7EB %s +// RUN: %clang -no-canonical-prefixes -target armv7eb--netbsd-eabi \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=ARMV7EB %s +// RUN: %clang -r -no-canonical-prefixes -target armeb--netbsd-eabi \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=ARMEB-R %s // RUN: %clang -no-canonical-prefixes -target arm--netbsd \ // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=ARM-APCS %s @@ -132,11 +141,17 @@ // ARMEB: clang{{.*}}" "-cc1" "-triple" "armebv5e--netbsd-eabi" // ARMEB: as{{.*}}" "-mcpu=arm926ej-s" "-o" // ARMEB: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" +// ARMEB-NOT: "--be8" // ARMEB: "-m" "armelfb_nbsd_eabi" // ARMEB: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" // ARMEB: "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" // ARMEB: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc" // ARMEB: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" +// ARMV7EB: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" +// ARMV7EB: "--be8" "-m" "armelfb_nbsd_eabi" + +// ARMEB-R: ld{{.*}}" +// ARMEB-R-NOT: "--be8" // ARM-APCS: clang{{.*}}" "-cc1" "-triple" "armv4--netbsd" // ARM-APCS: as{{.*}}" "-mcpu=strongarm" "-o" diff --git a/test/FixIt/typo-location-bugs.cpp b/test/FixIt/typo-location-bugs.cpp index e44664d49adb..c7111a801066 100644 --- a/test/FixIt/typo-location-bugs.cpp +++ b/test/FixIt/typo-location-bugs.cpp @@ -34,3 +34,16 @@ void test(B b) { b.f(1); // expected-error{{too many arguments to function call, expected 0, have 1; did you mean 'A::f'?}} } } + +namespace PR20626 { +class A { +public: + void Foo(){}; // expected-note{{'Foo' declared here}} +}; +class B {}; +class C : public A, public B { + void Run() { + B::Foo(); // expected-error{{no member named 'Foo' in 'PR20626::B'; did you mean simply 'Foo'?}} + } +}; +} diff --git a/test/Modules/Inputs/System/usr/include/malloc.h b/test/Modules/Inputs/System/usr/include/malloc.h new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Modules/Inputs/System/usr/include/malloc.h diff --git a/test/Modules/Inputs/System/usr/include/stdlib.h b/test/Modules/Inputs/System/usr/include/stdlib.h new file mode 100644 index 000000000000..a1bf1a8b2945 --- /dev/null +++ b/test/Modules/Inputs/System/usr/include/stdlib.h @@ -0,0 +1 @@ +typedef __SIZE_TYPE__ size_t; diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m index 4b8cb5bdc5d5..f120bcfd9824 100644 --- a/test/Modules/compiler_builtins.m +++ b/test/Modules/compiler_builtins.m @@ -1,6 +1,6 @@ // RUN: rm -rf %t -// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify -// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify +// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -I%S/Inputs/System/usr/include -Xclang -verify +// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -I%S/Inputs/System/usr/include -Xclang -verify // expected-no-diagnostics #ifdef __SSE__ diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 4f321140c6b2..f3a1ba5d6781 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -2997,6 +2997,620 @@ // MIPS32EL:#define _mips 1 // MIPS32EL:#define mips 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding \ +// RUN: -triple=mips64-none-none -target-abi n32 < /dev/null \ +// RUN: | FileCheck -check-prefix MIPSN32BE %s +// +// MIPSN32BE: #define MIPSEB 1 +// MIPSN32BE: #define _ABIN32 2 +// MIPSN32BE: #define _ILP32 1 +// MIPSN32BE: #define _MIPSEB 1 +// MIPSN32BE: #define _MIPS_ARCH "mips64r2" +// MIPSN32BE: #define _MIPS_ARCH_MIPS64R2 1 +// MIPSN32BE: #define _MIPS_FPSET 32 +// MIPSN32BE: #define _MIPS_ISA _MIPS_ISA_MIPS64 +// MIPSN32BE: #define _MIPS_SIM _ABIN32 +// MIPSN32BE: #define _MIPS_SZINT 32 +// MIPSN32BE: #define _MIPS_SZLONG 32 +// MIPSN32BE: #define _MIPS_SZPTR 32 +// MIPSN32BE: #define __ATOMIC_ACQUIRE 2 +// MIPSN32BE: #define __ATOMIC_ACQ_REL 4 +// MIPSN32BE: #define __ATOMIC_CONSUME 1 +// MIPSN32BE: #define __ATOMIC_RELAXED 0 +// MIPSN32BE: #define __ATOMIC_RELEASE 3 +// MIPSN32BE: #define __ATOMIC_SEQ_CST 5 +// MIPSN32BE: #define __BIG_ENDIAN__ 1 +// MIPSN32BE: #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ +// MIPSN32BE: #define __CHAR16_TYPE__ unsigned short +// MIPSN32BE: #define __CHAR32_TYPE__ unsigned int +// MIPSN32BE: #define __CHAR_BIT__ 8 +// MIPSN32BE: #define __CONSTANT_CFSTRINGS__ 1 +// MIPSN32BE: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPSN32BE: #define __DBL_DIG__ 15 +// MIPSN32BE: #define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPSN32BE: #define __DBL_HAS_DENORM__ 1 +// MIPSN32BE: #define __DBL_HAS_INFINITY__ 1 +// MIPSN32BE: #define __DBL_HAS_QUIET_NAN__ 1 +// MIPSN32BE: #define __DBL_MANT_DIG__ 53 +// MIPSN32BE: #define __DBL_MAX_10_EXP__ 308 +// MIPSN32BE: #define __DBL_MAX_EXP__ 1024 +// MIPSN32BE: #define __DBL_MAX__ 1.7976931348623157e+308 +// MIPSN32BE: #define __DBL_MIN_10_EXP__ (-307) +// MIPSN32BE: #define __DBL_MIN_EXP__ (-1021) +// MIPSN32BE: #define __DBL_MIN__ 2.2250738585072014e-308 +// MIPSN32BE: #define __DECIMAL_DIG__ 36 +// MIPSN32BE: #define __FINITE_MATH_ONLY__ 0 +// MIPSN32BE: #define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPSN32BE: #define __FLT_DIG__ 6 +// MIPSN32BE: #define __FLT_EPSILON__ 1.19209290e-7F +// MIPSN32BE: #define __FLT_EVAL_METHOD__ 0 +// MIPSN32BE: #define __FLT_HAS_DENORM__ 1 +// MIPSN32BE: #define __FLT_HAS_INFINITY__ 1 +// MIPSN32BE: #define __FLT_HAS_QUIET_NAN__ 1 +// MIPSN32BE: #define __FLT_MANT_DIG__ 24 +// MIPSN32BE: #define __FLT_MAX_10_EXP__ 38 +// MIPSN32BE: #define __FLT_MAX_EXP__ 128 +// MIPSN32BE: #define __FLT_MAX__ 3.40282347e+38F +// MIPSN32BE: #define __FLT_MIN_10_EXP__ (-37) +// MIPSN32BE: #define __FLT_MIN_EXP__ (-125) +// MIPSN32BE: #define __FLT_MIN__ 1.17549435e-38F +// MIPSN32BE: #define __FLT_RADIX__ 2 +// MIPSN32BE: #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_INT_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_LONG_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +// MIPSN32BE: #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +// MIPSN32BE: #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +// MIPSN32BE: #define __GNUC_MINOR__ 2 +// MIPSN32BE: #define __GNUC_PATCHLEVEL__ 1 +// MIPSN32BE: #define __GNUC_STDC_INLINE__ 1 +// MIPSN32BE: #define __GNUC__ 4 +// MIPSN32BE: #define __GXX_ABI_VERSION 1002 +// MIPSN32BE: #define __GXX_RTTI 1 +// MIPSN32BE: #define __ILP32__ 1 +// MIPSN32BE: #define __INT16_C_SUFFIX__ +// MIPSN32BE: #define __INT16_FMTd__ "hd" +// MIPSN32BE: #define __INT16_FMTi__ "hi" +// MIPSN32BE: #define __INT16_MAX__ 32767 +// MIPSN32BE: #define __INT16_TYPE__ short +// MIPSN32BE: #define __INT32_C_SUFFIX__ +// MIPSN32BE: #define __INT32_FMTd__ "d" +// MIPSN32BE: #define __INT32_FMTi__ "i" +// MIPSN32BE: #define __INT32_MAX__ 2147483647 +// MIPSN32BE: #define __INT32_TYPE__ int +// MIPSN32BE: #define __INT64_C_SUFFIX__ LL +// MIPSN32BE: #define __INT64_FMTd__ "lld" +// MIPSN32BE: #define __INT64_FMTi__ "lli" +// MIPSN32BE: #define __INT64_MAX__ 9223372036854775807LL +// MIPSN32BE: #define __INT64_TYPE__ long long int +// MIPSN32BE: #define __INT8_C_SUFFIX__ +// MIPSN32BE: #define __INT8_FMTd__ "hhd" +// MIPSN32BE: #define __INT8_FMTi__ "hhi" +// MIPSN32BE: #define __INT8_MAX__ 127 +// MIPSN32BE: #define __INT8_TYPE__ signed char +// MIPSN32BE: #define __INTMAX_C_SUFFIX__ LL +// MIPSN32BE: #define __INTMAX_FMTd__ "lld" +// MIPSN32BE: #define __INTMAX_FMTi__ "lli" +// MIPSN32BE: #define __INTMAX_MAX__ 9223372036854775807LL +// MIPSN32BE: #define __INTMAX_TYPE__ long long int +// MIPSN32BE: #define __INTMAX_WIDTH__ 64 +// MIPSN32BE: #define __INTPTR_FMTd__ "ld" +// MIPSN32BE: #define __INTPTR_FMTi__ "li" +// MIPSN32BE: #define __INTPTR_MAX__ 2147483647L +// MIPSN32BE: #define __INTPTR_TYPE__ long int +// MIPSN32BE: #define __INTPTR_WIDTH__ 32 +// MIPSN32BE: #define __INT_FAST16_FMTd__ "hd" +// MIPSN32BE: #define __INT_FAST16_FMTi__ "hi" +// MIPSN32BE: #define __INT_FAST16_MAX__ 32767 +// MIPSN32BE: #define __INT_FAST16_TYPE__ short +// MIPSN32BE: #define __INT_FAST32_FMTd__ "d" +// MIPSN32BE: #define __INT_FAST32_FMTi__ "i" +// MIPSN32BE: #define __INT_FAST32_MAX__ 2147483647 +// MIPSN32BE: #define __INT_FAST32_TYPE__ int +// MIPSN32BE: #define __INT_FAST64_FMTd__ "lld" +// MIPSN32BE: #define __INT_FAST64_FMTi__ "lli" +// MIPSN32BE: #define __INT_FAST64_MAX__ 9223372036854775807LL +// MIPSN32BE: #define __INT_FAST64_TYPE__ long long int +// MIPSN32BE: #define __INT_FAST8_FMTd__ "hhd" +// MIPSN32BE: #define __INT_FAST8_FMTi__ "hhi" +// MIPSN32BE: #define __INT_FAST8_MAX__ 127 +// MIPSN32BE: #define __INT_FAST8_TYPE__ signed char +// MIPSN32BE: #define __INT_LEAST16_FMTd__ "hd" +// MIPSN32BE: #define __INT_LEAST16_FMTi__ "hi" +// MIPSN32BE: #define __INT_LEAST16_MAX__ 32767 +// MIPSN32BE: #define __INT_LEAST16_TYPE__ short +// MIPSN32BE: #define __INT_LEAST32_FMTd__ "d" +// MIPSN32BE: #define __INT_LEAST32_FMTi__ "i" +// MIPSN32BE: #define __INT_LEAST32_MAX__ 2147483647 +// MIPSN32BE: #define __INT_LEAST32_TYPE__ int +// MIPSN32BE: #define __INT_LEAST64_FMTd__ "lld" +// MIPSN32BE: #define __INT_LEAST64_FMTi__ "lli" +// MIPSN32BE: #define __INT_LEAST64_MAX__ 9223372036854775807LL +// MIPSN32BE: #define __INT_LEAST64_TYPE__ long long int +// MIPSN32BE: #define __INT_LEAST8_FMTd__ "hhd" +// MIPSN32BE: #define __INT_LEAST8_FMTi__ "hhi" +// MIPSN32BE: #define __INT_LEAST8_MAX__ 127 +// MIPSN32BE: #define __INT_LEAST8_TYPE__ signed char +// MIPSN32BE: #define __INT_MAX__ 2147483647 +// MIPSN32BE: #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L +// MIPSN32BE: #define __LDBL_DIG__ 33 +// MIPSN32BE: #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L +// MIPSN32BE: #define __LDBL_HAS_DENORM__ 1 +// MIPSN32BE: #define __LDBL_HAS_INFINITY__ 1 +// MIPSN32BE: #define __LDBL_HAS_QUIET_NAN__ 1 +// MIPSN32BE: #define __LDBL_MANT_DIG__ 113 +// MIPSN32BE: #define __LDBL_MAX_10_EXP__ 4932 +// MIPSN32BE: #define __LDBL_MAX_EXP__ 16384 +// MIPSN32BE: #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L +// MIPSN32BE: #define __LDBL_MIN_10_EXP__ (-4931) +// MIPSN32BE: #define __LDBL_MIN_EXP__ (-16381) +// MIPSN32BE: #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +// MIPSN32BE: #define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPSN32BE: #define __LONG_MAX__ 2147483647L +// MIPSN32BE: #define __MIPSEB 1 +// MIPSN32BE: #define __MIPSEB__ 1 +// MIPSN32BE: #define __NO_INLINE__ 1 +// MIPSN32BE: #define __ORDER_BIG_ENDIAN__ 4321 +// MIPSN32BE: #define __ORDER_LITTLE_ENDIAN__ 1234 +// MIPSN32BE: #define __ORDER_PDP_ENDIAN__ 3412 +// MIPSN32BE: #define __POINTER_WIDTH__ 32 +// MIPSN32BE: #define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPSN32BE: #define __PTRDIFF_FMTd__ "d" +// MIPSN32BE: #define __PTRDIFF_FMTi__ "i" +// MIPSN32BE: #define __PTRDIFF_MAX__ 2147483647 +// MIPSN32BE: #define __PTRDIFF_TYPE__ int +// MIPSN32BE: #define __PTRDIFF_WIDTH__ 32 +// MIPSN32BE: #define __REGISTER_PREFIX__ +// MIPSN32BE: #define __SCHAR_MAX__ 127 +// MIPSN32BE: #define __SHRT_MAX__ 32767 +// MIPSN32BE: #define __SIG_ATOMIC_MAX__ 2147483647 +// MIPSN32BE: #define __SIG_ATOMIC_WIDTH__ 32 +// MIPSN32BE: #define __SIZEOF_DOUBLE__ 8 +// MIPSN32BE: #define __SIZEOF_FLOAT__ 4 +// MIPSN32BE: #define __SIZEOF_INT__ 4 +// MIPSN32BE: #define __SIZEOF_LONG_DOUBLE__ 16 +// MIPSN32BE: #define __SIZEOF_LONG_LONG__ 8 +// MIPSN32BE: #define __SIZEOF_LONG__ 4 +// MIPSN32BE: #define __SIZEOF_POINTER__ 4 +// MIPSN32BE: #define __SIZEOF_PTRDIFF_T__ 4 +// MIPSN32BE: #define __SIZEOF_SHORT__ 2 +// MIPSN32BE: #define __SIZEOF_SIZE_T__ 4 +// MIPSN32BE: #define __SIZEOF_WCHAR_T__ 4 +// MIPSN32BE: #define __SIZEOF_WINT_T__ 4 +// MIPSN32BE: #define __SIZE_FMTX__ "X" +// MIPSN32BE: #define __SIZE_FMTo__ "o" +// MIPSN32BE: #define __SIZE_FMTu__ "u" +// MIPSN32BE: #define __SIZE_FMTx__ "x" +// MIPSN32BE: #define __SIZE_MAX__ 4294967295U +// MIPSN32BE: #define __SIZE_TYPE__ unsigned int +// MIPSN32BE: #define __SIZE_WIDTH__ 32 +// MIPSN32BE: #define __STDC_HOSTED__ 0 +// MIPSN32BE: #define __STDC_UTF_16__ 1 +// MIPSN32BE: #define __STDC_UTF_32__ 1 +// MIPSN32BE: #define __STDC_VERSION__ 201112L +// MIPSN32BE: #define __STDC__ 1 +// MIPSN32BE: #define __UINT16_C_SUFFIX__ +// MIPSN32BE: #define __UINT16_FMTX__ "hX" +// MIPSN32BE: #define __UINT16_FMTo__ "ho" +// MIPSN32BE: #define __UINT16_FMTu__ "hu" +// MIPSN32BE: #define __UINT16_FMTx__ "hx" +// MIPSN32BE: #define __UINT16_MAX__ 65535 +// MIPSN32BE: #define __UINT16_TYPE__ unsigned short +// MIPSN32BE: #define __UINT32_C_SUFFIX__ U +// MIPSN32BE: #define __UINT32_FMTX__ "X" +// MIPSN32BE: #define __UINT32_FMTo__ "o" +// MIPSN32BE: #define __UINT32_FMTu__ "u" +// MIPSN32BE: #define __UINT32_FMTx__ "x" +// MIPSN32BE: #define __UINT32_MAX__ 4294967295U +// MIPSN32BE: #define __UINT32_TYPE__ unsigned int +// MIPSN32BE: #define __UINT64_C_SUFFIX__ ULL +// MIPSN32BE: #define __UINT64_FMTX__ "llX" +// MIPSN32BE: #define __UINT64_FMTo__ "llo" +// MIPSN32BE: #define __UINT64_FMTu__ "llu" +// MIPSN32BE: #define __UINT64_FMTx__ "llx" +// MIPSN32BE: #define __UINT64_MAX__ 18446744073709551615ULL +// MIPSN32BE: #define __UINT64_TYPE__ long long unsigned int +// MIPSN32BE: #define __UINT8_C_SUFFIX__ +// MIPSN32BE: #define __UINT8_FMTX__ "hhX" +// MIPSN32BE: #define __UINT8_FMTo__ "hho" +// MIPSN32BE: #define __UINT8_FMTu__ "hhu" +// MIPSN32BE: #define __UINT8_FMTx__ "hhx" +// MIPSN32BE: #define __UINT8_MAX__ 255 +// MIPSN32BE: #define __UINT8_TYPE__ unsigned char +// MIPSN32BE: #define __UINTMAX_C_SUFFIX__ ULL +// MIPSN32BE: #define __UINTMAX_FMTX__ "llX" +// MIPSN32BE: #define __UINTMAX_FMTo__ "llo" +// MIPSN32BE: #define __UINTMAX_FMTu__ "llu" +// MIPSN32BE: #define __UINTMAX_FMTx__ "llx" +// MIPSN32BE: #define __UINTMAX_MAX__ 18446744073709551615ULL +// MIPSN32BE: #define __UINTMAX_TYPE__ long long unsigned int +// MIPSN32BE: #define __UINTMAX_WIDTH__ 64 +// MIPSN32BE: #define __UINTPTR_FMTX__ "lX" +// MIPSN32BE: #define __UINTPTR_FMTo__ "lo" +// MIPSN32BE: #define __UINTPTR_FMTu__ "lu" +// MIPSN32BE: #define __UINTPTR_FMTx__ "lx" +// MIPSN32BE: #define __UINTPTR_MAX__ 4294967295UL +// MIPSN32BE: #define __UINTPTR_TYPE__ long unsigned int +// MIPSN32BE: #define __UINTPTR_WIDTH__ 32 +// MIPSN32BE: #define __UINT_FAST16_FMTX__ "hX" +// MIPSN32BE: #define __UINT_FAST16_FMTo__ "ho" +// MIPSN32BE: #define __UINT_FAST16_FMTu__ "hu" +// MIPSN32BE: #define __UINT_FAST16_FMTx__ "hx" +// MIPSN32BE: #define __UINT_FAST16_MAX__ 65535 +// MIPSN32BE: #define __UINT_FAST16_TYPE__ unsigned short +// MIPSN32BE: #define __UINT_FAST32_FMTX__ "X" +// MIPSN32BE: #define __UINT_FAST32_FMTo__ "o" +// MIPSN32BE: #define __UINT_FAST32_FMTu__ "u" +// MIPSN32BE: #define __UINT_FAST32_FMTx__ "x" +// MIPSN32BE: #define __UINT_FAST32_MAX__ 4294967295U +// MIPSN32BE: #define __UINT_FAST32_TYPE__ unsigned int +// MIPSN32BE: #define __UINT_FAST64_FMTX__ "llX" +// MIPSN32BE: #define __UINT_FAST64_FMTo__ "llo" +// MIPSN32BE: #define __UINT_FAST64_FMTu__ "llu" +// MIPSN32BE: #define __UINT_FAST64_FMTx__ "llx" +// MIPSN32BE: #define __UINT_FAST64_MAX__ 18446744073709551615ULL +// MIPSN32BE: #define __UINT_FAST64_TYPE__ long long unsigned int +// MIPSN32BE: #define __UINT_FAST8_FMTX__ "hhX" +// MIPSN32BE: #define __UINT_FAST8_FMTo__ "hho" +// MIPSN32BE: #define __UINT_FAST8_FMTu__ "hhu" +// MIPSN32BE: #define __UINT_FAST8_FMTx__ "hhx" +// MIPSN32BE: #define __UINT_FAST8_MAX__ 255 +// MIPSN32BE: #define __UINT_FAST8_TYPE__ unsigned char +// MIPSN32BE: #define __UINT_LEAST16_FMTX__ "hX" +// MIPSN32BE: #define __UINT_LEAST16_FMTo__ "ho" +// MIPSN32BE: #define __UINT_LEAST16_FMTu__ "hu" +// MIPSN32BE: #define __UINT_LEAST16_FMTx__ "hx" +// MIPSN32BE: #define __UINT_LEAST16_MAX__ 65535 +// MIPSN32BE: #define __UINT_LEAST16_TYPE__ unsigned short +// MIPSN32BE: #define __UINT_LEAST32_FMTX__ "X" +// MIPSN32BE: #define __UINT_LEAST32_FMTo__ "o" +// MIPSN32BE: #define __UINT_LEAST32_FMTu__ "u" +// MIPSN32BE: #define __UINT_LEAST32_FMTx__ "x" +// MIPSN32BE: #define __UINT_LEAST32_MAX__ 4294967295U +// MIPSN32BE: #define __UINT_LEAST32_TYPE__ unsigned int +// MIPSN32BE: #define __UINT_LEAST64_FMTX__ "llX" +// MIPSN32BE: #define __UINT_LEAST64_FMTo__ "llo" +// MIPSN32BE: #define __UINT_LEAST64_FMTu__ "llu" +// MIPSN32BE: #define __UINT_LEAST64_FMTx__ "llx" +// MIPSN32BE: #define __UINT_LEAST64_MAX__ 18446744073709551615ULL +// MIPSN32BE: #define __UINT_LEAST64_TYPE__ long long unsigned int +// MIPSN32BE: #define __UINT_LEAST8_FMTX__ "hhX" +// MIPSN32BE: #define __UINT_LEAST8_FMTo__ "hho" +// MIPSN32BE: #define __UINT_LEAST8_FMTu__ "hhu" +// 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 __WCHAR_MAX__ 2147483647 +// MIPSN32BE: #define __WCHAR_TYPE__ int +// MIPSN32BE: #define __WCHAR_WIDTH__ 32 +// MIPSN32BE: #define __WINT_TYPE__ int +// MIPSN32BE: #define __WINT_WIDTH__ 32 +// MIPSN32BE: #define __clang__ 1 +// MIPSN32BE: #define __llvm__ 1 +// MIPSN32BE: #define __mips 64 +// MIPSN32BE: #define __mips64 1 +// MIPSN32BE: #define __mips64__ 1 +// MIPSN32BE: #define __mips__ 1 +// MIPSN32BE: #define __mips_fpr 64 +// MIPSN32BE: #define __mips_hard_float 1 +// MIPSN32BE: #define __mips_isa_rev 2 +// MIPSN32BE: #define __mips_n32 1 +// MIPSN32BE: #define _mips 1 +// MIPSN32BE: #define mips 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding \ +// RUN: -triple=mips64el-none-none -target-abi n32 < /dev/null \ +// RUN: | FileCheck -check-prefix MIPSN32EL %s +// +// MIPSN32EL: #define MIPSEL 1 +// MIPSN32EL: #define _ABIN32 2 +// MIPSN32EL: #define _ILP32 1 +// MIPSN32EL: #define _MIPSEL 1 +// MIPSN32EL: #define _MIPS_ARCH "mips64r2" +// MIPSN32EL: #define _MIPS_ARCH_MIPS64R2 1 +// MIPSN32EL: #define _MIPS_FPSET 32 +// MIPSN32EL: #define _MIPS_ISA _MIPS_ISA_MIPS64 +// MIPSN32EL: #define _MIPS_SIM _ABIN32 +// MIPSN32EL: #define _MIPS_SZINT 32 +// MIPSN32EL: #define _MIPS_SZLONG 32 +// MIPSN32EL: #define _MIPS_SZPTR 32 +// MIPSN32EL: #define __ATOMIC_ACQUIRE 2 +// MIPSN32EL: #define __ATOMIC_ACQ_REL 4 +// MIPSN32EL: #define __ATOMIC_CONSUME 1 +// MIPSN32EL: #define __ATOMIC_RELAXED 0 +// MIPSN32EL: #define __ATOMIC_RELEASE 3 +// MIPSN32EL: #define __ATOMIC_SEQ_CST 5 +// MIPSN32EL: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// MIPSN32EL: #define __CHAR16_TYPE__ unsigned short +// MIPSN32EL: #define __CHAR32_TYPE__ unsigned int +// MIPSN32EL: #define __CHAR_BIT__ 8 +// MIPSN32EL: #define __CONSTANT_CFSTRINGS__ 1 +// MIPSN32EL: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MIPSN32EL: #define __DBL_DIG__ 15 +// MIPSN32EL: #define __DBL_EPSILON__ 2.2204460492503131e-16 +// MIPSN32EL: #define __DBL_HAS_DENORM__ 1 +// MIPSN32EL: #define __DBL_HAS_INFINITY__ 1 +// MIPSN32EL: #define __DBL_HAS_QUIET_NAN__ 1 +// MIPSN32EL: #define __DBL_MANT_DIG__ 53 +// MIPSN32EL: #define __DBL_MAX_10_EXP__ 308 +// MIPSN32EL: #define __DBL_MAX_EXP__ 1024 +// MIPSN32EL: #define __DBL_MAX__ 1.7976931348623157e+308 +// MIPSN32EL: #define __DBL_MIN_10_EXP__ (-307) +// MIPSN32EL: #define __DBL_MIN_EXP__ (-1021) +// MIPSN32EL: #define __DBL_MIN__ 2.2250738585072014e-308 +// MIPSN32EL: #define __DECIMAL_DIG__ 36 +// MIPSN32EL: #define __FINITE_MATH_ONLY__ 0 +// MIPSN32EL: #define __FLT_DENORM_MIN__ 1.40129846e-45F +// MIPSN32EL: #define __FLT_DIG__ 6 +// MIPSN32EL: #define __FLT_EPSILON__ 1.19209290e-7F +// MIPSN32EL: #define __FLT_EVAL_METHOD__ 0 +// MIPSN32EL: #define __FLT_HAS_DENORM__ 1 +// MIPSN32EL: #define __FLT_HAS_INFINITY__ 1 +// MIPSN32EL: #define __FLT_HAS_QUIET_NAN__ 1 +// MIPSN32EL: #define __FLT_MANT_DIG__ 24 +// MIPSN32EL: #define __FLT_MAX_10_EXP__ 38 +// MIPSN32EL: #define __FLT_MAX_EXP__ 128 +// MIPSN32EL: #define __FLT_MAX__ 3.40282347e+38F +// MIPSN32EL: #define __FLT_MIN_10_EXP__ (-37) +// MIPSN32EL: #define __FLT_MIN_EXP__ (-125) +// MIPSN32EL: #define __FLT_MIN__ 1.17549435e-38F +// MIPSN32EL: #define __FLT_RADIX__ 2 +// MIPSN32EL: #define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_INT_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_LONG_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +// MIPSN32EL: #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +// MIPSN32EL: #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +// MIPSN32EL: #define __GNUC_MINOR__ 2 +// MIPSN32EL: #define __GNUC_PATCHLEVEL__ 1 +// MIPSN32EL: #define __GNUC_STDC_INLINE__ 1 +// MIPSN32EL: #define __GNUC__ 4 +// MIPSN32EL: #define __GXX_ABI_VERSION 1002 +// MIPSN32EL: #define __GXX_RTTI 1 +// MIPSN32EL: #define __ILP32__ 1 +// MIPSN32EL: #define __INT16_C_SUFFIX__ +// MIPSN32EL: #define __INT16_FMTd__ "hd" +// MIPSN32EL: #define __INT16_FMTi__ "hi" +// MIPSN32EL: #define __INT16_MAX__ 32767 +// MIPSN32EL: #define __INT16_TYPE__ short +// MIPSN32EL: #define __INT32_C_SUFFIX__ +// MIPSN32EL: #define __INT32_FMTd__ "d" +// MIPSN32EL: #define __INT32_FMTi__ "i" +// MIPSN32EL: #define __INT32_MAX__ 2147483647 +// MIPSN32EL: #define __INT32_TYPE__ int +// MIPSN32EL: #define __INT64_C_SUFFIX__ LL +// MIPSN32EL: #define __INT64_FMTd__ "lld" +// MIPSN32EL: #define __INT64_FMTi__ "lli" +// MIPSN32EL: #define __INT64_MAX__ 9223372036854775807LL +// MIPSN32EL: #define __INT64_TYPE__ long long int +// MIPSN32EL: #define __INT8_C_SUFFIX__ +// MIPSN32EL: #define __INT8_FMTd__ "hhd" +// MIPSN32EL: #define __INT8_FMTi__ "hhi" +// MIPSN32EL: #define __INT8_MAX__ 127 +// MIPSN32EL: #define __INT8_TYPE__ signed char +// MIPSN32EL: #define __INTMAX_C_SUFFIX__ LL +// MIPSN32EL: #define __INTMAX_FMTd__ "lld" +// MIPSN32EL: #define __INTMAX_FMTi__ "lli" +// MIPSN32EL: #define __INTMAX_MAX__ 9223372036854775807LL +// MIPSN32EL: #define __INTMAX_TYPE__ long long int +// MIPSN32EL: #define __INTMAX_WIDTH__ 64 +// MIPSN32EL: #define __INTPTR_FMTd__ "ld" +// MIPSN32EL: #define __INTPTR_FMTi__ "li" +// MIPSN32EL: #define __INTPTR_MAX__ 2147483647L +// MIPSN32EL: #define __INTPTR_TYPE__ long int +// MIPSN32EL: #define __INTPTR_WIDTH__ 32 +// MIPSN32EL: #define __INT_FAST16_FMTd__ "hd" +// MIPSN32EL: #define __INT_FAST16_FMTi__ "hi" +// MIPSN32EL: #define __INT_FAST16_MAX__ 32767 +// MIPSN32EL: #define __INT_FAST16_TYPE__ short +// MIPSN32EL: #define __INT_FAST32_FMTd__ "d" +// MIPSN32EL: #define __INT_FAST32_FMTi__ "i" +// MIPSN32EL: #define __INT_FAST32_MAX__ 2147483647 +// MIPSN32EL: #define __INT_FAST32_TYPE__ int +// MIPSN32EL: #define __INT_FAST64_FMTd__ "lld" +// MIPSN32EL: #define __INT_FAST64_FMTi__ "lli" +// MIPSN32EL: #define __INT_FAST64_MAX__ 9223372036854775807LL +// MIPSN32EL: #define __INT_FAST64_TYPE__ long long int +// MIPSN32EL: #define __INT_FAST8_FMTd__ "hhd" +// MIPSN32EL: #define __INT_FAST8_FMTi__ "hhi" +// MIPSN32EL: #define __INT_FAST8_MAX__ 127 +// MIPSN32EL: #define __INT_FAST8_TYPE__ signed char +// MIPSN32EL: #define __INT_LEAST16_FMTd__ "hd" +// MIPSN32EL: #define __INT_LEAST16_FMTi__ "hi" +// MIPSN32EL: #define __INT_LEAST16_MAX__ 32767 +// MIPSN32EL: #define __INT_LEAST16_TYPE__ short +// MIPSN32EL: #define __INT_LEAST32_FMTd__ "d" +// MIPSN32EL: #define __INT_LEAST32_FMTi__ "i" +// MIPSN32EL: #define __INT_LEAST32_MAX__ 2147483647 +// MIPSN32EL: #define __INT_LEAST32_TYPE__ int +// MIPSN32EL: #define __INT_LEAST64_FMTd__ "lld" +// MIPSN32EL: #define __INT_LEAST64_FMTi__ "lli" +// MIPSN32EL: #define __INT_LEAST64_MAX__ 9223372036854775807LL +// MIPSN32EL: #define __INT_LEAST64_TYPE__ long long int +// MIPSN32EL: #define __INT_LEAST8_FMTd__ "hhd" +// MIPSN32EL: #define __INT_LEAST8_FMTi__ "hhi" +// MIPSN32EL: #define __INT_LEAST8_MAX__ 127 +// MIPSN32EL: #define __INT_LEAST8_TYPE__ signed char +// MIPSN32EL: #define __INT_MAX__ 2147483647 +// MIPSN32EL: #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L +// MIPSN32EL: #define __LDBL_DIG__ 33 +// MIPSN32EL: #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L +// MIPSN32EL: #define __LDBL_HAS_DENORM__ 1 +// MIPSN32EL: #define __LDBL_HAS_INFINITY__ 1 +// MIPSN32EL: #define __LDBL_HAS_QUIET_NAN__ 1 +// MIPSN32EL: #define __LDBL_MANT_DIG__ 113 +// MIPSN32EL: #define __LDBL_MAX_10_EXP__ 4932 +// MIPSN32EL: #define __LDBL_MAX_EXP__ 16384 +// MIPSN32EL: #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L +// MIPSN32EL: #define __LDBL_MIN_10_EXP__ (-4931) +// MIPSN32EL: #define __LDBL_MIN_EXP__ (-16381) +// MIPSN32EL: #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +// MIPSN32EL: #define __LITTLE_ENDIAN__ 1 +// MIPSN32EL: #define __LONG_LONG_MAX__ 9223372036854775807LL +// MIPSN32EL: #define __LONG_MAX__ 2147483647L +// MIPSN32EL: #define __MIPSEL 1 +// MIPSN32EL: #define __MIPSEL__ 1 +// MIPSN32EL: #define __NO_INLINE__ 1 +// MIPSN32EL: #define __ORDER_BIG_ENDIAN__ 4321 +// MIPSN32EL: #define __ORDER_LITTLE_ENDIAN__ 1234 +// MIPSN32EL: #define __ORDER_PDP_ENDIAN__ 3412 +// MIPSN32EL: #define __POINTER_WIDTH__ 32 +// MIPSN32EL: #define __PRAGMA_REDEFINE_EXTNAME 1 +// MIPSN32EL: #define __PTRDIFF_FMTd__ "d" +// MIPSN32EL: #define __PTRDIFF_FMTi__ "i" +// MIPSN32EL: #define __PTRDIFF_MAX__ 2147483647 +// MIPSN32EL: #define __PTRDIFF_TYPE__ int +// MIPSN32EL: #define __PTRDIFF_WIDTH__ 32 +// MIPSN32EL: #define __REGISTER_PREFIX__ +// MIPSN32EL: #define __SCHAR_MAX__ 127 +// MIPSN32EL: #define __SHRT_MAX__ 32767 +// MIPSN32EL: #define __SIG_ATOMIC_MAX__ 2147483647 +// MIPSN32EL: #define __SIG_ATOMIC_WIDTH__ 32 +// MIPSN32EL: #define __SIZEOF_DOUBLE__ 8 +// MIPSN32EL: #define __SIZEOF_FLOAT__ 4 +// MIPSN32EL: #define __SIZEOF_INT__ 4 +// MIPSN32EL: #define __SIZEOF_LONG_DOUBLE__ 16 +// MIPSN32EL: #define __SIZEOF_LONG_LONG__ 8 +// MIPSN32EL: #define __SIZEOF_LONG__ 4 +// MIPSN32EL: #define __SIZEOF_POINTER__ 4 +// MIPSN32EL: #define __SIZEOF_PTRDIFF_T__ 4 +// MIPSN32EL: #define __SIZEOF_SHORT__ 2 +// MIPSN32EL: #define __SIZEOF_SIZE_T__ 4 +// MIPSN32EL: #define __SIZEOF_WCHAR_T__ 4 +// MIPSN32EL: #define __SIZEOF_WINT_T__ 4 +// MIPSN32EL: #define __SIZE_FMTX__ "X" +// MIPSN32EL: #define __SIZE_FMTo__ "o" +// MIPSN32EL: #define __SIZE_FMTu__ "u" +// MIPSN32EL: #define __SIZE_FMTx__ "x" +// MIPSN32EL: #define __SIZE_MAX__ 4294967295U +// MIPSN32EL: #define __SIZE_TYPE__ unsigned int +// MIPSN32EL: #define __SIZE_WIDTH__ 32 +// MIPSN32EL: #define __STDC_HOSTED__ 0 +// MIPSN32EL: #define __STDC_UTF_16__ 1 +// MIPSN32EL: #define __STDC_UTF_32__ 1 +// MIPSN32EL: #define __STDC_VERSION__ 201112L +// MIPSN32EL: #define __STDC__ 1 +// MIPSN32EL: #define __UINT16_C_SUFFIX__ +// MIPSN32EL: #define __UINT16_FMTX__ "hX" +// MIPSN32EL: #define __UINT16_FMTo__ "ho" +// MIPSN32EL: #define __UINT16_FMTu__ "hu" +// MIPSN32EL: #define __UINT16_FMTx__ "hx" +// MIPSN32EL: #define __UINT16_MAX__ 65535 +// MIPSN32EL: #define __UINT16_TYPE__ unsigned short +// MIPSN32EL: #define __UINT32_C_SUFFIX__ U +// MIPSN32EL: #define __UINT32_FMTX__ "X" +// MIPSN32EL: #define __UINT32_FMTo__ "o" +// MIPSN32EL: #define __UINT32_FMTu__ "u" +// MIPSN32EL: #define __UINT32_FMTx__ "x" +// MIPSN32EL: #define __UINT32_MAX__ 4294967295U +// MIPSN32EL: #define __UINT32_TYPE__ unsigned int +// MIPSN32EL: #define __UINT64_C_SUFFIX__ ULL +// MIPSN32EL: #define __UINT64_FMTX__ "llX" +// MIPSN32EL: #define __UINT64_FMTo__ "llo" +// MIPSN32EL: #define __UINT64_FMTu__ "llu" +// MIPSN32EL: #define __UINT64_FMTx__ "llx" +// MIPSN32EL: #define __UINT64_MAX__ 18446744073709551615ULL +// MIPSN32EL: #define __UINT64_TYPE__ long long unsigned int +// MIPSN32EL: #define __UINT8_C_SUFFIX__ +// MIPSN32EL: #define __UINT8_FMTX__ "hhX" +// MIPSN32EL: #define __UINT8_FMTo__ "hho" +// MIPSN32EL: #define __UINT8_FMTu__ "hhu" +// MIPSN32EL: #define __UINT8_FMTx__ "hhx" +// MIPSN32EL: #define __UINT8_MAX__ 255 +// MIPSN32EL: #define __UINT8_TYPE__ unsigned char +// MIPSN32EL: #define __UINTMAX_C_SUFFIX__ ULL +// MIPSN32EL: #define __UINTMAX_FMTX__ "llX" +// MIPSN32EL: #define __UINTMAX_FMTo__ "llo" +// MIPSN32EL: #define __UINTMAX_FMTu__ "llu" +// MIPSN32EL: #define __UINTMAX_FMTx__ "llx" +// MIPSN32EL: #define __UINTMAX_MAX__ 18446744073709551615ULL +// MIPSN32EL: #define __UINTMAX_TYPE__ long long unsigned int +// MIPSN32EL: #define __UINTMAX_WIDTH__ 64 +// MIPSN32EL: #define __UINTPTR_FMTX__ "lX" +// MIPSN32EL: #define __UINTPTR_FMTo__ "lo" +// MIPSN32EL: #define __UINTPTR_FMTu__ "lu" +// MIPSN32EL: #define __UINTPTR_FMTx__ "lx" +// MIPSN32EL: #define __UINTPTR_MAX__ 4294967295UL +// MIPSN32EL: #define __UINTPTR_TYPE__ long unsigned int +// MIPSN32EL: #define __UINTPTR_WIDTH__ 32 +// MIPSN32EL: #define __UINT_FAST16_FMTX__ "hX" +// MIPSN32EL: #define __UINT_FAST16_FMTo__ "ho" +// MIPSN32EL: #define __UINT_FAST16_FMTu__ "hu" +// MIPSN32EL: #define __UINT_FAST16_FMTx__ "hx" +// MIPSN32EL: #define __UINT_FAST16_MAX__ 65535 +// MIPSN32EL: #define __UINT_FAST16_TYPE__ unsigned short +// MIPSN32EL: #define __UINT_FAST32_FMTX__ "X" +// MIPSN32EL: #define __UINT_FAST32_FMTo__ "o" +// MIPSN32EL: #define __UINT_FAST32_FMTu__ "u" +// MIPSN32EL: #define __UINT_FAST32_FMTx__ "x" +// MIPSN32EL: #define __UINT_FAST32_MAX__ 4294967295U +// MIPSN32EL: #define __UINT_FAST32_TYPE__ unsigned int +// MIPSN32EL: #define __UINT_FAST64_FMTX__ "llX" +// MIPSN32EL: #define __UINT_FAST64_FMTo__ "llo" +// MIPSN32EL: #define __UINT_FAST64_FMTu__ "llu" +// MIPSN32EL: #define __UINT_FAST64_FMTx__ "llx" +// MIPSN32EL: #define __UINT_FAST64_MAX__ 18446744073709551615ULL +// MIPSN32EL: #define __UINT_FAST64_TYPE__ long long unsigned int +// MIPSN32EL: #define __UINT_FAST8_FMTX__ "hhX" +// MIPSN32EL: #define __UINT_FAST8_FMTo__ "hho" +// MIPSN32EL: #define __UINT_FAST8_FMTu__ "hhu" +// MIPSN32EL: #define __UINT_FAST8_FMTx__ "hhx" +// MIPSN32EL: #define __UINT_FAST8_MAX__ 255 +// MIPSN32EL: #define __UINT_FAST8_TYPE__ unsigned char +// MIPSN32EL: #define __UINT_LEAST16_FMTX__ "hX" +// MIPSN32EL: #define __UINT_LEAST16_FMTo__ "ho" +// MIPSN32EL: #define __UINT_LEAST16_FMTu__ "hu" +// MIPSN32EL: #define __UINT_LEAST16_FMTx__ "hx" +// MIPSN32EL: #define __UINT_LEAST16_MAX__ 65535 +// MIPSN32EL: #define __UINT_LEAST16_TYPE__ unsigned short +// MIPSN32EL: #define __UINT_LEAST32_FMTX__ "X" +// MIPSN32EL: #define __UINT_LEAST32_FMTo__ "o" +// MIPSN32EL: #define __UINT_LEAST32_FMTu__ "u" +// MIPSN32EL: #define __UINT_LEAST32_FMTx__ "x" +// MIPSN32EL: #define __UINT_LEAST32_MAX__ 4294967295U +// MIPSN32EL: #define __UINT_LEAST32_TYPE__ unsigned int +// MIPSN32EL: #define __UINT_LEAST64_FMTX__ "llX" +// MIPSN32EL: #define __UINT_LEAST64_FMTo__ "llo" +// MIPSN32EL: #define __UINT_LEAST64_FMTu__ "llu" +// MIPSN32EL: #define __UINT_LEAST64_FMTx__ "llx" +// MIPSN32EL: #define __UINT_LEAST64_MAX__ 18446744073709551615ULL +// MIPSN32EL: #define __UINT_LEAST64_TYPE__ long long unsigned int +// MIPSN32EL: #define __UINT_LEAST8_FMTX__ "hhX" +// MIPSN32EL: #define __UINT_LEAST8_FMTo__ "hho" +// MIPSN32EL: #define __UINT_LEAST8_FMTu__ "hhu" +// 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 __WCHAR_MAX__ 2147483647 +// MIPSN32EL: #define __WCHAR_TYPE__ int +// MIPSN32EL: #define __WCHAR_WIDTH__ 32 +// MIPSN32EL: #define __WINT_TYPE__ int +// MIPSN32EL: #define __WINT_WIDTH__ 32 +// MIPSN32EL: #define __clang__ 1 +// MIPSN32EL: #define __llvm__ 1 +// MIPSN32EL: #define __mips 64 +// MIPSN32EL: #define __mips64 1 +// MIPSN32EL: #define __mips64__ 1 +// MIPSN32EL: #define __mips__ 1 +// MIPSN32EL: #define __mips_fpr 64 +// MIPSN32EL: #define __mips_hard_float 1 +// MIPSN32EL: #define __mips_isa_rev 2 +// MIPSN32EL: #define __mips_n32 1 +// MIPSN32EL: #define _mips 1 +// MIPSN32EL: #define mips 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-none-none < /dev/null | FileCheck -check-prefix MIPS64BE %s // // MIPS64BE:#define MIPSEB 1 @@ -3055,21 +3669,21 @@ // MIPS64BE:#define __INT32_FMTi__ "i" // MIPS64BE:#define __INT32_MAX__ 2147483647 // MIPS64BE:#define __INT32_TYPE__ int -// MIPS64BE:#define __INT64_C_SUFFIX__ LL -// MIPS64BE:#define __INT64_FMTd__ "lld" -// MIPS64BE:#define __INT64_FMTi__ "lli" +// MIPS64BE:#define __INT64_C_SUFFIX__ L +// MIPS64BE:#define __INT64_FMTd__ "ld" +// MIPS64BE:#define __INT64_FMTi__ "li" // MIPS64BE:#define __INT64_MAX__ 9223372036854775807L -// MIPS64BE:#define __INT64_TYPE__ long long int +// MIPS64BE:#define __INT64_TYPE__ long int // MIPS64BE:#define __INT8_C_SUFFIX__ {{$}} // MIPS64BE:#define __INT8_FMTd__ "hhd" // MIPS64BE:#define __INT8_FMTi__ "hhi" // MIPS64BE:#define __INT8_MAX__ 127 // MIPS64BE:#define __INT8_TYPE__ signed char -// MIPS64BE:#define __INTMAX_C_SUFFIX__ LL -// MIPS64BE:#define __INTMAX_FMTd__ "lld" -// MIPS64BE:#define __INTMAX_FMTi__ "lli" -// MIPS64BE:#define __INTMAX_MAX__ 9223372036854775807LL -// MIPS64BE:#define __INTMAX_TYPE__ long long int +// MIPS64BE:#define __INTMAX_C_SUFFIX__ L +// MIPS64BE:#define __INTMAX_FMTd__ "ld" +// MIPS64BE:#define __INTMAX_FMTi__ "li" +// MIPS64BE:#define __INTMAX_MAX__ 9223372036854775807L +// MIPS64BE:#define __INTMAX_TYPE__ long int // MIPS64BE:#define __INTMAX_WIDTH__ 64 // MIPS64BE:#define __INTPTR_FMTd__ "ld" // MIPS64BE:#define __INTPTR_FMTi__ "li" @@ -3158,15 +3772,15 @@ // MIPS64BE:#define __UINT32_C_SUFFIX__ U // MIPS64BE:#define __UINT32_MAX__ 4294967295U // MIPS64BE:#define __UINT32_TYPE__ unsigned int -// MIPS64BE:#define __UINT64_C_SUFFIX__ ULL -// MIPS64BE:#define __UINT64_MAX__ 18446744073709551615ULL -// MIPS64BE:#define __UINT64_TYPE__ long long unsigned int +// MIPS64BE:#define __UINT64_C_SUFFIX__ UL +// MIPS64BE:#define __UINT64_MAX__ 18446744073709551615UL +// MIPS64BE:#define __UINT64_TYPE__ long unsigned int // MIPS64BE:#define __UINT8_C_SUFFIX__ {{$}} // MIPS64BE:#define __UINT8_MAX__ 255 // MIPS64BE:#define __UINT8_TYPE__ unsigned char -// MIPS64BE:#define __UINTMAX_C_SUFFIX__ ULL -// MIPS64BE:#define __UINTMAX_MAX__ 18446744073709551615ULL -// MIPS64BE:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS64BE:#define __UINTMAX_C_SUFFIX__ UL +// MIPS64BE:#define __UINTMAX_MAX__ 18446744073709551615UL +// MIPS64BE:#define __UINTMAX_TYPE__ long unsigned int // MIPS64BE:#define __UINTMAX_WIDTH__ 64 // MIPS64BE:#define __UINTPTR_MAX__ 18446744073709551615UL // MIPS64BE:#define __UINTPTR_TYPE__ long unsigned int @@ -3262,21 +3876,21 @@ // MIPS64EL:#define __INT32_FMTi__ "i" // MIPS64EL:#define __INT32_MAX__ 2147483647 // MIPS64EL:#define __INT32_TYPE__ int -// MIPS64EL:#define __INT64_C_SUFFIX__ LL -// MIPS64EL:#define __INT64_FMTd__ "lld" -// MIPS64EL:#define __INT64_FMTi__ "lli" +// MIPS64EL:#define __INT64_C_SUFFIX__ L +// MIPS64EL:#define __INT64_FMTd__ "ld" +// MIPS64EL:#define __INT64_FMTi__ "li" // MIPS64EL:#define __INT64_MAX__ 9223372036854775807L -// MIPS64EL:#define __INT64_TYPE__ long long int +// MIPS64EL:#define __INT64_TYPE__ long int // MIPS64EL:#define __INT8_C_SUFFIX__ {{$}} // MIPS64EL:#define __INT8_FMTd__ "hhd" // MIPS64EL:#define __INT8_FMTi__ "hhi" // MIPS64EL:#define __INT8_MAX__ 127 // MIPS64EL:#define __INT8_TYPE__ signed char -// MIPS64EL:#define __INTMAX_C_SUFFIX__ LL -// MIPS64EL:#define __INTMAX_FMTd__ "lld" -// MIPS64EL:#define __INTMAX_FMTi__ "lli" -// MIPS64EL:#define __INTMAX_MAX__ 9223372036854775807LL -// MIPS64EL:#define __INTMAX_TYPE__ long long int +// MIPS64EL:#define __INTMAX_C_SUFFIX__ L +// MIPS64EL:#define __INTMAX_FMTd__ "ld" +// MIPS64EL:#define __INTMAX_FMTi__ "li" +// MIPS64EL:#define __INTMAX_MAX__ 9223372036854775807L +// MIPS64EL:#define __INTMAX_TYPE__ long int // MIPS64EL:#define __INTMAX_WIDTH__ 64 // MIPS64EL:#define __INTPTR_FMTd__ "ld" // MIPS64EL:#define __INTPTR_FMTi__ "li" @@ -3366,15 +3980,15 @@ // MIPS64EL:#define __UINT32_C_SUFFIX__ U // MIPS64EL:#define __UINT32_MAX__ 4294967295U // MIPS64EL:#define __UINT32_TYPE__ unsigned int -// MIPS64EL:#define __UINT64_C_SUFFIX__ ULL -// MIPS64EL:#define __UINT64_MAX__ 18446744073709551615ULL -// MIPS64EL:#define __UINT64_TYPE__ long long unsigned int +// MIPS64EL:#define __UINT64_C_SUFFIX__ UL +// MIPS64EL:#define __UINT64_MAX__ 18446744073709551615UL +// MIPS64EL:#define __UINT64_TYPE__ long unsigned int // MIPS64EL:#define __UINT8_C_SUFFIX__ {{$}} // MIPS64EL:#define __UINT8_MAX__ 255 // MIPS64EL:#define __UINT8_TYPE__ unsigned char -// MIPS64EL:#define __UINTMAX_C_SUFFIX__ ULL -// MIPS64EL:#define __UINTMAX_MAX__ 18446744073709551615ULL -// MIPS64EL:#define __UINTMAX_TYPE__ long long unsigned int +// MIPS64EL:#define __UINTMAX_C_SUFFIX__ UL +// MIPS64EL:#define __UINTMAX_MAX__ 18446744073709551615UL +// MIPS64EL:#define __UINTMAX_TYPE__ long unsigned int // MIPS64EL:#define __UINTMAX_WIDTH__ 64 // MIPS64EL:#define __UINTPTR_MAX__ 18446744073709551615UL // MIPS64EL:#define __UINTPTR_TYPE__ long unsigned int @@ -3442,6 +4056,15 @@ // MIPS-ARCH-32R2:#define _MIPS_ISA _MIPS_ISA_MIPS32 // MIPS-ARCH-32R2:#define __mips_isa_rev 2 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips-none-none \ +// RUN: -target-cpu mips32r6 < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-ARCH-32R6 %s +// +// MIPS-ARCH-32R6:#define _MIPS_ARCH "mips32r6" +// MIPS-ARCH-32R6:#define _MIPS_ARCH_MIPS32R6 1 +// MIPS-ARCH-32R6:#define _MIPS_ISA _MIPS_ISA_MIPS32 +// MIPS-ARCH-32R6:#define __mips_isa_rev 6 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-none-none \ // RUN: < /dev/null \ // RUN: | FileCheck -check-prefix MIPS-ARCH-DEF64 %s @@ -3469,6 +4092,15 @@ // MIPS-ARCH-64R2:#define _MIPS_ISA _MIPS_ISA_MIPS64 // MIPS-ARCH-64R2:#define __mips_isa_rev 2 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-none-none \ +// RUN: -target-cpu mips64r6 < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-ARCH-64R6 %s +// +// MIPS-ARCH-64R6:#define _MIPS_ARCH "mips64r6" +// MIPS-ARCH-64R6:#define _MIPS_ARCH_MIPS64R6 1 +// MIPS-ARCH-64R6:#define _MIPS_ISA _MIPS_ISA_MIPS64 +// MIPS-ARCH-64R6:#define __mips_isa_rev 6 +// // Check MIPS float ABI macros // // RUN: %clang_cc1 -E -dM -ffreestanding \ diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c index c7189f607cfd..9bc1aa7cc5e2 100644 --- a/test/Preprocessor/stdint.c +++ b/test/Preprocessor/stdint.c @@ -322,8 +322,8 @@ // // RUN: %clang_cc1 -E -ffreestanding -triple=mips64-none-none %s | FileCheck -check-prefix MIPS64 %s // -// MIPS64:typedef long long int int64_t; -// MIPS64:typedef long long unsigned int uint64_t; +// MIPS64:typedef long int int64_t; +// MIPS64:typedef long unsigned int uint64_t; // MIPS64:typedef int64_t int_least64_t; // MIPS64:typedef uint64_t uint_least64_t; // MIPS64:typedef int64_t int_fast64_t; @@ -353,8 +353,8 @@ // MIPS64:typedef int64_t intptr_t; // MIPS64:typedef uint64_t uintptr_t; // -// MIPS64:typedef long long int intmax_t; -// MIPS64:typedef long long unsigned int uintmax_t; +// MIPS64:typedef long int intmax_t; +// MIPS64:typedef long unsigned int uintmax_t; // // MIPS64:INT8_MAX_ 127 // MIPS64:INT8_MIN_ (-127 -1) @@ -386,26 +386,26 @@ // MIPS64:INT_FAST32_MAX_ 2147483647 // MIPS64:UINT_FAST32_MAX_ 4294967295U // -// MIPS64:INT64_MAX_ 9223372036854775807LL -// MIPS64:INT64_MIN_ (-9223372036854775807LL -1) -// MIPS64:UINT64_MAX_ 18446744073709551615ULL -// MIPS64:INT_LEAST64_MIN_ (-9223372036854775807LL -1) -// MIPS64:INT_LEAST64_MAX_ 9223372036854775807LL -// MIPS64:UINT_LEAST64_MAX_ 18446744073709551615ULL -// MIPS64:INT_FAST64_MIN_ (-9223372036854775807LL -1) -// MIPS64:INT_FAST64_MAX_ 9223372036854775807LL -// MIPS64:UINT_FAST64_MAX_ 18446744073709551615ULL -// -// MIPS64:INTPTR_MIN_ (-9223372036854775807LL -1) -// MIPS64:INTPTR_MAX_ 9223372036854775807LL -// MIPS64:UINTPTR_MAX_ 18446744073709551615ULL -// MIPS64:PTRDIFF_MIN_ (-9223372036854775807LL -1) -// MIPS64:PTRDIFF_MAX_ 9223372036854775807LL -// MIPS64:SIZE_MAX_ 18446744073709551615ULL -// -// MIPS64:INTMAX_MIN_ (-9223372036854775807LL -1) -// MIPS64:INTMAX_MAX_ 9223372036854775807LL -// MIPS64:UINTMAX_MAX_ 18446744073709551615ULL +// MIPS64:INT64_MAX_ 9223372036854775807L +// MIPS64:INT64_MIN_ (-9223372036854775807L -1) +// MIPS64:UINT64_MAX_ 18446744073709551615UL +// MIPS64:INT_LEAST64_MIN_ (-9223372036854775807L -1) +// MIPS64:INT_LEAST64_MAX_ 9223372036854775807L +// MIPS64:UINT_LEAST64_MAX_ 18446744073709551615UL +// MIPS64:INT_FAST64_MIN_ (-9223372036854775807L -1) +// MIPS64:INT_FAST64_MAX_ 9223372036854775807L +// MIPS64:UINT_FAST64_MAX_ 18446744073709551615UL +// +// MIPS64:INTPTR_MIN_ (-9223372036854775807L -1) +// MIPS64:INTPTR_MAX_ 9223372036854775807L +// MIPS64:UINTPTR_MAX_ 18446744073709551615UL +// MIPS64:PTRDIFF_MIN_ (-9223372036854775807L -1) +// MIPS64:PTRDIFF_MAX_ 9223372036854775807L +// MIPS64:SIZE_MAX_ 18446744073709551615UL +// +// MIPS64:INTMAX_MIN_ (-9223372036854775807L -1) +// MIPS64:INTMAX_MAX_ 9223372036854775807L +// MIPS64:UINTMAX_MAX_ 18446744073709551615UL // // MIPS64:SIG_ATOMIC_MIN_ (-2147483647 -1) // MIPS64:SIG_ATOMIC_MAX_ 2147483647 @@ -421,11 +421,11 @@ // MIPS64:UINT16_C_(0) 0U // MIPS64:INT32_C_(0) 0 // MIPS64:UINT32_C_(0) 0U -// MIPS64:INT64_C_(0) 0LL -// MIPS64:UINT64_C_(0) 0ULL +// MIPS64:INT64_C_(0) 0L +// MIPS64:UINT64_C_(0) 0UL // -// MIPS64:INTMAX_C_(0) 0LL -// MIPS64:UINTMAX_C_(0) 0ULL +// MIPS64:INTMAX_C_(0) 0L +// MIPS64:UINTMAX_C_(0) 0UL // // RUN: %clang_cc1 -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s // diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c index e21c3fd58e80..71eaaa8b7a5b 100644 --- a/test/Sema/atomic-ops.c +++ b/test/Sema/atomic-ops.c @@ -49,7 +49,7 @@ char i8; short i16; int i32; int __attribute__((vector_size(8))) i64; -struct Incomplete *incomplete; +struct Incomplete *incomplete; // expected-note {{forward declaration of 'struct Incomplete'}} _Static_assert(__atomic_is_lock_free(1, &i8), ""); _Static_assert(__atomic_is_lock_free(1, &i64), ""); @@ -268,6 +268,10 @@ void memory_checks(_Atomic(int) *Ap, int *p, int val) { (void)__c11_atomic_fetch_add(Ap, 1, memory_order_acq_rel); (void)__c11_atomic_fetch_add(Ap, 1, memory_order_seq_cst); + (void)__c11_atomic_fetch_add( + (struct Incomplete * _Atomic *)0, // expected-error {{incomplete type 'struct Incomplete'}} + 1, memory_order_seq_cst); + (void)__c11_atomic_init(Ap, val); (void)__c11_atomic_init(Ap, val); (void)__c11_atomic_init(Ap, val); diff --git a/test/Sema/attr-flag-enum.c b/test/Sema/attr-flag-enum.c deleted file mode 100644 index a53c1dc8e7d1..000000000000 --- a/test/Sema/attr-flag-enum.c +++ /dev/null @@ -1,73 +0,0 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -std=c11 -Wassign-enum %s - -enum __attribute__((flag_enum)) flag { - ea = 0x1, - eb = 0x2, - ec = 0x8, -}; - -enum __attribute__((flag_enum)) flag2 { - ga = 0x1, - gb = 0x4, - - gc = 0x5, // no-warning - gd = 0x7, // expected-warning {{enumeration value 'gd' is out of range}} - ge = ~0x2, // expected-warning {{enumeration value 'ge' is out of range}} - gf = ~0x4, // no-warning - gg = ~0x1, // no-warning - gh = ~0x5, // no-warning - gi = ~0x11, // expected-warning {{enumeration value 'gi' is out of range}} -}; - -enum __attribute__((flag_enum)) flag3 { - fa = 0x1, - fb = ~0x1u, // no-warning -}; - -// What happens here is that ~0x2 is negative, and so the enum must be signed. -// But ~0x1u is unsigned and has the high bit set, so the enum must be 64-bit. -// The result is that ~0x1u does not have high bits set, and so it is considered -// to be an invalid value. See Sema::IsValueInFlagEnum in SemaDecl.cpp for more -// discussion. -enum __attribute__((flag_enum)) flag4 { - ha = 0x1, - hb = 0x2, - - hc = ~0x1u, // expected-warning {{enumeration value 'hc' is out of range}} - hd = ~0x2, // no-warning -}; - -void f(void) { - enum flag e = 0; // no-warning - e = 0x1; // no-warning - e = 0x3; // no-warning - e = 0xa; // no-warning - e = 0x4; // expected-warning {{integer constant not in range of enumerated type}} - e = 0xf; // expected-warning {{integer constant not in range of enumerated type}} - e = ~0; // no-warning - e = ~0x1; // no-warning - e = ~0x2; // no-warning - e = ~0x3; // no-warning - e = ~0x4; // expected-warning {{integer constant not in range of enumerated type}} - - switch (e) { - case 0: break; // no-warning - case 0x1: break; // no-warning - case 0x3: break; // no-warning - case 0xa: break; // no-warning - case 0x4: break; // expected-warning {{case value not in enumerated type}} - case 0xf: break; // expected-warning {{case value not in enumerated type}} - case ~0: break; // expected-warning {{case value not in enumerated type}} - case ~0x1: break; // expected-warning {{case value not in enumerated type}} - case ~0x2: break; // expected-warning {{case value not in enumerated type}} - case ~0x3: break; // expected-warning {{case value not in enumerated type}} - case ~0x4: break; // expected-warning {{case value not in enumerated type}} - default: break; - } - - enum flag2 f = ~0x1; // no-warning - f = ~0x1u; // no-warning - - enum flag4 h = ~0x1; // no-warning - h = ~0x1u; // expected-warning {{integer constant not in range of enumerated type}} -} diff --git a/test/Sema/inline-asm-validate-x86.c b/test/Sema/inline-asm-validate-x86.c index 174deca80b43..658b714056f8 100644 --- a/test/Sema/inline-asm-validate-x86.c +++ b/test/Sema/inline-asm-validate-x86.c @@ -6,7 +6,7 @@ void I(int i, int j) { static const int AboveMax = 32; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "I"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'I'}} + : "0"(i), "I"(j)); // expected-error{{constraint 'I' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "I"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'I'}} @@ -23,7 +23,7 @@ void J(int i, int j) { static const int AboveMax = 64; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "J"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'J'}} + : "0"(i), "J"(j)); // expected-error{{constraint 'J' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "J"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'J'}} @@ -40,7 +40,7 @@ void K(int i, int j) { static const int AboveMax = 128; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "K"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'K'}} + : "0"(i), "K"(j)); // expected-error{{constraint 'K' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "K"(BelowMin)); // expected-error{{value '-129' out of range for constraint 'K'}} @@ -57,7 +57,7 @@ void M(int i, int j) { static const int AboveMax = 4; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "M"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'M'}} + : "0"(i), "M"(j)); // expected-error{{constraint 'M' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "M"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'M'}} @@ -74,7 +74,7 @@ void N(int i, int j) { static const int AboveMax = 256; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "N"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'N'}} + : "0"(i), "N"(j)); // expected-error{{constraint 'N' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "N"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'N'}} @@ -91,7 +91,7 @@ void O(int i, int j) { static const int AboveMax = 128; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "O"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'O'}} + : "0"(i), "O"(j)); // expected-error{{constraint 'O' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "O"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'O'}} diff --git a/test/Sema/typo-correction.c b/test/Sema/typo-correction.c index df7da797f050..8276737e4fec 100644 --- a/test/Sema/typo-correction.c +++ b/test/Sema/typo-correction.c @@ -13,6 +13,11 @@ void PR21656() { a = b ? : 0; // expected-warning {{type specifier missing, defaults to 'int'}} \ // expected-error {{use of undeclared identifier 'b'}} +int foobar; // expected-note {{'foobar' declared here}} +a = goobar ?: 4; // expected-warning {{type specifier missing, defaults to 'int'}} \ + // expected-error {{use of undeclared identifier 'goobar'; did you mean 'foobar'?}} \ + // expected-error {{initializer element is not a compile-time constant}} + struct ContainerStuct { enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}} }; diff --git a/test/SemaCXX/attr-flag-enum-reject.cpp b/test/SemaCXX/attr-flag-enum-reject.cpp deleted file mode 100644 index f28d60c0c295..000000000000 --- a/test/SemaCXX/attr-flag-enum-reject.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -x c++ -Wassign-enum %s - -enum __attribute__((flag_enum)) flag { // expected-warning {{ignored}} -}; diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp index e028faad2510..79ab3f597954 100644 --- a/test/SemaCXX/typo-correction-delayed.cpp +++ b/test/SemaCXX/typo-correction-delayed.cpp @@ -157,3 +157,29 @@ namespace PR22092 { a = b ? : 0; // expected-error {{C++ requires a type specifier for all declarations}} \ // expected-error-re {{use of undeclared identifier 'b'{{$}}}} } + +namespace PR22250 { +// expected-error@+4 {{use of undeclared identifier 'size_t'; did you mean 'sizeof'?}} +// expected-error-re@+3 {{use of undeclared identifier 'y'{{$}}}} +// expected-error-re@+2 {{use of undeclared identifier 'z'{{$}}}} +// expected-error@+1 {{expected ';' after top level declarator}} +int getenv_s(size_t *y, char(&z)) {} +} + +namespace PR22291 { +template <unsigned I> void f() { + unsigned *prio_bits_array; // expected-note {{'prio_bits_array' declared here}} + // expected-error@+1 {{use of undeclared identifier 'prio_op_array'; did you mean 'prio_bits_array'?}} + __atomic_store_n(prio_op_array + I, false, __ATOMIC_RELAXED); +} +} + +namespace PR22297 { +double pow(double x, double y); +struct TimeTicks { + static void Now(); // expected-note {{'Now' declared here}} +}; +void f() { + TimeTicks::now(); // expected-error {{no member named 'now' in 'PR22297::TimeTicks'; did you mean 'Now'?}} +} +} diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index a73be2e0815b..5dd3f7e4af79 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -2185,8 +2185,7 @@ static std::string CalculateDiagnostic(const Record &S) { Namespace = 1U << 11, Field = 1U << 12, CXXMethod = 1U << 13, - ObjCProtocol = 1U << 14, - Enum = 1U << 15 + ObjCProtocol = 1U << 14 }; uint32_t SubMask = 0; @@ -2220,7 +2219,6 @@ static std::string CalculateDiagnostic(const Record &S) { .Case("Namespace", Namespace) .Case("Field", Field) .Case("CXXMethod", CXXMethod) - .Case("Enum", Enum) .Default(0); if (!V) { // Something wasn't in our mapping, so be helpful and let the developer @@ -2239,7 +2237,6 @@ static std::string CalculateDiagnostic(const Record &S) { case Var: return "ExpectedVariable"; case Param: return "ExpectedParameter"; case Class: return "ExpectedClass"; - case Enum: return "ExpectedEnum"; case CXXMethod: // FIXME: Currently, this maps to ExpectedMethod based on existing code, // but should map to something a bit more accurate at some point. @@ -2393,8 +2390,6 @@ static std::string GenerateLangOptRequirements(const Record &R, std::string FnName = "check", Test; for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I) { std::string Part = (*I)->getValueAsString("Name"); - if ((*I)->getValueAsBit("Negated")) - Test += "!"; Test += "S.LangOpts." + Part; if (I + 1 != E) Test += " || "; |