diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index deffa24c4e42..982abb024525 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -61,7 +61,7 @@ Improvements to Clang's diagnostics New Compiler Flags ------------------ -The option .... +- --autocomplete was implemented to obtain a list of flags and its arguments. This is used for shell autocompletion. Deprecated Compiler Flags ------------------------- @@ -200,7 +200,13 @@ libclang Static Analyzer --------------- -... +- The static analyzer now supports using the + `z3 theorem prover `_ from Microsoft Research + as an external constraint solver. This allows reasoning over more complex + queries, but performance is ~15x slower than the default range-based + constraint solver. To enable the z3 solver backend, clang must be built with + the ``CLANG_ANALYZER_BUILD_Z3=ON`` option, and the + ``-Xanalyzer -analyzer-constraints=z3`` arguments passed at runtime. Undefined Behavior Sanitizer (UBSan) ------------------------------------ @@ -240,8 +246,20 @@ New Issues Found Python Binding Changes ---------------------- +Python bindings now support both Python 2 and Python 3. + The following methods have been added: +- ``is_scoped_enum`` has been added to ``Cursor``. + +- ``exception_specification_kind`` has been added to ``Cursor``. + +- ``get_address_space`` has been added to ``Type``. + +- ``get_typedef_name`` has been added to ``Type``. + +- ``get_exception_specification_kind`` has been added to ``Type``. + - ... Significant Known Problems diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index b35f436e91b6..3b5ea9fa539b 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -3206,6 +3206,8 @@ enum CXCallingConv { CXCallingConv_X86RegCall = 8, CXCallingConv_IntelOclBicc = 9, CXCallingConv_Win64 = 10, + /* Alias for compatibility with older versions of API. */ + CXCallingConv_X86_64Win64 = CXCallingConv_Win64, CXCallingConv_X86_64SysV = 11, CXCallingConv_X86VectorCall = 12, CXCallingConv_Swift = 13, diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 08b34a75aa60..54e6ebcd8af2 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1666,8 +1666,7 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext, unsigned HasSkippedBody : 1; /// Indicates if the function declaration will have a body, once we're done - /// parsing it. (We don't set it to false when we're done parsing, in the - /// hopes this is simpler.) + /// parsing it. unsigned WillHaveBody : 1; /// \brief End part of this FunctionDecl's source range. diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index a28d63182749..fcef881fa0ae 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -138,9 +138,10 @@ def err_drv_cc_print_options_failure : Error< def err_drv_lto_without_lld : Error<"LTO requires -fuse-ld=lld">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; -def err_invalid_ios_deployment_target : Error< +def warn_invalid_ios_deployment_target : Warning< "invalid iOS deployment version '%0', iOS 10 is the maximum deployment " - "target for 32-bit targets">; + "target for 32-bit targets">, InGroup, + DefaultError; def err_drv_conflicting_deployment_targets : Error< "conflicting deployment targets, both '%0' and '%1' are present in environment">; def err_arc_unsupported_on_runtime : Error< diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 53d8f36ecd00..23e4d4633ae2 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -151,9 +151,13 @@ def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexible-array-union-member">; def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; -def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; + +def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">; + +def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">; +def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>; // Name of this warning in GCC. -def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; +def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; @@ -215,9 +219,10 @@ def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre1zCompat]>; def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic", [CXXPre1zCompatPedantic]>; -def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister, +def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister, DeprecatedIncrementBool, - CXX1zCompatMangling]>; + CXX17CompatMangling]>; +def : DiagGroup<"c++1z-compat", [CXX17Compat]>; def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; @@ -769,10 +774,11 @@ def CXX14 : DiagGroup<"c++14-extensions", [CXX14BinaryLiteral]>; // A warning group for warnings about using C++1z features as extensions in // earlier C++ versions. -def CXX1z : DiagGroup<"c++1z-extensions">; +def CXX17 : DiagGroup<"c++17-extensions">; def : DiagGroup<"c++0x-extensions", [CXX11]>; def : DiagGroup<"c++1y-extensions", [CXX14]>; +def : DiagGroup<"c++1z-extensions", [CXX17]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index d6de5c04a74d..706881bfdc5d 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -181,10 +181,10 @@ def err_hex_constant_requires : Error< def ext_hex_constant_invalid : Extension< "hexadecimal floating constants are a C99 feature">, InGroup; def ext_hex_literal_invalid : Extension< - "hexadecimal floating literals are a C++1z feature">, InGroup; + "hexadecimal floating literals are a C++17 feature">, InGroup; def warn_cxx1z_hex_literal : Warning< "hexadecimal floating literals are incompatible with " - "C++ standards before C++1z">, + "C++ standards before C++17">, InGroup, DefaultIgnore; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup; @@ -208,7 +208,7 @@ def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup, DefaultIgnore; def warn_cxx14_compat_u8_character_literal : Warning< - "unicode literals are incompatible with C++ standards before C++1z">, + "unicode literals are incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx11_compat_user_defined_literal : Warning< "identifier after literal will be treated as a user-defined literal suffix " diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index f39ffeae61f4..5170c07bf666 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -211,10 +211,10 @@ def err_inline_namespace_alias : Error<"namespace alias cannot be inline">; def err_namespace_nonnamespace_scope : Error< "namespaces can only be defined in global or namespace scope">; def ext_nested_namespace_definition : ExtWarn< - "nested namespace definition is a C++1z extension; " - "define each namespace separately">, InGroup; + "nested namespace definition is a C++17 extension; " + "define each namespace separately">, InGroup; def warn_cxx14_compat_nested_namespace_definition : Warning< - "nested namespace definition is incompatible with C++ standards before C++1z">, + "nested namespace definition is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_inline_nested_namespace_definition : Error< "nested namespace definition cannot be 'inline'">; @@ -358,7 +358,7 @@ def err_expected_coloncolon_after_super : Error< "expected '::' after '__super'">; def ext_decomp_decl_empty : ExtWarn< - "ISO C++1z does not allow a decomposition group to be empty">, + "ISO C++17 does not allow a decomposition group to be empty">, InGroup>; /// Objective-C parser diagnostics @@ -522,16 +522,16 @@ def err_function_is_not_record : Error< def err_super_in_using_declaration : Error< "'__super' cannot be used with a using declaration">; def ext_constexpr_if : ExtWarn< - "constexpr if is a C++1z extension">, InGroup; + "constexpr if is a C++17 extension">, InGroup; def warn_cxx14_compat_constexpr_if : Warning< - "constexpr if is incompatible with C++ standards before C++1z">, + "constexpr if is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_init_statement : ExtWarn< - "'%select{if|switch}0' initialization statements are a C++1z extension">, - InGroup; + "'%select{if|switch}0' initialization statements are a C++17 extension">, + InGroup; def warn_cxx14_compat_init_statement : Warning< "%select{if|switch}0 initialization statements are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; @@ -560,7 +560,7 @@ def warn_cxx98_compat_nullptr : Warning< def warn_cxx14_compat_attribute : Warning< "attributes on %select{a namespace|an enumerator}0 declaration are " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, InGroup, DefaultIgnore; @@ -577,10 +577,10 @@ def err_cxx11_attribute_repeated : Error< "attribute %0 cannot appear multiple times in an attribute specifier">; def warn_cxx14_compat_using_attribute_ns : Warning< "default scope specifier for attributes is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; def ext_using_attribute_ns : ExtWarn< - "default scope specifier for attributes is a C++1z extension">, - InGroup; + "default scope specifier for attributes is a C++17 extension">, + InGroup; def err_using_attribute_ns_conflict : Error< "attribute with scope specifier cannot follow default scope specifier">; def err_attributes_not_allowed : Error<"an attribute list cannot appear here">; @@ -617,11 +617,11 @@ def err_expected_comma_greater : Error< def err_class_on_template_template_param : Error< "template template parameter requires 'class' after the parameter list">; def ext_template_template_param_typename : ExtWarn< - "template template parameter using 'typename' is a C++1z extension">, - InGroup; + "template template parameter using 'typename' is a C++17 extension">, + InGroup; def warn_cxx14_compat_template_template_param_typename : Warning< "template template parameter using 'typename' is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_template_spec_syntax_non_template : Error< "identifier followed by '<' indicates a class template specialization but " @@ -695,10 +695,10 @@ def err_default_template_template_parameter_not_template : Error< "template">; def ext_fold_expression : ExtWarn< - "pack fold expression is a C++1z extension">, - InGroup; + "pack fold expression is a C++17 extension">, + InGroup; def warn_cxx14_compat_fold_expression : Warning< - "pack fold expression is incompatible with C++ standards before C++1z">, + "pack fold expression is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_expected_fold_operator : Error< "expected a foldable binary operator in fold expression">; @@ -751,16 +751,16 @@ def err_alias_declaration_pack_expansion : Error< // C++1z using-declaration pack expansions def ext_multi_using_declaration : ExtWarn< "use of multiple declarators in a single using declaration is " - "a C++1z extension">, InGroup; + "a C++17 extension">, InGroup; def warn_cxx1z_compat_multi_using_declaration : Warning< "use of multiple declarators in a single using declaration is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_using_declaration_pack : ExtWarn< - "pack expansion of using declaration is a C++1z extension">, InGroup; + "pack expansion of using declaration is a C++17 extension">, InGroup; def warn_cxx1z_compat_using_declaration_pack : Warning< "pack expansion using declaration is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; // C++11 override control def ext_override_control_keyword : ExtWarn< @@ -817,10 +817,10 @@ def err_expected_star_this_capture : Error< // C++1z constexpr lambda expressions def warn_cxx14_compat_constexpr_on_lambda : Warning< - "constexpr on lambda expressions is incompatible with C++ standards before C++1z">, + "constexpr on lambda expressions is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_constexpr_on_lambda_cxx1z : ExtWarn< - "'constexpr' on lambda expressions is a C++1z extension">, InGroup; + "'constexpr' on lambda expressions is a C++17 extension">, InGroup; // Availability attribute def err_expected_version : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index af14638e1d61..6456913a1549 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -211,9 +211,9 @@ def warn_auto_storage_class : Warning< def warn_deprecated_register : Warning< "'register' storage class specifier is deprecated " - "and incompatible with C++1z">, InGroup; + "and incompatible with C++17">, InGroup; def ext_register_storage_class : ExtWarn< - "ISO C++1z does not allow 'register' storage class specifier">, + "ISO C++17 does not allow 'register' storage class specifier">, DefaultError, InGroup; def err_invalid_decl_spec_combination : Error< @@ -391,9 +391,9 @@ def err_decomp_decl_context : Error< "decomposition declaration not permitted in this context">; def warn_cxx14_compat_decomp_decl : Warning< "decomposition declarations are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; def ext_decomp_decl : ExtWarn< - "decomposition declarations are a C++1z extension">, InGroup; + "decomposition declarations are a C++17 extension">, InGroup; def err_decomp_decl_spec : Error< "decomposition declaration cannot be declared " "%plural{1:'%1'|:with '%1' specifiers}0">; @@ -494,7 +494,7 @@ def err_access_decl : Error< "ISO C++11 does not allow access declarations; " "use using declarations instead">; def ext_dynamic_exception_spec : ExtWarn< - "ISO C++1z does not allow dynamic exception specifications">, + "ISO C++17 does not allow dynamic exception specifications">, InGroup, DefaultError; def warn_exception_spec_deprecated : Warning< "dynamic exception specifications are deprecated">, @@ -507,7 +507,7 @@ def warn_deprecated_copy_operation : Warning< InGroup, DefaultIgnore; def warn_cxx1z_compat_exception_spec_in_signature : Warning< "mangled name of %0 will change in C++17 due to non-throwing exception " - "specification in function signature">, InGroup; + "specification in function signature">, InGroup; def warn_global_constructor : Warning< "declaration requires a global constructor">, @@ -1200,15 +1200,15 @@ def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">; def ext_static_assert_no_message : ExtWarn< - "static_assert with no message is a C++1z extension">, InGroup; + "static_assert with no message is a C++17 extension">, InGroup; def warn_cxx14_compat_static_assert_no_message : Warning< - "static_assert with no message is incompatible with C++ standards before C++1z">, + "static_assert with no message is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_inline_variable : ExtWarn< - "inline variables are a C++1z extension">, InGroup; + "inline variables are a C++17 extension">, InGroup; def warn_cxx14_compat_inline_variable : Warning< - "inline variables are incompatible with C++ standards before C++1z">, + "inline variables are incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def warn_inline_namespace_reopened_noninline : Warning< @@ -1922,7 +1922,7 @@ def err_auto_not_allowed : Error< "|in non-static struct member|in struct member" "|in non-static union member|in union member" "|in non-static class member|in interface member" - "|in exception declaration|in template parameter until C++1z|in block literal" + "|in exception declaration|in template parameter until C++17|in block literal" "|in template argument|in typedef|in type alias|in function return type" "|in conversion function type|here|in lambda parameter" "|in type allocated by 'new'|in K&R-style function parameter" @@ -2147,11 +2147,11 @@ def err_for_range_iter_deduction_failure : Error< def err_for_range_member_begin_end_mismatch : Error< "range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">; def ext_for_range_begin_end_types_differ : ExtWarn< - "'begin' and 'end' returning different types (%0 and %1) is a C++1z extension">, - InGroup; + "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">, + InGroup; def warn_for_range_begin_end_types_differ : Warning< "'begin' and 'end' returning different types (%0 and %1) is incompatible " - "with C++ standards before C++1z">, InGroup, DefaultIgnore; + "with C++ standards before C++17">, InGroup, DefaultIgnore; def note_in_for_range: Note< "when looking up '%select{begin|end}0' function for range expression " "of type %1">; @@ -3905,7 +3905,7 @@ def err_template_nontype_parm_bad_type : Error< "a non-type template parameter cannot have type %0">; def warn_cxx14_compat_template_nontype_parm_auto_type : Warning< "non-type template parameters declared with %0 are incompatible with C++ " - "standards before C++1z">, + "standards before C++17">, DefaultIgnore, InGroup; def err_template_param_default_arg_redefinition : Error< "template parameter redefines default argument">; @@ -6337,9 +6337,9 @@ def note_member_first_declared_here : Note< def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< "incrementing expression of type bool is deprecated and " - "incompatible with C++1z">, InGroup; + "incompatible with C++17">, InGroup; def ext_increment_bool : ExtWarn< - "ISO C++1z does not allow incrementing expression of type bool">, + "ISO C++17 does not allow incrementing expression of type bool">, DefaultError, InGroup; def err_increment_decrement_enum : Error< "cannot %select{decrement|increment}0 expression of enum type %1">; @@ -6528,10 +6528,10 @@ let CategoryName = "Lambda Issue" in { // C++1z '*this' captures. def warn_cxx14_compat_star_this_lambda_capture : Warning< - "by value capture of '*this' is incompatible with C++ standards before C++1z">, + "by value capture of '*this' is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_star_this_lambda_capture_cxx1z : ExtWarn< - "capture of '*this' by copy is a C++1z extension">, InGroup; + "capture of '*this' by copy is a C++17 extension">, InGroup; } def err_return_in_captured_stmt : Error< @@ -7200,7 +7200,7 @@ def warn_unused_volatile : Warning< def ext_cxx14_attr : Extension< "use of the %0 attribute is a C++14 extension">, InGroup; def ext_cxx1z_attr : Extension< - "use of the %0 attribute is a C++1z extension">, InGroup; + "use of the %0 attribute is a C++17 extension">, InGroup; def warn_unused_comparison : Warning< "%select{%select{|in}1equality|relational}0 comparison result unused">, diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 3c0674f598d1..753c178eec6a 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -2019,6 +2019,10 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group; def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group; def msingle_float : Flag<["-"], "msingle-float">, Group; def mdouble_float : Flag<["-"], "mdouble-float">, Group; +def mmadd4 : Flag<["-"], "mmadd4">, Group, + HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">; +def mno_madd4 : Flag<["-"], "mno-madd4">, Group, + HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">; def mmsa : Flag<["-"], "mmsa">, Group, HelpText<"Enable MSA ASE (MIPS only)">; def mno_msa : Flag<["-"], "mno-msa">, Group, diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index eb42f1260d92..6651491e5b27 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -315,7 +315,7 @@ class ToolChain { /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables /// by default. - virtual bool IsUnwindTablesDefault() const; + virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const; /// \brief Test whether this toolchain defaults to PIC. virtual bool isPICDefault() const = 0; diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index 669e487023a5..a019d6392214 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -109,15 +109,17 @@ LANGSTANDARD(gnucxx14, "gnu++14", GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y") -LANGSTANDARD(cxx1z, "c++1z", - CXX, "Working draft for ISO C++ 2017", +LANGSTANDARD(cxx17, "c++17", + CXX, "ISO C++ 2017 with amendments", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat) +LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z") -LANGSTANDARD(gnucxx1z, "gnu++1z", - CXX, "Working draft for ISO C++ 2017 with GNU extensions", +LANGSTANDARD(gnucxx17, "gnu++17", + CXX, "ISO C++ 2017 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat | GNUMode) +LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z") LANGSTANDARD(cxx2a, "c++2a", CXX, "Working draft for ISO C++ 2020", diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 5cab48882251..1caceab85eea 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -1837,9 +1837,10 @@ bool CXXMethodDecl::hasInlineBody() const { const FunctionDecl *CheckFn = getTemplateInstantiationPattern(); if (!CheckFn) CheckFn = this; - + const FunctionDecl *fn; - return CheckFn->hasBody(fn) && !fn->isOutOfLine(); + return CheckFn->isDefined(fn) && !fn->isOutOfLine() && + (fn->doesThisDeclarationHaveABody() || fn->willHaveBody()); } bool CXXMethodDecl::isLambdaStaticInvoker() const { diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 6713fca04571..fe45b5e47f36 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -1052,7 +1052,9 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(TypeSourceInfo *Type, :Type->getType()->isRValueReferenceType()? VK_XValue :VK_RValue), OK_Ordinary, - Type->getType()->isDependentType(), true, true, + Type->getType()->isDependentType() || + Type->getType()->getContainedDeducedType(), + true, true, Type->getType()->containsUnexpandedParameterPack()), Type(Type), LParenLoc(LParenLoc), diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 0c0c861e5d56..a26b608082f5 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -9788,6 +9788,8 @@ class VoidExprEvaluator bool Success(const APValue &V, const Expr *e) { return true; } + bool ZeroInitialization(const Expr *E) { return true; } + bool VisitCastExpr(const CastExpr *E) { switch (E->getCastKind()) { default: diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 73be2e173fda..5d75aa5a7528 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -8050,6 +8050,7 @@ class MipsTargetInfo : public TargetInfo { NoDSP, DSP1, DSP2 } DspRev; bool HasMSA; + bool DisableMadd4; protected: bool HasFP64; @@ -8060,7 +8061,7 @@ class MipsTargetInfo : public TargetInfo { : TargetInfo(Triple), IsMips16(false), IsMicromips(false), IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), - HasMSA(false), HasFP64(false) { + HasMSA(false), DisableMadd4(false), HasFP64(false) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI((getTriple().getArch() == llvm::Triple::mips || @@ -8306,6 +8307,9 @@ class MipsTargetInfo : public TargetInfo { if (HasMSA) Builder.defineMacro("__mips_msa", Twine(1)); + if (DisableMadd4) + Builder.defineMacro("__mips_no_madd4", Twine(1)); + Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0))); Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth())); Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); @@ -8468,6 +8472,8 @@ class MipsTargetInfo : public TargetInfo { DspRev = std::max(DspRev, DSP2); else if (Feature == "+msa") HasMSA = true; + else if (Feature == "+nomadd4") + DisableMadd4 = true; else if (Feature == "+fp64") HasFP64 = true; else if (Feature == "-fp64") diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index c17828974e92..eb230aad4d35 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -5573,17 +5573,14 @@ void ARMABIInfo::setCCs() { // AAPCS apparently requires runtime support functions to be soft-float, but // that's almost certainly for historic reasons (Thumb1 not supporting VFP // most likely). It's more convenient for AAPCS16_VFP to be hard-float. - switch (getABIKind()) { - case APCS: - case AAPCS16_VFP: - if (abiCC != getLLVMDefaultCC()) + + // The Run-time ABI for the ARM Architecture section 4.1.2 requires + // AEABI-complying FP helper functions to use the base AAPCS. + // These AEABI functions are expanded in the ARM llvm backend, all the builtin + // support functions emitted by clang such as the _Complex helpers follow the + // abiCC. + if (abiCC != getLLVMDefaultCC()) BuiltinCC = abiCC; - break; - case AAPCS: - case AAPCS_VFP: - BuiltinCC = llvm::CallingConv::ARM_AAPCS; - break; - } } ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, @@ -6754,14 +6751,6 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const { return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - // Use indirect if the aggregate cannot fit into registers for - // passing arguments according to the ABI - unsigned Threshold = IsO32 ? 16 : 64; - - if(getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(Threshold)) - return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align), true, - getContext().getTypeAlign(Ty) / 8 > Align); - // If we have reached here, aggregates are passed directly by coercing to // another structure type. Padding is inserted if the offset of the // aggregate is unaligned. diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 2be7f0f69004..9a858df8ab2d 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -217,7 +217,7 @@ StringRef ToolChain::getDefaultUniversalArchName() const { } } -bool ToolChain::IsUnwindTablesDefault() const { +bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { return false; } diff --git a/lib/Driver/ToolChains/Arch/Mips.cpp b/lib/Driver/ToolChains/Arch/Mips.cpp index 1da90d1dc7ba..b45dcd6db678 100644 --- a/lib/Driver/ToolChains/Arch/Mips.cpp +++ b/lib/Driver/ToolChains/Arch/Mips.cpp @@ -297,6 +297,8 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg, options::OPT_modd_spreg, "nooddspreg"); + AddTargetFeature(Args, Features, options::OPT_mno_madd4, options::OPT_mmadd4, + "nomadd4"); AddTargetFeature(Args, Features, options::OPT_mlong_calls, options::OPT_mno_long_calls, "long-calls"); AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt,"mt"); diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index b82cc2d4fa5d..baf7a93d2d92 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -2538,7 +2538,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool AsynchronousUnwindTables = Args.hasFlag(options::OPT_fasynchronous_unwind_tables, options::OPT_fno_asynchronous_unwind_tables, - (getToolChain().IsUnwindTablesDefault() || + (getToolChain().IsUnwindTablesDefault(Args) || getToolChain().getSanitizerArgs().needsUnwindTables()) && !KernelOrKext); if (Args.hasFlag(options::OPT_funwind_tables, options::OPT_fno_unwind_tables, diff --git a/lib/Driver/ToolChains/CrossWindows.cpp b/lib/Driver/ToolChains/CrossWindows.cpp index 7d0c438b1360..04b71c48cd4c 100644 --- a/lib/Driver/ToolChains/CrossWindows.cpp +++ b/lib/Driver/ToolChains/CrossWindows.cpp @@ -214,7 +214,7 @@ CrossWindowsToolChain::CrossWindowsToolChain(const Driver &D, } } -bool CrossWindowsToolChain::IsUnwindTablesDefault() const { +bool CrossWindowsToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // FIXME: all non-x86 targets need unwind tables, however, LLVM currently does // not know how to emit them. return getArch() == llvm::Triple::x86_64; diff --git a/lib/Driver/ToolChains/CrossWindows.h b/lib/Driver/ToolChains/CrossWindows.h index 5375a6324a3f..2f66446ec732 100644 --- a/lib/Driver/ToolChains/CrossWindows.h +++ b/lib/Driver/ToolChains/CrossWindows.h @@ -56,7 +56,7 @@ class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : public Generic_GCC { const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 0d63858f2cd4..6b7f0c71dfb7 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -1174,13 +1174,12 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { unsigned Major, Minor, Micro; bool HadExtra; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (iOSVersion && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSVersion->getValue(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << iOSVersion->getAsString(Args); + // The iOS deployment target that is explicitly specified via a command line + // option or an environment variable. + std::string ExplicitIOSDeploymentTargetStr; + + if (iOSVersion) + ExplicitIOSDeploymentTargetStr = iOSVersion->getAsString(Args); // Add a macro to differentiate between m(iphone|tv|watch)os-version-min=X.Y and // -m(iphone|tv|watch)simulator-version-min=X.Y. @@ -1223,13 +1222,9 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { if (char *env = ::getenv("WATCHOS_DEPLOYMENT_TARGET")) WatchOSTarget = env; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (!iOSTarget.empty() && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSTarget.c_str(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; + if (!iOSTarget.empty()) + ExplicitIOSDeploymentTargetStr = + std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; // If there is no command-line argument to specify the Target version and // no environment variable defined, see if we can set the default based @@ -1393,12 +1388,19 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { HadExtra || Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << iOSVersion->getAsString(Args); - // iOS 10 is the maximum deployment target for 32-bit targets. If the - // inferred deployment target is iOS 11 or later, set it to 10.99. + // For 32-bit targets, the deployment target for iOS has to be earlier than + // iOS 11. if (getTriple().isArch32Bit() && Major >= 11) { - Major = 10; - Minor = 99; - Micro = 99; + // If the deployment target is explicitly specified, print a diagnostic. + if (!ExplicitIOSDeploymentTargetStr.empty()) { + getDriver().Diag(diag::warn_invalid_ios_deployment_target) + << ExplicitIOSDeploymentTargetStr; + // Otherwise, set it to 10.99.99. + } else { + Major = 10; + Minor = 99; + Micro = 99; + } } } else if (Platform == TvOS) { if (!Driver::GetReleaseVersion(TvOSVersion->getValue(), Major, Minor, @@ -1834,8 +1836,8 @@ Darwin::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, return DAL; } -bool MachO::IsUnwindTablesDefault() const { - return getArch() == llvm::Triple::x86_64; +bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { + return !UseSjLjExceptions(Args); } bool MachO::UseDwarfDebugFlags() const { diff --git a/lib/Driver/ToolChains/Darwin.h b/lib/Driver/ToolChains/Darwin.h index 6cb1d04b78c0..77c569e8f865 100644 --- a/lib/Driver/ToolChains/Darwin.h +++ b/lib/Driver/ToolChains/Darwin.h @@ -216,7 +216,7 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain { bool UseObjCMixedDispatch() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; RuntimeLibType GetDefaultRuntimeLibType() const override { return ToolChain::RLT_CompilerRT; diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp index bc26ee1de46d..72a9f85ba389 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp @@ -2291,7 +2291,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { CudaInstallation.print(OS); } -bool Generic_GCC::IsUnwindTablesDefault() const { +bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h index cdf610054401..f29342b95a07 100644 --- a/lib/Driver/ToolChains/Gnu.h +++ b/lib/Driver/ToolChains/Gnu.h @@ -284,7 +284,7 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain { void printVerboseInfo(raw_ostream &OS) const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp index 9e9d943610be..b871c856d2a0 100644 --- a/lib/Driver/ToolChains/MSVC.cpp +++ b/lib/Driver/ToolChains/MSVC.cpp @@ -699,7 +699,7 @@ bool MSVCToolChain::IsIntegratedAssemblerDefault() const { return true; } -bool MSVCToolChain::IsUnwindTablesDefault() const { +bool MSVCToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // Emit unwind tables by default on Win64. All non-x86_32 Windows platforms // such as ARM and PPC actually require unwind tables, but LLVM doesn't know // how to generate them yet. diff --git a/lib/Driver/ToolChains/MSVC.h b/lib/Driver/ToolChains/MSVC.h index 055830c52e0d..d153691a5c90 100644 --- a/lib/Driver/ToolChains/MSVC.h +++ b/lib/Driver/ToolChains/MSVC.h @@ -73,7 +73,7 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { Action::OffloadKind DeviceOffloadKind) const override; bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp index 7550bab486f1..632b76d92bdd 100644 --- a/lib/Driver/ToolChains/MinGW.cpp +++ b/lib/Driver/ToolChains/MinGW.cpp @@ -347,7 +347,7 @@ Tool *toolchains::MinGW::buildLinker() const { return new tools::MinGW::Linker(*this); } -bool toolchains::MinGW::IsUnwindTablesDefault() const { +bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/MinGW.h b/lib/Driver/ToolChains/MinGW.h index cf1628a4ccdd..9b3d7c553f1d 100644 --- a/lib/Driver/ToolChains/MinGW.h +++ b/lib/Driver/ToolChains/MinGW.h @@ -60,7 +60,7 @@ class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain { const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/NetBSD.h b/lib/Driver/ToolChains/NetBSD.h index 412d0815e81a..5163ff72d81b 100644 --- a/lib/Driver/ToolChains/NetBSD.h +++ b/lib/Driver/ToolChains/NetBSD.h @@ -65,7 +65,10 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - bool IsUnwindTablesDefault() const override { return true; } + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override { + return true; + } + SanitizerMask getSupportedSanitizers() const override; protected: diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 64128dfdf534..92d61369b40f 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -497,6 +497,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_ref_qualifiers", "200710"); Builder.defineMacro("__cpp_alias_templates", "200704"); } + if (LangOpts.ThreadsafeStatics) + Builder.defineMacro("__cpp_threadsafe_static_init", "200806"); // C++14 features. if (LangOpts.CPlusPlus14) { @@ -519,6 +521,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_noexcept_function_type", "201510"); Builder.defineMacro("__cpp_capture_star_this", "201603"); Builder.defineMacro("__cpp_if_constexpr", "201606"); + Builder.defineMacro("__cpp_deduction_guides", "201611"); Builder.defineMacro("__cpp_template_auto", "201606"); Builder.defineMacro("__cpp_namespace_attributes", "201411"); Builder.defineMacro("__cpp_enumerator_attributes", "201411"); @@ -528,8 +531,6 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_structured_bindings", "201606"); Builder.defineMacro("__cpp_nontype_template_args", "201411"); Builder.defineMacro("__cpp_fold_expressions", "201603"); - // FIXME: This is not yet listed in SD-6. - Builder.defineMacro("__cpp_deduction_guides", "201611"); } if (LangOpts.AlignedAllocation) Builder.defineMacro("__cpp_aligned_new", "201606"); diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index b68559485a5e..27651c9ca85c 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -166,20 +166,11 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, } if (FnD) { - // If this is a friend function, mark that it's late-parsed so that - // it's still known to be a definition even before we attach the - // parsed body. Sema needs to treat friend function definitions - // differently during template instantiation, and it's possible for - // the containing class to be instantiated before all its member - // function definitions are parsed. - // - // If you remove this, you can remove the code that clears the flag - // after parsing the member. - if (D.getDeclSpec().isFriendSpecified()) { - FunctionDecl *FD = FnD->getAsFunction(); - Actions.CheckForFunctionRedefinition(FD); - FD->setLateTemplateParsed(true); - } + FunctionDecl *FD = FnD->getAsFunction(); + // Track that this function will eventually have a body; Sema needs + // to know this. + Actions.CheckForFunctionRedefinition(FD); + FD->setWillHaveBody(true); } else { // If semantic analysis could not build a function declaration, // just throw away the late-parsed declaration. @@ -558,10 +549,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) { ParseFunctionStatementBody(LM.D, FnScope); - // Clear the late-template-parsed bit if we set it before. - if (LM.D) - LM.D->getAsFunction()->setLateTemplateParsed(false); - while (Tok.isNot(tok::eof)) ConsumeAnyToken(); diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index ba2049d8a606..d603101c3fd9 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -552,7 +552,14 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, Qualifiers SrcQuals, DestQuals; Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); - + + // We do not meaningfully track object const-ness of Objective-C object + // types. Remove const from the source type if either the source or + // the destination is an Objective-C object type. + if (UnwrappedSrcType->isObjCObjectType() || + UnwrappedDestType->isObjCObjectType()) + SrcQuals.removeConst(); + Qualifiers RetainedSrcQuals, RetainedDestQuals; if (CheckCVR) { RetainedSrcQuals.setCVRQualifiers(SrcQuals.getCVRQualifiers()); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 91a8c619b26c..4de7d422072d 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, static std::string GetDefaultValueString(const ParmVarDecl *Param, const SourceManager &SM, const LangOptions &LangOpts) { - const Expr *defaultArg = Param->getDefaultArg(); - if (!defaultArg) - return ""; - const SourceRange SrcRange = defaultArg->getSourceRange(); + const SourceRange SrcRange = Param->getDefaultArgRange(); CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange); bool Invalid = CharSrcRange.isInvalid(); if (Invalid) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 31b24f91c1d9..692a77e2b62f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6999,6 +6999,21 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, return; } } + + if (cast(ShadowedDecl)->hasLocalStorage()) { + // A variable can't shadow a local variable in an enclosing scope, if + // they are separated by a non-capturing declaration context. + for (DeclContext *ParentDC = NewDC; + ParentDC && !ParentDC->Equals(OldDC); + ParentDC = getLambdaAwareParentOfDeclContext(ParentDC)) { + // Only block literals, captured statements, and lambda expressions + // can capture; other scopes don't. + if (!isa(ParentDC) && !isa(ParentDC) && + !isLambdaCallOperator(ParentDC)) { + return; + } + } + } } } @@ -12075,8 +12090,9 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D, FD->setInvalidDecl(); } - // See if this is a redefinition. - if (!FD->isLateTemplateParsed()) { + // See if this is a redefinition. If 'will have body' is already set, then + // these checks were already performed when it was set. + if (!FD->willHaveBody() && !FD->isLateTemplateParsed()) { CheckForFunctionRedefinition(FD, nullptr, SkipBody); // If we're skipping the body, we're done. Don't enter the scope. @@ -13278,6 +13294,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, AddMsStructLayoutForRecord(RD); } } + New->setLexicalDeclContext(CurContext); return New; }; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index abe912fb548b..6fee23aa8bc1 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3771,6 +3771,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (PatternDef) { Pattern = PatternDef->getBody(PatternDef); PatternDecl = PatternDef; + if (PatternDef->willHaveBody()) + PatternDef = nullptr; } // FIXME: We need to track the instantiation stack in order to know which diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp index 3d4b92518810..072f5e74aabb 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify -Wc++1z-extensions %s -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++1z-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -Wc++17-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++17-extensions %s struct [[nodiscard]] S {}; S get_s(); @@ -23,7 +23,7 @@ void f() { } #ifdef EXT -// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}} +// expected-warning@4 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@8 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@11 {{use of the 'nodiscard' attribute is a C++17 extension}} #endif diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp index a627d8331a74..551df38a8100 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++1z -Wc++1z-extensions -verify %s -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++1z-extensions -verify -DEXT %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s static_assert(__has_cpp_attribute(maybe_unused) == 201603, ""); @@ -20,7 +20,7 @@ void f() { } #ifdef EXT -// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++1z extension}} +// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++17 extension}} #endif diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp index 055f40f98f66..fbca6635ec18 100644 --- a/test/CXX/drs/dr0xx.cpp +++ b/test/CXX/drs/dr0xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple namespace dr1 { // dr1: no namespace X { extern "C" void dr1_f(int a = 1); } @@ -276,9 +276,9 @@ namespace dr23 { // dr23: yes namespace dr25 { // dr25: yes struct A { - void f() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} }; - void (A::*f)() throw (int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*f)() throw (int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*g)() throw () = f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -286,7 +286,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*g2)() throw () = 0; - void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (A::*i)() throw () = &A::f; #if __cplusplus <= 201402L // expected-error@-2 {{is not superset of source}} @@ -294,7 +294,7 @@ namespace dr25 { // dr25: yes // expected-error@-4 {{different exception specifications}} #endif void (A::*i2)() throw () = 0; - void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void x() { g2 = f; #if __cplusplus <= 201402L @@ -941,7 +941,7 @@ namespace dr84 { // dr84: yes }; A a; // Cannot use B(C) / operator C() pair to construct the B from the B temporary - // here. In C++1z, we initialize the B object directly using 'A::operator B()'. + // here. In C++17, we initialize the B object directly using 'A::operator B()'. B b = a; #if __cplusplus <= 201402L // expected-error@-2 {{no viable}} @@ -1033,14 +1033,14 @@ namespace dr91 { // dr91: yes } namespace dr92 { // dr92: 4 c++17 - void f() throw(int, float); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} - void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void f() throw(int, float); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} + void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{target exception specification is not superset of source}} #else // expected-warning@-4 {{target exception specification is not superset of source}} #endif - void (*q)() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + void (*q)() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} void (**pp)() throw() = &q; #if __cplusplus <= 201402L // expected-error@-2 {{exception specifications are not allowed}} @@ -1064,7 +1064,7 @@ namespace dr92 { // dr92: 4 c++17 // expected-error@-2 {{not implicitly convertible}} #endif - template struct Y {}; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}} + template struct Y {}; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}} Y<&h> yp; // ok } diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp index 64ba3be2a618..f193c8e024fb 100644 --- a/test/CXX/drs/dr13xx.cpp +++ b/test/CXX/drs/dr13xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors __extension__ typedef __SIZE_TYPE__ size_t; @@ -124,7 +124,7 @@ namespace dr1315 { // dr1315: partial namespace dr1330 { // dr1330: 4 c++11 // exception-specifications are parsed in a context where the class is complete. struct A { - void f() throw(T) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -134,7 +134,7 @@ namespace dr1330 { // dr1330: 4 c++11 #endif }; - void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} void (A::*af2)() throw() = &A::f; // expected-error-re {{{{not superset|different exception spec}}}} #if __cplusplus >= 201103L @@ -144,7 +144,7 @@ namespace dr1330 { // dr1330: 4 c++11 // Likewise, they're instantiated separately from an enclosing class template. template struct B { - void f() throw(T, typename U::type) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void f() throw(T, typename U::type) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} struct T {}; #if __cplusplus >= 201103L @@ -161,7 +161,7 @@ namespace dr1330 { // dr1330: 4 c++11 static const int value = true; }; - void (B

