diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-08 17:13:11 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-08 17:13:11 +0000 |
commit | 0a5fb09b599c1bdea3cd11168bb8f4ff4040316e (patch) | |
tree | 5e94367d1a8032322c6871cfe16714c0982fd61a /include | |
parent | f0c0337bbfb63d1f9edf145aab535bdf82c20454 (diff) | |
download | src-0a5fb09b599c1bdea3cd11168bb8f4ff4040316e.tar.gz src-0a5fb09b599c1bdea3cd11168bb8f4ff4040316e.zip |
Vendor import of clang trunk r302418:vendor/clang/clang-trunk-r302418
Notes
Notes:
svn path=/vendor/clang/dist/; revision=317951
svn path=/vendor/clang/clang-trunk-r302418/; revision=317952; tag=vendor/clang/clang-trunk-r302418
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/ODRHash.h | 2 | ||||
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 14 | ||||
-rw-r--r-- | include/clang/Basic/Attr.td | 7 | ||||
-rw-r--r-- | include/clang/Basic/AttrDocs.td | 15 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsARM.def | 84 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 6 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86_64.def | 2 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 18 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 21 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 3 | ||||
-rw-r--r-- | include/clang/Driver/Distro.h | 5 | ||||
-rw-r--r-- | include/clang/Driver/Multilib.h | 9 | ||||
-rw-r--r-- | include/clang/Driver/Options.td | 4 | ||||
-rw-r--r-- | include/clang/Frontend/CodeGenOptions.def | 1 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 2 | ||||
-rw-r--r-- | include/clang/Lex/HeaderSearch.h | 12 | ||||
-rw-r--r-- | include/clang/Lex/Lexer.h | 5 | ||||
-rw-r--r-- | include/clang/Lex/ModuleMap.h | 10 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 31 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 3 | ||||
-rw-r--r-- | include/clang/Tooling/FixIt.h | 7 |
21 files changed, 233 insertions, 28 deletions
diff --git a/include/clang/AST/ODRHash.h b/include/clang/AST/ODRHash.h index 9af8488fca10..e4cc12d35891 100644 --- a/include/clang/AST/ODRHash.h +++ b/include/clang/AST/ODRHash.h @@ -25,7 +25,7 @@ namespace clang { class Decl; class IdentifierInfo; -class NestedNameSpecifer; +class NestedNameSpecifier; class Stmt; class TemplateParameterList; diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index f11469b8fc20..0ab8d5fe4fc1 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -1223,6 +1223,20 @@ AST_MATCHER_P(InitListExpr, hasSyntacticForm, InnerMatcher.matches(*SyntForm, Finder, Builder)); } +/// \brief Matches C++ initializer list expressions. +/// +/// Given +/// \code +/// std::vector<int> a({ 1, 2, 3 }); +/// std::vector<int> b = { 4, 5 }; +/// int c[] = { 6, 7 }; +/// std::pair<int, int> d = { 8, 9 }; +/// \endcode +/// cxxStdInitializerListExpr() +/// matches "{ 1, 2, 3 }" and "{ 4, 5 }" +const internal::VariadicDynCastAllOfMatcher<Stmt, + CXXStdInitializerListExpr> cxxStdInitializerListExpr; + /// \brief Matches implicit initializers of init list expressions. /// /// Given diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 04a948a6c46e..3eeeb1bdc971 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -864,6 +864,13 @@ def OpenCLUnrollHint : InheritableAttr { let Documentation = [OpenCLUnrollHintDocs]; } +def OpenCLIntelReqdSubGroupSize: InheritableAttr { + let Spellings = [GNU<"intel_reqd_sub_group_size">]; + let Args = [UnsignedArgument<"SubGroupSize">]; + let Subjects = SubjectList<[Function], ErrorDiag>; + let Documentation = [OpenCLIntelReqdSubGroupSizeDocs]; +} + // This attribute is both a type attribute, and a declaration attribute (for // parameter variables). def OpenCLAccess : Attr { diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index be2a91515ae8..9e2fdf4834aa 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -2216,6 +2216,21 @@ s6.11.5 for details. }]; } +def OpenCLIntelReqdSubGroupSizeDocs : Documentation { + let Category = DocCatStmt; + let Heading = "__attribute__((intel_reqd_sub_group_size))"; + let Content = [{ +The optional attribute intel_reqd_sub_group_size can be used to indicate that +the kernel must be compiled and executed with the specified subgroup size. When +this attribute is present, get_max_sub_group_size() is guaranteed to return the +specified integer value. This is important for the correctness of many subgroup +algorithms, and in some cases may be used by the compiler to generate more optimal +code. See `cl_intel_required_subgroup_size +<https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt>` +for details. + }]; +} + def OpenCLAccessDocs : Documentation { let Category = DocCatStmt; let Heading = "__read_only, __write_only, __read_write (read_only, write_only, read_write)"; diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def index 6cc7308d4cbc..e8db347d4be5 100644 --- a/include/clang/Basic/BuiltinsARM.def +++ b/include/clang/Basic/BuiltinsARM.def @@ -25,11 +25,93 @@ // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") +// 16-bit multiplications +BUILTIN(__builtin_arm_smulbb, "iii", "nc") +BUILTIN(__builtin_arm_smulbt, "iii", "nc") +BUILTIN(__builtin_arm_smultb, "iii", "nc") +BUILTIN(__builtin_arm_smultt, "iii", "nc") +BUILTIN(__builtin_arm_smulwb, "iii", "nc") +BUILTIN(__builtin_arm_smulwt, "iii", "nc") + // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") BUILTIN(__builtin_arm_qsub, "iii", "nc") BUILTIN(__builtin_arm_ssat, "iiUi", "nc") -BUILTIN(__builtin_arm_usat, "UiUiUi", "nc") +BUILTIN(__builtin_arm_usat, "UiiUi", "nc") + +BUILTIN(__builtin_arm_smlabb, "iiii", "nc") +BUILTIN(__builtin_arm_smlabt, "iiii", "nc") +BUILTIN(__builtin_arm_smlatb, "iiii", "nc") +BUILTIN(__builtin_arm_smlatt, "iiii", "nc") +BUILTIN(__builtin_arm_smlawb, "iiii", "nc") +BUILTIN(__builtin_arm_smlawt, "iiii", "nc") + +BUILTIN(__builtin_arm_ssat16, "iii", "nc") +BUILTIN(__builtin_arm_usat16, "iii", "nc") + +BUILTIN(__builtin_arm_sxtab16, "iii", "nc") +BUILTIN(__builtin_arm_sxtb16, "ii", "nc") +BUILTIN(__builtin_arm_uxtab16, "iii", "nc") +BUILTIN(__builtin_arm_uxtb16, "ii", "nc") + +BUILTIN(__builtin_arm_sel, "iii", "nc") + +BUILTIN(__builtin_arm_qadd8, "iii", "nc") +BUILTIN(__builtin_arm_qsub8, "iii", "nc") +BUILTIN(__builtin_arm_sadd8, "iii", "nc") +BUILTIN(__builtin_arm_shadd8, "iii", "nc") +BUILTIN(__builtin_arm_shsub8, "iii", "nc") +BUILTIN(__builtin_arm_ssub8, "iii", "nc") +BUILTIN(__builtin_arm_uadd8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhadd8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhsub8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqadd8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqsub8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_usub8, "UiUiUi", "nc") + +// Sum of 8-bit absolute differences +BUILTIN(__builtin_arm_usad8, "UiUiUi", "nc") +BUILTIN(__builtin_arm_usada8, "UiUiUiUi", "nc") + +// Parallel 16-bit addition and subtraction +BUILTIN(__builtin_arm_qadd16, "iii", "nc") +BUILTIN(__builtin_arm_qasx, "iii", "nc") +BUILTIN(__builtin_arm_qsax, "iii", "nc") +BUILTIN(__builtin_arm_qsub16, "iii", "nc") +BUILTIN(__builtin_arm_sadd16, "iii", "nc") +BUILTIN(__builtin_arm_sasx, "iii", "nc") +BUILTIN(__builtin_arm_shadd16, "iii", "nc") +BUILTIN(__builtin_arm_shasx, "iii", "nc") +BUILTIN(__builtin_arm_shsax, "iii", "nc") +BUILTIN(__builtin_arm_shsub16, "iii", "nc") +BUILTIN(__builtin_arm_ssax, "iii", "nc") +BUILTIN(__builtin_arm_ssub16, "iii", "nc") +BUILTIN(__builtin_arm_uadd16, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uasx, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhadd16, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhasx, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhsax, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uhsub16, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqadd16, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqasx, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqsax, "UiUiUi", "nc") +BUILTIN(__builtin_arm_uqsub16, "UiUiUi", "nc") +BUILTIN(__builtin_arm_usax, "UiUiUi", "nc") +BUILTIN(__builtin_arm_usub16, "UiUiUi", "nc") + +// Parallel 16-bit multiplication +BUILTIN(__builtin_arm_smlad, "iiii", "nc") +BUILTIN(__builtin_arm_smladx, "iiii", "nc") +BUILTIN(__builtin_arm_smlald, "LLiiiLLi", "nc") +BUILTIN(__builtin_arm_smlaldx, "LLiiiLLi", "nc") +BUILTIN(__builtin_arm_smlsd, "iiii", "nc") +BUILTIN(__builtin_arm_smlsdx, "iiii", "nc") +BUILTIN(__builtin_arm_smlsld, "LLiiiLLi", "nc") +BUILTIN(__builtin_arm_smlsldx, "LLiiiLLi", "nc") +BUILTIN(__builtin_arm_smuad, "iii", "nc") +BUILTIN(__builtin_arm_smuadx, "iii", "nc") +BUILTIN(__builtin_arm_smusd, "iii", "nc") +BUILTIN(__builtin_arm_smusdx, "iii", "nc") // Bit manipulation BUILTIN(__builtin_arm_rbit, "UiUi", "nc") diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index c8a3c2f4d3ab..68b868ce8e6e 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -668,6 +668,12 @@ TARGET_BUILTIN(__builtin_ia32_pext_si, "UiUiUi", "", "bmi2") // TBM TARGET_BUILTIN(__builtin_ia32_bextri_u32, "UiUiIUi", "", "tbm") +// LWP +TARGET_BUILTIN(__builtin_ia32_llwpcb, "vv*", "", "lwp") +TARGET_BUILTIN(__builtin_ia32_slwpcb, "v*", "", "lwp") +TARGET_BUILTIN(__builtin_ia32_lwpins32, "UcUiUiUi", "", "lwp") +TARGET_BUILTIN(__builtin_ia32_lwpval32, "vUiUiUi", "", "lwp") + // SHA TARGET_BUILTIN(__builtin_ia32_sha1rnds4, "V4iV4iV4iIc", "", "sha") TARGET_BUILTIN(__builtin_ia32_sha1nexte, "V4iV4iV4i", "", "sha") diff --git a/include/clang/Basic/BuiltinsX86_64.def b/include/clang/Basic/BuiltinsX86_64.def index d38f522c3812..2851184c2c84 100644 --- a/include/clang/Basic/BuiltinsX86_64.def +++ b/include/clang/Basic/BuiltinsX86_64.def @@ -69,6 +69,8 @@ TARGET_BUILTIN(__builtin_ia32_bzhi_di, "ULLiULLiULLi", "", "bmi2") TARGET_BUILTIN(__builtin_ia32_pdep_di, "ULLiULLiULLi", "", "bmi2") TARGET_BUILTIN(__builtin_ia32_pext_di, "ULLiULLiULLi", "", "bmi2") TARGET_BUILTIN(__builtin_ia32_bextri_u64, "ULLiULLiIULLi", "", "tbm") +TARGET_BUILTIN(__builtin_ia32_lwpins64, "UcULLiUiUi", "", "lwp") +TARGET_BUILTIN(__builtin_ia32_lwpval64, "vULLiUiUi", "", "lwp") TARGET_BUILTIN(__builtin_ia32_pbroadcastq512_gpr_mask, "V8LLiLLiV8LLiUc", "", "avx512f") TARGET_BUILTIN(__builtin_ia32_pbroadcastq128_gpr_mask, "V2LLiULLiV2LLiUc","","avx512vl") TARGET_BUILTIN(__builtin_ia32_pbroadcastq256_gpr_mask, "V4LLiULLiV4LLiUc","","avx512vl") diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index cd284e94303b..77db8993f018 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -475,8 +475,6 @@ def warn_pragma_pop_macro_no_push : Warning< def warn_pragma_message : Warning<"%0">, InGroup<PoundPragmaMessage>, DefaultWarnNoWerror; def err_pragma_message : Error<"%0">; -def err_pragma_module_import_expected_module_name : Error< - "expected %select{identifier in|'.' or end of directive after}0 module name">; def warn_pragma_ignored : Warning<"unknown pragma ignored">, InGroup<UnknownPragmas>, DefaultIgnore; def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, @@ -511,6 +509,22 @@ def warn_pragma_debug_unexpected_command : Warning< "unexpected debug command '%0'">, InGroup<IgnoredPragmas>; def warn_pragma_debug_missing_argument : Warning< "missing argument to debug command '%0'">, InGroup<IgnoredPragmas>; +// #pragma module +def err_pp_expected_module_name : Error< + "expected %select{identifier after '.' in |}0module name">; +def err_pp_module_begin_wrong_module : Error< + "must specify '-fmodule-name=%0' to enter %select{|submodule of }1" + "this module%select{ (current module is %3)|}2">; +def err_pp_module_begin_no_module_map : Error< + "no module map available for module %0">; +def err_pp_module_begin_no_submodule : Error< + "submodule %0.%1 not declared in module map">; +def err_pp_module_begin_without_module_end : Error< + "no matching '#pragma clang module end' for this " + "'#pragma clang module begin'">; +def err_pp_module_end_without_module_begin : Error< + "no matching '#pragma clang module begin' for this " + "'#pragma clang module end'">; def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">; def err_paste_at_start : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 6a3a2124a5ff..a0c0e5f86449 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -730,6 +730,9 @@ def err_super_in_lambda_unsupported : Error< def warn_pragma_unused_undeclared_var : Warning< "undeclared variable %0 used as an argument for '#pragma unused'">, InGroup<IgnoredPragmas>; +def warn_atl_uuid_deprecated : Warning< + "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">, + InGroup<DeprecatedDeclarations>; def warn_pragma_unused_expected_var_arg : Warning< "only variables can be arguments to '#pragma unused'">, InGroup<IgnoredPragmas>; @@ -2088,7 +2091,7 @@ def err_enum_invalid_underlying : Error< "non-integral type %0 is an invalid underlying type">; def err_enumerator_too_large : Error< "enumerator value is not representable in the underlying type %0">; -def ext_enumerator_too_large : ExtWarn< +def ext_enumerator_too_large : Extension< "enumerator value is not representable in the underlying type %0">, InGroup<MicrosoftEnumValue>; def err_enumerator_wrapped : Error< @@ -2868,7 +2871,8 @@ def warn_partial_availability : Warning<"%0 is only available conditionally">, def note_partial_availability_silence : Note< "explicitly redeclare %0 to silence this warning">; def note_unguarded_available_silence : Note< - "enclose %0 in an @available check to silence this warning">; + "enclose %0 in %select{an @available|a __builtin_available}1 check to silence" + " this warning">; def warn_partial_message : Warning<"%0 is partial: %1">, InGroup<UnguardedAvailability>, DefaultIgnore; def warn_partial_fwdclass_message : Warning< @@ -4759,7 +4763,7 @@ def ext_forward_ref_enum : Extension< "ISO C forbids forward references to 'enum' types">; def err_forward_ref_enum : Error< "ISO C++ forbids forward references to 'enum' types">; -def ext_ms_forward_ref_enum : Extension< +def ext_ms_forward_ref_enum : ExtWarn< "forward references to 'enum' types are a Microsoft extension">, InGroup<MicrosoftEnumForwardReference>; def ext_forward_ref_enum_def : Extension< @@ -7920,7 +7924,11 @@ def warn_empty_switch_body : Warning< def note_empty_body_on_separate_line : Note< "put the semicolon on a separate line to silence this warning">; -def err_va_start_used_in_non_variadic_function : Error< +def err_va_start_captured_stmt : Error< + "'va_start' cannot be used in a captured statement">; +def err_va_start_outside_function : Error< + "'va_start' cannot be used outside a function">; +def err_va_start_fixed_function : Error< "'va_start' used in function with fixed args">; def err_va_start_used_in_wrong_abi_function : Error< "'va_start' used in %select{System V|Win64}0 ABI function">; @@ -8297,6 +8305,8 @@ def err_sampler_argument_required : Error< "sampler_t variable required - got %0">; def err_wrong_sampler_addressspace: Error< "sampler type cannot be used with the __local and __global address space qualifiers">; +def err_opencl_nonconst_global_sampler : Error< + "global sampler requires a const or constant address space qualifier">; def err_opencl_cast_non_zero_to_event_t : Error< "cannot cast non-zero value '%0' to 'event_t'">; def err_opencl_global_invalid_addr_space : Error< @@ -8971,6 +8981,9 @@ def warn_nullability_lost : Warning< "implicit conversion from nullable pointer %0 to non-nullable pointer " "type %1">, InGroup<NullableToNonNullConversion>, DefaultIgnore; +def warn_zero_as_null_pointer_constant : Warning< + "zero as null pointer constant">, + InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore; def err_nullability_cs_multilevel : Error< "nullability keyword %0 cannot be applied to multi-level pointer type %1">; diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 63348c094c93..bd2062d967b4 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -297,6 +297,9 @@ def fsanitize_coverage_trace_pc def fsanitize_coverage_trace_pc_guard : Flag<["-"], "fsanitize-coverage-trace-pc-guard">, HelpText<"Enable PC tracing with guard in sanitizer coverage">; +def fsanitize_coverage_no_prune + : Flag<["-"], "fsanitize-coverage-no-prune">, + HelpText<"Disable coverage pruning (i.e. instrument all blocks/edges)">; def fprofile_instrument_EQ : Joined<["-"], "fprofile-instrument=">, HelpText<"Enable PGO instrumentation. The accepted value is clang, llvm, " "or none">; diff --git a/include/clang/Driver/Distro.h b/include/clang/Driver/Distro.h index e2fb8b643350..fab49862a442 100644 --- a/include/clang/Driver/Distro.h +++ b/include/clang/Driver/Distro.h @@ -57,6 +57,7 @@ public: UbuntuXenial, UbuntuYakkety, UbuntuZesty, + UbuntuArtful, UnknownDistro }; @@ -110,9 +111,9 @@ public: } bool IsUbuntu() const { - return DistroVal >= UbuntuHardy && DistroVal <= UbuntuZesty; + return DistroVal >= UbuntuHardy && DistroVal <= UbuntuArtful; } - + /// @} }; diff --git a/include/clang/Driver/Multilib.h b/include/clang/Driver/Multilib.h index 0419186b745d..36d2493b1afc 100644 --- a/include/clang/Driver/Multilib.h +++ b/include/clang/Driver/Multilib.h @@ -70,13 +70,21 @@ public: /// All elements begin with either '+' or '-' const flags_list &flags() const { return Flags; } flags_list &flags() { return Flags; } + /// Add a flag to the flags list + /// \p Flag must be a flag accepted by the driver with its leading '-' removed, + /// and replaced with either: + /// '-' which contraindicates using this multilib with that flag + /// or: + /// '+' which promotes using this multilib in the presence of that flag + /// otherwise '-print-multi-lib' will not emit them correctly. Multilib &flag(StringRef F) { assert(F.front() == '+' || F.front() == '-'); Flags.push_back(F); return *this; } + LLVM_DUMP_METHOD void dump() const; /// \brief print summary of the Multilib void print(raw_ostream &OS) const; @@ -150,6 +158,7 @@ public: unsigned size() const { return Multilibs.size(); } + LLVM_DUMP_METHOD void dump() const; void print(raw_ostream &OS) const; MultilibSet &setIncludeDirsCallback(IncludeDirsFunc F) { diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 1272a36ecc70..31015228f362 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1688,6 +1688,8 @@ def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>, HelpText<"Additional arguments to forward to LLVM's option processing">; def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">, Group<m_Group>, HelpText<"Set Mac OS X deployment target">; +def mmacos_version_min_EQ : Joined<["-"], "mmacos-version-min=">, + Group<m_Group>, Alias<mmacosx_version_min_EQ>; def mms_bitfields : Flag<["-"], "mms-bitfields">, Group<m_Group>, Flags<[CC1Option]>, HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">; def mno_ms_bitfields : Flag<["-"], "mno-ms-bitfields">, Group<m_Group>, @@ -1750,6 +1752,7 @@ def mno_bmi : Flag<["-"], "mno-bmi">, Group<m_x86_Features_Group>; def mno_bmi2 : Flag<["-"], "mno-bmi2">, Group<m_x86_Features_Group>; def mno_popcnt : Flag<["-"], "mno-popcnt">, Group<m_x86_Features_Group>; def mno_tbm : Flag<["-"], "mno-tbm">, Group<m_x86_Features_Group>; +def mno_lwp : Flag<["-"], "mno-lwp">, Group<m_x86_Features_Group>; def mno_fma4 : Flag<["-"], "mno-fma4">, Group<m_x86_Features_Group>; def mno_fma : Flag<["-"], "mno-fma">, Group<m_x86_Features_Group>; def mno_xop : Flag<["-"], "mno-xop">, Group<m_x86_Features_Group>; @@ -1949,6 +1952,7 @@ def mbmi : Flag<["-"], "mbmi">, Group<m_x86_Features_Group>; def mbmi2 : Flag<["-"], "mbmi2">, Group<m_x86_Features_Group>; def mpopcnt : Flag<["-"], "mpopcnt">, Group<m_x86_Features_Group>; def mtbm : Flag<["-"], "mtbm">, Group<m_x86_Features_Group>; +def mlwp : Flag<["-"], "mlwp">, Group<m_x86_Features_Group>; def mfma4 : Flag<["-"], "mfma4">, Group<m_x86_Features_Group>; def mfma : Flag<["-"], "mfma">, Group<m_x86_Features_Group>; def mxop : Flag<["-"], "mxop">, Group<m_x86_Features_Group>; diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index 0b7d466ab3d4..7495ad808c99 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -160,6 +160,7 @@ CODEGENOPT(SanitizeCoverageTracePC, 1, 0) ///< Enable PC tracing ///< in sanitizer coverage. CODEGENOPT(SanitizeCoverageTracePCGuard, 1, 0) ///< Enable PC tracing with guard ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageNoPrune, 1, 0) ///< Disable coverage pruning. CODEGENOPT(SanitizeStats , 1, 0) ///< Collect statistics for sanitizers. CODEGENOPT(SimplifyLibCalls , 1, 1) ///< Set when -fbuiltin is enabled. CODEGENOPT(SoftFloat , 1, 0) ///< -soft-float. diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index 384499a3d82a..8d690a448f85 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -146,6 +146,8 @@ public: return *CurrentASTUnit; } + Module *getCurrentModule() const; + std::unique_ptr<ASTUnit> takeCurrentASTUnit() { return std::move(CurrentASTUnit); } diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index 64c6f2a03f2b..6e24e1893ab6 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -538,9 +538,15 @@ public: /// /// \param File The module map file. /// \param IsSystem Whether this file is in a system header directory. + /// \param ID If the module map file is already mapped (perhaps as part of + /// processing a preprocessed module), the ID of the file. + /// \param Offset [inout] An offset within ID to start parsing. On exit, + /// filled by the end of the parsed contents (either EOF or the + /// location of an end-of-module-map pragma). /// /// \returns true if an error occurred, false otherwise. - bool loadModuleMapFile(const FileEntry *File, bool IsSystem); + bool loadModuleMapFile(const FileEntry *File, bool IsSystem, + FileID ID = FileID(), unsigned *Offset = nullptr); /// \brief Collect the set of all known, top-level modules. /// @@ -686,7 +692,9 @@ private: LoadModuleMapResult loadModuleMapFileImpl(const FileEntry *File, bool IsSystem, - const DirectoryEntry *Dir); + const DirectoryEntry *Dir, + FileID ID = FileID(), + unsigned *Offset = nullptr); /// \brief Try to load the module map file in the given directory. /// diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index 6ac6316d1248..3be733167e5c 100644 --- a/include/clang/Lex/Lexer.h +++ b/include/clang/Lex/Lexer.h @@ -478,6 +478,11 @@ public: return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts); } + /// Returns the leading whitespace for line that corresponds to the given + /// location \p Loc. + static StringRef getIndentationForLine(SourceLocation Loc, + const SourceManager &SM); + //===--------------------------------------------------------------------===// // Internal implementation interfaces. private: diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h index 46136725d87a..0fd6abe2f7d0 100644 --- a/include/clang/Lex/ModuleMap.h +++ b/include/clang/Lex/ModuleMap.h @@ -546,14 +546,20 @@ public: /// \param HomeDir The directory in which relative paths within this module /// map file will be resolved. /// + /// \param ID The FileID of the file to process, if we've already entered it. + /// + /// \param Offset [inout] On input the offset at which to start parsing. On + /// output, the offset at which the module map terminated. + /// /// \param ExternModuleLoc The location of the "extern module" declaration /// that caused us to load this module map file, if any. /// /// \returns true if an error occurred, false otherwise. bool parseModuleMapFile(const FileEntry *File, bool IsSystem, - const DirectoryEntry *HomeDir, + const DirectoryEntry *HomeDir, FileID ID = FileID(), + unsigned *Offset = nullptr, SourceLocation ExternModuleLoc = SourceLocation()); - + /// \brief Dump the contents of the module map, for debugging purposes. void dump(); diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index b1a7325c3426..0e3f563785d4 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -324,7 +324,7 @@ class Preprocessor { /// \brief If the current lexer is for a submodule that is being built, this /// is that submodule. - Module *CurSubmodule; + Module *CurLexerSubmodule; /// \brief Keeps track of the stack of files currently /// \#included, and macros currently being expanded from, not counting @@ -507,16 +507,19 @@ class Preprocessor { /// \brief Information about a submodule that we're currently building. struct BuildingSubmoduleInfo { - BuildingSubmoduleInfo(Module *M, SourceLocation ImportLoc, + BuildingSubmoduleInfo(Module *M, SourceLocation ImportLoc, bool IsPragma, SubmoduleState *OuterSubmoduleState, unsigned OuterPendingModuleMacroNames) - : M(M), ImportLoc(ImportLoc), OuterSubmoduleState(OuterSubmoduleState), + : M(M), ImportLoc(ImportLoc), IsPragma(IsPragma), + OuterSubmoduleState(OuterSubmoduleState), OuterPendingModuleMacroNames(OuterPendingModuleMacroNames) {} /// The module that we are building. Module *M; /// The location at which the module was included. SourceLocation ImportLoc; + /// Whether we entered this submodule via a pragma. + bool IsPragma; /// The previous SubmoduleState. SubmoduleState *OuterSubmoduleState; /// The number of pending module macro names when we started building this. @@ -773,8 +776,9 @@ public: /// expansions going on at the time. PreprocessorLexer *getCurrentFileLexer() const; - /// \brief Return the submodule owning the file being lexed. - Module *getCurrentSubmodule() const { return CurSubmodule; } + /// \brief Return the submodule owning the file being lexed. This may not be + /// the current module if we have changed modules since entering the file. + Module *getCurrentLexerSubmodule() const { return CurLexerSubmodule; } /// \brief Returns the FileID for the preprocessor predefines. FileID getPredefinesFileID() const { return PredefinesFileID; } @@ -1726,13 +1730,16 @@ public: bool CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef, bool *ShadowFlag = nullptr); -private: + void EnterSubmodule(Module *M, SourceLocation ImportLoc, bool ForPragma); + Module *LeaveSubmodule(bool ForPragma); +private: void PushIncludeMacroStack() { assert(CurLexerKind != CLK_CachingLexer && "cannot push a caching lexer"); - IncludeMacroStack.emplace_back( - CurLexerKind, CurSubmodule, std::move(CurLexer), std::move(CurPTHLexer), - CurPPLexer, std::move(CurTokenLexer), CurDirLookup); + IncludeMacroStack.emplace_back(CurLexerKind, CurLexerSubmodule, + std::move(CurLexer), std::move(CurPTHLexer), + CurPPLexer, std::move(CurTokenLexer), + CurDirLookup); CurPPLexer = nullptr; } @@ -1742,16 +1749,13 @@ private: CurPPLexer = IncludeMacroStack.back().ThePPLexer; CurTokenLexer = std::move(IncludeMacroStack.back().TheTokenLexer); CurDirLookup = IncludeMacroStack.back().TheDirLookup; - CurSubmodule = IncludeMacroStack.back().TheSubmodule; + CurLexerSubmodule = IncludeMacroStack.back().TheSubmodule; CurLexerKind = IncludeMacroStack.back().CurLexerKind; IncludeMacroStack.pop_back(); } void PropagateLineStartLeadingSpaceInfo(Token &Result); - void EnterSubmodule(Module *M, SourceLocation ImportLoc); - void LeaveSubmodule(); - /// Determine whether we need to create module macros for #defines in the /// current context. bool needModuleMacros() const; @@ -1967,7 +1971,6 @@ public: void HandlePragmaPoison(); void HandlePragmaSystemHeader(Token &SysHeaderTok); void HandlePragmaDependency(Token &DependencyTok); - void HandlePragmaModuleImport(Token &Tok); void HandlePragmaPushMacro(Token &Tok); void HandlePragmaPopMacro(Token &Tok); void HandlePragmaIncludeAlias(Token &Tok); diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index eca383bee2f5..e5961079f7c2 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -3766,6 +3766,9 @@ public: void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc); + /// Warn when implicitly casting 0 to nullptr. + void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E); + ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool) { return DelayedDiagnostics.push(pool); } diff --git a/include/clang/Tooling/FixIt.h b/include/clang/Tooling/FixIt.h index e2259d4357bc..c1e508849280 100644 --- a/include/clang/Tooling/FixIt.h +++ b/include/clang/Tooling/FixIt.h @@ -65,6 +65,13 @@ FixItHint createReplacement(const D &Destination, const S &Source, getText(Source, Context)); } +// \brief Returns a FixItHint to replace \p Destination by \p Source. +template <typename D> +FixItHint createReplacement(const D &Destination, StringRef Source) { + return FixItHint::CreateReplacement(internal::getSourceRange(Destination), + Source); +} + } // end namespace fixit } // end namespace tooling } // end namespace clang |