Date: Sun, 24 Dec 2017 01:08:34 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r327135 - in projects/clang600-import/contrib/llvm/tools/clang: include/clang/AST include/clang/Basic include/clang/Frontend include/clang/Index include/clang/Parse include/clang/Sema i... Message-ID: <201712240108.vBO18YKf078482@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sun Dec 24 01:08:34 2017 New Revision: 327135 URL: https://svnweb.freebsd.org/changeset/base/327135 Log: Merge clang trunk r321414 to contrib/llvm. Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/ODRHash.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Type.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticIDs.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSerializationKinds.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/arm_neon.td projects/clang600-import/contrib/llvm/tools/clang/include/clang/Frontend/PrecompiledPreamble.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Index/IndexSymbol.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Parse/Parser.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h projects/clang600-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Decl.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Expr.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ItaniumMangle.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/TypeLoc.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Basic/Diagnostic.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Basic/SourceManager.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Basic/Targets/AArch64.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGExprCXX.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CGExprComplex.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypeCache.h projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/SanitizerArgs.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Fuchsia.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Myriad.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Frontend/PrecompiledPreamble.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Headers/__clang_cuda_intrinsics.h projects/clang600-import/contrib/llvm/tools/clang/lib/Headers/cpuid.h projects/clang600-import/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h projects/clang600-import/contrib/llvm/tools/clang/lib/Index/IndexSymbol.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Lex/HeaderSearch.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Lex/ModuleMap.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Parse/ParseTemplate.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Rewrite/HTMLRewrite.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/CodeCompleteConsumer.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaExprMember.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaExprObjC.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/Serialization/ASTWriterDecl.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp projects/clang600-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp projects/clang600-import/contrib/llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp projects/clang600-import/contrib/llvm/tools/clang/utils/TableGen/NeonEmitter.cpp Directory Properties: projects/clang600-import/contrib/llvm/tools/clang/ (props changed) Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h Sun Dec 24 01:08:34 2017 (r327135) @@ -1759,6 +1759,11 @@ class FunctionDecl : public DeclaratorDecl, public Dec unsigned IsCopyDeductionCandidate : 1; private: + + /// Store the ODRHash after first calculation. + unsigned HasODRHash : 1; + unsigned ODRHash; + /// \brief End part of this FunctionDecl's source range. /// /// We could compute the full range in getSourceRange(). However, when we're @@ -1841,8 +1846,9 @@ class FunctionDecl : public DeclaratorDecl, public Dec IsExplicitlyDefaulted(false), HasImplicitReturnZero(false), IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified), InstantiationIsPending(false), UsesSEHTry(false), HasSkippedBody(false), - WillHaveBody(false), IsCopyDeductionCandidate(false), - EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) {} + WillHaveBody(false), IsCopyDeductionCandidate(false), HasODRHash(false), + ODRHash(0), EndRangeLoc(NameInfo.getEndLoc()), + DNLoc(NameInfo.getInfo()) {} using redeclarable_base = Redeclarable<FunctionDecl>; @@ -2438,6 +2444,10 @@ class FunctionDecl : public DeclaratorDecl, public Dec /// the corresponding Builtin ID. If the function is not a memory function, /// returns 0. unsigned getMemoryFunctionKind() const; + + /// \brief Returns ODRHash of the function. This value is calculated and + /// stored on first call, then the stored value returned on the other calls. + unsigned getODRHash(); // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/ODRHash.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/ODRHash.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/ODRHash.h Sun Dec 24 01:08:34 2017 (r327135) @@ -53,6 +53,10 @@ class ODRHash { (public) // more information than the AddDecl class. void AddCXXRecordDecl(const CXXRecordDecl *Record); + // Use this for ODR checking functions between modules. This method compares + // more information than the AddDecl class. + void AddFunctionDecl(const FunctionDecl *Function); + // Process SubDecls of the main Decl. This method calls the DeclVisitor // while AddDecl does not. void AddSubDecl(const Decl *D); Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Type.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/AST/Type.h Sun Dec 24 01:08:34 2017 (r327135) @@ -976,16 +976,14 @@ class QualType { (public) return LHS.Value != RHS.Value; } - std::string getAsString() const { - return getAsString(split()); + static std::string getAsString(SplitQualType split, + const PrintingPolicy &Policy) { + return getAsString(split.Ty, split.Quals, Policy); } + static std::string getAsString(const Type *ty, Qualifiers qs, + const PrintingPolicy &Policy); - static std::string getAsString(SplitQualType split) { - return getAsString(split.Ty, split.Quals); - } - - static std::string getAsString(const Type *ty, Qualifiers qs); - + std::string getAsString() const; std::string getAsString(const PrintingPolicy &Policy) const; void print(raw_ostream &OS, const PrintingPolicy &Policy, Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sun Dec 24 01:08:34 2017 (r327135) @@ -267,14 +267,25 @@ def RenderScript : LangOpt<"RenderScript">; def ObjC : LangOpt<"ObjC1">; def BlocksSupported : LangOpt<"Blocks">; -// Defines targets for target-specific attributes. The list of strings should -// specify architectures for which the target applies, based off the ArchType -// enumeration in Triple.h. -class TargetArch<list<string> arches> { - list<string> Arches = arches; +// Defines targets for target-specific attributes. Empty lists are unchecked. +class TargetSpec { + // Specifies Architectures for which the target applies, based off the + // ArchType enumeration in Triple.h. + list<string> Arches = []; + // Specifies Operating Systems for which the target applies, based off the + // OSType enumeration in Triple.h list<string> OSes; + // Specifies the C++ ABIs for which the target applies, based off the + // TargetCXXABI::Kind in TargetCXXABI.h. list<string> CXXABIs; + // Specifies Object Formats for which the target applies, based off the + // ObjectFormatType enumeration in Triple.h + list<string> ObjectFormats; } + +class TargetArch<list<string> arches> : TargetSpec { + let Arches = arches; +} def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>; def TargetAVR : TargetArch<["avr"]>; def TargetMips32 : TargetArch<["mips", "mipsel"]>; @@ -288,6 +299,9 @@ def TargetWindows : TargetArch<["x86", "x86_64", "arm" def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", "arm", "thumb", "aarch64"]> { let CXXABIs = ["Microsoft"]; } +def TargetELF : TargetSpec { + let ObjectFormats = ["ELF"]; +} // Attribute subject match rules that are used for #pragma clang attribute. // @@ -465,8 +479,8 @@ class InheritableAttr : Attr; /// A target-specific attribute. This class is meant to be used as a mixin /// with InheritableAttr or Attr depending on the attribute's needs. -class TargetSpecificAttr<TargetArch target> { - TargetArch Target = target; +class TargetSpecificAttr<TargetSpec target> { + TargetSpec Target = target; // Attributes are generally required to have unique spellings for their names // so that the parser can determine what kind of attribute it has parsed. // However, target-specific attributes are special in that the attribute only @@ -1121,7 +1135,7 @@ def IBOutletCollection : InheritableAttr { let Documentation = [Undocumented]; } -def IFunc : Attr { +def IFunc : Attr, TargetSpecificAttr<TargetELF> { let Spellings = [GCC<"ifunc">]; let Args = [StringArgument<"Resolver">]; let Subjects = SubjectList<[Function]>; Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.td Sun Dec 24 01:08:34 2017 (r327135) @@ -198,6 +198,11 @@ def err_missing_module : Error< def err_no_submodule : Error<"no submodule named %0 in module '%1'">; def err_no_submodule_suggest : Error< "no submodule named %0 in module '%1'; did you mean '%2'?">; +def warn_no_priv_submodule_use_toplevel : Warning< + "no submodule named %0 in module '%1'; using top level '%2'">, + InGroup<PrivateModule>; +def note_private_top_level_defined : Note< + "module defined here">; def warn_missing_submodule : Warning<"missing submodule '%0'">, InGroup<IncompleteUmbrella>; def note_module_import_here : Note<"module imported here">; Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticIDs.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticIDs.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticIDs.h Sun Dec 24 01:08:34 2017 (r327135) @@ -297,7 +297,7 @@ class DiagnosticIDs : public RefCountedBase<Diagnostic /// \brief Get the set of all diagnostic IDs. static void getAllDiagnostics(diag::Flavor Flavor, - SmallVectorImpl<diag::kind> &Diags); + std::vector<diag::kind> &Diags); /// \brief Get the diagnostic option with the closest edit distance to the /// given group name. Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td Sun Dec 24 01:08:34 2017 (r327135) @@ -691,11 +691,15 @@ def err_mmap_expected_feature : Error<"expected a feat def err_mmap_expected_attribute : Error<"expected an attribute name">; def warn_mmap_unknown_attribute : Warning<"unknown attribute '%0'">, InGroup<IgnoredAttributes>; -def warn_mmap_mismatched_top_level_private : Warning< - "top-level module '%0' in private module map, expected a submodule of '%1'">, +def warn_mmap_mismatched_private_submodule : Warning< + "private submodule '%0' in private module map, expected top-level module">, InGroup<PrivateModule>; -def note_mmap_rename_top_level_private_as_submodule : Note< - "make '%0' a submodule of '%1' to ensure it can be found by name">; +def warn_mmap_mismatched_private_module_name : Warning< + "expected canonical name for private module '%0'">, + InGroup<PrivateModule>; +def note_mmap_rename_top_level_private_module : Note< + "rename '%0' to ensure it can be found by name">; + def err_mmap_duplicate_header_attribute : Error< "header attribute '%0' specified multiple times">; def err_mmap_invalid_header_attribute_value : Error< Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sun Dec 24 01:08:34 2017 (r327135) @@ -3911,6 +3911,9 @@ def err_template_param_different_kind : Error< "%select{|template parameter }0redeclaration">; def note_template_param_different_kind : Note< "template parameter has a different kind in template argument">; + +def err_invalid_decl_specifier_in_nontype_parm : Error< + "invalid declaration specifier in template non-type parameter">; def err_template_nontype_parm_different_type : Error< "template non-type parameter has a different type %0 in template " Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSerializationKinds.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSerializationKinds.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSerializationKinds.td Sun Dec 24 01:08:34 2017 (r327135) @@ -270,6 +270,29 @@ def note_module_odr_violation_mismatch_decl_diff : Not "friend function %2|" "}1">; +def err_module_odr_violation_function : Error< + "%q0 has different definitions in different modules; " + "%select{definition in module '%2'|defined here}1 " + "first difference is " + "%select{" + "return type is %4|" + "%ordinal4 parameter with name %5|" + "%ordinal4 parameter with type %5%select{| decayed from %7}6|" + "%ordinal4 parameter with%select{out|}5 a default argument|" + "%ordinal4 parameter with a default argument|" + "function body" + "}3">; + +def note_module_odr_violation_function : Note<"but in '%0' found " + "%select{" + "different return type %2|" + "%ordinal2 parameter with name %3|" + "%ordinal2 parameter with type %3%select{| decayed from %5}4|" + "%ordinal2 parameter with%select{out|}3 a default argument|" + "%ordinal2 parameter with a different default argument|" + "a different body" + "}1">; + def err_module_odr_violation_mismatch_decl_unknown : Error< "%q0 %select{with definition in module '%2'|defined here}1 has different " "definitions in different modules; first difference is this " Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/arm_neon.td ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/arm_neon.td Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Basic/arm_neon.td Sun Dec 24 01:08:34 2017 (r327135) @@ -227,6 +227,7 @@ def OP_UNAVAILABLE : Operation { // u: unsigned integer (int/float args) // f: float (int args) // F: double (int args) +// H: half (int args) // d: default // g: default, ignore 'Q' size modifier. // j: default, force 'Q' size modifier. @@ -345,6 +346,7 @@ def OP_MLSLHi : Op<(call "vmlsl", $p0, (call "vget_h (call "vget_high", $p2))>; def OP_MLSLHi_N : Op<(call "vmlsl_n", $p0, (call "vget_high", $p1), $p2)>; def OP_MUL_N : Op<(op "*", $p0, (dup $p1))>; +def OP_MULX_N : Op<(call "vmulx", $p0, (dup $p1))>; def OP_MLA_N : Op<(op "+", $p0, (op "*", $p1, (dup $p2)))>; def OP_MLS_N : Op<(op "-", $p0, (op "*", $p1, (dup $p2)))>; def OP_FMLA_N : Op<(call "vfma", $p0, $p1, (dup $p2))>; @@ -1660,4 +1662,187 @@ def SCALAR_SQRDMLSH_LANEQ : SOpInst<"vqrdmlsh_laneq", def SCALAR_VDUP_LANE : IInst<"vdup_lane", "sdi", "ScSsSiSlSfSdSUcSUsSUiSUlSPcSPs">; def SCALAR_VDUP_LANEQ : IInst<"vdup_laneq", "sji", "ScSsSiSlSfSdSUcSUsSUiSUlSPcSPs">; +} + +// ARMv8.2-A FP16 intrinsics. +let ArchGuard = "defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(__aarch64__)" in { + + // ARMv8.2-A FP16 one-operand vector intrinsics. + + // Comparison + def CMEQH : SInst<"vceqz", "ud", "hQh">; + def CMGEH : SInst<"vcgez", "ud", "hQh">; + def CMGTH : SInst<"vcgtz", "ud", "hQh">; + def CMLEH : SInst<"vclez", "ud", "hQh">; + def CMLTH : SInst<"vcltz", "ud", "hQh">; + + // Vector conversion + def VCVT_F16 : SInst<"vcvt_f16", "Hd", "sUsQsQUs">; + def VCVT_S16 : SInst<"vcvt_s16", "xd", "hQh">; + def VCVT_U16 : SInst<"vcvt_u16", "ud", "hQh">; + def VCVTA_S16 : SInst<"vcvta_s16", "xd", "hQh">; + def VCVTA_U16 : SInst<"vcvta_u16", "ud", "hQh">; + def VCVTM_S16 : SInst<"vcvtm_s16", "xd", "hQh">; + def VCVTM_U16 : SInst<"vcvtm_u16", "ud", "hQh">; + def VCVTN_S16 : SInst<"vcvtn_s16", "xd", "hQh">; + def VCVTN_U16 : SInst<"vcvtn_u16", "ud", "hQh">; + def VCVTP_S16 : SInst<"vcvtp_s16", "xd", "hQh">; + def VCVTP_U16 : SInst<"vcvtp_u16", "ud", "hQh">; + + // Vector rounding + def FRINTZH : SInst<"vrnd", "dd", "hQh">; + def FRINTNH : SInst<"vrndn", "dd", "hQh">; + def FRINTAH : SInst<"vrnda", "dd", "hQh">; + def FRINTPH : SInst<"vrndp", "dd", "hQh">; + def FRINTMH : SInst<"vrndm", "dd", "hQh">; + def FRINTXH : SInst<"vrndx", "dd", "hQh">; + def FRINTIH : SInst<"vrndi", "dd", "hQh">; + + // Misc. + def VABSH : SInst<"vabs", "dd", "hQh">; + def VNEGH : SOpInst<"vneg", "dd", "hQh", OP_NEG>; + def VRECPEH : SInst<"vrecpe", "dd", "hQh">; + def FRSQRTEH : SInst<"vrsqrte", "dd", "hQh">; + def FSQRTH : SInst<"vsqrt", "dd", "hQh">; + + // ARMv8.2-A FP16 two-operands vector intrinsics. + + // Misc. + def VADDH : SOpInst<"vadd", "ddd", "hQh", OP_ADD>; + def VABDH : SInst<"vabd", "ddd", "hQh">; + def VSUBH : SOpInst<"vsub", "ddd", "hQh", OP_SUB>; + + // Comparison + let InstName = "vacge" in { + def VCAGEH : SInst<"vcage", "udd", "hQh">; + def VCALEH : SInst<"vcale", "udd", "hQh">; + } + let InstName = "vacgt" in { + def VCAGTH : SInst<"vcagt", "udd", "hQh">; + def VCALTH : SInst<"vcalt", "udd", "hQh">; + } + def VCEQH : SOpInst<"vceq", "udd", "hQh", OP_EQ>; + def VCGEH : SOpInst<"vcge", "udd", "hQh", OP_GE>; + def VCGTH : SOpInst<"vcgt", "udd", "hQh", OP_GT>; + let InstName = "vcge" in + def VCLEH : SOpInst<"vcle", "udd", "hQh", OP_LE>; + let InstName = "vcgt" in + def VCLTH : SOpInst<"vclt", "udd", "hQh", OP_LT>; + + // Vector conversion + let isVCVT_N = 1 in { + def VCVT_N_F16 : SInst<"vcvt_n_f16", "Hdi", "sUsQsQUs">; + def VCVT_N_S16 : SInst<"vcvt_n_s16", "xdi", "hQh">; + def VCVT_N_U16 : SInst<"vcvt_n_u16", "udi", "hQh">; + } + + // Max/Min + def VMAXH : SInst<"vmax", "ddd", "hQh">; + def VMINH : SInst<"vmin", "ddd", "hQh">; + def FMAXNMH : SInst<"vmaxnm", "ddd", "hQh">; + def FMINNMH : SInst<"vminnm", "ddd", "hQh">; + + // Multiplication/Division + def VMULH : SOpInst<"vmul", "ddd", "hQh", OP_MUL>; + def MULXH : SInst<"vmulx", "ddd", "hQh">; + def FDIVH : IOpInst<"vdiv", "ddd", "hQh", OP_DIV>; + + // Pairwise addition + def VPADDH : SInst<"vpadd", "ddd", "hQh">; + + // Pairwise Max/Min + def VPMAXH : SInst<"vpmax", "ddd", "hQh">; + def VPMINH : SInst<"vpmin", "ddd", "hQh">; + // Pairwise MaxNum/MinNum + def FMAXNMPH : SInst<"vpmaxnm", "ddd", "hQh">; + def FMINNMPH : SInst<"vpminnm", "ddd", "hQh">; + + // Reciprocal/Sqrt + def VRECPSH : SInst<"vrecps", "ddd", "hQh">; + def VRSQRTSH : SInst<"vrsqrts", "ddd", "hQh">; + + // ARMv8.2-A FP16 three-operands vector intrinsics. + + // Vector fused multiply-add operations + def VFMAH : SInst<"vfma", "dddd", "hQh">; + def VFMSH : SOpInst<"vfms", "dddd", "hQh", OP_FMLS>; + + // ARMv8.2-A FP16 lane vector intrinsics. + + // FMA lane + def VFMA_LANEH : IInst<"vfma_lane", "dddgi", "hQh">; + def VFMA_LANEQH : IInst<"vfma_laneq", "dddji", "hQh">; + + // FMA lane with scalar argument + def FMLA_NH : SOpInst<"vfma_n", "ddds", "hQh", OP_FMLA_N>; + // Scalar floating point fused multiply-add (scalar, by element) + def SCALAR_FMLA_LANEH : IInst<"vfma_lane", "sssdi", "Sh">; + def SCALAR_FMLA_LANEQH : IInst<"vfma_laneq", "sssji", "Sh">; + + // FMS lane + def VFMS_LANEH : IOpInst<"vfms_lane", "dddgi", "hQh", OP_FMS_LN>; + def VFMS_LANEQH : IOpInst<"vfms_laneq", "dddji", "hQh", OP_FMS_LNQ>; + // FMS lane with scalar argument + def FMLS_NH : SOpInst<"vfms_n", "ddds", "hQh", OP_FMLS_N>; + // Scalar floating foint fused multiply-subtract (scalar, by element) + def SCALAR_FMLS_LANEH : IOpInst<"vfms_lane", "sssdi", "Sh", OP_FMS_LN>; + def SCALAR_FMLS_LANEQH : IOpInst<"vfms_laneq", "sssji", "Sh", OP_FMS_LNQ>; + + // Mul lane + def VMUL_LANEH : IOpInst<"vmul_lane", "ddgi", "hQh", OP_MUL_LN>; + def VMUL_LANEQH : IOpInst<"vmul_laneq", "ddji", "hQh", OP_MUL_LN>; + def VMUL_NH : IOpInst<"vmul_n", "dds", "hQh", OP_MUL_N>; + // Scalar floating point multiply (scalar, by element) + def SCALAR_FMUL_LANEH : IOpInst<"vmul_lane", "ssdi", "Sh", OP_SCALAR_MUL_LN>; + def SCALAR_FMUL_LANEQH : IOpInst<"vmul_laneq", "ssji", "Sh", OP_SCALAR_MUL_LN>; + + // Mulx lane + def VMULX_LANEH : IOpInst<"vmulx_lane", "ddgi", "hQh", OP_MULX_LN>; + def VMULX_LANEQH : IOpInst<"vmulx_laneq", "ddji", "hQh", OP_MULX_LN>; + def VMULX_NH : IOpInst<"vmulx_n", "dds", "hQh", OP_MULX_N>; + // TODO: Scalar floating point multiply extended (scalar, by element) + // Below ones are commented out because they need vmulx_f16(float16_t, float16_t) + // which will be implemented later with fp16 scalar intrinsic (arm_fp16.h) + //def SCALAR_FMULX_LANEH : IOpInst<"vmulx_lane", "ssdi", "Sh", OP_SCALAR_MUL_LN>; + //def SCALAR_FMULX_LANEQH : IOpInst<"vmulx_laneq", "ssji", "Sh", OP_SCALAR_MUL_LN>; + + // ARMv8.2-A FP16 reduction vector intrinsics. + def VMAXVH : SInst<"vmaxv", "sd", "hQh">; + def VMINVH : SInst<"vminv", "sd", "hQh">; + def FMAXNMVH : SInst<"vmaxnmv", "sd", "hQh">; + def FMINNMVH : SInst<"vminnmv", "sd", "hQh">; + + // Data processing intrinsics - section 5 + + // Logical operations + let isHiddenLInst = 1 in + def VBSLH : SInst<"vbsl", "dudd", "hQh">; + + // Transposition operations + def VZIPH : WInst<"vzip", "2dd", "hQh">; + def VUZPH : WInst<"vuzp", "2dd", "hQh">; + def VTRNH : WInst<"vtrn", "2dd", "hQh">; + + // Set all lanes to same value. + /* Already implemented prior to ARMv8.2-A. + def VMOV_NH : WOpInst<"vmov_n", "ds", "hQh", OP_DUP>; + def VDUP_NH : WOpInst<"vdup_n", "ds", "hQh", OP_DUP>; + def VDUP_LANE1H : WOpInst<"vdup_lane", "dgi", "hQh", OP_DUP_LN>;*/ + + // Vector Extract + def VEXTH : WInst<"vext", "dddi", "hQh">; + + // Reverse vector elements + def VREV64H : WOpInst<"vrev64", "dd", "hQh", OP_REV64>; + + // Permutation + def VTRN1H : SOpInst<"vtrn1", "ddd", "hQh", OP_TRN1>; + def VZIP1H : SOpInst<"vzip1", "ddd", "hQh", OP_ZIP1>; + def VUZP1H : SOpInst<"vuzp1", "ddd", "hQh", OP_UZP1>; + def VTRN2H : SOpInst<"vtrn2", "ddd", "hQh", OP_TRN2>; + def VZIP2H : SOpInst<"vzip2", "ddd", "hQh", OP_ZIP2>; + def VUZP2H : SOpInst<"vuzp2", "ddd", "hQh", OP_UZP2>; + + def SCALAR_VDUP_LANEH : IInst<"vdup_lane", "sdi", "Sh">; + def SCALAR_VDUP_LANEQH : IInst<"vdup_laneq", "sji", "Sh">; } Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Frontend/PrecompiledPreamble.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Frontend/PrecompiledPreamble.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Frontend/PrecompiledPreamble.h Sun Dec 24 01:08:34 2017 (r327135) @@ -19,6 +19,7 @@ #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/Support/AlignOf.h" #include "llvm/Support/MD5.h" +#include <cstddef> #include <memory> #include <system_error> #include <type_traits> @@ -89,6 +90,11 @@ class PrecompiledPreamble { (public) /// PreambleBounds used to build the preamble. PreambleBounds getBounds() const; + /// Returns the size, in bytes, that preamble takes on disk or in memory. + /// For on-disk preambles returns 0 if filesystem operations fail. Intended to + /// be used for logging and debugging purposes only. + std::size_t getSize() const; + /// Check whether PrecompiledPreamble can be reused for the new contents(\p /// MainFileBuffer) of the main file. bool CanReuse(const CompilerInvocation &Invocation, @@ -244,6 +250,11 @@ class PreambleCallbacks { public: virtual ~PreambleCallbacks() = default; + /// Called before FrontendAction::BeginSourceFile. + /// Can be used to store references to various CompilerInstance fields + /// (e.g. SourceManager) that may be interesting to the consumers of other + /// callbacks. + virtual void BeforeExecute(CompilerInstance &CI); /// Called after FrontendAction::Execute(), but before /// FrontendAction::EndSourceFile(). Can be used to transfer ownership of /// various CompilerInstance fields before they are destroyed. Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Index/IndexSymbol.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Index/IndexSymbol.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Index/IndexSymbol.h Sun Dec 24 01:08:34 2017 (r327135) @@ -56,7 +56,7 @@ enum class SymbolKind : uint8_t { Using, }; -enum class SymbolLanguage { +enum class SymbolLanguage : uint8_t { C, ObjC, CXX, @@ -64,7 +64,7 @@ enum class SymbolLanguage { }; /// Language specific sub-kinds. -enum class SymbolSubKind { +enum class SymbolSubKind : uint8_t { None, CXXCopyConstructor, CXXMoveConstructor, @@ -74,8 +74,9 @@ enum class SymbolSubKind { UsingValue, }; +typedef uint8_t SymbolPropertySet; /// Set of properties that provide additional info about a symbol. -enum class SymbolProperty : uint8_t { +enum class SymbolProperty : SymbolPropertySet { Generic = 1 << 0, TemplatePartialSpecialization = 1 << 1, TemplateSpecialization = 1 << 2, @@ -86,7 +87,6 @@ enum class SymbolProperty : uint8_t { Local = 1 << 7, }; static const unsigned SymbolPropertyBitNum = 8; -typedef unsigned SymbolPropertySet; /// Set of roles that are attributed to symbol occurrences. enum class SymbolRole : uint32_t { @@ -127,8 +127,8 @@ struct SymbolRelation { struct SymbolInfo { SymbolKind Kind; SymbolSubKind SubKind; - SymbolPropertySet Properties; SymbolLanguage Lang; + SymbolPropertySet Properties; }; SymbolInfo getSymbolInfo(const Decl *D); Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Parse/Parser.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Parse/Parser.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Parse/Parser.h Sun Dec 24 01:08:34 2017 (r327135) @@ -2748,10 +2748,10 @@ class Parser : public CodeCompletionHandler { (private bool ParseTemplateParameterList(unsigned Depth, SmallVectorImpl<NamedDecl*> &TemplateParams); bool isStartOfTemplateTypeParameter(); - Decl *ParseTemplateParameter(unsigned Depth, unsigned Position); - Decl *ParseTypeParameter(unsigned Depth, unsigned Position); - Decl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position); - Decl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position); + NamedDecl *ParseTemplateParameter(unsigned Depth, unsigned Position); + NamedDecl *ParseTypeParameter(unsigned Depth, unsigned Position); + NamedDecl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position); + NamedDecl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position); void DiagnoseMisplacedEllipsis(SourceLocation EllipsisLoc, SourceLocation CorrectLoc, bool AlreadyHasEllipsis, Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sun Dec 24 01:08:34 2017 (r327135) @@ -6064,7 +6064,7 @@ class Sema { (public) void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl); TemplateDecl *AdjustDeclIfTemplate(Decl *&Decl); - Decl *ActOnTypeParameter(Scope *S, bool Typename, + NamedDecl *ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, @@ -6077,12 +6077,12 @@ class Sema { (public) SourceLocation Loc); QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc); - Decl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, + NamedDecl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg); - Decl *ActOnTemplateTemplateParameter(Scope *S, + NamedDecl *ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h Sun Dec 24 01:08:34 2017 (r327135) @@ -1092,6 +1092,10 @@ class ASTReader (private) llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2> PendingOdrMergeFailures; + /// \brief Function definitions in which we found an ODR violation. + llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2> + PendingFunctionOdrMergeFailures; + /// \brief DeclContexts in which we have diagnosed an ODR violation. llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures; Modified: projects/clang600-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Sun Dec 24 01:08:34 2017 (r327135) @@ -334,7 +334,7 @@ class PathDiagnosticLocationPair { (public) // Path "pieces" for path-sensitive diagnostics. //===----------------------------------------------------------------------===// -class PathDiagnosticPiece { +class PathDiagnosticPiece: public llvm::FoldingSetNode { public: enum Kind { ControlFlow, Event, Macro, Call, Note }; enum DisplayHint { Above, Below }; Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTDumper.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -99,6 +99,9 @@ namespace { const CommandTraits *Traits; const SourceManager *SM; + /// The policy to use for printing; can be defaulted. + PrintingPolicy PrintPolicy; + /// Pending[i] is an action to dump an entity at level i. llvm::SmallVector<std::function<void(bool isLastChild)>, 32> Pending; @@ -207,12 +210,17 @@ namespace { public: ASTDumper(raw_ostream &OS, const CommandTraits *Traits, const SourceManager *SM) - : OS(OS), Traits(Traits), SM(SM), - ShowColors(SM && SM->getDiagnostics().getShowColors()) { } + : ASTDumper(OS, Traits, SM, + SM && SM->getDiagnostics().getShowColors()) {} ASTDumper(raw_ostream &OS, const CommandTraits *Traits, const SourceManager *SM, bool ShowColors) - : OS(OS), Traits(Traits), SM(SM), ShowColors(ShowColors) {} + : ASTDumper(OS, Traits, SM, ShowColors, LangOptions()) {} + ASTDumper(raw_ostream &OS, const CommandTraits *Traits, + const SourceManager *SM, bool ShowColors, + const PrintingPolicy &PrintPolicy) + : OS(OS), Traits(Traits), SM(SM), PrintPolicy(PrintPolicy), + ShowColors(ShowColors) {} void setDeserialize(bool D) { Deserialize = D; } @@ -646,13 +654,13 @@ void ASTDumper::dumpBareType(QualType T, bool Desugar) ColorScope Color(*this, TypeColor); SplitQualType T_split = T.split(); - OS << "'" << QualType::getAsString(T_split) << "'"; + OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'"; if (Desugar && !T.isNull()) { // If the type is sugared, also dump a (shallow) desugared type. SplitQualType D_split = T.getSplitDesugaredType(); if (T_split != D_split) - OS << ":'" << QualType::getAsString(D_split) << "'"; + OS << ":'" << QualType::getAsString(D_split, PrintPolicy) << "'"; } } @@ -1187,12 +1195,12 @@ void ASTDumper::VisitFunctionDecl(const FunctionDecl * if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { if (MD->size_overridden_methods() != 0) { - auto dumpOverride = - [=](const CXXMethodDecl *D) { - SplitQualType T_split = D->getType().split(); - OS << D << " " << D->getParent()->getName() << "::" - << D->getNameAsString() << " '" << QualType::getAsString(T_split) << "'"; - }; + auto dumpOverride = [=](const CXXMethodDecl *D) { + SplitQualType T_split = D->getType().split(); + OS << D << " " << D->getParent()->getName() + << "::" << D->getNameAsString() << " '" + << QualType::getAsString(T_split, PrintPolicy) << "'"; + }; dumpChild([=] { auto Overrides = MD->overridden_methods(); @@ -1537,7 +1545,7 @@ void ASTDumper::VisitTemplateDeclSpecialization(const case TSK_ExplicitInstantiationDefinition: if (!DumpExplicitInst) break; - // Fall through. + LLVM_FALLTHROUGH; case TSK_Undeclared: case TSK_ImplicitInstantiation: if (DumpRefOnly) @@ -2682,15 +2690,19 @@ LLVM_DUMP_METHOD void Type::dump(llvm::raw_ostream &OS LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); } LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS, bool Deserialize) const { - ASTDumper P(OS, &getASTContext().getCommentCommandTraits(), - &getASTContext().getSourceManager()); + const ASTContext &Ctx = getASTContext(); + const SourceManager &SM = Ctx.getSourceManager(); + ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &SM, + SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy()); P.setDeserialize(Deserialize); P.dumpDecl(this); } LLVM_DUMP_METHOD void Decl::dumpColor() const { - ASTDumper P(llvm::errs(), &getASTContext().getCommentCommandTraits(), - &getASTContext().getSourceManager(), /*ShowColors*/true); + const ASTContext &Ctx = getASTContext(); + ASTDumper P(llvm::errs(), &Ctx.getCommentCommandTraits(), + &Ctx.getSourceManager(), /*ShowColors*/ true, + Ctx.getPrintingPolicy()); P.dumpDecl(this); } @@ -2705,7 +2717,9 @@ LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ost while (!DC->isTranslationUnit()) DC = DC->getParent(); ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext(); - ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager()); + const SourceManager &SM = Ctx.getSourceManager(); + ASTDumper P(OS, &Ctx.getCommentCommandTraits(), &Ctx.getSourceManager(), + SM.getDiagnostics().getShowColors(), Ctx.getPrintingPolicy()); P.setDeserialize(Deserialize); P.dumpLookups(this, DumpDecls); } Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -134,17 +134,12 @@ namespace clang { bool ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, SmallVectorImpl<TemplateArgument> &ToArgs); - template <typename InContainerTy> - bool ImportTemplateArgumentListInfo(const InContainerTy &Container, - TemplateArgumentListInfo &ToTAInfo); bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord, bool Complain = true); bool IsStructuralMatch(VarDecl *FromVar, VarDecl *ToVar, bool Complain = true); bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord); bool IsStructuralMatch(EnumConstantDecl *FromEC, EnumConstantDecl *ToEC); - bool IsStructuralMatch(FunctionTemplateDecl *From, - FunctionTemplateDecl *To); bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To); bool IsStructuralMatch(VarTemplateDecl *From, VarTemplateDecl *To); Decl *VisitDecl(Decl *D); @@ -200,7 +195,6 @@ namespace clang { ClassTemplateSpecializationDecl *D); Decl *VisitVarTemplateDecl(VarTemplateDecl *D); Decl *VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D); - Decl *VisitFunctionTemplateDecl(FunctionTemplateDecl *D); // Importing statements DeclGroupRef ImportDeclGroup(DeclGroupRef DG); @@ -286,7 +280,6 @@ namespace clang { Expr *VisitCXXDeleteExpr(CXXDeleteExpr *E); Expr *VisitCXXConstructExpr(CXXConstructExpr *E); Expr *VisitCXXMemberCallExpr(CXXMemberCallExpr *E); - Expr *VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E); Expr *VisitExprWithCleanups(ExprWithCleanups *EWC); Expr *VisitCXXThisExpr(CXXThisExpr *E); Expr *VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E); @@ -1254,18 +1247,6 @@ bool ASTNodeImporter::ImportTemplateArguments(const Te return false; } -template <typename InContainerTy> -bool ASTNodeImporter::ImportTemplateArgumentListInfo( - const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo) { - for (const auto &FromLoc : Container) { - if (auto ToLoc = ImportTemplateArgumentLoc(FromLoc)) - ToTAInfo.addArgument(*ToLoc); - else - return true; - } - return false; -} - bool ASTNodeImporter::IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord, bool Complain) { // Eliminate a potential failure point where we attempt to re-import @@ -1299,14 +1280,6 @@ bool ASTNodeImporter::IsStructuralMatch(EnumDecl *From return Ctx.IsStructurallyEquivalent(FromEnum, ToEnum); } -bool ASTNodeImporter::IsStructuralMatch(FunctionTemplateDecl *From, - FunctionTemplateDecl *To) { - StructuralEquivalenceContext Ctx( - Importer.getFromContext(), Importer.getToContext(), - Importer.getNonEquivalentDecls(), false, false); - return Ctx.IsStructurallyEquivalent(From, To); -} - bool ASTNodeImporter::IsStructuralMatch(EnumConstantDecl *FromEC, EnumConstantDecl *ToEC) { @@ -4224,64 +4197,6 @@ Decl *ASTNodeImporter::VisitVarTemplateSpecializationD return D2; } -Decl *ASTNodeImporter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { - DeclContext *DC, *LexicalDC; - DeclarationName Name; - SourceLocation Loc; - NamedDecl *ToD; - - if (ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc)) - return nullptr; - - if (ToD) - return ToD; - - // Try to find a function in our own ("to") context with the same name, same - // type, and in the same context as the function we're importing. - if (!LexicalDC->isFunctionOrMethod()) { - unsigned IDNS = Decl::IDNS_Ordinary; - SmallVector<NamedDecl *, 2> FoundDecls; - DC->getRedeclContext()->localUncachedLookup(Name, FoundDecls); - for (unsigned I = 0, N = FoundDecls.size(); I != N; ++I) { - if (!FoundDecls[I]->isInIdentifierNamespace(IDNS)) - continue; - - if (FunctionTemplateDecl *FoundFunction = - dyn_cast<FunctionTemplateDecl>(FoundDecls[I])) { - if (FoundFunction->hasExternalFormalLinkage() && - D->hasExternalFormalLinkage()) { - if (IsStructuralMatch(D, FoundFunction)) { - Importer.Imported(D, FoundFunction); - // FIXME: Actually try to merge the body and other attributes. - return FoundFunction; - } - } - } - } - } - - TemplateParameterList *Params = - ImportTemplateParameterList(D->getTemplateParameters()); - if (!Params) - return nullptr; - - FunctionDecl *TemplatedFD = - cast_or_null<FunctionDecl>(Importer.Import(D->getTemplatedDecl())); - if (!TemplatedFD) - return nullptr; - - FunctionTemplateDecl *ToFunc = FunctionTemplateDecl::Create( - Importer.getToContext(), DC, Loc, Name, Params, TemplatedFD); - - TemplatedFD->setDescribedFunctionTemplate(ToFunc); - ToFunc->setAccess(D->getAccess()); - ToFunc->setLexicalDeclContext(LexicalDC); - Importer.Imported(D, ToFunc); - - LexicalDC->addDeclInternal(ToFunc); - return ToFunc; -} - //---------------------------------------------------------------------------- // Import Statements //---------------------------------------------------------------------------- @@ -5842,47 +5757,6 @@ Expr *ASTNodeImporter::VisitCXXPseudoDestructorExpr( Importer.Import(E->getQualifierLoc()), ScopeInfo, Importer.Import(E->getColonColonLoc()), Importer.Import(E->getTildeLoc()), Storage); -} - -Expr *ASTNodeImporter::VisitCXXDependentScopeMemberExpr( - CXXDependentScopeMemberExpr *E) { - Expr *Base = nullptr; - if (!E->isImplicitAccess()) { - Base = Importer.Import(E->getBase()); - if (!Base) - return nullptr; - } - - QualType BaseType = Importer.Import(E->getBaseType()); - if (BaseType.isNull()) - return nullptr; - - TemplateArgumentListInfo ToTAInfo(Importer.Import(E->getLAngleLoc()), - Importer.Import(E->getRAngleLoc())); - TemplateArgumentListInfo *ResInfo = nullptr; - if (E->hasExplicitTemplateArgs()) { - if (ImportTemplateArgumentListInfo(E->template_arguments(), ToTAInfo)) - return nullptr; - ResInfo = &ToTAInfo; - } - - DeclarationName Name = Importer.Import(E->getMember()); - if (!E->getMember().isEmpty() && Name.isEmpty()) - return nullptr; - - DeclarationNameInfo MemberNameInfo(Name, Importer.Import(E->getMemberLoc())); - // Import additional name location/type info. - ImportDeclarationNameLoc(E->getMemberNameInfo(), MemberNameInfo); - auto ToFQ = Importer.Import(E->getFirstQualifierFoundInScope()); - if (!ToFQ && E->getFirstQualifierFoundInScope()) - return nullptr; - - return CXXDependentScopeMemberExpr::Create( - Importer.getToContext(), Base, BaseType, E->isArrow(), - Importer.Import(E->getOperatorLoc()), - Importer.Import(E->getQualifierLoc()), - Importer.Import(E->getTemplateKeywordLoc()), - cast_or_null<NamedDecl>(ToFQ), MemberNameInfo, ResInfo); } Expr *ASTNodeImporter::VisitCallExpr(CallExpr *E) { Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Decl.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Decl.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Decl.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -26,6 +26,7 @@ #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExternalASTSource.h" +#include "clang/AST/ODRHash.h" #include "clang/AST/PrettyPrinter.h" #include "clang/AST/Redeclarable.h" #include "clang/AST/Stmt.h" @@ -1548,7 +1549,10 @@ void NamedDecl::printQualifiedName(raw_ostream &OS, // enumerator is declared in the scope that immediately contains // the enum-specifier. Each scoped enumerator is declared in the // scope of the enumeration. - if (ED->isScoped() || ED->getIdentifier()) + // For the case of unscoped enumerator, do not include in the qualified + // name any information about its enum enclosing scope, as is visibility + // is global. + if (ED->isScoped()) OS << *ED; else continue; @@ -3599,6 +3603,25 @@ unsigned FunctionDecl::getMemoryFunctionKind() const { break; } return 0; +} + +unsigned FunctionDecl::getODRHash() { + if (HasODRHash) + return ODRHash; + + if (FunctionDecl *Definition = getDefinition()) { + if (Definition != this) { + HasODRHash = true; + ODRHash = Definition->getODRHash(); + return ODRHash; + } + } + + class ODRHash Hash; + Hash.AddFunctionDecl(this); + HasODRHash = true; + ODRHash = Hash.CalculateHash(); + return ODRHash; } //===----------------------------------------------------------------------===// Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Expr.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Expr.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/Expr.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -3116,7 +3116,8 @@ bool Expr::HasSideEffects(const ASTContext &Ctx, if (DCE->getTypeAsWritten()->isReferenceType() && DCE->getCastKind() == CK_Dynamic) return true; - } // Fall through. + } + LLVM_FALLTHROUGH; case ImplicitCastExprClass: case CStyleCastExprClass: case CXXStaticCastExprClass: Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -857,7 +857,7 @@ LambdaCapture::LambdaCapture(SourceLocation Loc, bool switch (Kind) { case LCK_StarThis: Bits |= Capture_ByCopy; - // Fall through + LLVM_FALLTHROUGH; case LCK_This: assert(!Var && "'this' capture cannot have a variable!"); Bits |= Capture_This; @@ -865,7 +865,7 @@ LambdaCapture::LambdaCapture(SourceLocation Loc, bool case LCK_ByCopy: Bits |= Capture_ByCopy; - // Fall through + LLVM_FALLTHROUGH; case LCK_ByRef: assert(Var && "capture must have a variable!"); break; Modified: projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp ============================================================================== --- projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Sun Dec 24 01:04:58 2017 (r327134) +++ projects/clang600-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Sun Dec 24 01:08:34 2017 (r327135) @@ -5913,7 +5913,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const << (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'"); else Info.CCEDiag(E, diag::note_invalid_subexpr_in_const_expr); - // Fall through. + LLVM_FALLTHROUGH; case Builtin::BI__builtin_strchr: case Builtin::BI__builtin_wcschr: case Builtin::BI__builtin_memchr: @@ -5952,7 +5952,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const Desired)) return ZeroInitialization(E); StopAtNull = true; - // Fall through. + LLVM_FALLTHROUGH; case Builtin::BImemchr: case Builtin::BI__builtin_memchr: case Builtin::BI__builtin_char_memchr: @@ -5965,7 +5965,7 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const case Builtin::BIwcschr: case Builtin::BI__builtin_wcschr: StopAtNull = true; - // Fall through. + LLVM_FALLTHROUGH; case Builtin::BIwmemchr: case Builtin::BI__builtin_wmemchr: // wcschr and wmemchr are given a wchar_t to look for. Just use it. @@ -7209,6 +7209,7 @@ static int EvaluateBuiltinClassifyType(const CallExpr case BuiltinType::Dependent: llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type"); }; + break; case Type::Enum: return LangOpts.CPlusPlus ? enumeral_type_class : integer_type_class; @@ -7419,7 +7420,10 @@ static bool isDesignatorAtObjectEnd(const ASTContext & // If we don't know the array bound, conservatively assume we're looking at // the final array element. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712240108.vBO18YKf078482>