::*bpf1)() throw(B

::T, int) = &B

::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B

::*bpf1)() throw(B

::T, int) = &B

::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus < 201103L // expected-error@-2 {{not superset}} // FIXME: We only delay instantiation in C++11 onwards. In C++98, something @@ -172,7 +172,7 @@ namespace dr1330 { // dr1330: 4 c++11 // the "T has not yet been instantiated" error here, rather than giving // confusing errors later on. #endif - void (B

::*bpf2)() throw(int) = &B

::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}} + void (B

::*bpf2)() throw(int) = &B

::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}} #if __cplusplus <= 201402L // expected-error@-2 {{not superset}} #else @@ -194,7 +194,7 @@ namespace dr1330 { // dr1330: 4 c++11 template int f() throw(typename T::error) { return 0; } // expected-error 1-4{{prior to '::'}} expected-note 0-1{{prior to '::'}} expected-note 0-1{{requested here}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif // An exception-specification is needed even if the function is only used in // an unevaluated operand. @@ -203,7 +203,7 @@ namespace dr1330 { // dr1330: 4 c++11 decltype(f()) f2; // expected-note {{instantiation of}} bool f3 = noexcept(f()); // expected-note {{instantiation of}} #endif - // In C++1z onwards, substituting explicit template arguments into the + // In C++17 onwards, substituting explicit template arguments into the // function type substitutes into the exception specification (because it's // part of the type). In earlier languages, we don't notice there's a problem // until we've already started to instantiate. @@ -217,7 +217,7 @@ namespace dr1330 { // dr1330: 4 c++11 template struct C { C() throw(typename T::type); // expected-error 1-2{{prior to '::'}} #if __cplusplus > 201402L - // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}} + // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}} #endif }; struct D : C {}; // ok diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp index f5395cfe183d..d62ed9f0d36d 100644 --- a/test/CXX/drs/dr1xx.cpp +++ b/test/CXX/drs/dr1xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors namespace dr100 { // dr100: yes template struct A {}; // expected-note 0-1{{declared here}} @@ -313,7 +313,7 @@ namespace dr126 { // dr126: no virtual void z() throw(long); // expected-error {{more lax}} }; #else - void f() throw(int); // expected-error {{ISO C++1z does not allow}} expected-note {{use 'noexcept}} + void f() throw(int); // expected-error {{ISO C++17 does not allow}} expected-note {{use 'noexcept}} #endif } diff --git a/test/CXX/drs/dr20xx.cpp b/test/CXX/drs/dr20xx.cpp index b97a9a46bc85..5819c319fd54 100644 --- a/test/CXX/drs/dr20xx.cpp +++ b/test/CXX/drs/dr20xx.cpp @@ -10,7 +10,7 @@ #define static_assert(...) _Static_assert(__VA_ARGS__) #endif -namespace dr2094 { // dr2094: 5.0 +namespace dr2094 { // dr2094: 5 struct A { int n; }; struct B { volatile int n; }; static_assert(__is_trivially_copyable(volatile int), ""); diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp index a5677a125a00..4e745ef2f4d0 100644 --- a/test/CXX/drs/dr2xx.cpp +++ b/test/CXX/drs/dr2xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // PR13819 -- __SIZE_TYPE__ is incompatible. typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}} @@ -984,7 +984,7 @@ namespace dr289 { // dr289: yes namespace dr294 { // dr294: no void f() throw(int); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif int main() { (void)static_cast(f); // FIXME: ill-formed in C++14 and before @@ -1001,13 +1001,13 @@ namespace dr294 { // dr294: no #endif (void)static_cast(f); // FIXME: ill-formed in C++14 and before #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void (*p)() throw() = f; // expected-error-re {{{{not superset|different exception specification}}}} void (*q)() throw(int) = f; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif } } diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp index a55bb91be558..1a5976eadaff 100644 --- a/test/CXX/drs/dr4xx.cpp +++ b/test/CXX/drs/dr4xx.cpp @@ -1,7 +1,7 @@ // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets. __extension__ typedef __SIZE_TYPE__ size_t; @@ -507,16 +507,16 @@ namespace dr437 { // dr437: sup 1308 struct S { void f() throw(S); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif void g() throw(T); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U; void h() throw(U); #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif struct U {}; }; @@ -1202,7 +1202,7 @@ namespace dr495 { // dr495: 3.5 long n2 = s2; } -namespace dr496 { // dr496: sup dr2094 +namespace dr496 { // dr496: sup 2094 struct A { int n; }; struct B { volatile int n; }; int check1[ __is_trivially_copyable(const int) ? 1 : -1]; diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp index 97b40b8b7c26..5122398b7ca3 100644 --- a/test/CXX/drs/dr5xx.cpp +++ b/test/CXX/drs/dr5xx.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: This is included to avoid a diagnostic with no source location // pointing at the implicit operator new. We can't match such a diagnostic @@ -966,7 +966,7 @@ namespace dr595 { // dr595: dup 1330 template struct X { void f() throw(T) {} #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}} + // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}} #endif }; struct S { diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index 8c4f36c0ff74..ad6086835876 100644 --- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s struct pr12960 { int begin; @@ -125,7 +125,7 @@ void g() { }; for (auto a : Differ()) #if __cplusplus <= 201402L - // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++1z extension}} + // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++17 extension}} // expected-note@-6 {{selected 'begin' function with iterator type 'int *'}} // expected-note@-6 {{selected 'end' function with iterator type 'null_t'}} #endif diff --git a/test/CodeCompletion/uninstantiated_params.cpp b/test/CodeCompletion/uninstantiated_params.cpp new file mode 100644 index 000000000000..57a520dd5712 --- /dev/null +++ b/test/CodeCompletion/uninstantiated_params.cpp @@ -0,0 +1,13 @@ +template +struct unique_ptr { + typedef T* pointer; + + void reset(pointer ptr = pointer()); +}; + +void test() { + unique_ptr x; + x. + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr = pointer()#>#}) +} diff --git a/test/CodeGen/arm-float-helpers.c b/test/CodeGen/arm-float-helpers.c new file mode 100644 index 000000000000..30363304bcf9 --- /dev/null +++ b/test/CodeGen/arm-float-helpers.c @@ -0,0 +1,233 @@ +// REQUIRES: arm-registered-target +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" -target-feature "+soft-float-abi" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi -target-feature "+soft-float" %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -target-feature "+soft-float-abi" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabi -target-feature "+soft-float" -meabi gnu %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-eabihf -meabi gnu %s | FileCheck %s + +// The Runtime ABI for the ARM Architecture IHI0043 section 4.1.2 The +// floating-point helper functions to always use the base AAPCS (soft-float) +// calling convention. +// +// These helper functions such as __aeabi_fadd are not explicitly called by +// clang, instead they are generated by the ARMISelLowering when they are +// needed; clang relies on llvm to use the base AAPCS. +// +// In this test we check that clang is not directly calling the __aeabi_ +// functions. We rely on llvm to test that the base AAPCS is used for any +// __aeabi_ function from 4.1.2 that is used. +// +// When compiled to an object file with -mfloat-abi=soft each function F +// below should result in a call to __aeabi_F. If clang is changed to call any +// of these functions directly the test will need to be altered to check that +// arm_aapcscc is used. +// +// Note that it is only the functions in 4.1.2 that must use the base AAPCS, +// other runtime functions such as the _Complex helper routines are not covered. + +float fadd(float a, float b) { return a + b; } +// CHECK-LABEL: define float @fadd(float %a, float %b) +// CHECK-NOT: __aeabi_fadd +// CHECK: %add = fadd float {{.*}}, {{.*}} + +float fdiv(float a, float b) { return a / b; } +// CHECK-LABEL: define float @fdiv(float %a, float %b) +// CHECK-NOT: __aeabi_fdiv +// CHECK: %div = fdiv float {{.*}}, {{.*}} + +float fmul(float a, float b) { return a * b; } +// CHECK-LABEL: define float @fmul(float %a, float %b) +// CHECK-NOT: __aeabi_fmul +// CHECK: %mul = fmul float {{.*}}, {{.*}} + +float fsub(float a, float b) { return a - b; } +// CHECK-LABEL: define float @fsub(float %a, float %b) +// CHECK-NOT: __aeabi_fsub +// CHECK: %sub = fsub float {{.*}}, {{.*}} + +int fcmpeq(float a, float b) { return a == b; } +// CHECK-LABEL: define i32 @fcmpeq(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpeq +// CHECK: %cmp = fcmp oeq float {{.*}}, {{.*}} + +int fcmplt(float a, float b) { return a < b; } +// CHECK-LABEL: define i32 @fcmplt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmplt +// CHECK: %cmp = fcmp olt float {{.*}}, {{.*}} + +int fcmple(float a, float b) { return a <= b; } +// CHECK-LABEL: define i32 @fcmple(float %a, float %b) +// CHECK-NOT: __aeabi_fcmple +// CHECK: %cmp = fcmp ole float {{.*}}, {{.*}} + +int fcmpge(float a, float b) { return a >= b; } +// CHECK-LABEL: define i32 @fcmpge(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpge +// CHECK: %cmp = fcmp oge float {{.*}}, {{.*}} + +int fcmpgt(float a, float b) { return a > b; } +// CHECK-LABEL: define i32 @fcmpgt(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpgt +// CHECK: %cmp = fcmp ogt float {{.*}}, {{.*}} + +int fcmpun(float a, float b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @fcmpun(float %a, float %b) +// CHECK-NOT: __aeabi_fcmpun +// CHECK: %cmp = fcmp uno double %conv, %conv1 + +double dadd(double a, double b) { return a + b; } +// CHECK-LABEL: define double @dadd(double %a, double %b) +// CHECK-NOT: __aeabi_dadd +// CHECK: %add = fadd double {{.*}}, {{.*}} + +double ddiv(double a, double b) { return a / b; } +// CHECK-LABEL: define double @ddiv(double %a, double %b) +// CHECK-NOT: __aeabi_ddiv +// CHECK: %div = fdiv double {{.*}}, {{.*}} + +double dmul(double a, double b) { return a * b; } +// CHECK-LABEL: define double @dmul(double %a, double %b) +// CHECK-NOT: __aeabi_dmul +// CHECK: %mul = fmul double {{.*}}, {{.*}} + +double dsub(double a, double b) { return a - b; } +// CHECK-LABEL: define double @dsub(double %a, double %b) +// CHECK-NOT: __aeabi_dsub +// CHECK: %sub = fsub double {{.*}}, {{.*}} + +int dcmpeq(double a, double b) { return a == b; } +// CHECK-LABEL: define i32 @dcmpeq(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpeq +// CHECK: %cmp = fcmp oeq double {{.*}}, {{.*}} + +int dcmplt(double a, double b) { return a < b; } +// CHECK-LABEL: define i32 @dcmplt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmplt +// CHECK: %cmp = fcmp olt double {{.*}}, {{.*}} + +int dcmple(double a, double b) { return a <= b; } +// CHECK-LABEL: define i32 @dcmple(double %a, double %b) +// CHECK-NOT: __aeabi_dcmple +// CHECK: %cmp = fcmp ole double {{.*}}, {{.*}} + +int dcmpge(double a, double b) { return a >= b; } +// CHECK-LABEL: define i32 @dcmpge(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpge +// CHECK: %cmp = fcmp oge double {{.*}}, {{.*}} + +int dcmpgt(double a, double b) { return a > b; } +// CHECK-LABEL: define i32 @dcmpgt(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpgt +// CHECK: %cmp = fcmp ogt double {{.*}}, {{.*}} + +int dcmpun(double a, double b) { return __builtin_isunordered(a, b); } +// CHECK-LABEL: define i32 @dcmpun(double %a, double %b) +// CHECK-NOT: __aeabi_dcmpun +// CHECK: %cmp = fcmp uno double {{.*}}, {{.*}} + +int d2iz(double a) { return (int)a; } +// CHECK-LABEL: define i32 @d2iz(double %a) +// CHECK-NOT: __aeabi_d2iz +// CHECK: %conv = fptosi double {{.*}} to i32 + +unsigned int d2uiz(double a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @d2uiz(double %a) +// CHECK-NOT: __aeabi_d2uiz +// CHECK: %conv = fptoui double {{.*}} to i32 + +long long d2lz(double a) { return (long long)a; } +// CHECK-LABEL: define i64 @d2lz(double %a) +// CHECK-NOT: __aeabi_d2lz +// CHECK: %conv = fptosi double {{.*}} to i64 + +unsigned long long d2ulz(double a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @d2ulz(double %a) +// CHECK-NOT: __aeabi_d2ulz +// CHECK: %conv = fptoui double {{.*}} to i64 + +int f2iz(float a) { return (int)a; } +// CHECK-LABEL: define i32 @f2iz(float %a) +// CHECK-NOT: __aeabi_f2iz +// CHECK: %conv = fptosi float {{.*}} to i32 + +unsigned int f2uiz(float a) { return (unsigned int)a; } +// CHECK-LABEL: define i32 @f2uiz(float %a) +// CHECK-NOT: __aeabi_f2uiz +// CHECK: %conv = fptoui float {{.*}} to i32 + +long long f2lz(float a) { return (long long)a; } +// CHECK-LABEL: define i64 @f2lz(float %a) +// CHECK-NOT: __aeabi_f2lz +// CHECK: %conv = fptosi float {{.*}} to i64 + +unsigned long long f2ulz(float a) { return (unsigned long long)a; } +// CHECK-LABEL: define i64 @f2ulz(float %a) +// CHECK-NOT: __aeabi_f2ulz +// CHECK: %conv = fptoui float {{.*}} to i64 + +float d2f(double a) { return (float)a; } +// CHECK-LABEL: define float @d2f(double %a) +// CHECK-NOT: __aeabi_d2f +// CHECK: %conv = fptrunc double {{.*}} to float + +double f2d(float a) { return (double)a; } +// CHECK-LABEL: define double @f2d(float %a) +// CHECK-NOT: __aeabi_f2d +// CHECK: %conv = fpext float {{.*}} to double + +double i2d(int a) { return (double)a; } +// CHECK-LABEL: define double @i2d(i32 %a) +// CHECK-NOT: __aeabi_i2d +// CHECK: %conv = sitofp i32 {{.*}} to double + +double ui2d(unsigned int a) { return (double)a; } +// CHECK-LABEL: define double @ui2d(i32 %a) +// CHECK-NOT: __aeabi_ui2d +// CHECK: %conv = uitofp i32 {{.*}} to double + +double l2d(long long a) { return (double)a; } +// CHECK-LABEL: define double @l2d(i64 %a) +// CHECK-NOT: __aeabi_l2d +// CHECK: %conv = sitofp i64 {{.*}} to double + +double ul2d(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define double @ul2d(i64 %a) +// CHECK-NOT: __aeabi_ul2d +// CHECK: %conv = uitofp i64 {{.*}} to double + +float i2f(int a) { return (int)a; } +// CHECK-LABEL: define float @i2f(i32 %a) +// CHECK-NOT: __aeabi_i2f +// CHECK: %conv = sitofp i32 {{.*}} to float + +float ui2f(unsigned int a) { return (unsigned int)a; } +// CHECK-LABEL: define float @ui2f(i32 %a) +// CHECK-NOT: __aeabi_ui2f +// CHECK: %conv = uitofp i32 {{.*}} to float + +float l2f(long long a) { return (long long)a; } +// CHECK-LABEL: define float @l2f(i64 %a) +// CHECK-NOT: __aeabi_l2f +// CHECK: %conv = sitofp i64 {{.*}} to float + +float ul2f(unsigned long long a) { return (unsigned long long)a; } +// CHECK-LABEL: define float @ul2f(i64 %a) +// CHECK-NOT: __aeabi_ul2f +// CHECK: %conv = uitofp i64 {{.*}} to float + +// Functions in section 4.1.2 not used by llvm and don't easily map directly to +// C source code. +// cfcmpeq +// cfcmple +// cfrcmple +// cdcmpeq +// cdcmple +// cdrcmple +// frsub +// drsub diff --git a/test/CodeGen/complex-math.c b/test/CodeGen/complex-math.c index 96c7ad9cdbc9..8792ca14b9d8 100644 --- a/test/CodeGen/complex-math.c +++ b/test/CodeGen/complex-math.c @@ -2,7 +2,8 @@ // RUN: %clang_cc1 %s -O1 -emit-llvm -triple x86_64-pc-win64 -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC -// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARM +// RUN %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabi -o - | FileCheck %s --check-prefix=ARM +// RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARMHF // RUN: %clang_cc1 %s -O1 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K float _Complex add_float_rr(float a, float b) { @@ -476,8 +477,15 @@ _Bool ne_float_cc(float _Complex a, float _Complex b) { // Check that the libcall will obtain proper calling convention on ARM _Complex double foo(_Complex double a, _Complex double b) { + // These functions are not defined as floating point helper functions in + // Run-time ABI for the ARM architecture document so they must not always + // use the base AAPCS. + // ARM-LABEL: @foo( - // ARM: call arm_aapcscc { double, double } @__muldc3 + // ARM: call void { double, double } @__muldc3 + + // ARMHF-LABEL: @foo( + // ARMHF: call { double, double } @__muldc3 // ARM7K-LABEL: @foo( // ARM7K: call { double, double } @__muldc3 diff --git a/test/CodeGen/mips-aggregate-arg.c b/test/CodeGen/mips-aggregate-arg.c deleted file mode 100644 index ccf30df7c22a..000000000000 --- a/test/CodeGen/mips-aggregate-arg.c +++ /dev/null @@ -1,38 +0,0 @@ -// RUN: %clang_cc1 -triple mipsel-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32-N64 %s -// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n64 | FileCheck -check-prefix=N32-N64 %s - -struct t1 { - char t1[10]; -}; - -struct t2 { - char t2[20]; -}; - -struct t3 { - char t3[65]; -}; - -extern struct t1 g1; -extern struct t2 g2; -extern struct t3 g3; -extern void f1(struct t1); -extern void f2(struct t2); -extern void f3(struct t3); - -void f() { - -// O32: call void @f1(i32 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// O32: call void @f2(%struct.t2* byval align 4 %{{.*}}) -// O32: call void @f3(%struct.t3* byval align 4 %{{.*}}) - -// N32-N64: call void @f1(i64 inreg %{{[0-9]+}}, i16 inreg %{{[0-9]+}}) -// N32-N64: call void @f2(i64 inreg %{{[0-9]+}}, i64 inreg %{{[0-9]+}}, i32 inreg %{{[0-9]+}}) -// N32-N64: call void @f3(%struct.t3* byval align 8 %{{.*}}) - - f1(g1); - f2(g2); - f3(g3); -} - diff --git a/test/CodeGen/mips-madd4.c b/test/CodeGen/mips-madd4.c new file mode 100644 index 000000000000..bc7bb593f95d --- /dev/null +++ b/test/CodeGen/mips-madd4.c @@ -0,0 +1,87 @@ +// REQUIRES: mips-registered-target +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 %s -o -| FileCheck %s -check-prefix=MADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 %s -o -| FileCheck %s -check-prefix=NOMADD4 +// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=MADD4-NONAN +// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=NOMADD4-NONAN + +float madd_s (float f, float g, float h) +{ + return (f * g) + h; +} +// MADD4: madd.s +// NOMADD4: mul.s +// NOMADD4: add.s + +float msub_s (float f, float g, float h) +{ + return (f * g) - h; +} +// MADD4: msub.s +// NOMADD4: mul.s +// NOMADD4: sub.s + +double madd_d (double f, double g, double h) +{ + return (f * g) + h; +} +// MADD4: madd.d +// NOMADD4: mul.d +// NOMADD4: add.d + +double msub_d (double f, double g, double h) +{ + return (f * g) - h; +} +// MADD4: msub.d +// NOMADD4: mul.d +// NOMADD4: sub.d + + +float nmadd_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: add.s +// NOMADD4-NONAN: sub.s + +float nmsub_s (float f, float g, float h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.s +// NOMADD4-NONAN: mul.s +// NOMADD4-NONAN: sub.s +// NOMADD4-NONAN: sub.s + +double nmadd_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) + h); +} +// MADD4-NONAN: nmadd.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: add.d +// NOMADD4-NONAN: sub.d + +double nmsub_d (double f, double g, double h) +{ + // FIXME: Zero has been explicitly placed to force generation of a positive + // zero in IR until pattern used to match this instruction is changed to + // comply with negative zero as well. + return 0-((f * g) - h); +} +// MADD4-NONAN: nmsub.d +// NOMADD4-NONAN: mul.d +// NOMADD4-NONAN: sub.d +// NOMADD4-NONAN: sub.d + diff --git a/test/CodeGenCXX/pr34163.cpp b/test/CodeGenCXX/pr34163.cpp new file mode 100644 index 000000000000..a200a0f509bc --- /dev/null +++ b/test/CodeGenCXX/pr34163.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple x86_64-linux-gnu -o - -x c++ %s | FileCheck %s + +void f(struct X *) {} + +// CHECK: @_ZTV1X = +struct X { + void a() { delete this; } + virtual ~X() {} + virtual void key_function(); +}; + +// CHECK: define {{.*}} @_ZN1X12key_functionEv( +void X::key_function() {} diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 7c7b2f05f1dc..545951d5aa11 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -69,6 +69,14 @@ // ARMV7_HARDFLOAT-NOT: "-msoft-float" // ARMV7_HARDFLOAT: "-x" "c" +// RUN: %clang -target arm64-apple-ios10 -### -S %s -arch arm64 2>&1 | \ +// RUN: FileCheck -check-prefix=ARM64-APPLE %s +// ARM64-APPLE: -munwind-table + +// RUN: %clang -target armv7k-apple-watchos4.0 -### -S %s -arch armv7k 2>&1 | \ +// RUN: FileCheck -check-prefix=ARMV7K-APPLE %s +// ARMV7K-APPLE: -munwind-table + // RUN: %clang -target arm-linux -### -S %s -march=armv5e 2>&1 | \ // RUN: FileCheck -check-prefix=ARMV5E %s // ARMV5E: clang diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 12c7ef6eb0b1..3ff49aca6c02 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -26,6 +26,8 @@ // RUN: %clang -target armv7-apple-ios11.1 -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s +// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s // CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \ @@ -45,6 +47,10 @@ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS11 %s // CHECK-VERSION-IOS11: arm64-apple-ios11.1.0 +// RUN: %clang -target armv7-apple-ios9.0 -miphoneos-version-min=11.0 -c -Wno-invalid-ios-deployment-target -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS12 %s +// CHECK-VERSION-IOS12: thumbv7-apple-ios11.0.0 + // RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s // RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \ diff --git a/test/Driver/unknown-std.cpp b/test/Driver/unknown-std.cpp index 195a671edadf..a7aae5112221 100644 --- a/test/Driver/unknown-std.cpp +++ b/test/Driver/unknown-std.cpp @@ -13,8 +13,8 @@ // CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard // CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard -// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard -// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard +// CHECK-NEXT: note: use 'c++17' for 'ISO C++ 2017 with amendments' standard +// CHECK-NEXT: note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard // CHECK-NEXT: note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard // CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index 0b7fc626ff8a..92c561a20acc 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -216,7 +216,7 @@ template typedef Mystery::type getMysteriousThing() { // \ } template Foo, // expected-error {{template template parameter requires 'class' after the parameter list}} - template typename Bar, // expected-warning {{template template parameter using 'typename' is a C++1z extension}} + template typename Bar, // expected-warning {{template template parameter using 'typename' is a C++17 extension}} template struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}} void func(); diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index 24f38e51d91e..04821bdb2277 100644 --- a/test/Lexer/cxx-features.cpp +++ b/test/Lexer/cxx-features.cpp @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -std=c++14 -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -verify %s // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s -// RUN: %clang_cc1 -fno-rtti -verify %s -DNO_EXCEPTIONS -DNO_RTTI +// RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS // RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify %s // expected-no-diagnostics @@ -22,19 +22,15 @@ // --- C++17 features --- -#if check(variadic_using, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_variadic_using" -#endif - #if check(hex_float, 0, 0, 0, 201603) #error "wrong value for __cpp_hex_float" #endif -#if check(inline_variables, 0, 0, 0, 201606) // FIXME: provisional name +#if check(inline_variables, 0, 0, 0, 201606) #error "wrong value for __cpp_inline_variables" #endif -#if check(aligned_new, 0, 0, 0, 201606) // FIXME: provisional name +#if check(aligned_new, 0, 0, 0, 201606) #error "wrong value for __cpp_aligned_new" #endif @@ -52,7 +48,7 @@ // constexpr checked below -#if check(if_constexpr, 0, 0, 0, 201606) // FIXME: provisional name +#if check(if_constexpr, 0, 0, 0, 201606) #error "wrong value for __cpp_if_constexpr" #endif @@ -60,7 +56,11 @@ // static_assert checked below -#if check(template_auto, 0, 0, 0, 201606) // FIXME: provisional name +#if check(deduction_guides, 0, 0, 0, 201611) +#error "wrong value for __cpp_deduction_guides" +#endif + +#if check(template_auto, 0, 0, 0, 201606) #error "wrong value for __cpp_template_auto" #endif @@ -80,6 +80,10 @@ // inheriting_constructors checked below +#if check(variadic_using, 0, 0, 0, 201611) +#error "wrong value for __cpp_variadic_using" +#endif + #if check(aggregate_bases, 0, 0, 0, 201603) #error "wrong value for __cpp_aggregate_bases" #endif @@ -96,10 +100,6 @@ #error "wrong value for __cpp_template_template_args" #endif -#if check(deduction_guides, 0, 0, 0, 201611) // FIXME: provisional name -#error "wrong value for __cpp_deduction_guides" -#endif - // --- C++14 features --- #if check(binary_literals, 0, 0, 201304, 201304) @@ -163,6 +163,10 @@ #error "wrong value for __cpp_user_defined_literals" #endif +#if defined(NO_THREADSAFE_STATICS) ? check(threadsafe_static_init, 0, 0, 0, 0) : check(threadsafe_static_init, 200806, 200806, 200806, 200806) +#error "wrong value for __cpp_threadsafe_static_init" +#endif + #if check(lambdas, 0, 200907, 200907, 200907) #error "wrong value for __cpp_lambdas" #endif diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp index 163db72f56f2..3241751a1233 100644 --- a/test/Lexer/hexfloat.cpp +++ b/test/Lexer/hexfloat.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s -// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}} float f = 0x1p+1; @@ -9,10 +9,10 @@ double d = 0x.2p2; float g = 0x1.2p2; double h = 0x1.p2; #if __cplusplus <= 201402L -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} -// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} #endif // PR12717: In order to minimally diverge from the C++ standard, we do not lex diff --git a/test/Modules/Inputs/innerstructredef.h b/test/Modules/Inputs/innerstructredef.h new file mode 100644 index 000000000000..600f44e41cf8 --- /dev/null +++ b/test/Modules/Inputs/innerstructredef.h @@ -0,0 +1,6 @@ +struct Outer { +// This definition is actually hidden since only submodule 'one' is imported. +struct Inner { + int x; +} field; +}; diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 4cb3e8a02804..4788daa43166 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -451,3 +451,12 @@ module DebugNestedB { module objcAtKeywordMissingEnd { header "objcAtKeywordMissingEnd.h" } + +module innerstructredef { + module one { + header "empty.h" + } + module two { + header "innerstructredef.h" + } +} diff --git a/test/Modules/inner-struct-redefines-invisible.m b/test/Modules/inner-struct-redefines-invisible.m new file mode 100644 index 000000000000..ecf6d808df3d --- /dev/null +++ b/test/Modules/inner-struct-redefines-invisible.m @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s +// expected-no-diagnostics + +@import innerstructredef.one; + +struct Outer { +// Should set lexical context when parsing 'Inner' here, otherwise there's a crash: +struct Inner { + int x; +} field; +}; diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index 647762f165cb..5db06bd3f2a3 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++1z-extensions %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions %s // Need std::initializer_list namespace std { @@ -127,7 +127,7 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} [[]] using ns::i; // expected-error {{an attribute list cannot appear here}} [[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}} [[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}} -namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++1z}} +namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++17}} using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}} using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}} @@ -179,7 +179,7 @@ enum [[]] E2; // expected-error {{forbids forward references}} enum [[]] E1; enum [[]] E3 : int; enum [[]] { - k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++1z}} + k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++17}} }; enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}} enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}} @@ -352,7 +352,7 @@ int fallthru(int n) { switch (n) { case 0: n += 5; - [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++1z extension}} + [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++17 extension}} case 1: n *= 2; break; diff --git a/test/Parser/cxx1z-constexpr-lambdas.cpp b/test/Parser/cxx1z-constexpr-lambdas.cpp index ea000e361ccb..4cf3d1221167 100644 --- a/test/Parser/cxx1z-constexpr-lambdas.cpp +++ b/test/Parser/cxx1z-constexpr-lambdas.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++1z %s -verify +// RUN: %clang_cc1 -std=c++17 %s -verify // RUN: %clang_cc1 -std=c++14 %s -verify // RUN: %clang_cc1 -std=c++11 %s -verify @@ -23,9 +23,9 @@ auto XL16 = [] () constexpr { }; #else -auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++1z extension}} -auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++1z extension}} -auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++1z extension}} +auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}} +auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}} +auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}} #endif diff --git a/test/Parser/cxx1z-nested-namespace-definition.cpp b/test/Parser/cxx1z-nested-namespace-definition.cpp index 96f34c540acc..e5e809aa0366 100644 --- a/test/Parser/cxx1z-nested-namespace-definition.cpp +++ b/test/Parser/cxx1z-nested-namespace-definition.cpp @@ -2,13 +2,13 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT // RUN: %clang_cc1 -x c++ %t -DFIXIT -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z -Wc++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat namespace foo1::foo2::foo3 { #if __cplusplus <= 201400L -// expected-warning@-2 {{nested namespace definition is a C++1z extension; define each namespace separately}} +// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}} #else -// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++1z}} +// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}} #endif int foo(int x) { return x; } } diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 3a8e5dbd3fd8..5a77d06d2403 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -4686,6 +4686,16 @@ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-MSA %s // MIPS-MSA:#define __mips_msa 1 // +// RUN: %clang_cc1 -target-feature +nomadd4 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-NOMADD4 %s +// MIPS-NOMADD4:#define __mips_no_madd4 1 +// +// RUN: %clang_cc1 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-MADD4 %s +// MIPS-MADD4-NOT:#define __mips_no_madd4 1 +// // RUN: %clang_cc1 -target-cpu mips32r3 -target-feature +nan2008 \ // RUN: -E -dM -triple=mips-none-none < /dev/null \ // RUN: | FileCheck -match-full-lines -check-prefix MIPS-NAN2008 %s diff --git a/test/SemaCUDA/function-overload.cu b/test/SemaCUDA/function-overload.cu index 3d4c29c42cee..adf488b5eea3 100644 --- a/test/SemaCUDA/function-overload.cu +++ b/test/SemaCUDA/function-overload.cu @@ -222,7 +222,7 @@ GlobalFnPtr fp_g = g; // Test overloading of destructors // Can't mix H and unattributed destructors struct d_h { - ~d_h() {} // expected-note {{previous declaration is here}} + ~d_h() {} // expected-note {{previous definition is here}} __host__ ~d_h() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCUDA/no-destructor-overload.cu b/test/SemaCUDA/no-destructor-overload.cu index aa6971ee8ca8..32dbb8db76ec 100644 --- a/test/SemaCUDA/no-destructor-overload.cu +++ b/test/SemaCUDA/no-destructor-overload.cu @@ -7,27 +7,27 @@ // giant change to clang, and the use cases seem quite limited. struct A { - ~A() {} // expected-note {{previous declaration is here}} + ~A() {} // expected-note {{previous definition is here}} __device__ ~A() {} // expected-error {{destructor cannot be redeclared}} }; struct B { - __host__ ~B() {} // expected-note {{previous declaration is here}} + __host__ ~B() {} // expected-note {{previous definition is here}} __host__ __device__ ~B() {} // expected-error {{destructor cannot be redeclared}} }; struct C { - __host__ __device__ ~C() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~C() {} // expected-note {{previous definition is here}} __host__ ~C() {} // expected-error {{destructor cannot be redeclared}} }; struct D { - __device__ ~D() {} // expected-note {{previous declaration is here}} + __device__ ~D() {} // expected-note {{previous definition is here}} __host__ __device__ ~D() {} // expected-error {{destructor cannot be redeclared}} }; struct E { - __host__ __device__ ~E() {} // expected-note {{previous declaration is here}} + __host__ __device__ ~E() {} // expected-note {{previous definition is here}} __device__ ~E() {} // expected-error {{destructor cannot be redeclared}} }; diff --git a/test/SemaCXX/constant-expression-cxx1y.cpp b/test/SemaCXX/constant-expression-cxx1y.cpp index ac4e0fd471ae..0c0cb0ec58a1 100644 --- a/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/test/SemaCXX/constant-expression-cxx1y.cpp @@ -982,3 +982,9 @@ constexpr void PR28739(int n) { // expected-error {{never produces a constant}} int *p = &n; p += (__int128)(unsigned long)-1; // expected-note {{cannot refer to element 18446744073709551615 of non-array object in a constant expression}} } + +constexpr void Void(int n) { + void(n + 1); + void(); +} +constexpr int void_test = (Void(0), 1); diff --git a/test/SemaCXX/cxx0x-compat.cpp b/test/SemaCXX/cxx0x-compat.cpp index bcf0cf11dc18..8f7aaab6a438 100644 --- a/test/SemaCXX/cxx0x-compat.cpp +++ b/test/SemaCXX/cxx0x-compat.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++11-compat -verify %s -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++11-compat -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++11-compat -verify %s #if __cplusplus < 201103L @@ -42,14 +42,14 @@ void h(size_t foo, size_t bar) { char c = 'x'_x; // expected-warning {{will be treated as a user-defined literal suffix}} template int f() { // expected-warning {{C++11 extension}} - return (N + ...); // expected-warning {{C++1z extension}} + return (N + ...); // expected-warning {{C++17 extension}} } #else auto init_capture = [a(0)] {}; // expected-warning {{initialized lambda captures are incompatible with C++ standards before C++14}} -static_assert(true); // expected-warning {{incompatible with C++ standards before C++1z}} +static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}} -template int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++1z}} +template int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp index 668c24280258..9232a8b6eba0 100644 --- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -286,6 +286,29 @@ namespace tuple_tests { } } +namespace dependent { + template struct X { + X(T); + }; + template int Var(T t) { + X x(t); + return X(x) + 1; // expected-error {{invalid operands}} + } + template int Cast(T t) { + return X(X(t)) + 1; // expected-error {{invalid operands}} + } + template int New(T t) { + return X(new X(t)) + 1; // expected-error {{invalid operands}} + }; + template int Var(float); // expected-note {{instantiation of}} + template int Cast(float); // expected-note {{instantiation of}} + template int New(float); // expected-note {{instantiation of}} + template int operator+(X, int); + template int Var(int); + template int Cast(int); + template int New(int); +} + #else // expected-no-diagnostics diff --git a/test/SemaCXX/cxx1z-init-statement.cpp b/test/SemaCXX/cxx1z-init-statement.cpp index 4afe0402d13f..d37acd08ce77 100644 --- a/test/SemaCXX/cxx1z-init-statement.cpp +++ b/test/SemaCXX/cxx1z-init-statement.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++1z -verify %s +// RUN: %clang_cc1 -std=c++17 -verify %s void testIf() { int x = 0; diff --git a/test/SemaCXX/deprecated.cpp b/test/SemaCXX/deprecated.cpp index ac477d4b66bc..26f30c91b098 100644 --- a/test/SemaCXX/deprecated.cpp +++ b/test/SemaCXX/deprecated.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++17 %s -Wdeprecated -verify -triple x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS +// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS #include "Inputs/register.h" @@ -12,8 +12,8 @@ void h() throw(int); void i() throw(...); #if __cplusplus > 201402L // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} -// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} +// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}} #elif __cplusplus >= 201103L // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept' instead}} // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept(false)' instead}} @@ -23,7 +23,7 @@ void i() throw(...); void stuff() { register int n; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow 'register' storage class specifier}} + // expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}} #elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS) // expected-warning@-4 {{'register' storage class specifier is deprecated}} #endif @@ -34,14 +34,14 @@ void stuff() { bool b; ++b; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif b++; #if __cplusplus > 201402L - // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}} + // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} #else // expected-warning@-4 {{incrementing expression of type bool is deprecated}} #endif diff --git a/test/SemaCXX/inline.cpp b/test/SemaCXX/inline.cpp index b20bc18d0a3f..ba29521ce504 100644 --- a/test/SemaCXX/inline.cpp +++ b/test/SemaCXX/inline.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s -Wc++98-c++11-c++14-compat +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wc++98-c++11-c++14-compat // Check that we don't allow illegal uses of inline // (checking C++-only constructs here) @@ -12,7 +12,7 @@ void localVar() { // Check that we warn appropriately. #if __cplusplus <= 201402L -inline int a; // expected-warning{{inline variables are a C++1z extension}} +inline int a; // expected-warning{{inline variables are a C++17 extension}} #else -inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++1z}} +inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}} #endif diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp index 7de4d07b50b8..196375c3d687 100644 --- a/test/SemaCXX/static-assert.cpp +++ b/test/SemaCXX/static-assert.cpp @@ -49,5 +49,5 @@ struct X { ~X(); }; StaticAssertProtected sap1; StaticAssertProtected sap2; // expected-note {{instantiation}} -static_assert(true); // expected-warning {{C++1z extension}} +static_assert(true); // expected-warning {{C++17 extension}} static_assert(false); // expected-error-re {{failed{{$}}}} expected-warning {{extension}} diff --git a/test/SemaCXX/warn-c++1z-extensions.cpp b/test/SemaCXX/warn-c++1z-extensions.cpp index 9b5e1c205cf3..a0d44a34ffed 100644 --- a/test/SemaCXX/warn-c++1z-extensions.cpp +++ b/test/SemaCXX/warn-c++1z-extensions.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s void f() { - if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++1z extension}} - switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++1z extension}} + if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++17 extension}} + switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++17 extension}} case 5: break; } } diff --git a/test/SemaCXX/warn-shadow.cpp b/test/SemaCXX/warn-shadow.cpp index d5f0623eb320..3d09c786285a 100644 --- a/test/SemaCXX/warn-shadow.cpp +++ b/test/SemaCXX/warn-shadow.cpp @@ -213,3 +213,12 @@ typedef int externC; // expected-note {{previous declaration is here}} void handleLinkageSpec() { typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}} } + +namespace PR33947 { +void f(int a) { + struct A { + void g(int a) {} + A() { int a; } + }; +} +} diff --git a/test/SemaObjC/illegal-nonarc-bridged-cast.m b/test/SemaObjC/illegal-nonarc-bridged-cast.m index f3406ef983cc..23c7b96e3709 100644 --- a/test/SemaObjC/illegal-nonarc-bridged-cast.m +++ b/test/SemaObjC/illegal-nonarc-bridged-cast.m @@ -1,8 +1,9 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks -Wcast-qual -verify %s // rdar://10597832 typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; +@class NSString; @interface NSString @end @@ -18,7 +19,7 @@ NSString *CreateNSString(); void from_cf() { id obj1 = (__bridge_transfer id)CFCreateSomething(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} id obj2 = (__bridge_transfer NSString*)CFCreateString(); // expected-warning {{'__bridge_transfer' casts have no effect when not using ARC}} - (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} + (__bridge int*)CFCreateSomething(); // expected-warning {{expression result unused}} expected-warning {{cast from 'const void *' to 'int *' drops const qualifier}} id obj3 = (__bridge id)CFGetSomething(); id obj4 = (__bridge NSString*)CFGetString(); } @@ -41,3 +42,15 @@ void to_cf_ignored(id obj) { CFTypeRef cf1 = (__bridge_retained CFTypeRef)CreateSomething(); // no-warning CFTypeRef cf3 = (__bridge CFTypeRef)CreateSomething(); // no-warning } + +// Check that clang doesn't warn about dropping const from Objective-C object +// types. +void test_wcast_qual() { + CFStringRef c; + NSString *n0 = (NSString *)c; + NSString **n1 = (NSString **)&c; + const NSString *n2; + const NSString **n3; + void *p0 = (void *)n2; + void **p1 = (void **)n3; +} diff --git a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp index cfaad0cd0c96..0b8f0eed1601 100644 --- a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp +++ b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp @@ -25,7 +25,7 @@ namespace CanonicalNullptr { } namespace Auto { - template struct A { }; // expected-error {{until C++1z}} + template struct A { }; // expected-error {{until C++17}} } namespace check_conversion_early { diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index b03b3f0ef9c2..2a326e76aa6a 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -28,7 +28,7 @@

C++ Defect Report Support in Clang

-

Last updated: $Date: 2017-05-10 00:21:24 +0200 (Wed, 10 May 2017) $

+

Last updated: $Date: 2017-08-11 18:07:17 +0200 (Fri, 11 Aug 2017) $

C++ defect report implementation status

@@ -591,7 +591,7 @@ 92 CD4 Should exception-specifications be part of the type system? - Clang 4 (C++17 onwards) + Clang 4 (C++17 onwards) 93 @@ -813,7 +813,7 @@ 129 CD3 Stability of uninitialized auto variables - Duplicate of 616 + Duplicate of 616 130 @@ -1480,7 +1480,7 @@ accessible? 240 CD3 Uninitialized values and undefined behavior - Duplicate of 616 + Duplicate of 616 241 @@ -1594,7 +1594,7 @@ accessible? 259 CD1 Restrictions on explicit specialization and instantiation - Clang 4 + Clang 4 260 @@ -1913,7 +1913,7 @@ of class templates 312 CD3 “use” of invalid pointer value not defined - Duplicate of 616 + Duplicate of 616 313 @@ -2279,7 +2279,7 @@ of class templates 373 C++11 Lookup on namespace qualified name in using-directive - SVN + Clang 5 374 @@ -3017,7 +3017,7 @@ of class templates 496 CD3 Is a volatile-qualified type really a POD? - Superseded by dr2094 + Superseded by 2094 497 @@ -3541,7 +3541,7 @@ and POD class 583 CD3 Relational pointer comparisons against the null pointer constant - Clang 4 + Clang 4 584 @@ -3613,7 +3613,7 @@ and POD class 595 dup Exception specifications in templates instantiated from class bodies - Duplicate of 1330 + Duplicate of 1330 596 @@ -3739,7 +3739,7 @@ and POD class 616 CD3 Definition of “indeterminate value” - Clang 4 + Clang 4 617 @@ -5839,7 +5839,7 @@ and POD class 1004 C++11 Injected-class-names as arguments for template template parameters - SVN + Clang 5 1005 @@ -7093,7 +7093,7 @@ and POD class 1213 CD3 Array subscripting and xvalues - Clang 4 + Clang 4 1214 @@ -7405,7 +7405,7 @@ and POD class 1265 CD3 Mixed use of the auto specifier - SVN + Clang 5 1266 @@ -7585,7 +7585,7 @@ and POD class 1295 CD3 Binding a reference to an rvalue bit-field - Clang 4 + Clang 4 1296 @@ -7675,7 +7675,7 @@ and POD class 1310 CD3 What is an “acceptable lookup result?” - SVN + Clang 5 1311 @@ -7795,7 +7795,7 @@ and POD class 1330 CD3 Delayed instantiation of noexcept specifiers - Clang 4 (C++11 onwards) + Clang 4 (C++11 onwards) 1331 @@ -8143,7 +8143,7 @@ and POD class 1388 CD3 Missing non-deduced context following a function parameter pack - Clang 4 + Clang 4 1389 @@ -8209,7 +8209,7 @@ and POD class 1399 CD3 Deduction with multiple function parameter packs - Duplicate of 1388 + Duplicate of 1388 1400 @@ -8785,7 +8785,7 @@ and POD class 1495 CD3 Partial specialization of variadic class template - Clang 4 + Clang 4 1496 @@ -8887,7 +8887,7 @@ and POD class 1512 CD3 Pointer comparison vs qualification conversions - Clang 4 + Clang 4 1513 @@ -8923,7 +8923,7 @@ and POD class 1518 CD4 Explicit default constructors and copy-list-initialization - Clang 4 + Clang 4 1519 @@ -9733,7 +9733,7 @@ and POD class 1653 CD4 Removing deprecated increment of bool - Clang 4 (C++17 onwards) + Clang 4 (C++17 onwards) 1654 @@ -9763,7 +9763,7 @@ and POD class 1658 C++14 Deleted default constructor for abstract class via destructor - SVN + Clang 5 1659 @@ -11161,7 +11161,7 @@ and POD class 1891 CD4 Move constructor/assignment for closure class - Clang 4 + Clang 4 1892 @@ -12379,7 +12379,7 @@ and POD class 2094 DR Trivial copy/move constructor for class with volatile member - Clang 5.0 + Clang 5 2095 diff --git a/www/cxx_status.html b/www/cxx_status.html index 39c3147ca47c..4a4d44bd3679 100644 --- a/www/cxx_status.html +++ b/www/cxx_status.html @@ -26,7 +26,7 @@

C++ Support in Clang

-

Last updated: $Date: 2017-07-15 17:51:59 +0200 (Sat, 15 Jul 2017) $

+

Last updated: $Date: 2017-08-11 18:16:08 +0200 (Fri, 11 Aug 2017) $

Clang fully implements all published ISO C++ standards (C++98 / C++03, Available in Clang? - SD-6: SG10 feature test recommendations - SD-6 - N/A + SD-6: SG10 feature test recommendations + SD-6 + N/A Clang 3.4 (N3745)
@@ -871,6 +871,11 @@ and library features that are not part of standard C++.

Clang 4 (P0096R3) + + + Clang 5 (P0096R4) + +