From b60736ec1405bb0a8dd40989f67ef4c93da068ab Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 16 Feb 2021 21:13:02 +0100 Subject: [PATCH] Vendor import of llvm-project main 8e464dd76bef, the last commit before the upstream release/12.x branch was created. --- clang/include/clang-c/Index.h | 88 +- clang/include/clang-c/Rewrite.h | 63 + .../clang/APINotes/APINotesYAMLCompiler.h | 24 + clang/include/clang/APINotes/Types.h | 734 +++ clang/include/clang/ARCMigrate/FileRemapper.h | 8 + clang/include/clang/AST/APValue.h | 163 +- clang/include/clang/AST/ASTContext.h | 153 +- clang/include/clang/AST/ASTFwd.h | 6 +- clang/include/clang/AST/ASTImporter.h | 8 + clang/include/clang/AST/ASTNodeTraverser.h | 72 +- .../clang/AST/ASTStructuralEquivalence.h | 7 + clang/include/clang/AST/ASTTypeTraits.h | 74 +- clang/include/clang/AST/AbstractBasicReader.h | 34 + clang/include/clang/AST/AbstractBasicWriter.h | 35 + clang/include/clang/AST/Attr.h | 39 +- clang/include/clang/AST/CXXInheritance.h | 10 - .../clang/AST/CXXRecordDeclDefinitionBits.def | 7 + clang/include/clang/AST/CanonicalType.h | 4 +- clang/include/clang/AST/CommentLexer.h | 31 +- clang/include/clang/AST/ComputeDependence.h | 4 +- clang/include/clang/AST/Decl.h | 132 +- clang/include/clang/AST/DeclBase.h | 3 +- clang/include/clang/AST/DeclCXX.h | 96 +- clang/include/clang/AST/DeclObjC.h | 45 +- clang/include/clang/AST/DeclOpenMP.h | 246 +- clang/include/clang/AST/DeclTemplate.h | 117 +- clang/include/clang/AST/DeclarationName.h | 23 +- clang/include/clang/AST/DependenceFlags.h | 1 + clang/include/clang/AST/DependentDiagnostic.h | 10 +- clang/include/clang/AST/Expr.h | 404 +- clang/include/clang/AST/ExprCXX.h | 297 +- clang/include/clang/AST/ExprConcepts.h | 6 +- clang/include/clang/AST/ExprObjC.h | 4 +- clang/include/clang/AST/ExternalASTSource.h | 4 - clang/include/clang/AST/GlobalDecl.h | 1 + clang/include/clang/AST/IgnoreExpr.h | 161 + clang/include/clang/AST/Mangle.h | 17 +- clang/include/clang/AST/NestedNameSpecifier.h | 34 +- clang/include/clang/AST/OpenMPClause.h | 494 +- clang/include/clang/AST/OperationKinds.def | 11 +- clang/include/clang/AST/OptionalDiagnostic.h | 2 +- clang/include/clang/AST/ParentMap.h | 4 +- clang/include/clang/AST/ParentMapContext.h | 13 +- clang/include/clang/AST/PrettyPrinter.h | 40 +- clang/include/clang/AST/PropertiesBase.td | 308 + clang/include/clang/AST/RecordLayout.h | 65 +- clang/include/clang/AST/RecursiveASTVisitor.h | 56 +- clang/include/clang/AST/Redeclarable.h | 15 + clang/include/clang/AST/Stmt.h | 60 +- clang/include/clang/AST/StmtIterator.h | 9 +- clang/include/clang/AST/StmtOpenMP.h | 1651 +++--- clang/include/clang/AST/TemplateBase.h | 72 +- clang/include/clang/AST/TemplateName.h | 6 +- clang/include/clang/AST/TextNodeDumper.h | 3 + clang/include/clang/AST/Type.h | 208 +- clang/include/clang/AST/TypeLoc.h | 93 +- clang/include/clang/AST/TypeProperties.td | 15 +- .../clang/ASTMatchers/ASTMatchFinder.h | 4 + clang/include/clang/ASTMatchers/ASTMatchers.h | 574 +- .../clang/ASTMatchers/ASTMatchersInternal.h | 938 ++- .../clang/ASTMatchers/ASTMatchersMacros.h | 58 +- .../clang/ASTMatchers/Dynamic/VariantValue.h | 40 +- .../clang/Analysis/Analyses/CalledOnceCheck.h | 112 + .../clang/Analysis/Analyses/Dominators.h | 70 - .../clang/Analysis/Analyses/LiveVariables.h | 18 +- .../clang/Analysis/Analyses/ThreadSafety.h | 8 + .../clang/Analysis/Analyses/ThreadSafetyTIL.h | 4 +- clang/include/clang/Analysis/CallGraph.h | 4 +- clang/include/clang/Analysis/IssueHash.h | 49 + clang/include/clang/Analysis/PathDiagnostic.h | 39 + clang/include/clang/Basic/AddressSpaces.h | 2 + clang/include/clang/Basic/AlignedAllocation.h | 2 + clang/include/clang/Basic/Attr.td | 296 +- clang/include/clang/Basic/AttrDocs.td | 1122 +++- clang/include/clang/Basic/Builtins.def | 85 +- clang/include/clang/Basic/Builtins.h | 7 + clang/include/clang/Basic/BuiltinsAArch64.def | 11 + clang/include/clang/Basic/BuiltinsAMDGPU.def | 6 + clang/include/clang/Basic/BuiltinsBPF.def | 8 +- clang/include/clang/Basic/BuiltinsNVPTX.def | 2 +- clang/include/clang/Basic/BuiltinsPPC.def | 236 +- .../clang/Basic/BuiltinsWebAssembly.def | 134 +- clang/include/clang/Basic/BuiltinsX86.def | 51 +- clang/include/clang/Basic/BuiltinsX86_64.def | 11 + clang/include/clang/Basic/CodeGenOptions.def | 50 +- clang/include/clang/Basic/CodeGenOptions.h | 46 +- clang/include/clang/Basic/Cuda.h | 8 + clang/include/clang/Basic/DebugInfoOptions.h | 6 +- clang/include/clang/Basic/DeclNodes.td | 1 + clang/include/clang/Basic/Diagnostic.h | 408 +- clang/include/clang/Basic/Diagnostic.td | 10 + clang/include/clang/Basic/DiagnosticAST.h | 2 +- .../include/clang/Basic/DiagnosticASTKinds.td | 11 +- .../include/clang/Basic/DiagnosticAnalysis.h | 2 +- clang/include/clang/Basic/DiagnosticComment.h | 2 +- .../clang/Basic/DiagnosticCommonKinds.td | 6 + clang/include/clang/Basic/DiagnosticCrossTU.h | 2 +- clang/include/clang/Basic/DiagnosticDriver.h | 2 +- .../clang/Basic/DiagnosticDriverKinds.td | 41 +- .../include/clang/Basic/DiagnosticFrontend.h | 2 +- .../clang/Basic/DiagnosticFrontendKinds.td | 22 +- clang/include/clang/Basic/DiagnosticGroups.td | 46 +- clang/include/clang/Basic/DiagnosticIDs.h | 12 +- clang/include/clang/Basic/DiagnosticLex.h | 2 +- .../include/clang/Basic/DiagnosticLexKinds.td | 9 +- .../include/clang/Basic/DiagnosticOptions.def | 1 + clang/include/clang/Basic/DiagnosticOptions.h | 12 + clang/include/clang/Basic/DiagnosticParse.h | 2 +- .../clang/Basic/DiagnosticParseKinds.td | 86 +- .../clang/Basic/DiagnosticRefactoring.h | 2 +- clang/include/clang/Basic/DiagnosticSema.h | 2 +- .../clang/Basic/DiagnosticSemaKinds.td | 393 +- .../clang/Basic/DiagnosticSerialization.h | 2 +- .../Basic/DiagnosticSerializationKinds.td | 19 +- clang/include/clang/Basic/DirectoryEntry.h | 298 + clang/include/clang/Basic/FPOptions.def | 4 +- clang/include/clang/Basic/Features.def | 3 + clang/include/clang/Basic/FileEntry.h | 406 ++ clang/include/clang/Basic/FileManager.h | 158 +- clang/include/clang/Basic/IdentifierTable.h | 12 - clang/include/clang/Basic/LLVM.h | 1 + clang/include/clang/Basic/LangOptions.def | 42 +- clang/include/clang/Basic/LangOptions.h | 165 +- clang/include/clang/Basic/LangStandard.h | 14 +- clang/include/clang/Basic/LangStandards.def | 14 + clang/include/clang/Basic/Module.h | 55 +- .../include/clang/Basic/OpenCLExtensions.def | 142 +- clang/include/clang/Basic/OpenCLOptions.h | 217 +- clang/include/clang/Basic/OpenMPKinds.def | 20 +- clang/include/clang/Basic/OpenMPKinds.h | 23 +- clang/include/clang/Basic/OperatorKinds.h | 5 + clang/include/clang/Basic/PPCTypes.def | 38 + clang/include/clang/Basic/PartialDiagnostic.h | 277 +- clang/include/clang/Basic/ProfileList.h | 58 + clang/include/clang/Basic/Sanitizers.def | 4 +- clang/include/clang/Basic/SourceLocation.h | 31 + clang/include/clang/Basic/SourceManager.h | 1028 ++-- clang/include/clang/Basic/Specifiers.h | 34 +- clang/include/clang/Basic/TargetCXXABI.h | 25 +- clang/include/clang/Basic/TargetID.h | 56 + clang/include/clang/Basic/TargetInfo.h | 78 +- clang/include/clang/Basic/TargetOptions.h | 12 +- clang/include/clang/Basic/TokenKinds.def | 17 +- clang/include/clang/Basic/TypeNodes.td | 2 +- clang/include/clang/Basic/arm_mve.td | 12 +- clang/include/clang/Basic/arm_mve_defs.td | 8 +- clang/include/clang/Basic/arm_neon.td | 73 +- clang/include/clang/CodeGen/BackendUtil.h | 5 - clang/include/clang/CodeGen/CGFunctionInfo.h | 60 +- clang/include/clang/Driver/Compilation.h | 17 + clang/include/clang/Driver/Distro.h | 17 +- clang/include/clang/Driver/Driver.h | 4 +- clang/include/clang/Driver/Job.h | 29 +- clang/include/clang/Driver/Options.h | 8 +- clang/include/clang/Driver/Options.td | 3032 ++++++---- clang/include/clang/Driver/SanitizerArgs.h | 5 +- clang/include/clang/Driver/ToolChain.h | 32 +- clang/include/clang/Driver/XRayArgs.h | 2 + clang/include/clang/Edit/EditedSource.h | 2 +- clang/include/clang/Format/Format.h | 1089 +++- clang/include/clang/Frontend/ASTUnit.h | 18 +- .../include/clang/Frontend/CompilerInstance.h | 68 +- .../clang/Frontend/CompilerInvocation.h | 22 +- clang/include/clang/Frontend/FrontendAction.h | 2 +- .../include/clang/Frontend/FrontendActions.h | 2 + .../include/clang/Frontend/FrontendOptions.h | 35 +- .../clang/Frontend/PrecompiledPreamble.h | 9 +- clang/include/clang/Frontend/Utils.h | 8 +- .../SerializablePathCollection.h | 129 + clang/include/clang/Lex/HeaderSearch.h | 34 + clang/include/clang/Lex/HeaderSearchOptions.h | 9 +- clang/include/clang/Lex/Lexer.h | 10 +- clang/include/clang/Lex/ModuleMap.h | 13 +- clang/include/clang/Lex/Preprocessor.h | 24 + ...rExcludedConditionalDirectiveSkipMapping.h | 3 +- clang/include/clang/Lex/PreprocessorOptions.h | 26 +- clang/include/clang/Parse/Parser.h | 70 +- .../include/clang/Sema/CodeCompleteConsumer.h | 3 - clang/include/clang/Sema/DeclSpec.h | 588 +- clang/include/clang/Sema/DelayedDiagnostic.h | 19 +- clang/include/clang/Sema/Designator.h | 49 +- clang/include/clang/Sema/Initialization.h | 61 +- .../clang/Sema/MultiplexExternalSemaSource.h | 2 - clang/include/clang/Sema/Overload.h | 6 + clang/include/clang/Sema/Ownership.h | 21 +- clang/include/clang/Sema/ParsedAttr.h | 48 +- clang/include/clang/Sema/ScopeInfo.h | 15 +- clang/include/clang/Sema/Sema.h | 835 ++- clang/include/clang/Sema/SemaInternal.h | 5 + clang/include/clang/Sema/Template.h | 2 +- .../include/clang/Serialization/ASTBitCodes.h | 10 +- clang/include/clang/Serialization/ASTReader.h | 51 +- .../clang/Serialization/ASTRecordReader.h | 6 +- .../clang/Serialization/ASTRecordWriter.h | 15 +- clang/include/clang/Serialization/ASTWriter.h | 10 + .../include/clang/Serialization/ModuleFile.h | 19 +- .../clang/Serialization/ModuleManager.h | 6 +- .../clang/StaticAnalyzer/Checkers/Checkers.td | 16 +- .../StaticAnalyzer/Core/AnalyzerOptions.h | 34 +- .../Core/BugReporter/BugReporterVisitors.h | 5 +- .../clang/StaticAnalyzer/Core/IssueHash.h | 50 - .../Core/PathDiagnosticConsumers.h | 7 +- .../Core/PathSensitive/BasicValueFactory.h | 16 +- .../Core/PathSensitive/CallEvent.h | 56 +- .../Core/PathSensitive/CheckerContext.h | 20 + .../Core/PathSensitive/ExprEngine.h | 17 + .../PathSensitive/RangedConstraintManager.h | 22 +- .../Core/PathSensitive/SMTConstraintManager.h | 3 +- .../Core/PathSensitive/SMTConv.h | 18 +- .../Core/PathSensitive/SValBuilder.h | 2 +- .../StaticAnalyzer/Core/PathSensitive/SVals.h | 14 +- .../Core/PathSensitive/SymExpr.h | 3 + .../Core/PathSensitive/SymbolManager.h | 12 +- clang/include/clang/Testing/TestClangConfig.h | 2 + .../clang/Tooling/CompilationDatabase.h | 22 +- .../clang/Tooling/Inclusions/HeaderIncludes.h | 2 - .../clang/Tooling/Inclusions/IncludeStyle.h | 21 +- .../Refactoring/Extract/SourceExtraction.h | 0 .../Tooling/{Core => Refactoring}/Lookup.h | 6 +- .../Refactoring/RefactoringRuleContext.h | 2 +- .../Refactoring/Rename/SymbolOccurrences.h | 13 +- .../include/clang/Tooling/Syntax/BuildTree.h | 35 +- clang/include/clang/Tooling/Syntax/Nodes.h | 648 +- clang/include/clang/Tooling/Syntax/Nodes.td | 296 + clang/include/clang/Tooling/Syntax/Syntax.td | 85 + clang/include/clang/Tooling/Syntax/Tokens.h | 12 +- clang/include/clang/Tooling/Syntax/Tree.h | 216 +- clang/include/clang/Tooling/Tooling.h | 11 - .../clang/Tooling/Transformer/MatchConsumer.h | 6 - .../clang/Tooling/Transformer/RangeSelector.h | 29 +- .../clang/Tooling/Transformer/RewriteRule.h | 290 +- .../clang/Tooling/Transformer/Stencil.h | 11 +- clang/include/clang/module.modulemap | 1 + clang/lib/APINotes/APINotesFormat.h | 255 + clang/lib/APINotes/APINotesTypes.cpp | 107 + clang/lib/APINotes/APINotesYAMLCompiler.cpp | 598 ++ clang/lib/ARCMigrate/ARCMT.cpp | 8 +- clang/lib/ARCMigrate/FileRemapper.cpp | 15 + clang/lib/ARCMigrate/ObjCMT.cpp | 39 +- clang/lib/ARCMigrate/TransGCAttrs.cpp | 22 +- clang/lib/ARCMigrate/TransProperties.cpp | 17 +- clang/lib/ARCMigrate/Transforms.h | 6 +- clang/lib/AST/APValue.cpp | 538 +- clang/lib/AST/ASTContext.cpp | 585 +- clang/lib/AST/ASTDiagnostic.cpp | 15 +- clang/lib/AST/ASTDumper.cpp | 8 +- clang/lib/AST/ASTImporter.cpp | 564 +- clang/lib/AST/ASTImporterLookupTable.cpp | 14 + clang/lib/AST/ASTStructuralEquivalence.cpp | 500 +- clang/lib/AST/ASTTypeTraits.cpp | 58 +- clang/lib/AST/AttrImpl.cpp | 53 +- clang/lib/AST/CXXInheritance.cpp | 150 +- clang/lib/AST/CommentLexer.cpp | 9 +- clang/lib/AST/ComparisonCategories.cpp | 2 +- clang/lib/AST/ComputeDependence.cpp | 138 +- clang/lib/AST/Decl.cpp | 363 +- clang/lib/AST/DeclBase.cpp | 65 +- clang/lib/AST/DeclCXX.cpp | 135 +- clang/lib/AST/DeclObjC.cpp | 45 +- clang/lib/AST/DeclOpenMP.cpp | 112 +- clang/lib/AST/DeclPrinter.cpp | 28 +- clang/lib/AST/DeclTemplate.cpp | 77 +- clang/lib/AST/Expr.cpp | 482 +- clang/lib/AST/ExprCXX.cpp | 207 +- clang/lib/AST/ExprClassification.cpp | 4 +- clang/lib/AST/ExprConstant.cpp | 1547 +++-- clang/lib/AST/Interp/Disasm.cpp | 4 +- clang/lib/AST/Interp/State.cpp | 2 +- clang/lib/AST/ItaniumMangle.cpp | 1052 +++- clang/lib/AST/JSONNodeDumper.cpp | 8 +- clang/lib/AST/Linkage.h | 2 + clang/lib/AST/Mangle.cpp | 72 +- clang/lib/AST/MicrosoftMangle.cpp | 424 +- clang/lib/AST/NSAPI.cpp | 3 + clang/lib/AST/OpenMPClause.cpp | 180 +- clang/lib/AST/ParentMapContext.cpp | 117 +- clang/lib/AST/PrintfFormatString.cpp | 3 + clang/lib/AST/RecordLayout.cpp | 41 +- clang/lib/AST/RecordLayoutBuilder.cpp | 384 +- clang/lib/AST/Stmt.cpp | 110 +- clang/lib/AST/StmtOpenMP.cpp | 1135 ++-- clang/lib/AST/StmtPrinter.cpp | 25 +- clang/lib/AST/StmtProfile.cpp | 9 +- clang/lib/AST/TemplateBase.cpp | 35 +- clang/lib/AST/TemplateName.cpp | 18 +- clang/lib/AST/TextNodeDumper.cpp | 51 +- clang/lib/AST/Type.cpp | 113 +- clang/lib/AST/TypeLoc.cpp | 5 +- clang/lib/AST/TypePrinter.cpp | 314 +- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 447 +- clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 144 +- clang/lib/ASTMatchers/Dynamic/Marshallers.cpp | 11 +- clang/lib/ASTMatchers/Dynamic/Marshallers.h | 208 +- clang/lib/ASTMatchers/Dynamic/Registry.cpp | 11 +- .../lib/ASTMatchers/Dynamic/VariantValue.cpp | 30 + clang/lib/ASTMatchers/GtestMatchers.cpp | 4 +- clang/lib/Analysis/BodyFarm.cpp | 40 +- clang/lib/Analysis/CFG.cpp | 35 +- clang/lib/Analysis/CalledOnceCheck.cpp | 1525 +++++ clang/lib/Analysis/ExprMutationAnalyzer.cpp | 300 +- .../Core => Analysis}/IssueHash.cpp | 41 +- clang/lib/Analysis/LiveVariables.cpp | 102 +- clang/lib/Analysis/PathDiagnostic.cpp | 46 +- clang/lib/Analysis/ThreadSafety.cpp | 29 +- clang/lib/Analysis/ThreadSafetyCommon.cpp | 4 +- clang/lib/Basic/Cuda.cpp | 43 +- clang/lib/Basic/Diagnostic.cpp | 35 +- clang/lib/Basic/DiagnosticIDs.cpp | 109 +- clang/lib/Basic/FileEntry.cpp | 24 + clang/lib/Basic/FileManager.cpp | 181 +- clang/lib/Basic/IdentifierTable.cpp | 5 + clang/lib/Basic/LangOptions.cpp | 2 +- clang/lib/Basic/Module.cpp | 21 +- clang/lib/Basic/OpenCLOptions.cpp | 106 + clang/lib/Basic/OpenMPKinds.cpp | 50 +- clang/lib/Basic/ProfileList.cpp | 113 + clang/lib/Basic/SourceLocation.cpp | 21 +- clang/lib/Basic/SourceManager.cpp | 506 +- clang/lib/Basic/TargetID.cpp | 169 + clang/lib/Basic/TargetInfo.cpp | 1 + clang/lib/Basic/Targets.cpp | 68 +- clang/lib/Basic/Targets/AArch64.cpp | 48 +- clang/lib/Basic/Targets/AArch64.h | 6 + clang/lib/Basic/Targets/AMDGPU.cpp | 36 +- clang/lib/Basic/Targets/AMDGPU.h | 77 +- clang/lib/Basic/Targets/ARM.cpp | 2 + clang/lib/Basic/Targets/AVR.cpp | 7 + clang/lib/Basic/Targets/Hexagon.cpp | 3 +- clang/lib/Basic/Targets/MSP430.cpp | 1 + clang/lib/Basic/Targets/Mips.cpp | 1 - clang/lib/Basic/Targets/NVPTX.cpp | 8 + clang/lib/Basic/Targets/NVPTX.h | 20 +- clang/lib/Basic/Targets/OSTargets.h | 81 +- clang/lib/Basic/Targets/PPC.cpp | 87 +- clang/lib/Basic/Targets/PPC.h | 34 +- clang/lib/Basic/Targets/RISCV.cpp | 162 +- clang/lib/Basic/Targets/RISCV.h | 49 +- clang/lib/Basic/Targets/SPIR.h | 6 +- clang/lib/Basic/Targets/Sparc.cpp | 28 +- clang/lib/Basic/Targets/Sparc.h | 11 +- clang/lib/Basic/Targets/SystemZ.h | 4 + clang/lib/Basic/Targets/TCE.h | 2 + clang/lib/Basic/Targets/VE.h | 16 +- clang/lib/Basic/Targets/WebAssembly.cpp | 62 +- clang/lib/Basic/Targets/WebAssembly.h | 6 +- clang/lib/Basic/Targets/X86.cpp | 59 +- clang/lib/Basic/Targets/X86.h | 36 +- clang/lib/Basic/Version.cpp | 2 - clang/lib/Basic/Warnings.cpp | 7 +- clang/lib/CodeGen/ABIInfo.h | 2 +- clang/lib/CodeGen/BackendUtil.cpp | 564 +- clang/lib/CodeGen/CGAtomic.cpp | 60 +- clang/lib/CodeGen/CGBlocks.cpp | 17 +- clang/lib/CodeGen/CGBuiltin.cpp | 2365 +++++--- clang/lib/CodeGen/CGCUDANV.cpp | 109 +- clang/lib/CodeGen/CGCUDARuntime.h | 7 +- clang/lib/CodeGen/CGCXXABI.cpp | 26 +- clang/lib/CodeGen/CGCXXABI.h | 13 +- clang/lib/CodeGen/CGCall.cpp | 339 +- clang/lib/CodeGen/CGCall.h | 6 +- clang/lib/CodeGen/CGClass.cpp | 101 +- clang/lib/CodeGen/CGCleanup.h | 1 + clang/lib/CodeGen/CGDebugInfo.cpp | 310 +- clang/lib/CodeGen/CGDebugInfo.h | 14 +- clang/lib/CodeGen/CGDecl.cpp | 162 +- clang/lib/CodeGen/CGDeclCXX.cpp | 113 +- clang/lib/CodeGen/CGException.cpp | 28 +- clang/lib/CodeGen/CGExpr.cpp | 242 +- clang/lib/CodeGen/CGExprAgg.cpp | 131 +- clang/lib/CodeGen/CGExprCXX.cpp | 28 +- clang/lib/CodeGen/CGExprComplex.cpp | 11 +- clang/lib/CodeGen/CGExprConstant.cpp | 34 +- clang/lib/CodeGen/CGExprScalar.cpp | 438 +- clang/lib/CodeGen/CGLoopInfo.cpp | 93 +- clang/lib/CodeGen/CGLoopInfo.h | 15 +- clang/lib/CodeGen/CGObjC.cpp | 243 +- clang/lib/CodeGen/CGObjCGNU.cpp | 67 +- clang/lib/CodeGen/CGObjCMac.cpp | 100 +- clang/lib/CodeGen/CGObjCRuntime.cpp | 10 + clang/lib/CodeGen/CGObjCRuntime.h | 14 + clang/lib/CodeGen/CGOpenMPRuntime.cpp | 2002 +++++-- clang/lib/CodeGen/CGOpenMPRuntime.h | 79 +- clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp | 60 + clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h | 43 + clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 4864 +++++++++++++++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | 504 ++ clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 5225 +--------------- clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h | 465 +- clang/lib/CodeGen/CGRecordLayout.h | 17 +- clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 189 +- clang/lib/CodeGen/CGStmt.cpp | 301 +- clang/lib/CodeGen/CGStmtOpenMP.cpp | 205 +- clang/lib/CodeGen/CGVTT.cpp | 13 +- clang/lib/CodeGen/CGVTables.cpp | 96 +- clang/lib/CodeGen/CGValue.h | 2 +- clang/lib/CodeGen/CodeGenAction.cpp | 228 +- clang/lib/CodeGen/CodeGenFunction.cpp | 315 +- clang/lib/CodeGen/CodeGenFunction.h | 257 +- clang/lib/CodeGen/CodeGenModule.cpp | 400 +- clang/lib/CodeGen/CodeGenModule.h | 58 +- clang/lib/CodeGen/CodeGenPGO.cpp | 55 +- clang/lib/CodeGen/CodeGenPGO.h | 2 +- clang/lib/CodeGen/CodeGenTypeCache.h | 3 + clang/lib/CodeGen/CodeGenTypes.cpp | 71 +- clang/lib/CodeGen/CoverageMappingGen.cpp | 350 +- clang/lib/CodeGen/CoverageMappingGen.h | 50 +- clang/lib/CodeGen/ItaniumCXXABI.cpp | 183 +- clang/lib/CodeGen/MicrosoftCXXABI.cpp | 101 +- .../ObjectFilePCHContainerOperations.cpp | 10 +- clang/lib/CodeGen/SwiftCallingConv.cpp | 33 +- clang/lib/CodeGen/TargetInfo.cpp | 626 +- clang/lib/CodeGen/TargetInfo.h | 8 +- clang/lib/CrossTU/CrossTranslationUnit.cpp | 12 +- clang/lib/Driver/Compilation.cpp | 2 + clang/lib/Driver/Distro.cpp | 180 +- clang/lib/Driver/Driver.cpp | 347 +- clang/lib/Driver/Job.cpp | 22 +- clang/lib/Driver/SanitizerArgs.cpp | 42 +- clang/lib/Driver/ToolChain.cpp | 139 +- clang/lib/Driver/ToolChains/AIX.cpp | 62 +- clang/lib/Driver/ToolChains/AIX.h | 7 + clang/lib/Driver/ToolChains/AMDGPU.cpp | 136 +- clang/lib/Driver/ToolChains/AMDGPU.h | 14 +- clang/lib/Driver/ToolChains/AVR.cpp | 306 +- clang/lib/Driver/ToolChains/Ananas.cpp | 10 +- clang/lib/Driver/ToolChains/Arch/AArch64.cpp | 24 +- clang/lib/Driver/ToolChains/Arch/ARM.cpp | 261 +- clang/lib/Driver/ToolChains/Arch/ARM.h | 2 + clang/lib/Driver/ToolChains/Arch/Mips.cpp | 2 - clang/lib/Driver/ToolChains/Arch/PPC.cpp | 1 - clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 123 +- clang/lib/Driver/ToolChains/Arch/Sparc.cpp | 9 +- clang/lib/Driver/ToolChains/Arch/VE.cpp | 4 - clang/lib/Driver/ToolChains/Arch/VE.h | 2 - clang/lib/Driver/ToolChains/Arch/X86.cpp | 35 +- clang/lib/Driver/ToolChains/Arch/X86.h | 2 +- clang/lib/Driver/ToolChains/BareMetal.cpp | 146 +- clang/lib/Driver/ToolChains/BareMetal.h | 15 +- clang/lib/Driver/ToolChains/Clang.cpp | 681 ++- clang/lib/Driver/ToolChains/CloudABI.cpp | 5 +- clang/lib/Driver/ToolChains/CommonArgs.cpp | 267 +- clang/lib/Driver/ToolChains/CommonArgs.h | 14 +- clang/lib/Driver/ToolChains/CrossWindows.cpp | 15 +- clang/lib/Driver/ToolChains/CrossWindows.h | 6 +- clang/lib/Driver/ToolChains/Cuda.cpp | 217 +- clang/lib/Driver/ToolChains/Cuda.h | 9 +- clang/lib/Driver/ToolChains/Darwin.cpp | 132 +- clang/lib/Driver/ToolChains/Darwin.h | 21 +- clang/lib/Driver/ToolChains/DragonFly.cpp | 16 +- clang/lib/Driver/ToolChains/Flang.cpp | 44 +- clang/lib/Driver/ToolChains/Flang.h | 9 + clang/lib/Driver/ToolChains/FreeBSD.cpp | 18 +- clang/lib/Driver/ToolChains/Fuchsia.cpp | 29 +- clang/lib/Driver/ToolChains/Fuchsia.h | 6 +- clang/lib/Driver/ToolChains/Gnu.cpp | 155 +- clang/lib/Driver/ToolChains/Gnu.h | 6 +- clang/lib/Driver/ToolChains/HIP.cpp | 58 +- clang/lib/Driver/ToolChains/Hexagon.cpp | 10 +- .../lib/Driver/ToolChains/InterfaceStubs.cpp | 2 +- clang/lib/Driver/ToolChains/Linux.cpp | 36 +- clang/lib/Driver/ToolChains/MSP430.cpp | 157 +- clang/lib/Driver/ToolChains/MSP430.h | 13 + clang/lib/Driver/ToolChains/MSVC.cpp | 65 +- clang/lib/Driver/ToolChains/MinGW.cpp | 25 +- clang/lib/Driver/ToolChains/Minix.cpp | 10 +- clang/lib/Driver/ToolChains/Myriad.cpp | 10 +- clang/lib/Driver/ToolChains/NaCl.cpp | 5 +- clang/lib/Driver/ToolChains/NetBSD.cpp | 10 +- clang/lib/Driver/ToolChains/OpenBSD.cpp | 77 +- clang/lib/Driver/ToolChains/OpenBSD.h | 22 +- clang/lib/Driver/ToolChains/PS4CPU.cpp | 47 +- clang/lib/Driver/ToolChains/PS4CPU.h | 6 +- .../lib/Driver/ToolChains/RISCVToolchain.cpp | 21 +- clang/lib/Driver/ToolChains/RISCVToolchain.h | 1 + clang/lib/Driver/ToolChains/ROCm.h | 13 +- clang/lib/Driver/ToolChains/Solaris.cpp | 4 +- clang/lib/Driver/ToolChains/Solaris.h | 5 + clang/lib/Driver/ToolChains/VEToolchain.cpp | 31 +- clang/lib/Driver/ToolChains/VEToolchain.h | 1 + clang/lib/Driver/ToolChains/WebAssembly.cpp | 28 +- clang/lib/Driver/ToolChains/XCore.cpp | 4 +- clang/lib/Driver/ToolChains/ZOS.cpp | 33 + clang/lib/Driver/ToolChains/ZOS.h | 40 + clang/lib/Driver/Types.cpp | 6 +- clang/lib/Driver/XRayArgs.cpp | 26 + clang/lib/Edit/EditedSource.cpp | 4 +- clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 2 + clang/lib/Format/BreakableToken.cpp | 92 +- clang/lib/Format/BreakableToken.h | 1 - clang/lib/Format/ContinuationIndenter.cpp | 59 +- clang/lib/Format/Format.cpp | 167 +- clang/lib/Format/FormatInternal.h | 1 - clang/lib/Format/FormatToken.cpp | 5 +- clang/lib/Format/FormatToken.h | 299 +- clang/lib/Format/FormatTokenLexer.cpp | 23 +- clang/lib/Format/MacroExpander.cpp | 224 + clang/lib/Format/Macros.h | 141 + clang/lib/Format/TokenAnnotator.cpp | 263 +- clang/lib/Format/UnwrappedLineFormatter.cpp | 71 +- clang/lib/Format/UnwrappedLineParser.cpp | 252 +- clang/lib/Format/UnwrappedLineParser.h | 5 + clang/lib/Format/WhitespaceManager.cpp | 90 +- clang/lib/Frontend/ASTUnit.cpp | 103 +- clang/lib/Frontend/ChainedIncludesSource.cpp | 11 +- clang/lib/Frontend/CompilerInstance.cpp | 280 +- clang/lib/Frontend/CompilerInvocation.cpp | 2168 +++---- .../CreateInvocationFromCommandLine.cpp | 4 +- clang/lib/Frontend/DependencyFile.cpp | 17 +- clang/lib/Frontend/FrontendAction.cpp | 19 +- clang/lib/Frontend/FrontendActions.cpp | 58 +- clang/lib/Frontend/FrontendOptions.cpp | 2 +- clang/lib/Frontend/InitHeaderSearch.cpp | 2 + clang/lib/Frontend/InitPreprocessor.cpp | 32 +- .../Frontend/ModuleDependencyCollector.cpp | 52 +- clang/lib/Frontend/PrecompiledPreamble.cpp | 51 +- clang/lib/Frontend/Rewrite/HTMLPrint.cpp | 2 +- .../Frontend/Rewrite/InclusionRewriter.cpp | 78 +- clang/lib/Frontend/Rewrite/RewriteMacros.cpp | 2 +- .../Frontend/Rewrite/RewriteModernObjC.cpp | 57 +- clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 47 +- clang/lib/Frontend/TextDiagnostic.cpp | 5 +- clang/lib/Frontend/TextDiagnosticPrinter.cpp | 8 +- .../lib/Frontend/VerifyDiagnosticConsumer.cpp | 12 +- clang/lib/Headers/__clang_cuda_builtin_vars.h | 9 + clang/lib/Headers/__clang_cuda_cmath.h | 50 +- .../Headers/__clang_cuda_complex_builtins.h | 36 +- clang/lib/Headers/__clang_cuda_math.h | 9 +- .../__clang_cuda_math_forward_declares.h | 3 + .../Headers/__clang_cuda_runtime_wrapper.h | 28 +- clang/lib/Headers/__clang_hip_cmath.h | 664 +++ .../Headers/__clang_hip_libdevice_declares.h | 26 +- clang/lib/Headers/__clang_hip_math.h | 1194 ++-- .../lib/Headers/__clang_hip_runtime_wrapper.h | 5 + clang/lib/Headers/altivec.h | 1209 +++- clang/lib/Headers/amxintrin.h | 97 +- clang/lib/Headers/arm_acle.h | 26 + clang/lib/Headers/avx512fintrin.h | 157 +- clang/lib/Headers/avx512vlvnniintrin.h | 205 +- clang/lib/Headers/avxintrin.h | 6 +- clang/lib/Headers/avxvnniintrin.h | 225 + clang/lib/Headers/cpuid.h | 8 + clang/lib/Headers/cuda_wrappers/algorithm | 2 +- clang/lib/Headers/cuda_wrappers/new | 10 +- clang/lib/Headers/emmintrin.h | 2 +- clang/lib/Headers/gfniintrin.h | 209 +- clang/lib/Headers/hresetintrin.h | 49 + clang/lib/Headers/ia32intrin.h | 97 +- clang/lib/Headers/immintrin.h | 12 + clang/lib/Headers/intrin.h | 173 +- clang/lib/Headers/keylockerintrin.h | 506 ++ clang/lib/Headers/mm_malloc.h | 6 + clang/lib/Headers/opencl-c-base.h | 18 + clang/lib/Headers/opencl-c.h | 2 + clang/lib/Headers/openmp_wrappers/cmath | 5 +- clang/lib/Headers/openmp_wrappers/complex | 27 + clang/lib/Headers/openmp_wrappers/complex.h | 2 + .../Headers/openmp_wrappers/complex_cmath.h | 388 ++ clang/lib/Headers/popcntintrin.h | 11 +- clang/lib/Headers/ppc_wrappers/smmintrin.h | 24 + clang/lib/Headers/uintrintrin.h | 150 + clang/lib/Headers/wasm_simd128.h | 112 +- clang/lib/Headers/x86gprintrin.h | 23 + clang/lib/Index/FileIndexRecord.cpp | 2 +- clang/lib/Index/IndexBody.cpp | 4 +- clang/lib/Index/IndexTypeSourceInfo.cpp | 21 + clang/lib/Index/IndexingAction.cpp | 11 +- clang/lib/Index/SimpleFormatContext.h | 72 - clang/lib/Index/USRGeneration.cpp | 3 + .../SerializablePathCollection.cpp | 91 + clang/lib/Lex/HeaderSearch.cpp | 58 +- clang/lib/Lex/Lexer.cpp | 49 +- clang/lib/Lex/LiteralSupport.cpp | 4 +- clang/lib/Lex/ModuleMap.cpp | 76 +- clang/lib/Lex/PPDirectives.cpp | 12 +- clang/lib/Lex/PPLexerChange.cpp | 27 +- clang/lib/Lex/PPMacroExpansion.cpp | 31 +- clang/lib/Lex/Pragma.cpp | 2 +- clang/lib/Lex/Preprocessor.cpp | 16 +- clang/lib/Lex/ScratchBuffer.cpp | 8 +- clang/lib/Lex/TokenLexer.cpp | 10 +- clang/lib/Parse/ParseCXXInlineMethods.cpp | 23 +- clang/lib/Parse/ParseDecl.cpp | 300 +- clang/lib/Parse/ParseDeclCXX.cpp | 107 +- clang/lib/Parse/ParseExpr.cpp | 96 +- clang/lib/Parse/ParseExprCXX.cpp | 71 +- clang/lib/Parse/ParseObjc.cpp | 37 +- clang/lib/Parse/ParseOpenMP.cpp | 458 +- clang/lib/Parse/ParsePragma.cpp | 311 +- clang/lib/Parse/ParseStmt.cpp | 57 +- clang/lib/Parse/ParseStmtAsm.cpp | 2 +- clang/lib/Parse/ParseTemplate.cpp | 21 +- clang/lib/Parse/ParseTentative.cpp | 13 +- clang/lib/Parse/Parser.cpp | 66 +- clang/lib/Rewrite/HTMLRewrite.cpp | 22 +- clang/lib/Rewrite/Rewriter.cpp | 8 +- clang/lib/Rewrite/TokenRewriter.cpp | 2 +- clang/lib/Sema/AnalysisBasedWarnings.cpp | 102 +- clang/lib/Sema/CodeCompleteConsumer.cpp | 6 +- clang/lib/Sema/DeclSpec.cpp | 167 +- clang/lib/Sema/JumpDiagnostics.cpp | 17 + .../lib/Sema/MultiplexExternalSemaSource.cpp | 7 - clang/lib/Sema/ScopeInfo.cpp | 1 + clang/lib/Sema/Sema.cpp | 163 +- clang/lib/Sema/SemaAccess.cpp | 3 +- clang/lib/Sema/SemaAttr.cpp | 345 +- clang/lib/Sema/SemaCUDA.cpp | 103 +- clang/lib/Sema/SemaCast.cpp | 81 +- clang/lib/Sema/SemaChecking.cpp | 1033 +++- clang/lib/Sema/SemaCodeComplete.cpp | 92 +- clang/lib/Sema/SemaConcept.cpp | 23 +- clang/lib/Sema/SemaCoroutine.cpp | 102 +- clang/lib/Sema/SemaDecl.cpp | 1189 ++-- clang/lib/Sema/SemaDeclAttr.cpp | 1060 +++- clang/lib/Sema/SemaDeclCXX.cpp | 225 +- clang/lib/Sema/SemaDeclObjC.cpp | 76 +- clang/lib/Sema/SemaExceptionSpec.cpp | 4 +- clang/lib/Sema/SemaExpr.cpp | 1004 ++-- clang/lib/Sema/SemaExprCXX.cpp | 201 +- clang/lib/Sema/SemaExprMember.cpp | 119 +- clang/lib/Sema/SemaExprObjC.cpp | 88 +- clang/lib/Sema/SemaInit.cpp | 356 +- clang/lib/Sema/SemaLambda.cpp | 145 +- clang/lib/Sema/SemaLookup.cpp | 378 +- clang/lib/Sema/SemaModule.cpp | 2 +- clang/lib/Sema/SemaObjCProperty.cpp | 14 +- clang/lib/Sema/SemaOpenMP.cpp | 1065 +++- clang/lib/Sema/SemaOverload.cpp | 978 +-- clang/lib/Sema/SemaSYCL.cpp | 20 +- clang/lib/Sema/SemaStmt.cpp | 217 +- clang/lib/Sema/SemaStmtAsm.cpp | 6 +- clang/lib/Sema/SemaStmtAttr.cpp | 78 +- clang/lib/Sema/SemaTemplate.cpp | 645 +- clang/lib/Sema/SemaTemplateDeduction.cpp | 379 +- clang/lib/Sema/SemaTemplateInstantiate.cpp | 187 +- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 417 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 63 +- clang/lib/Sema/SemaType.cpp | 1222 ++-- clang/lib/Sema/TreeTransform.h | 205 +- clang/lib/Sema/UsedDeclVisitor.h | 11 +- clang/lib/Serialization/ASTCommon.cpp | 6 + clang/lib/Serialization/ASTReader.cpp | 434 +- clang/lib/Serialization/ASTReaderDecl.cpp | 166 +- clang/lib/Serialization/ASTReaderStmt.cpp | 365 +- clang/lib/Serialization/ASTWriter.cpp | 183 +- clang/lib/Serialization/ASTWriterDecl.cpp | 59 +- clang/lib/Serialization/ASTWriterStmt.cpp | 158 +- clang/lib/Serialization/GlobalModuleIndex.cpp | 7 +- clang/lib/Serialization/ModuleManager.cpp | 59 +- .../Checkers/BasicObjCFoundationChecks.cpp | 3 +- .../Checkers/CastValueChecker.cpp | 148 +- .../Checkers/CheckObjCDealloc.cpp | 2 +- .../StaticAnalyzer/Checkers/DebugCheckers.cpp | 10 +- .../Checkers/DereferenceChecker.cpp | 69 +- .../Checkers/ExprInspectionChecker.cpp | 4 +- .../Checkers/FuchsiaHandleChecker.cpp | 312 +- .../Checkers/GenericTaintChecker.cpp | 5 +- .../Checkers/IteratorModeling.cpp | 103 +- .../Checkers/IteratorRangeChecker.cpp | 2 + .../Checkers/LocalizationChecker.cpp | 7 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 2 +- .../StaticAnalyzer/Checkers/MallocChecker.cpp | 15 +- .../StaticAnalyzer/Checkers/MoveChecker.cpp | 4 +- .../Checkers/OSObjectCStyleCast.cpp | 21 +- .../Checkers/ObjCMissingSuperCallChecker.cpp | 7 +- .../Checkers/PaddingChecker.cpp | 5 +- .../Checkers/PthreadLockChecker.cpp | 271 +- .../RetainCountDiagnostics.cpp | 4 +- .../Checkers/ReturnPointerRangeChecker.cpp | 7 +- clang/lib/StaticAnalyzer/Checkers/SmartPtr.h | 2 + .../Checkers/SmartPtrChecker.cpp | 48 +- .../Checkers/SmartPtrModeling.cpp | 512 +- .../Checkers/StdLibraryFunctionsChecker.cpp | 2086 ++++--- .../StaticAnalyzer/Checkers/StreamChecker.cpp | 70 +- clang/lib/StaticAnalyzer/Checkers/Taint.cpp | 2 +- .../Checkers/UndefBranchChecker.cpp | 7 +- .../Checkers/VirtualCallChecker.cpp | 4 +- .../Checkers/WebKit/ASTUtils.cpp | 4 +- .../WebKit/NoUncountedMembersChecker.cpp | 7 +- .../Checkers/WebKit/PtrTypesSemantics.cpp | 58 +- .../Checkers/WebKit/PtrTypesSemantics.h | 23 +- .../WebKit/RefCntblBaseVirtualDtorChecker.cpp | 12 +- .../WebKit/UncountedCallArgsChecker.cpp | 3 +- .../WebKit/UncountedLambdaCapturesChecker.cpp | 107 + .../WebKit/UncountedLocalVarsChecker.cpp | 251 + clang/lib/StaticAnalyzer/Checkers/Yaml.h | 0 .../StaticAnalyzer/Core/AnalyzerOptions.cpp | 2 +- .../StaticAnalyzer/Core/BasicValueFactory.cpp | 25 +- clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 13 +- .../Core/BugReporterVisitors.cpp | 7 +- clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 2 +- .../StaticAnalyzer/Core/CheckerContext.cpp | 2 +- clang/lib/StaticAnalyzer/Core/DynamicType.cpp | 13 + clang/lib/StaticAnalyzer/Core/Environment.cpp | 21 +- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 155 +- clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 7 +- .../lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 26 +- .../Core/ExprEngineCallAndReturn.cpp | 14 +- .../StaticAnalyzer/Core/ExprEngineObjC.cpp | 13 +- .../StaticAnalyzer/Core/HTMLDiagnostics.cpp | 47 +- .../StaticAnalyzer/Core/PlistDiagnostics.cpp | 400 +- .../lib/StaticAnalyzer/Core/ProgramState.cpp | 3 - .../Core/RangeConstraintManager.cpp | 1114 +++- .../Core/RangedConstraintManager.cpp | 41 +- clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | 23 +- clang/lib/StaticAnalyzer/Core/SVals.cpp | 48 +- .../StaticAnalyzer/Core/SarifDiagnostics.cpp | 16 +- .../Core/SimpleConstraintManager.cpp | 4 +- .../StaticAnalyzer/Core/SimpleSValBuilder.cpp | 19 +- .../lib/StaticAnalyzer/Core/SymbolManager.cpp | 28 +- .../StaticAnalyzer/Core/TextDiagnostics.cpp | 49 +- .../Frontend/AnalysisConsumer.cpp | 4 +- clang/lib/Tooling/AllTUsExecution.cpp | 2 +- clang/lib/Tooling/ArgumentsAdjusters.cpp | 34 +- clang/lib/Tooling/CompilationDatabase.cpp | 58 +- clang/lib/Tooling/Core/Replacement.cpp | 2 +- .../DependencyScanningFilesystem.cpp | 20 +- .../DependencyScanningWorker.cpp | 24 +- .../DependencyScanning/ModuleDepCollector.cpp | 13 +- clang/lib/Tooling/FileMatchTrie.cpp | 14 +- .../lib/Tooling/Inclusions/HeaderIncludes.cpp | 52 +- clang/lib/Tooling/Inclusions/IncludeStyle.cpp | 1 + clang/lib/Tooling/JSONCompilationDatabase.cpp | 48 +- .../lib/Tooling/Refactoring/ASTSelection.cpp | 2 +- .../Tooling/{Core => Refactoring}/Lookup.cpp | 2 +- .../Refactoring/RefactoringActions.cpp | 4 +- .../Refactoring/Rename/SymbolOccurrences.cpp | 5 +- .../Tooling/Refactoring/Rename/USRFinder.cpp | 4 +- .../Refactoring/Rename/USRFindingAction.cpp | 52 +- .../Refactoring/Rename/USRLocFinder.cpp | 2 +- clang/lib/Tooling/Syntax/BuildTree.cpp | 817 ++- .../Tooling/Syntax/ComputeReplacements.cpp | 15 +- clang/lib/Tooling/Syntax/Mutations.cpp | 36 +- clang/lib/Tooling/Syntax/Nodes.cpp | 838 ++- clang/lib/Tooling/Syntax/Synthesis.cpp | 224 +- clang/lib/Tooling/Syntax/Tokens.cpp | 91 +- clang/lib/Tooling/Syntax/Tree.cpp | 418 +- clang/lib/Tooling/Tooling.cpp | 71 +- clang/lib/Tooling/Transformer/Parsing.cpp | 8 +- .../lib/Tooling/Transformer/RangeSelector.cpp | 26 +- clang/lib/Tooling/Transformer/RewriteRule.cpp | 264 +- clang/lib/Tooling/Transformer/Stencil.cpp | 77 +- clang/lib/Tooling/Transformer/Transformer.cpp | 42 +- clang/tools/clang-format/ClangFormat.cpp | 32 +- clang/tools/driver/cc1_main.cpp | 10 +- clang/tools/driver/cc1as_main.cpp | 29 +- clang/tools/driver/driver.cpp | 7 + .../TableGen/ClangASTPropertiesEmitter.cpp | 12 +- clang/utils/TableGen/ClangAttrEmitter.cpp | 56 +- .../TableGen/ClangDiagnosticsEmitter.cpp | 5 + .../utils/TableGen/ClangOptionDocEmitter.cpp | 2 - clang/utils/TableGen/ClangSyntaxEmitter.cpp | 236 + clang/utils/TableGen/NeonEmitter.cpp | 25 +- clang/utils/TableGen/SveEmitter.cpp | 20 +- clang/utils/TableGen/TableGen.cpp | 12 + clang/utils/TableGen/TableGenBackends.h | 8 +- compiler-rt/.clang-tidy | 2 + .../include/fuzzer/FuzzedDataProvider.h | 9 + compiler-rt/include/profile/InstrProfData.inc | 139 +- .../include/sanitizer/asan_interface.h | 16 +- .../include/sanitizer/common_interface_defs.h | 9 +- .../include/sanitizer/dfsan_interface.h | 8 +- .../include/sanitizer/hwasan_interface.h | 3 + .../include/sanitizer/memprof_interface.h | 65 + .../include/sanitizer/msan_interface.h | 3 + .../include/sanitizer/netbsd_syscall_hooks.h | 213 +- compiler-rt/lib/asan/asan_allocator.cpp | 477 +- compiler-rt/lib/asan/asan_allocator.h | 11 +- compiler-rt/lib/asan/asan_flags.cpp | 10 +- compiler-rt/lib/asan/asan_fuchsia.cpp | 35 +- compiler-rt/lib/asan/asan_interceptors.cpp | 41 +- compiler-rt/lib/asan/asan_interceptors.h | 22 +- .../lib/asan/asan_interceptors_vfork.S | 3 +- .../lib/asan/asan_interface_internal.h | 4 +- compiler-rt/lib/asan/asan_internal.h | 2 - compiler-rt/lib/asan/asan_linux.cpp | 45 +- compiler-rt/lib/asan/asan_mac.cpp | 48 +- compiler-rt/lib/asan/asan_malloc_linux.cpp | 10 +- compiler-rt/lib/asan/asan_malloc_local.h | 2 +- compiler-rt/lib/asan/asan_mapping.h | 21 + compiler-rt/lib/asan/asan_poisoning.cpp | 6 - compiler-rt/lib/asan/asan_premap_shadow.cpp | 18 +- compiler-rt/lib/asan/asan_report.cpp | 5 +- compiler-rt/lib/asan/asan_rtems.cpp | 6 + compiler-rt/lib/asan/asan_rtl.cpp | 5 +- compiler-rt/lib/asan/asan_shadow_setup.cpp | 45 +- compiler-rt/lib/asan/asan_stack.h | 5 - compiler-rt/lib/asan/asan_thread.cpp | 27 +- compiler-rt/lib/asan/asan_thread.h | 7 +- compiler-rt/lib/asan/asan_win.cpp | 19 +- compiler-rt/lib/builtins/README.txt | 2 + compiler-rt/lib/builtins/aarch64/lse.S | 236 + compiler-rt/lib/builtins/assembly.h | 93 +- compiler-rt/lib/builtins/atomic.c | 90 +- compiler-rt/lib/builtins/clear_cache.c | 14 +- compiler-rt/lib/builtins/cpu_model.c | 65 +- compiler-rt/lib/builtins/divdf3.c | 189 +- compiler-rt/lib/builtins/divdi3.c | 15 +- compiler-rt/lib/builtins/divmoddi4.c | 13 +- compiler-rt/lib/builtins/divmodsi4.c | 13 +- compiler-rt/lib/builtins/divmodti4.c | 32 + compiler-rt/lib/builtins/divsf3.c | 174 +- compiler-rt/lib/builtins/divsi3.c | 25 +- compiler-rt/lib/builtins/divtf3.c | 203 +- compiler-rt/lib/builtins/divti3.c | 15 +- compiler-rt/lib/builtins/emutls.c | 7 +- compiler-rt/lib/builtins/extendhfsf2.c | 6 +- compiler-rt/lib/builtins/extendhftf2.c | 23 + compiler-rt/lib/builtins/fp_div_impl.inc | 419 ++ compiler-rt/lib/builtins/fp_extend.h | 4 + compiler-rt/lib/builtins/fp_lib.h | 7 + compiler-rt/lib/builtins/fp_trunc.h | 4 + compiler-rt/lib/builtins/int_div_impl.inc | 25 + compiler-rt/lib/builtins/int_mulo_impl.inc | 49 + compiler-rt/lib/builtins/int_mulv_impl.inc | 47 + compiler-rt/lib/builtins/int_util.h | 16 + compiler-rt/lib/builtins/moddi3.c | 16 +- compiler-rt/lib/builtins/modti3.c | 16 +- compiler-rt/lib/builtins/mulodi4.c | 33 +- compiler-rt/lib/builtins/mulosi4.c | 33 +- compiler-rt/lib/builtins/muloti4.c | 33 +- compiler-rt/lib/builtins/mulvdi3.c | 33 +- compiler-rt/lib/builtins/mulvsi3.c | 33 +- compiler-rt/lib/builtins/mulvti3.c | 33 +- compiler-rt/lib/builtins/os_version_check.c | 108 +- compiler-rt/lib/builtins/paritydi2.c | 6 +- compiler-rt/lib/builtins/parityti2.c | 8 +- .../lib/builtins/riscv/int_mul_impl.inc | 6 +- compiler-rt/lib/builtins/truncdfhf2.c | 4 +- compiler-rt/lib/builtins/truncsfhf2.c | 6 +- compiler-rt/lib/builtins/trunctfhf2.c | 23 + compiler-rt/lib/cfi/cfi.cpp | 2 +- compiler-rt/lib/crt/crtbegin.c | 8 + compiler-rt/lib/dfsan/dfsan.cpp | 100 +- compiler-rt/lib/dfsan/dfsan_custom.cpp | 201 +- compiler-rt/lib/dfsan/dfsan_flags.inc | 4 - compiler-rt/lib/dfsan/dfsan_interceptors.cpp | 41 +- compiler-rt/lib/dfsan/done_abilist.txt | 85 + compiler-rt/lib/fuzzer/FuzzerCorpus.h | 62 +- .../lib/fuzzer/FuzzerDataFlowTrace.cpp | 2 +- compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 91 +- .../lib/fuzzer/FuzzerExtFunctionsWeak.cpp | 2 +- .../lib/fuzzer/FuzzerExtraCounters.cpp | 2 +- compiler-rt/lib/fuzzer/FuzzerFlags.def | 37 +- compiler-rt/lib/fuzzer/FuzzerFork.cpp | 14 +- compiler-rt/lib/fuzzer/FuzzerIO.cpp | 45 + compiler-rt/lib/fuzzer/FuzzerIO.h | 6 + compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp | 8 +- compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp | 14 +- compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 253 + compiler-rt/lib/fuzzer/FuzzerInternal.h | 4 +- compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 69 +- compiler-rt/lib/fuzzer/FuzzerMutate.cpp | 40 +- compiler-rt/lib/fuzzer/FuzzerMutate.h | 14 +- compiler-rt/lib/fuzzer/FuzzerOptions.h | 9 +- compiler-rt/lib/fuzzer/FuzzerPlatform.h | 18 +- compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | 34 +- compiler-rt/lib/fuzzer/FuzzerTracePC.h | 6 +- compiler-rt/lib/fuzzer/FuzzerUtil.h | 6 + compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp | 19 +- compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp | 2 +- compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp | 4 +- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 14 +- compiler-rt/lib/gwp_asan/common.cpp | 3 + compiler-rt/lib/gwp_asan/crash_handler.cpp | 24 +- compiler-rt/lib/gwp_asan/crash_handler.h | 2 +- compiler-rt/lib/gwp_asan/definitions.h | 2 +- .../lib/gwp_asan/guarded_pool_allocator.cpp | 114 +- .../lib/gwp_asan/guarded_pool_allocator.h | 78 +- compiler-rt/lib/gwp_asan/mutex.h | 14 +- compiler-rt/lib/gwp_asan/optional/backtrace.h | 48 +- .../gwp_asan/optional/backtrace_fuchsia.cpp | 21 + .../optional/backtrace_linux_libc.cpp | 25 +- .../optional/backtrace_sanitizer_common.cpp | 49 +- .../lib/gwp_asan/optional/options_parser.cpp | 249 +- .../lib/gwp_asan/optional/options_parser.h | 12 +- compiler-rt/lib/gwp_asan/optional/printf.h | 33 + .../lib/gwp_asan/optional/segv_handler.h | 70 +- .../optional/segv_handler_fuchsia.cpp | 22 + .../gwp_asan/optional/segv_handler_posix.cpp | 182 +- compiler-rt/lib/gwp_asan/options.inc | 30 +- .../platform_specific/common_fuchsia.cpp | 15 + .../platform_specific/common_posix.cpp | 6 +- .../guarded_pool_allocator_fuchsia.cpp | 103 + .../guarded_pool_allocator_fuchsia.h | 22 + .../guarded_pool_allocator_posix.cpp | 64 +- .../guarded_pool_allocator_posix.h | 18 + .../guarded_pool_allocator_tls.h | 55 + .../platform_specific/mutex_fuchsia.cpp | 21 + .../platform_specific/mutex_fuchsia.h | 23 + .../gwp_asan/platform_specific/mutex_posix.h | 23 + .../platform_specific/utilities_fuchsia.cpp | 19 + .../platform_specific/utilities_posix.cpp | 65 +- compiler-rt/lib/gwp_asan/random.cpp | 31 - compiler-rt/lib/gwp_asan/random.h | 23 - compiler-rt/lib/gwp_asan/utilities.cpp | 63 + compiler-rt/lib/gwp_asan/utilities.h | 18 +- compiler-rt/lib/hwasan/hwasan.cpp | 4 +- compiler-rt/lib/hwasan/hwasan.h | 9 +- compiler-rt/lib/hwasan/hwasan_allocator.cpp | 20 +- compiler-rt/lib/hwasan/hwasan_allocator.h | 14 +- .../lib/hwasan/hwasan_dynamic_shadow.cpp | 50 +- .../lib/hwasan/hwasan_interceptors_vfork.S | 1 + .../lib/hwasan/hwasan_interface_internal.h | 3 + compiler-rt/lib/hwasan/hwasan_linux.cpp | 74 +- compiler-rt/lib/hwasan/hwasan_malloc_bisect.h | 2 +- compiler-rt/lib/hwasan/hwasan_mapping.h | 9 + compiler-rt/lib/hwasan/hwasan_new_delete.cpp | 39 +- compiler-rt/lib/hwasan/hwasan_report.cpp | 25 +- compiler-rt/lib/hwasan/hwasan_thread.h | 2 - compiler-rt/lib/hwasan/hwasan_thread_list.h | 63 +- compiler-rt/lib/interception/interception.h | 4 +- .../lib/interception/interception_linux.cpp | 10 +- .../lib/interception/interception_linux.h | 10 +- .../lib/interception/interception_win.cpp | 6 +- compiler-rt/lib/lsan/lsan.cpp | 4 +- compiler-rt/lib/lsan/lsan_allocator.cpp | 10 + compiler-rt/lib/lsan/lsan_common.cpp | 298 +- compiler-rt/lib/lsan/lsan_common.h | 20 +- compiler-rt/lib/lsan/lsan_common_fuchsia.cpp | 7 +- compiler-rt/lib/lsan/lsan_common_linux.cpp | 5 + compiler-rt/lib/lsan/lsan_fuchsia.h | 2 +- compiler-rt/lib/lsan/lsan_interceptors.cpp | 17 +- compiler-rt/lib/lsan/lsan_posix.h | 2 +- compiler-rt/lib/lsan/lsan_thread.cpp | 5 + compiler-rt/lib/lsan/lsan_thread.h | 2 + compiler-rt/lib/memprof/README.txt | 17 + compiler-rt/lib/memprof/memprof.syms.extra | 1 + compiler-rt/lib/memprof/memprof_allocator.cpp | 905 +++ compiler-rt/lib/memprof/memprof_allocator.h | 105 + .../lib/memprof/memprof_descriptions.cpp | 70 + .../lib/memprof/memprof_descriptions.h | 45 + compiler-rt/lib/memprof/memprof_flags.cpp | 93 + compiler-rt/lib/memprof/memprof_flags.h | 45 + compiler-rt/lib/memprof/memprof_flags.inc | 49 + .../lib/memprof/memprof_init_version.h | 26 + .../lib/memprof/memprof_interceptors.cpp | 366 ++ .../lib/memprof/memprof_interceptors.h | 54 + .../memprof_interceptors_memintrinsics.cpp | 29 + .../memprof_interceptors_memintrinsics.h | 79 + .../lib/memprof/memprof_interface_internal.h | 64 + compiler-rt/lib/memprof/memprof_internal.h | 104 + compiler-rt/lib/memprof/memprof_linux.cpp | 80 + .../lib/memprof/memprof_malloc_linux.cpp | 226 + compiler-rt/lib/memprof/memprof_mapping.h | 113 + .../lib/memprof/memprof_new_delete.cpp | 145 + compiler-rt/lib/memprof/memprof_posix.cpp | 55 + compiler-rt/lib/memprof/memprof_preinit.cpp | 23 + compiler-rt/lib/memprof/memprof_rtl.cpp | 321 + .../lib/memprof/memprof_shadow_setup.cpp | 62 + compiler-rt/lib/memprof/memprof_stack.cpp | 59 + compiler-rt/lib/memprof/memprof_stack.h | 75 + compiler-rt/lib/memprof/memprof_stats.cpp | 157 + compiler-rt/lib/memprof/memprof_stats.h | 61 + compiler-rt/lib/memprof/memprof_thread.cpp | 220 + compiler-rt/lib/memprof/memprof_thread.h | 138 + compiler-rt/lib/memprof/weak_symbols.txt | 1 + compiler-rt/lib/msan/msan.cpp | 51 +- compiler-rt/lib/msan/msan_interceptors.cpp | 10 +- .../lib/msan/msan_interface_internal.h | 10 +- compiler-rt/lib/msan/msan_linux.cpp | 3 +- compiler-rt/lib/msan/msan_poisoning.cpp | 81 +- compiler-rt/lib/msan/msan_thread.cpp | 58 +- compiler-rt/lib/msan/msan_thread.h | 24 +- compiler-rt/lib/profile/GCDAProfiling.c | 94 +- compiler-rt/lib/profile/InstrProfiling.c | 6 +- compiler-rt/lib/profile/InstrProfiling.h | 9 + .../lib/profile/InstrProfilingBuffer.c | 24 +- compiler-rt/lib/profile/InstrProfilingFile.c | 35 +- .../lib/profile/InstrProfilingInternal.c | 3 + .../profile/InstrProfilingPlatformDarwin.c | 3 + .../lib/profile/InstrProfilingPlatformLinux.c | 2 +- compiler-rt/lib/profile/InstrProfilingPort.h | 16 +- compiler-rt/lib/profile/InstrProfilingValue.c | 39 +- .../lib/profile/InstrProfilingVersionVar.c | 17 + .../lib/profile/InstrProfilingWriter.c | 3 + .../sanitizer_common/sanitizer_allocator.cpp | 39 +- .../sanitizer_common/sanitizer_allocator.h | 6 +- .../sanitizer_allocator_checks.h | 10 +- .../sanitizer_allocator_primary32.h | 1 + .../sanitizer_allocator_primary64.h | 3 +- .../sanitizer_allocator_report.cpp | 8 + .../sanitizer_allocator_report.h | 1 + .../sanitizer_allocator_secondary.h | 8 +- .../lib/sanitizer_common/sanitizer_atomic.h | 4 +- .../sanitizer_common/sanitizer_atomic_clang.h | 14 +- .../sanitizer_atomic_clang_mips.h | 10 +- .../sanitizer_atomic_clang_other.h | 24 +- .../sanitizer_atomic_clang_x86.h | 6 +- .../sanitizer_common/sanitizer_atomic_msvc.h | 36 +- .../lib/sanitizer_common/sanitizer_common.h | 119 +- .../sanitizer_common_interceptors.inc | 199 +- .../sanitizer_common_interceptors_format.inc | 6 + .../sanitizer_common_interceptors_ioctl.inc | 6 +- ...er_common_interceptors_vfork_riscv64.inc.S | 56 + .../sanitizer_common_interface.inc | 1 + .../sanitizer_common_libcdep.cpp | 53 + .../sanitizer_common_nolibc.cpp | 4 +- .../sanitizer_common_syscalls.inc | 14 +- .../sanitizer_deadlock_detector1.cpp | 2 +- .../sanitizer_deadlock_detector2.cpp | 2 +- .../sanitizer_deadlock_detector_interface.h | 6 + .../lib/sanitizer_common/sanitizer_errno.h | 2 +- .../sanitizer_common/sanitizer_errno_codes.h | 1 + .../lib/sanitizer_common/sanitizer_file.cpp | 37 +- .../lib/sanitizer_common/sanitizer_file.h | 1 + .../sanitizer_common/sanitizer_flag_parser.h | 2 +- .../lib/sanitizer_common/sanitizer_flags.cpp | 11 +- .../lib/sanitizer_common/sanitizer_flags.h | 4 + .../lib/sanitizer_common/sanitizer_flags.inc | 19 +- .../sanitizer_common/sanitizer_fuchsia.cpp | 21 +- .../sanitizer_common/sanitizer_getauxval.h | 5 +- .../sanitizer_interface_internal.h | 4 + .../sanitizer_internal_defs.h | 21 +- .../sanitizer_common/sanitizer_libignore.cpp | 2 +- .../lib/sanitizer_common/sanitizer_linux.cpp | 229 +- .../lib/sanitizer_common/sanitizer_linux.h | 11 +- .../sanitizer_linux_libcdep.cpp | 217 +- .../lib/sanitizer_common/sanitizer_mac.cpp | 215 +- .../lib/sanitizer_common/sanitizer_mac.h | 3 +- .../lib/sanitizer_common/sanitizer_netbsd.cpp | 5 + .../sanitizer_common/sanitizer_openbsd.cpp | 115 - .../lib/sanitizer_common/sanitizer_platform.h | 37 +- .../sanitizer_platform_interceptors.h | 359 +- .../sanitizer_platform_limits_freebsd.cpp | 2 - .../sanitizer_platform_limits_netbsd.cpp | 155 +- .../sanitizer_platform_limits_netbsd.h | 12 +- .../sanitizer_platform_limits_openbsd.cpp | 279 - .../sanitizer_platform_limits_openbsd.h | 382 -- .../sanitizer_platform_limits_posix.cpp | 107 +- .../sanitizer_platform_limits_posix.h | 8 +- .../sanitizer_platform_limits_solaris.cpp | 3 +- .../lib/sanitizer_common/sanitizer_posix.cpp | 12 +- .../lib/sanitizer_common/sanitizer_posix.h | 2 +- .../sanitizer_posix_libcdep.cpp | 16 +- .../lib/sanitizer_common/sanitizer_procmaps.h | 2 +- .../sanitizer_procmaps_bsd.cpp | 31 +- .../sanitizer_procmaps_common.cpp | 2 +- .../sanitizer_procmaps_solaris.cpp | 7 +- .../lib/sanitizer_common/sanitizer_ptrauth.h | 2 + .../lib/sanitizer_common/sanitizer_rtems.cpp | 2 - .../sanitizer_signal_interceptors.inc | 5 +- .../sanitizer_common/sanitizer_solaris.cpp | 18 +- .../sanitizer_common/sanitizer_stackdepot.cpp | 9 +- .../sanitizer_common/sanitizer_stackdepot.h | 1 + .../sanitizer_stackdepotbase.h | 20 +- .../sanitizer_common/sanitizer_stacktrace.cpp | 37 +- .../sanitizer_common/sanitizer_stacktrace.h | 25 +- .../sanitizer_stacktrace_libcdep.cpp | 21 +- .../sanitizer_stacktrace_printer.cpp | 92 +- .../sanitizer_stacktrace_printer.h | 4 +- .../sanitizer_common/sanitizer_stoptheworld.h | 13 +- .../sanitizer_stoptheworld_fuchsia.cpp | 3 +- .../sanitizer_stoptheworld_fuchsia.h | 20 + .../sanitizer_stoptheworld_linux_libcdep.cpp | 106 +- .../sanitizer_stoptheworld_mac.cpp | 20 +- .../sanitizer_stoptheworld_netbsd_libcdep.cpp | 16 +- .../sanitizer_symbolizer_internal.h | 7 +- .../sanitizer_symbolizer_libbacktrace.h | 2 +- .../sanitizer_symbolizer_libcdep.cpp | 9 +- .../sanitizer_symbolizer_mac.cpp | 21 +- .../sanitizer_symbolizer_mac.h | 4 +- .../sanitizer_symbolizer_markup.cpp | 7 +- .../sanitizer_symbolizer_posix_libcdep.cpp | 8 +- .../sanitizer_symbolizer_report.cpp | 9 +- .../sanitizer_symbolizer_win.cpp | 11 +- .../sanitizer_syscall_generic.inc | 2 +- .../sanitizer_syscall_linux_riscv64.inc | 174 + .../sanitizer_syscalls_netbsd.inc | 119 +- .../sanitizer_thread_registry.h | 5 +- .../sanitizer_tls_get_addr.cpp | 86 +- .../sanitizer_common/sanitizer_tls_get_addr.h | 21 +- .../sanitizer_common/sanitizer_unwind_win.cpp | 11 + .../lib/sanitizer_common/sanitizer_win.cpp | 46 +- .../symbolizer/scripts/build_symbolizer.sh | 2 +- .../symbolizer/scripts/global_symbols.txt | 2 + compiler-rt/lib/scudo/scudo_allocator.cpp | 35 +- compiler-rt/lib/scudo/scudo_crc32.h | 2 +- compiler-rt/lib/scudo/scudo_tsd.h | 8 +- compiler-rt/lib/scudo/scudo_utils.cpp | 2 +- compiler-rt/lib/scudo/scudo_utils.h | 2 +- .../lib/scudo/standalone/allocator_config.h | 84 +- .../lib/scudo/standalone/atomic_helpers.h | 22 +- compiler-rt/lib/scudo/standalone/chunk.h | 3 +- compiler-rt/lib/scudo/standalone/combined.h | 277 +- compiler-rt/lib/scudo/standalone/common.h | 10 + compiler-rt/lib/scudo/standalone/flags.cpp | 15 - .../standalone/fuzz/get_error_info_fuzzer.cpp | 12 +- .../standalone/include/scudo/interface.h | 53 +- .../lib/scudo/standalone/internal_defs.h | 1 - compiler-rt/lib/scudo/standalone/linux.cpp | 11 +- compiler-rt/lib/scudo/standalone/linux.h | 45 - .../lib/scudo/standalone/local_cache.h | 1 + compiler-rt/lib/scudo/standalone/memtag.h | 139 +- compiler-rt/lib/scudo/standalone/options.h | 74 + compiler-rt/lib/scudo/standalone/primary32.h | 229 +- compiler-rt/lib/scudo/standalone/primary64.h | 175 +- compiler-rt/lib/scudo/standalone/release.cpp | 2 +- compiler-rt/lib/scudo/standalone/release.h | 166 +- compiler-rt/lib/scudo/standalone/secondary.h | 128 +- .../lib/scudo/standalone/stack_depot.h | 2 +- .../lib/scudo/standalone/string_utils.cpp | 20 +- .../lib/scudo/standalone/tsd_exclusive.h | 37 +- compiler-rt/lib/scudo/standalone/tsd_shared.h | 164 +- compiler-rt/lib/scudo/standalone/wrappers_c.h | 8 - .../lib/scudo/standalone/wrappers_c.inc | 37 +- compiler-rt/lib/tsan/dd/dd_interceptors.cpp | 11 +- compiler-rt/lib/tsan/dd/dd_rtl.h | 2 +- compiler-rt/lib/tsan/rtl/tsan_dispatch_defs.h | 11 +- compiler-rt/lib/tsan/rtl/tsan_external.cpp | 11 +- compiler-rt/lib/tsan/rtl/tsan_flags.cpp | 2 +- compiler-rt/lib/tsan/rtl/tsan_interceptors.h | 2 +- .../rtl/tsan_interceptors_libdispatch.cpp | 32 + .../lib/tsan/rtl/tsan_interceptors_mac.cpp | 1 + .../tsan/rtl/tsan_interceptors_mach_vm.cpp | 19 +- .../lib/tsan/rtl/tsan_interceptors_posix.cpp | 106 +- compiler-rt/lib/tsan/rtl/tsan_interface.cpp | 13 +- compiler-rt/lib/tsan/rtl/tsan_interface_inl.h | 23 +- compiler-rt/lib/tsan/rtl/tsan_platform.h | 31 +- .../lib/tsan/rtl/tsan_platform_linux.cpp | 24 +- .../lib/tsan/rtl/tsan_platform_mac.cpp | 9 +- .../lib/tsan/rtl/tsan_platform_posix.cpp | 47 +- compiler-rt/lib/tsan/rtl/tsan_report.cpp | 6 +- compiler-rt/lib/tsan/rtl/tsan_rtl.cpp | 16 +- compiler-rt/lib/tsan/rtl/tsan_rtl.h | 12 +- compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp | 2 +- compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp | 111 +- compiler-rt/lib/tsan/rtl/tsan_sync.cpp | 2 +- compiler-rt/lib/ubsan/ubsan_flags.cpp | 6 +- compiler-rt/lib/ubsan/ubsan_flags.h | 2 - compiler-rt/lib/ubsan/ubsan_platform.h | 2 +- .../lib/ubsan/ubsan_type_hash_itanium.cpp | 2 +- compiler-rt/lib/ubsan/ubsan_type_hash_win.cpp | 2 +- .../ubsan_minimal/ubsan_minimal_handlers.cpp | 2 +- compiler-rt/lib/xray/xray_basic_logging.cpp | 2 +- compiler-rt/lib/xray/xray_mips.cpp | 45 +- compiler-rt/lib/xray/xray_mips64.cpp | 64 +- compiler-rt/lib/xray/xray_x86_64.cpp | 13 +- compiler-rt/lib/xray/xray_x86_64.inc | 1 - libcxx/include/__availability | 206 + libcxx/include/__bit_reference | 30 +- libcxx/include/__bits | 146 + libcxx/include/__config | 304 +- libcxx/include/__debug | 39 +- libcxx/include/__functional_03 | 48 +- libcxx/include/__functional_base | 79 +- libcxx/include/__functional_base_03 | 24 +- libcxx/include/__hash_table | 238 +- libcxx/include/__libcpp_version | 2 +- libcxx/include/__locale | 270 +- libcxx/include/__memory/allocator_traits.h | 401 ++ libcxx/include/__memory/base.h | 127 + libcxx/include/__memory/pointer_traits.h | 169 + libcxx/include/__memory/utilities.h | 88 + libcxx/include/__mutex_base | 15 +- libcxx/include/__split_buffer | 24 +- libcxx/include/__sso_allocator | 9 +- libcxx/include/__string | 96 +- libcxx/include/__threading_support | 62 +- libcxx/include/__tree | 220 +- libcxx/include/algorithm | 685 ++- libcxx/include/any | 30 +- libcxx/include/array | 20 +- libcxx/include/atomic | 170 +- libcxx/include/barrier | 12 +- libcxx/include/bit | 146 +- libcxx/include/bitset | 12 +- libcxx/include/charconv | 27 +- libcxx/include/chrono | 7 +- libcxx/include/cmath | 4 +- libcxx/include/codecvt | 24 + libcxx/include/compare | 13 +- libcxx/include/complex | 17 +- libcxx/include/concepts | 5 + libcxx/include/ctime | 16 +- libcxx/include/deque | 16 +- libcxx/include/exception | 2 + libcxx/include/experimental/memory_resource | 5 +- libcxx/include/experimental/simd | 5 + libcxx/include/ext/hash_map | 2 +- libcxx/include/filesystem | 407 +- libcxx/include/forward_list | 6 +- libcxx/include/fstream | 155 +- libcxx/include/functional | 160 +- libcxx/include/future | 248 +- libcxx/include/iomanip | 4 +- libcxx/include/ios | 31 +- libcxx/include/iosfwd | 59 + libcxx/include/istream | 34 +- libcxx/include/iterator | 121 +- libcxx/include/latch | 8 + libcxx/include/list | 186 +- libcxx/include/locale | 184 +- libcxx/include/locale.h | 6 +- libcxx/include/map | 50 +- libcxx/include/memory | 1819 ++---- libcxx/include/module.modulemap | 1 + libcxx/include/mutex | 2 +- libcxx/include/new | 207 +- libcxx/include/numbers | 2 +- libcxx/include/numeric | 191 +- libcxx/include/optional | 5 +- libcxx/include/ostream | 28 +- libcxx/include/queue | 19 +- libcxx/include/random | 498 +- libcxx/include/regex | 183 +- libcxx/include/semaphore | 9 +- libcxx/include/shared_mutex | 1 + libcxx/include/span | 7 +- libcxx/include/sstream | 494 +- libcxx/include/stdexcept | 4 +- libcxx/include/streambuf | 14 +- libcxx/include/string | 352 +- libcxx/include/string_view | 65 +- libcxx/include/strstream | 26 +- libcxx/include/system_error | 4 +- libcxx/include/thread | 45 +- libcxx/include/tuple | 2 +- libcxx/include/type_traits | 382 +- libcxx/include/typeinfo | 29 +- libcxx/include/unordered_map | 270 +- libcxx/include/unordered_set | 160 +- libcxx/include/utility | 38 +- libcxx/include/valarray | 168 +- libcxx/include/variant | 127 +- libcxx/include/vector | 99 +- libcxx/include/version | 170 +- libcxx/include/wctype.h | 4 +- libcxx/src/atomic.cpp | 2 - libcxx/src/barrier.cpp | 12 +- libcxx/src/chrono.cpp | 155 +- libcxx/src/experimental/memory_resource.cpp | 10 - libcxx/src/filesystem/directory_iterator.cpp | 63 +- libcxx/src/filesystem/filesystem_common.h | 132 +- libcxx/src/filesystem/operations.cpp | 396 +- libcxx/src/include/config_elast.h | 4 + libcxx/src/include/refstring.h | 25 +- libcxx/src/ios.cpp | 16 - libcxx/src/ios.instantiations.cpp | 43 + libcxx/src/iostream.cpp | 2 +- libcxx/src/locale.cpp | 208 +- libcxx/src/memory.cpp | 4 - libcxx/src/new.cpp | 32 +- libcxx/src/optional.cpp | 1 + libcxx/src/random.cpp | 21 + .../support/runtime/exception_fallback.ipp | 4 - libcxx/src/thread.cpp | 18 +- libunwind/include/__libunwind_config.h | 10 + libunwind/include/libunwind.h | 160 +- libunwind/src/AddressSpace.hpp | 267 +- libunwind/src/DwarfInstructions.hpp | 9 +- libunwind/src/DwarfParser.hpp | 803 +-- libunwind/src/FrameHeaderCache.hpp | 2 +- libunwind/src/Registers.hpp | 458 +- libunwind/src/Unwind-seh.cpp | 20 +- libunwind/src/Unwind-sjlj.c | 12 + libunwind/src/UnwindCursor.hpp | 225 +- libunwind/src/UnwindLevel1.c | 4 +- libunwind/src/UnwindRegistersRestore.S | 25 +- libunwind/src/UnwindRegistersSave.S | 9 +- libunwind/src/Unwind_AppleExtras.cpp | 70 - libunwind/src/assembly.h | 24 +- libunwind/src/config.h | 54 +- libunwind/src/libunwind.cpp | 2 + lld/CODE_OWNERS.TXT | 6 +- lld/COFF/CallGraphSort.cpp | 245 + lld/COFF/CallGraphSort.h | 22 + lld/COFF/Chunks.cpp | 121 +- lld/COFF/Chunks.h | 10 + lld/COFF/Config.h | 21 + lld/COFF/DLL.cpp | 10 + lld/COFF/DebugTypes.cpp | 993 +++- lld/COFF/DebugTypes.h | 134 +- lld/COFF/Driver.cpp | 184 +- lld/COFF/Driver.h | 9 +- lld/COFF/DriverUtils.cpp | 24 +- lld/COFF/ICF.cpp | 2 +- lld/COFF/InputFiles.cpp | 58 +- lld/COFF/InputFiles.h | 20 +- lld/COFF/LTO.cpp | 7 + lld/COFF/MinGW.cpp | 97 + lld/COFF/MinGW.h | 21 + lld/COFF/Options.td | 46 +- lld/COFF/PDB.cpp | 863 +-- lld/COFF/PDB.h | 6 + lld/COFF/SymbolTable.cpp | 65 +- lld/COFF/Symbols.h | 23 +- lld/COFF/TypeMerger.h | 43 +- lld/COFF/Writer.cpp | 130 +- lld/COFF/Writer.h | 3 + lld/Common/Args.cpp | 19 +- lld/Common/ErrorHandler.cpp | 83 +- lld/Common/Reproduce.cpp | 7 +- lld/Common/Strings.cpp | 11 +- lld/Common/TargetOptionsCommandFlags.cpp | 2 +- lld/Common/Timer.cpp | 4 +- lld/Common/Version.cpp | 2 - lld/ELF/AArch64ErrataFix.cpp | 4 +- lld/ELF/AArch64ErrataFix.h | 2 +- lld/ELF/ARMErrataFix.cpp | 6 +- lld/ELF/ARMErrataFix.h | 2 +- lld/ELF/Arch/AArch64.cpp | 15 +- lld/ELF/Arch/AMDGPU.cpp | 2 +- lld/ELF/Arch/ARM.cpp | 2 +- lld/ELF/Arch/Hexagon.cpp | 4 +- lld/ELF/Arch/Mips.cpp | 6 +- lld/ELF/Arch/MipsArchTree.cpp | 4 +- lld/ELF/Arch/PPC.cpp | 10 +- lld/ELF/Arch/PPC64.cpp | 491 +- lld/ELF/Arch/PPCInsns.def | 27 + lld/ELF/Arch/RISCV.cpp | 6 +- lld/ELF/Arch/SPARCV9.cpp | 2 +- lld/ELF/Arch/X86.cpp | 10 +- lld/ELF/Arch/X86_64.cpp | 35 +- lld/ELF/CallGraphSort.cpp | 6 +- lld/ELF/Config.h | 12 +- lld/ELF/DWARF.cpp | 43 +- lld/ELF/DWARF.h | 4 + lld/ELF/Driver.cpp | 433 +- lld/ELF/Driver.h | 2 +- lld/ELF/DriverUtils.cpp | 9 +- lld/ELF/EhFrame.cpp | 46 +- lld/ELF/EhFrame.h | 1 + lld/ELF/ICF.cpp | 65 +- lld/ELF/InputFiles.cpp | 285 +- lld/ELF/InputFiles.h | 30 +- lld/ELF/InputSection.cpp | 79 +- lld/ELF/InputSection.h | 29 +- lld/ELF/LTO.cpp | 20 +- lld/ELF/LinkerScript.cpp | 199 +- lld/ELF/LinkerScript.h | 26 +- lld/ELF/MapFile.cpp | 3 + lld/ELF/MarkLive.cpp | 47 +- lld/ELF/Options.td | 87 +- lld/ELF/OutputSections.cpp | 68 +- lld/ELF/OutputSections.h | 8 +- lld/ELF/Relocations.cpp | 149 +- lld/ELF/Relocations.h | 8 +- lld/ELF/ScriptLexer.cpp | 2 +- lld/ELF/ScriptLexer.h | 2 +- lld/ELF/ScriptParser.cpp | 55 +- lld/ELF/SymbolTable.cpp | 2 + lld/ELF/Symbols.cpp | 67 +- lld/ELF/Symbols.h | 21 +- lld/ELF/SyntheticSections.cpp | 162 +- lld/ELF/SyntheticSections.h | 21 +- lld/ELF/Target.cpp | 8 +- lld/ELF/Target.h | 12 +- lld/ELF/Thunks.cpp | 194 +- lld/ELF/Writer.cpp | 353 +- lld/MachO/Arch/X86_64.cpp | 119 +- lld/MachO/Config.h | 38 +- lld/MachO/Driver.cpp | 785 ++- lld/MachO/Driver.h | 20 + lld/MachO/DriverUtils.cpp | 214 + lld/MachO/Dwarf.cpp | 42 + lld/MachO/Dwarf.h | 53 + lld/MachO/ExportTrie.cpp | 27 +- lld/MachO/ExportTrie.h | 2 + lld/MachO/InputFiles.cpp | 486 +- lld/MachO/InputFiles.h | 87 +- lld/MachO/InputSection.cpp | 54 +- lld/MachO/InputSection.h | 42 +- lld/MachO/LTO.cpp | 110 + lld/MachO/LTO.h | 43 + lld/MachO/ObjC.cpp | 36 + lld/MachO/ObjC.h | 31 + lld/MachO/Options.td | 136 +- lld/MachO/OutputSection.h | 2 + lld/MachO/OutputSegment.cpp | 10 +- lld/MachO/OutputSegment.h | 2 + lld/MachO/SymbolTable.cpp | 126 +- lld/MachO/SymbolTable.h | 22 +- lld/MachO/Symbols.cpp | 42 +- lld/MachO/Symbols.h | 196 +- lld/MachO/SyntheticSections.cpp | 666 ++- lld/MachO/SyntheticSections.h | 342 +- lld/MachO/Target.h | 20 +- lld/MachO/UnwindInfoSection.cpp | 340 ++ lld/MachO/UnwindInfoSection.h | 79 + lld/MachO/Writer.cpp | 360 +- lld/MachO/Writer.h | 4 + lld/README.md | 2 +- lld/docs/ELF/linker_script.rst | 19 + lld/docs/ELF/warn_backrefs.rst | 99 + lld/docs/ReleaseNotes.rst | 17 +- lld/docs/WebAssembly.rst | 30 +- lld/docs/conf.py | 6 +- lld/docs/error_handling_script.rst | 39 + lld/docs/index.rst | 2 + lld/docs/ld.lld.1 | 24 +- lld/include/lld/Common/Args.h | 2 + lld/include/lld/Common/Driver.h | 14 + lld/include/lld/Common/ErrorHandler.h | 22 + lld/include/lld/Common/LLVM.h | 6 + lld/include/lld/Common/Strings.h | 7 +- lld/lib/Driver/DarwinLdDriver.cpp | 1 + .../MachO/MachONormalizedFileFromAtoms.cpp | 2 +- .../MachO/MachONormalizedFileYAML.cpp | 4 +- lld/tools/lld/lld.cpp | 107 +- lldb/bindings/interface/SBAddress.i | 16 +- lldb/bindings/interface/SBAttachInfo.i | 4 +- lldb/bindings/interface/SBBlock.i | 2 +- lldb/bindings/interface/SBBreakpoint.i | 15 +- .../bindings/interface/SBBreakpointLocation.i | 2 +- lldb/bindings/interface/SBBreakpointName.i | 4 +- lldb/bindings/interface/SBBroadcaster.i | 6 +- .../bindings/interface/SBCommandInterpreter.i | 8 +- .../SBCommandInterpreterRunOptions.i | 14 +- .../interface/SBCommandReturnObject.i | 4 +- lldb/bindings/interface/SBCommunication.i | 3 + lldb/bindings/interface/SBCompileUnit.i | 32 +- lldb/bindings/interface/SBData.i | 3 + lldb/bindings/interface/SBDebugger.i | 174 +- lldb/bindings/interface/SBEnvironment.i | 3 +- lldb/bindings/interface/SBError.i | 4 +- lldb/bindings/interface/SBEvent.i | 32 +- lldb/bindings/interface/SBExecutionContext.i | 3 + lldb/bindings/interface/SBFile.i | 2 +- lldb/bindings/interface/SBFileSpec.i | 2 +- lldb/bindings/interface/SBFileSpecList.i | 3 + lldb/bindings/interface/SBFrame.i | 64 +- lldb/bindings/interface/SBFunction.i | 2 +- lldb/bindings/interface/SBHostOS.i | 3 + lldb/bindings/interface/SBInstruction.i | 3 + lldb/bindings/interface/SBInstructionList.i | 10 +- lldb/bindings/interface/SBLanguageRuntime.i | 3 + lldb/bindings/interface/SBLaunchInfo.i | 3 + lldb/bindings/interface/SBLineEntry.i | 34 +- lldb/bindings/interface/SBListener.i | 2 +- .../interface/SBMemoryRegionInfoList.i | 3 + lldb/bindings/interface/SBModule.i | 31 +- lldb/bindings/interface/SBModuleSpec.i | 3 + lldb/bindings/interface/SBPlatform.i | 15 +- lldb/bindings/interface/SBProcess.i | 104 +- lldb/bindings/interface/SBQueue.i | 3 + lldb/bindings/interface/SBQueueItem.i | 3 + lldb/bindings/interface/SBReproducer.i | 4 + lldb/bindings/interface/SBSection.i | 22 +- lldb/bindings/interface/SBSourceManager.i | 2 +- lldb/bindings/interface/SBStream.i | 2 +- lldb/bindings/interface/SBStringList.i | 3 + lldb/bindings/interface/SBStructuredData.i | 9 +- lldb/bindings/interface/SBSymbol.i | 4 +- lldb/bindings/interface/SBSymbolContext.i | 2 +- lldb/bindings/interface/SBSymbolContextList.i | 2 +- lldb/bindings/interface/SBTarget.i | 202 +- lldb/bindings/interface/SBThread.i | 6 +- lldb/bindings/interface/SBThreadPlan.i | 12 +- lldb/bindings/interface/SBTrace.i | 3 + lldb/bindings/interface/SBTraceOptions.i | 5 + lldb/bindings/interface/SBType.i | 170 +- lldb/bindings/interface/SBTypeEnumMember.i | 40 +- lldb/bindings/interface/SBValue.i | 70 +- lldb/bindings/interface/SBValueList.i | 91 +- lldb/bindings/interface/SBVariablesOptions.i | 3 + lldb/bindings/interface/SBWatchpoint.i | 2 +- lldb/bindings/lua/lua-swigsafecast.swig | 21 + lldb/bindings/lua/lua-typemaps.swig | 104 + lldb/bindings/lua/lua-wrapper.swig | 57 + lldb/bindings/{ => lua}/lua.swig | 12 +- lldb/bindings/macros.swig | 4 - lldb/bindings/python/python-extensions.swig | 23 +- lldb/bindings/python/python-swigsafecast.swig | 7 + lldb/bindings/python/python-typemaps.h | 17 + lldb/bindings/python/python-typemaps.swig | 23 +- lldb/bindings/python/python-wrapper.swig | 132 +- lldb/bindings/{ => python}/python.swig | 50 +- lldb/docs/_lldb/__init__.py | 9 + lldb/docs/design/overview.rst | 192 + lldb/docs/design/reproducers.rst | 212 + lldb/docs/design/sbapi.rst | 95 + lldb/docs/design/structureddataplugins.md | 442 ++ lldb/docs/man/lldb-server.rst | 209 + lldb/docs/man/lldb.rst | 16 +- lldb/docs/python_api.rst | 98 + lldb/docs/python_api_enums.rst | 1257 ++++ lldb/include/lldb/API/LLDB.h | 1 + lldb/include/lldb/API/SBAddress.h | 4 +- lldb/include/lldb/API/SBBreakpoint.h | 6 +- lldb/include/lldb/API/SBCommandInterpreter.h | 2 + .../lldb/API/SBCommandInterpreterRunOptions.h | 4 + lldb/include/lldb/API/SBModule.h | 4 + lldb/include/lldb/API/SBPlatform.h | 5 + lldb/include/lldb/API/SBReproducer.h | 26 + lldb/include/lldb/API/SBTarget.h | 6 + lldb/include/lldb/API/SBThreadPlan.h | 9 +- lldb/include/lldb/API/SBType.h | 7 + lldb/include/lldb/Breakpoint/Breakpoint.h | 20 +- .../lldb/Breakpoint/BreakpointLocation.h | 24 +- .../lldb/Breakpoint/BreakpointOptions.h | 2 +- lldb/include/lldb/Breakpoint/BreakpointSite.h | 13 +- .../lldb/Breakpoint/StoppointHitCounter.h | 43 + .../lldb/Breakpoint/StoppointLocation.h | 87 - lldb/include/lldb/Breakpoint/StoppointSite.h | 81 + lldb/include/lldb/Breakpoint/Watchpoint.h | 8 +- lldb/include/lldb/Core/Architecture.h | 7 - lldb/include/lldb/Core/Communication.h | 2 +- lldb/include/lldb/Core/Debugger.h | 6 +- lldb/include/lldb/Core/Disassembler.h | 19 +- lldb/include/lldb/Core/IOHandler.h | 16 +- lldb/include/lldb/Core/IOHandlerCursesGUI.h | 2 + lldb/include/lldb/Core/Module.h | 4 - lldb/include/lldb/Core/ModuleList.h | 41 +- lldb/include/lldb/Core/PluginInterface.h | 6 +- lldb/include/lldb/Core/PluginManager.h | 36 + lldb/include/lldb/Core/StructuredDataImpl.h | 14 +- lldb/include/lldb/Core/Value.h | 86 +- lldb/include/lldb/Core/ValueObject.h | 6 +- lldb/include/lldb/Core/ValueObjectCast.h | 2 +- lldb/include/lldb/Core/ValueObjectChild.h | 2 +- .../lldb/Core/ValueObjectConstResult.h | 4 +- .../lldb/Core/ValueObjectDynamicValue.h | 2 +- lldb/include/lldb/Core/ValueObjectMemory.h | 2 +- lldb/include/lldb/Core/ValueObjectRegister.h | 4 +- .../lldb/Core/ValueObjectSyntheticFilter.h | 2 +- lldb/include/lldb/Core/ValueObjectVariable.h | 2 +- .../lldb/DataFormatters/DataVisualization.h | 6 +- .../lldb/DataFormatters/FormatManager.h | 9 +- .../lldb/DataFormatters/FormattersContainer.h | 343 +- .../lldb/DataFormatters/StringPrinter.h | 2 +- .../lldb/DataFormatters/TypeCategory.h | 48 +- .../lldb/DataFormatters/TypeCategoryMap.h | 5 +- .../include/lldb/DataFormatters/TypeSummary.h | 2 +- .../lldb/DataFormatters/TypeSynthetic.h | 2 +- .../include/lldb/Expression/DWARFExpression.h | 8 +- .../lldb/Expression/ExpressionVariable.h | 2 +- .../include/lldb/Expression/UtilityFunction.h | 11 +- lldb/include/lldb/Host/Config.h.cmake | 6 +- lldb/include/lldb/Host/Editline.h | 16 +- lldb/include/lldb/Host/FileSystem.h | 22 +- lldb/include/lldb/Host/Host.h | 41 +- lldb/include/lldb/Host/HostInfoBase.h | 13 + lldb/include/lldb/Host/ProcessLaunchInfo.h | 5 +- lldb/include/lldb/Host/PseudoTerminal.h | 47 +- .../lldb/Host/common/NativeProcessProtocol.h | 16 +- .../lldb/Host/common/NativeRegisterContext.h | 9 + .../lldb/Interpreter/CommandCompletions.h | 59 +- .../lldb/Interpreter/CommandInterpreter.h | 41 +- lldb/include/lldb/Interpreter/CommandObject.h | 17 +- .../lldb/Interpreter/CommandObjectMultiword.h | 9 + lldb/include/lldb/Interpreter/OptionValue.h | 5 +- .../lldb/Interpreter/OptionValueArch.h | 3 +- .../lldb/Interpreter/OptionValueArray.h | 3 +- .../lldb/Interpreter/OptionValueBoolean.h | 3 +- .../lldb/Interpreter/OptionValueChar.h | 3 +- .../lldb/Interpreter/OptionValueDictionary.h | 3 +- .../lldb/Interpreter/OptionValueEnumeration.h | 3 +- .../Interpreter/OptionValueFileColonLine.h | 64 + .../lldb/Interpreter/OptionValueFileSpec.h | 3 +- .../Interpreter/OptionValueFileSpecList.h | 3 +- .../lldb/Interpreter/OptionValueFormat.h | 3 +- .../Interpreter/OptionValueFormatEntity.h | 2 +- .../lldb/Interpreter/OptionValueLanguage.h | 3 +- .../Interpreter/OptionValuePathMappings.h | 3 +- .../lldb/Interpreter/OptionValueProperties.h | 7 +- .../lldb/Interpreter/OptionValueRegex.h | 3 +- .../lldb/Interpreter/OptionValueSInt64.h | 3 +- .../lldb/Interpreter/OptionValueString.h | 3 +- .../lldb/Interpreter/OptionValueUInt64.h | 3 +- .../lldb/Interpreter/OptionValueUUID.h | 3 +- lldb/include/lldb/Interpreter/OptionValues.h | 1 + lldb/include/lldb/Interpreter/Options.h | 7 +- .../lldb/Interpreter/ScriptInterpreter.h | 20 +- lldb/include/lldb/Symbol/CompilerType.h | 13 +- lldb/include/lldb/Symbol/LineTable.h | 1 + lldb/include/lldb/Symbol/ObjectFile.h | 24 +- lldb/include/lldb/Symbol/SymbolContext.h | 14 +- lldb/include/lldb/Symbol/SymbolVendor.h | 8 +- lldb/include/lldb/Symbol/Type.h | 26 +- lldb/include/lldb/Symbol/TypeSystem.h | 35 +- lldb/include/lldb/Symbol/UnwindPlan.h | 1 + lldb/include/lldb/Symbol/Variable.h | 5 +- lldb/include/lldb/Target/ABI.h | 2 +- lldb/include/lldb/Target/DynamicLoader.h | 10 - .../lldb/Target/InstrumentationRuntime.h | 2 +- lldb/include/lldb/Target/Language.h | 4 + lldb/include/lldb/Target/LanguageRuntime.h | 18 +- lldb/include/lldb/Target/MemoryRegionInfo.h | 17 +- lldb/include/lldb/Target/OperatingSystem.h | 6 - lldb/include/lldb/Target/Platform.h | 30 +- lldb/include/lldb/Target/PostMortemProcess.h | 32 + lldb/include/lldb/Target/Process.h | 172 +- lldb/include/lldb/Target/ProcessTrace.h | 86 + .../include/lldb/Target/RemoteAwarePlatform.h | 7 +- lldb/include/lldb/Target/Runtime.h | 33 + .../lldb/Target/StackFrameRecognizer.h | 59 +- lldb/include/lldb/Target/SystemRuntime.h | 10 +- lldb/include/lldb/Target/Target.h | 161 +- lldb/include/lldb/Target/TargetList.h | 33 +- lldb/include/lldb/Target/Thread.h | 29 +- lldb/include/lldb/Target/ThreadPlan.h | 378 +- lldb/include/lldb/Target/ThreadPlanPython.h | 5 +- lldb/include/lldb/Target/ThreadPlanStack.h | 19 +- .../lldb/Target/ThreadPlanStepInRange.h | 18 - lldb/include/lldb/Target/ThreadTrace.h | 61 + lldb/include/lldb/Target/Trace.h | 203 + .../lldb/Target/TraceSessionFileParser.h | 179 + lldb/include/lldb/Target/UnwindAssembly.h | 7 - lldb/include/lldb/Utility/ArchSpec.h | 12 +- lldb/include/lldb/Utility/Args.h | 6 +- lldb/include/lldb/Utility/Broadcaster.h | 4 +- lldb/include/lldb/Utility/ConstString.h | 37 +- lldb/include/lldb/Utility/GDBRemote.h | 2 +- lldb/include/lldb/Utility/Iterable.h | 2 +- lldb/include/lldb/Utility/OptionDefinition.h | 58 + lldb/include/lldb/Utility/ProcessInfo.h | 34 - lldb/include/lldb/Utility/RangeMap.h | 54 +- lldb/include/lldb/Utility/RegisterValue.h | 11 +- lldb/include/lldb/Utility/Reproducer.h | 265 +- .../lldb/Utility/ReproducerInstrumentation.h | 71 +- .../include/lldb/Utility/ReproducerProvider.h | 434 ++ lldb/include/lldb/Utility/Scalar.h | 201 +- .../lldb/Utility/StringExtractorGDBRemote.h | 13 +- lldb/include/lldb/Utility/StringList.h | 2 +- lldb/include/lldb/Utility/StructuredData.h | 8 +- lldb/include/lldb/Utility/Timer.h | 8 + lldb/include/lldb/Utility/TraceOptions.h | 21 + lldb/include/lldb/Utility/UUID.h | 17 + .../include/lldb/Utility/UnimplementedError.h | 28 + lldb/include/lldb/Utility/XcodeSDK.h | 6 +- lldb/include/lldb/lldb-defines.h | 2 + lldb/include/lldb/lldb-enumerations.h | 17 +- lldb/include/lldb/lldb-forward.h | 9 +- lldb/include/lldb/lldb-private-interfaces.h | 14 +- lldb/include/lldb/lldb-private-types.h | 27 - lldb/source/API/SBAddress.cpp | 14 +- lldb/source/API/SBBreakpoint.cpp | 30 +- lldb/source/API/SBBreakpointLocation.cpp | 8 +- lldb/source/API/SBCommandInterpreter.cpp | 21 + .../API/SBCommandInterpreterRunOptions.cpp | 37 +- lldb/source/API/SBDebugger.cpp | 46 +- lldb/source/API/SBError.cpp | 2 +- lldb/source/API/SBFrame.cpp | 2 +- lldb/source/API/SBFunction.cpp | 4 +- lldb/source/API/SBHostOS.cpp | 9 +- lldb/source/API/SBInstruction.cpp | 2 +- lldb/source/API/SBLaunchInfo.cpp | 7 +- lldb/source/API/SBLineEntry.cpp | 4 +- lldb/source/API/SBModule.cpp | 58 +- lldb/source/API/SBPlatform.cpp | 110 +- lldb/source/API/SBQueueItem.cpp | 2 +- lldb/source/API/SBReproducer.cpp | 97 +- lldb/source/API/SBReproducerPrivate.h | 1 + lldb/source/API/SBSymbol.cpp | 4 +- lldb/source/API/SBTarget.cpp | 70 +- lldb/source/API/SBThreadPlan.cpp | 143 +- lldb/source/API/SBType.cpp | 39 +- lldb/source/API/SBValue.cpp | 4 +- lldb/source/API/SystemInitializerFull.cpp | 23 +- lldb/source/Breakpoint/Breakpoint.cpp | 21 +- lldb/source/Breakpoint/BreakpointID.cpp | 2 +- lldb/source/Breakpoint/BreakpointIDList.cpp | 8 +- lldb/source/Breakpoint/BreakpointLocation.cpp | 36 +- lldb/source/Breakpoint/BreakpointOptions.cpp | 2 +- lldb/source/Breakpoint/BreakpointResolver.cpp | 3 +- .../Breakpoint/BreakpointResolverAddress.cpp | 1 - .../Breakpoint/BreakpointResolverFileLine.cpp | 8 + .../Breakpoint/BreakpointResolverName.cpp | 9 +- lldb/source/Breakpoint/BreakpointSite.cpp | 77 +- lldb/source/Breakpoint/StoppointLocation.cpp | 32 - lldb/source/Breakpoint/StoppointSite.cpp | 23 + lldb/source/Breakpoint/Watchpoint.cpp | 19 +- lldb/source/Commands/CommandCompletions.cpp | 202 +- .../Commands/CommandObjectBreakpoint.cpp | 138 +- .../CommandObjectBreakpointCommand.cpp | 42 +- .../source/Commands/CommandObjectCommands.cpp | 206 +- .../Commands/CommandObjectExpression.cpp | 22 +- lldb/source/Commands/CommandObjectFrame.cpp | 45 +- lldb/source/Commands/CommandObjectMemory.cpp | 151 +- .../Commands/CommandObjectMultiword.cpp | 41 +- .../source/Commands/CommandObjectPlatform.cpp | 128 +- lldb/source/Commands/CommandObjectProcess.cpp | 99 +- lldb/source/Commands/CommandObjectQuit.cpp | 4 + .../CommandObjectRegexCommand.cpp | 14 +- .../Commands}/CommandObjectRegexCommand.h | 10 +- .../Commands/CommandObjectReproducer.cpp | 216 +- lldb/source/Commands/CommandObjectScript.cpp | 138 + .../CommandObjectScript.h | 21 +- lldb/source/Commands/CommandObjectSession.cpp | 208 + lldb/source/Commands/CommandObjectSession.h | 23 + lldb/source/Commands/CommandObjectSource.cpp | 17 + lldb/source/Commands/CommandObjectTarget.cpp | 648 +- lldb/source/Commands/CommandObjectThread.cpp | 539 +- .../Commands/CommandObjectThreadUtil.cpp | 158 + .../source/Commands/CommandObjectThreadUtil.h | 81 + lldb/source/Commands/CommandObjectTrace.cpp | 305 + lldb/source/Commands/CommandObjectTrace.h | 25 + lldb/source/Commands/CommandObjectType.cpp | 109 +- .../Commands/CommandObjectWatchpoint.cpp | 52 +- .../Commands/CommandOptionsProcessLaunch.cpp | 147 + .../Commands/CommandOptionsProcessLaunch.h | 49 + lldb/source/Commands/Options.td | 122 +- lldb/source/Core/Communication.cpp | 18 +- lldb/source/Core/CoreProperties.td | 4 + lldb/source/Core/Debugger.cpp | 38 +- lldb/source/Core/Disassembler.cpp | 92 +- lldb/source/Core/DynamicLoader.cpp | 2 - lldb/source/Core/IOHandler.cpp | 27 +- lldb/source/Core/IOHandlerCursesGUI.cpp | 630 +- lldb/source/Core/Mangled.cpp | 12 - lldb/source/Core/Module.cpp | 43 +- lldb/source/Core/ModuleList.cpp | 78 +- lldb/source/Core/PluginManager.cpp | 65 +- lldb/source/Core/SearchFilter.cpp | 41 +- lldb/source/Core/SourceManager.cpp | 9 +- lldb/source/Core/Value.cpp | 53 +- lldb/source/Core/ValueObject.cpp | 32 +- lldb/source/Core/ValueObjectCast.cpp | 2 +- lldb/source/Core/ValueObjectChild.cpp | 154 +- lldb/source/Core/ValueObjectConstResult.cpp | 21 +- lldb/source/Core/ValueObjectDynamicValue.cpp | 2 +- lldb/source/Core/ValueObjectMemory.cpp | 10 +- lldb/source/Core/ValueObjectRegister.cpp | 6 +- .../Core/ValueObjectSyntheticFilter.cpp | 6 +- lldb/source/Core/ValueObjectVariable.cpp | 14 +- .../DataFormatters/DataVisualization.cpp | 7 +- lldb/source/DataFormatters/FormatManager.cpp | 8 +- lldb/source/DataFormatters/TypeCategory.cpp | 8 +- .../DataFormatters/ValueObjectPrinter.cpp | 47 +- lldb/source/DataFormatters/VectorType.cpp | 16 +- lldb/source/Expression/DWARFExpression.cpp | 118 +- lldb/source/Expression/ExpressionVariable.cpp | 8 +- lldb/source/Expression/IRExecutionUnit.cpp | 3 +- lldb/source/Expression/IRInterpreter.cpp | 10 +- lldb/source/Expression/Materializer.cpp | 34 +- lldb/source/Expression/REPL.cpp | 44 +- lldb/source/Expression/UserExpression.cpp | 1 + lldb/source/Expression/UtilityFunction.cpp | 4 +- lldb/source/Host/common/Editline.cpp | 98 +- lldb/source/Host/common/FileSystem.cpp | 24 +- lldb/source/Host/common/Host.cpp | 49 +- .../Host/common/NativeProcessProtocol.cpp | 3 +- .../Host/common/NativeRegisterContext.cpp | 33 + lldb/source/Host/common/OptionParser.cpp | 1 + lldb/source/Host/common/ProcessLaunchInfo.cpp | 21 +- lldb/source/Host/common/PseudoTerminal.cpp | 222 +- lldb/source/Host/common/TCPSocket.cpp | 2 +- lldb/source/Host/freebsd/Host.cpp | 6 +- lldb/source/Host/netbsd/HostNetBSD.cpp | 7 +- lldb/source/Host/posix/PipePosix.cpp | 10 +- .../SystemInitializerCommon.cpp | 90 +- .../source/Interpreter/CommandInterpreter.cpp | 398 +- lldb/source/Interpreter/CommandObject.cpp | 31 +- .../Interpreter/CommandObjectScript.cpp | 68 - .../Interpreter/InterpreterProperties.td | 4 + lldb/source/Interpreter/OptionGroupUUID.cpp | 2 +- lldb/source/Interpreter/OptionValue.cpp | 4 +- lldb/source/Interpreter/OptionValueArray.cpp | 1 + .../Interpreter/OptionValueDictionary.cpp | 1 + .../Interpreter/OptionValueFileColonLine.cpp | 145 + .../Interpreter/OptionValueFileSpec.cpp | 7 - .../Interpreter/OptionValueFormatEntity.cpp | 5 +- .../Interpreter/OptionValueProperties.cpp | 35 +- lldb/source/Interpreter/Options.cpp | 20 +- lldb/source/Interpreter/Property.cpp | 6 + lldb/source/Interpreter/ScriptInterpreter.cpp | 8 +- .../source/Plugins/ABI/AArch64/ABIAArch64.cpp | 6 + lldb/source/Plugins/ABI/AArch64/ABIAArch64.h | 5 +- .../Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp | 8 +- .../Plugins/ABI/AArch64/ABISysV_arm64.cpp | 8 +- lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp | 7 +- lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp | 17 +- lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp | 21 +- .../Plugins/ABI/Hexagon/ABISysV_hexagon.cpp | 17 +- .../Plugins/ABI/Mips/ABISysV_mips64.cpp | 6 +- .../Plugins/ABI/PowerPC/ABISysV_ppc.cpp | 6 +- .../Plugins/ABI/PowerPC/ABISysV_ppc64.cpp | 7 +- .../Plugins/ABI/SystemZ/ABISysV_s390x.cpp | 21 +- lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp | 4 +- .../source/Plugins/ABI/X86/ABISysV_x86_64.cpp | 6 +- .../Plugins/ABI/X86/ABIWindows_x86_64.cpp | 6 +- .../Disassembler/LLVMC/DisassemblerLLVMC.cpp | 19 +- .../Hexagon-DYLD/DynamicLoaderHexagonDYLD.h | 4 - .../Hexagon-DYLD/HexagonDYLDRendezvous.cpp | 2 +- .../POSIX-DYLD/DYLDRendezvous.cpp | 7 +- .../DynamicLoader/POSIX-DYLD/DYLDRendezvous.h | 3 + .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 35 +- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.h | 6 + .../Static/DynamicLoaderStatic.cpp | 9 +- .../Static/DynamicLoaderStatic.h | 5 - .../Clang/ASTResultSynthesizer.cpp | 4 +- .../Plugins/ExpressionParser/Clang/ASTUtils.h | 22 +- .../Clang/ClangASTImporter.cpp | 99 +- .../ExpressionParser/Clang/ClangASTImporter.h | 60 +- .../ExpressionParser/Clang/ClangASTSource.cpp | 48 +- .../Clang/ClangExpressionDeclMap.cpp | 30 +- .../Clang/ClangExpressionDeclMap.h | 9 + .../Clang/ClangExpressionParser.cpp | 82 +- .../Clang/ClangExpressionSourceCode.cpp | 19 +- .../ExpressionParser/Clang/ClangHost.cpp | 6 +- .../Clang/ClangModulesDeclVendor.cpp | 15 +- .../Clang/ClangModulesDeclVendor.h | 14 +- .../Clang/ClangUserExpression.cpp | 189 +- .../Clang/ClangUserExpression.h | 20 +- .../Clang/ClangUtilityFunction.cpp | 11 +- .../Clang/ClangUtilityFunction.h | 70 +- .../Clang/CppModuleConfiguration.cpp | 44 +- .../Clang/CppModuleConfiguration.h | 5 +- .../Clang/CxxModuleHandler.cpp | 20 +- .../Clang/IRDynamicChecks.cpp | 30 +- .../ExpressionParser/Clang/IRForTarget.cpp | 13 +- .../Clang/ModuleDependencyCollector.h | 4 +- .../Clang/NameSearchContext.cpp | 3 +- ...nstrumentationRuntimeMainThreadChecker.cpp | 2 +- .../TSan/InstrumentationRuntimeTSan.cpp | 4 +- .../Plugins/JITLoader/GDB/JITLoaderGDB.cpp | 4 +- .../Language/CPlusPlus/BlockPointer.cpp | 6 +- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 24 +- .../Language/CPlusPlus/CPlusPlusLanguage.h | 4 + .../Plugins/Language/CPlusPlus/LibCxx.cpp | 2 +- .../Language/ClangCommon/ClangHighlighter.cpp | 4 +- lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 15 +- .../Plugins/Language/ObjC/CoreMedia.cpp | 19 +- lldb/source/Plugins/Language/ObjC/NSArray.cpp | 44 +- .../Plugins/Language/ObjC/NSDictionary.cpp | 5 +- lldb/source/Plugins/Language/ObjC/NSError.cpp | 4 +- .../Plugins/Language/ObjC/NSException.cpp | 3 +- .../Plugins/Language/ObjC/NSIndexPath.cpp | 2 +- .../source/Plugins/Language/ObjC/NSString.cpp | 2 +- .../Plugins/Language/ObjC/ObjCLanguage.h | 2 + .../ObjCPlusPlus/ObjCPlusPlusLanguage.h | 2 + .../CPlusPlus/CPPLanguageRuntime.cpp | 10 +- .../CPlusPlus/CPPLanguageRuntime.h | 5 - .../ItaniumABI/ItaniumABILanguageRuntime.cpp | 2 +- .../AppleObjCRuntime/AppleObjCRuntime.cpp | 14 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.cpp | 96 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.h | 3 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 171 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.h | 3 +- .../AppleObjCTrampolineHandler.cpp | 50 +- .../ObjC/ObjCLanguageRuntime.h | 3 +- .../MemoryHistory/asan/MemoryHistoryASan.cpp | 9 +- .../BSD-Archive/ObjectContainerBSDArchive.cpp | 4 +- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 18 +- .../Plugins/ObjectFile/PDB/ObjectFilePDB.cpp | 197 + .../Plugins/ObjectFile/PDB/ObjectFilePDB.h | 107 + .../ObjectFile/wasm/ObjectFileWasm.cpp | 61 +- .../Python/OperatingSystemPython.cpp | 4 +- .../Platform/FreeBSD/PlatformFreeBSD.cpp | 76 +- .../Platform/FreeBSD/PlatformFreeBSD.h | 11 - .../Platform/NetBSD/PlatformNetBSD.cpp | 121 +- .../Plugins/Platform/NetBSD/PlatformNetBSD.h | 12 +- .../Platform/OpenBSD/PlatformOpenBSD.cpp | 2 - .../Platform/OpenBSD/PlatformOpenBSD.h | 6 - .../Plugins/Platform/POSIX/PlatformPOSIX.cpp | 143 +- .../gdb-server/PlatformRemoteGDBServer.cpp | 29 +- .../gdb-server/PlatformRemoteGDBServer.h | 11 +- .../Plugins/Process/FreeBSD/FreeBSDThread.cpp | 5 +- .../Plugins/Process/FreeBSD/POSIXStopInfo.h | 16 +- .../Process/FreeBSD/ProcessFreeBSD.cpp | 15 +- .../Plugins/Process/FreeBSD/ProcessFreeBSD.h | 7 +- .../Process/FreeBSD/ProcessMonitor.cpp | 53 +- ...RegisterContextPOSIXProcessMonitor_arm.cpp | 7 +- .../RegisterContextPOSIXProcessMonitor_arm.h | 46 +- ...gisterContextPOSIXProcessMonitor_arm64.cpp | 9 +- ...RegisterContextPOSIXProcessMonitor_arm64.h | 43 +- ...egisterContextPOSIXProcessMonitor_mips64.h | 42 +- ...gisterContextPOSIXProcessMonitor_powerpc.h | 42 +- .../RegisterContextPOSIXProcessMonitor_x86.h | 38 +- .../FreeBSDRemote/NativeProcessFreeBSD.cpp | 880 +++ .../FreeBSDRemote/NativeProcessFreeBSD.h | 119 + .../NativeRegisterContextFreeBSD.cpp | 29 + .../NativeRegisterContextFreeBSD.h | 43 + .../NativeRegisterContextFreeBSD_x86_64.cpp | 656 ++ .../NativeRegisterContextFreeBSD_x86_64.h | 96 + .../FreeBSDRemote/NativeThreadFreeBSD.cpp | 286 + .../FreeBSDRemote/NativeThreadFreeBSD.h | 83 + .../Process/NetBSD/NativeProcessNetBSD.cpp | 186 +- .../Process/NetBSD/NativeProcessNetBSD.h | 12 +- .../NetBSD/NativeRegisterContextNetBSD.cpp | 6 - .../NetBSD/NativeRegisterContextNetBSD.h | 10 +- .../NativeRegisterContextNetBSD_x86_64.cpp | 1235 +--- .../NativeRegisterContextNetBSD_x86_64.h | 76 +- .../Process/NetBSD/NativeThreadNetBSD.cpp | 22 +- .../Process/NetBSD/NativeThreadNetBSD.h | 2 +- .../Plugins/Process/POSIX/CrashReason.cpp | 25 + .../Plugins/Process/POSIX/CrashReason.h | 2 + .../Plugins/Process/Utility/AuxVector.cpp | 1 + .../Plugins/Process/Utility/AuxVector.h | 1 + .../Process/Utility/DynamicRegisterInfo.cpp | 89 +- .../Process/Utility/DynamicRegisterInfo.h | 18 +- .../Utility/LinuxPTraceDefines_arm64sve.h | 291 + .../Plugins/Process/Utility/LinuxProcMaps.cpp | 172 +- .../Plugins/Process/Utility/LinuxProcMaps.h | 8 +- .../Plugins/Process/Utility/LinuxSignals.cpp | 143 +- .../Process/Utility/MipsLinuxSignals.cpp | 143 +- .../NativeRegisterContextWatchpoint_x86.cpp | 278 + .../NativeRegisterContextWatchpoint_x86.h | 48 + .../Utility/RegisterContextFreeBSD_i386.cpp | 7 +- .../Utility/RegisterContextFreeBSD_x86_64.cpp | 4 +- .../Process/Utility/RegisterContextMach_arm.h | 16 +- .../Utility/RegisterContextMach_i386.h | 12 +- .../Utility/RegisterContextMach_x86_64.h | 12 +- .../Utility/RegisterContextPOSIX_arm.cpp | 131 +- .../Utility/RegisterContextPOSIX_arm.h | 53 +- .../Utility/RegisterContextPOSIX_arm64.cpp | 16 +- .../Utility/RegisterContextPOSIX_arm64.h | 27 +- .../Utility/RegisterContextPOSIX_mips64.h | 4 - .../Utility/RegisterContextPOSIX_powerpc.h | 2 - .../Utility/RegisterContextPOSIX_s390x.h | 2 - .../Utility/RegisterContextPOSIX_x86.cpp | 107 +- .../Utility/RegisterContextPOSIX_x86.h | 44 +- .../Process/Utility/RegisterContext_x86.cpp | 58 + .../Process/Utility/RegisterContext_x86.h | 20 +- .../Process/Utility/RegisterInfoPOSIX_arm.cpp | 104 +- .../Process/Utility/RegisterInfoPOSIX_arm.h | 15 +- .../Utility/RegisterInfoPOSIX_arm64.cpp | 179 +- .../Process/Utility/RegisterInfoPOSIX_arm64.h | 47 +- .../Process/Utility/RegisterInfos_arm64_sve.h | 572 ++ .../Process/Utility/RegisterInfos_i386.h | 25 +- .../Process/Utility/RegisterInfos_x86_64.h | 47 +- .../Process/Utility/lldb-x86-register-enums.h | 4 +- .../Process/elf-core/ProcessElfCore.cpp | 11 +- .../Plugins/Process/elf-core/ProcessElfCore.h | 13 +- .../elf-core/RegisterContextPOSIXCore_arm.cpp | 4 +- .../elf-core/RegisterContextPOSIXCore_arm.h | 2 +- .../RegisterContextPOSIXCore_arm64.cpp | 144 +- .../elf-core/RegisterContextPOSIXCore_arm64.h | 14 + .../Process/elf-core/RegisterUtilities.h | 4 + .../Process/elf-core/ThreadElfCore.cpp | 14 +- .../gdb-remote/GDBRemoteCommunication.cpp | 10 +- .../GDBRemoteCommunicationClient.cpp | 86 +- .../gdb-remote/GDBRemoteCommunicationClient.h | 8 +- .../GDBRemoteCommunicationServer.cpp | 15 +- .../gdb-remote/GDBRemoteCommunicationServer.h | 13 - .../GDBRemoteCommunicationServerCommon.cpp | 2 +- .../GDBRemoteCommunicationServerLLGS.cpp | 386 +- .../GDBRemoteCommunicationServerLLGS.h | 21 + .../GDBRemoteCommunicationServerPlatform.cpp | 184 +- .../GDBRemoteCommunicationServerPlatform.h | 71 +- .../gdb-remote/GDBRemoteRegisterContext.cpp | 109 +- .../gdb-remote/GDBRemoteRegisterContext.h | 13 +- .../Process/gdb-remote/ProcessGDBRemote.cpp | 108 +- .../Process/gdb-remote/ProcessGDBRemote.h | 15 +- .../Process/gdb-remote/ThreadGDBRemote.cpp | 12 +- .../Process/gdb-remote/ThreadGDBRemote.h | 4 + .../Process/minidump/MinidumpParser.cpp | 188 +- .../Plugins/Process/minidump/MinidumpParser.h | 3 + .../Plugins/Process/minidump/MinidumpTypes.h | 15 - .../Process/minidump/ProcessMinidump.cpp | 193 +- .../Process/minidump/ProcessMinidump.h | 15 +- .../Plugins/ScriptInterpreter/Lua/Lua.cpp | 105 +- .../Plugins/ScriptInterpreter/Lua/Lua.h | 21 +- .../Lua/ScriptInterpreterLua.cpp | 161 +- .../Lua/ScriptInterpreterLua.h | 43 +- .../Python/PythonDataObjects.cpp | 4 + .../Python/ScriptInterpreterPython.cpp | 347 +- .../Python/ScriptInterpreterPythonImpl.h | 16 +- .../DarwinLog/StructuredDataDarwinLog.cpp | 2 +- .../Breakpad/SymbolFileBreakpad.cpp | 15 +- .../SymbolFile/DWARF/AppleDWARFIndex.cpp | 4 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 401 +- .../SymbolFile/DWARF/DWARFASTParserClang.h | 6 - .../SymbolFile/DWARF/DWARFAttribute.cpp | 2 +- .../Plugins/SymbolFile/DWARF/DWARFAttribute.h | 12 +- .../SymbolFile/DWARF/DWARFCompileUnit.cpp | 15 + .../SymbolFile/DWARF/DWARFCompileUnit.h | 4 + .../SymbolFile/DWARF/DWARFDebugAranges.cpp | 5 +- .../SymbolFile/DWARF/DWARFDebugInfo.cpp | 1 - .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp | 14 +- .../SymbolFile/DWARF/DWARFDebugInfoEntry.h | 8 +- .../Plugins/SymbolFile/DWARF/DWARFFormValue.h | 1 + .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 70 +- .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 14 +- .../SymbolFile/DWARF/ManualDWARFIndex.cpp | 5 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 757 ++- .../SymbolFile/DWARF/SymbolFileDWARF.h | 2 +- .../DWARF/SymbolFileDWARFDebugMap.cpp | 12 +- .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp | 3 +- .../SymbolFile/NativePDB/PdbAstBuilder.cpp | 7 +- .../Plugins/SymbolFile/NativePDB/PdbIndex.cpp | 4 +- .../Plugins/SymbolFile/NativePDB/PdbIndex.h | 5 +- .../NativePDB/SymbolFileNativePDB.cpp | 109 +- .../NativePDB/SymbolFileNativePDB.h | 1 + .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 6 +- .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 6 +- .../SymbolFile/Symtab/SymbolFileSymtab.cpp | 2 - .../SymbolFile/Symtab/SymbolFileSymtab.h | 6 - .../SymbolVendor/ELF/SymbolVendorELF.cpp | 6 +- .../SymbolVendor/ELF/SymbolVendorELF.h | 6 - .../SymbolVendor/wasm/SymbolVendorWasm.cpp | 3 +- .../SymbolVendor/wasm/SymbolVendorWasm.h | 4 - .../CommandObjectTraceStartIntelPT.cpp | 73 + .../intel-pt/CommandObjectTraceStartIntelPT.h | 65 + .../Plugins/Trace/intel-pt/DecodedThread.cpp | 64 + .../Plugins/Trace/intel-pt/DecodedThread.h | 146 + .../Plugins/Trace/intel-pt/IntelPTDecoder.cpp | 215 + .../Plugins/Trace/intel-pt/IntelPTDecoder.h | 52 + .../Plugins/Trace/intel-pt/TraceIntelPT.cpp | 114 + .../Plugins/Trace/intel-pt/TraceIntelPT.h | 96 + .../Trace/intel-pt/TraceIntelPTOptions.td | 16 + .../TraceIntelPTSessionFileParser.cpp | 97 + .../intel-pt/TraceIntelPTSessionFileParser.h | 84 + .../TypeSystem/Clang/TypeSystemClang.cpp | 323 +- .../TypeSystem/Clang/TypeSystemClang.h | 172 +- lldb/source/Symbol/CompileUnit.cpp | 3 +- lldb/source/Symbol/CompilerType.cpp | 27 +- lldb/source/Symbol/DWARFCallFrameInfo.cpp | 3 +- lldb/source/Symbol/FuncUnwinders.cpp | 4 +- lldb/source/Symbol/LineTable.cpp | 2 +- lldb/source/Symbol/LocateSymbolFile.cpp | 12 +- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp | 58 +- lldb/source/Symbol/ObjectFile.cpp | 252 +- lldb/source/Symbol/SymbolContext.cpp | 25 +- lldb/source/Symbol/SymbolVendor.cpp | 3 - lldb/source/Symbol/Symtab.cpp | 26 +- lldb/source/Symbol/Type.cpp | 52 +- lldb/source/Symbol/TypeSystem.cpp | 110 +- lldb/source/Symbol/UnwindPlan.cpp | 14 +- lldb/source/Symbol/Variable.cpp | 5 +- lldb/source/Target/ABI.cpp | 16 +- lldb/source/Target/AssertFrameRecognizer.cpp | 24 +- lldb/source/Target/LanguageRuntime.cpp | 13 +- lldb/source/Target/MemoryRegionInfo.cpp | 4 +- lldb/source/Target/OperatingSystem.cpp | 2 - lldb/source/Target/Platform.cpp | 75 +- lldb/source/Target/Process.cpp | 281 +- lldb/source/Target/ProcessTrace.cpp | 134 + lldb/source/Target/RemoteAwarePlatform.cpp | 19 +- lldb/source/Target/StackFrame.cpp | 34 +- lldb/source/Target/StackFrameRecognizer.cpp | 225 +- lldb/source/Target/SystemRuntime.cpp | 6 +- lldb/source/Target/Target.cpp | 774 ++- lldb/source/Target/TargetList.cpp | 536 +- lldb/source/Target/TargetProperties.td | 20 +- lldb/source/Target/Thread.cpp | 32 +- lldb/source/Target/ThreadPlan.cpp | 4 +- lldb/source/Target/ThreadPlanCallFunction.cpp | 6 +- lldb/source/Target/ThreadPlanPython.cpp | 12 +- lldb/source/Target/ThreadPlanStack.cpp | 18 +- lldb/source/Target/ThreadPlanStepInRange.cpp | 16 - .../Target/ThreadPlanStepOverBreakpoint.cpp | 4 +- lldb/source/Target/ThreadPlanStepRange.cpp | 8 +- lldb/source/Target/ThreadTrace.cpp | 39 + lldb/source/Target/Trace.cpp | 268 + lldb/source/Target/TraceSessionFileParser.cpp | 223 + lldb/source/Target/UnixSignals.cpp | 86 +- lldb/source/Target/UnwindAssembly.cpp | 2 - lldb/source/Utility/ArchSpec.cpp | 345 +- lldb/source/Utility/Args.cpp | 38 +- lldb/source/Utility/ConstString.cpp | 2 +- lldb/source/Utility/ProcessInfo.cpp | 56 +- lldb/source/Utility/RegisterValue.cpp | 32 +- lldb/source/Utility/Reproducer.cpp | 203 +- .../Utility/ReproducerInstrumentation.cpp | 31 +- lldb/source/Utility/ReproducerProvider.cpp | 221 + lldb/source/Utility/Scalar.cpp | 1008 +--- .../Utility/StringExtractorGDBRemote.cpp | 4 + lldb/source/Utility/StringLexer.cpp | 3 +- lldb/source/Utility/StringList.cpp | 2 +- lldb/source/Utility/StructuredData.cpp | 30 +- .../Utility/TildeExpressionResolver.cpp | 7 +- lldb/source/Utility/Timer.cpp | 8 + lldb/source/Utility/TraceOptions.cpp | 25 + lldb/source/Utility/UUID.cpp | 10 + lldb/source/Utility/UnimplementedError.cpp | 11 + lldb/source/Utility/XcodeSDK.cpp | 6 +- lldb/source/lldb.cpp | 7 - lldb/tools/driver/Driver.cpp | 106 +- lldb/tools/driver/Options.td | 4 + lldb/tools/lldb-server/LLGSOptions.td | 62 + lldb/tools/lldb-server/lldb-gdbserver.cpp | 309 +- lldb/tools/lldb-server/lldb-platform.cpp | 13 +- llvm/include/llvm-c/Core.h | 68 +- llvm/include/llvm-c/DataTypes.h | 4 - llvm/include/llvm-c/DebugInfo.h | 4 +- llvm/include/llvm-c/Error.h | 5 + llvm/include/llvm-c/LLJIT.h | 213 + llvm/include/llvm-c/LinkTimeOptimizer.h | 66 - llvm/include/llvm-c/Orc.h | 451 +- llvm/include/llvm-c/OrcBindings.h | 169 - llvm/include/llvm-c/OrcEE.h | 55 + llvm/include/llvm-c/Transforms/IPO.h | 3 - llvm/include/llvm-c/Transforms/Scalar.h | 6 +- .../include/llvm/ADT/APFixedPoint.h | 96 +- llvm/include/llvm/ADT/APFloat.h | 5 +- llvm/include/llvm/ADT/APInt.h | 44 +- llvm/include/llvm/ADT/APSInt.h | 20 +- llvm/include/llvm/ADT/AllocatorList.h | 7 - llvm/include/llvm/ADT/BitVector.h | 40 +- llvm/include/llvm/ADT/CoalescingBitVector.h | 7 +- llvm/include/llvm/ADT/DenseMap.h | 35 +- llvm/include/llvm/ADT/DenseMapInfo.h | 45 + llvm/include/llvm/ADT/DenseSet.h | 21 +- llvm/include/llvm/ADT/DepthFirstIterator.h | 2 +- llvm/include/llvm/ADT/DirectedGraph.h | 16 +- llvm/include/llvm/ADT/FloatingPointMode.h | 18 + llvm/include/llvm/ADT/FunctionExtras.h | 12 +- llvm/include/llvm/ADT/Hashing.h | 25 + llvm/include/llvm/ADT/ImmutableMap.h | 2 +- llvm/include/llvm/ADT/IntervalMap.h | 10 +- llvm/include/llvm/ADT/IntrusiveRefCntPtr.h | 45 +- llvm/include/llvm/ADT/Optional.h | 165 +- llvm/include/llvm/ADT/PointerUnion.h | 7 - llvm/include/llvm/ADT/STLExtras.h | 104 +- llvm/include/llvm/ADT/Sequence.h | 4 + llvm/include/llvm/ADT/SetVector.h | 5 + llvm/include/llvm/ADT/SmallPtrSet.h | 3 + llvm/include/llvm/ADT/SmallSet.h | 7 + llvm/include/llvm/ADT/SmallString.h | 61 +- llvm/include/llvm/ADT/SmallVector.h | 551 +- llvm/include/llvm/ADT/SparseSet.h | 9 +- llvm/include/llvm/ADT/Statistic.h | 2 + llvm/include/llvm/ADT/StringExtras.h | 111 +- llvm/include/llvm/ADT/StringMap.h | 12 +- llvm/include/llvm/ADT/StringSet.h | 3 + llvm/include/llvm/ADT/Triple.h | 67 +- llvm/include/llvm/ADT/iterator.h | 22 +- llvm/include/llvm/ADT/iterator_range.h | 1 - llvm/include/llvm/ADT/simple_ilist.h | 6 +- llvm/include/llvm/Analysis/AliasAnalysis.h | 104 +- llvm/include/llvm/Analysis/AliasSetTracker.h | 30 +- .../llvm/Analysis/BasicAliasAnalysis.h | 63 +- .../llvm/Analysis/BlockFrequencyInfoImpl.h | 12 +- .../llvm/Analysis/BranchProbabilityInfo.h | 287 +- llvm/include/llvm/Analysis/CFGPrinter.h | 22 +- llvm/include/llvm/Analysis/CGSCCPassManager.h | 540 +- llvm/include/llvm/Analysis/CallGraph.h | 7 - llvm/include/llvm/Analysis/CaptureTracking.h | 8 + llvm/include/llvm/Analysis/CodeMetrics.h | 3 +- llvm/include/llvm/Analysis/ConstantFolding.h | 6 +- llvm/include/llvm/Analysis/ConstraintSystem.h | 88 + llvm/include/llvm/Analysis/DDG.h | 28 +- llvm/include/llvm/Analysis/DDGPrinter.h | 91 + llvm/include/llvm/Analysis/Delinearization.h | 33 + llvm/include/llvm/Analysis/DemandedBits.h | 14 + .../llvm/Analysis/DivergenceAnalysis.h | 79 +- .../include/llvm/Analysis/DominanceFrontier.h | 1 - llvm/include/llvm/Analysis/EHPersonalities.h | 11 +- .../Analysis/FunctionPropertiesAnalysis.h | 86 + .../llvm/Analysis/IRSimilarityIdentifier.h | 789 +++ llvm/include/llvm/Analysis/IVDescriptors.h | 156 +- llvm/include/llvm/Analysis/InlineAdvisor.h | 82 +- .../llvm/Analysis/InlineFeaturesAnalysis.h | 45 - .../Analysis/InlineSizeEstimatorAnalysis.h | 12 +- llvm/include/llvm/Analysis/InstCount.h | 28 + .../llvm/Analysis/InstructionSimplify.h | 46 +- llvm/include/llvm/Analysis/Interval.h | 3 - llvm/include/llvm/Analysis/IntervalIterator.h | 6 +- .../llvm/Analysis/IteratedDominanceFrontier.h | 8 +- .../llvm/Analysis/LazyBranchProbabilityInfo.h | 2 +- llvm/include/llvm/Analysis/LazyCallGraph.h | 51 +- llvm/include/llvm/Analysis/LazyValueInfo.h | 18 +- llvm/include/llvm/Analysis/Lint.h | 28 +- llvm/include/llvm/Analysis/Loads.h | 9 + .../llvm/Analysis/LoopAccessAnalysis.h | 17 +- .../llvm/Analysis/LoopAnalysisManager.h | 1 + .../include/llvm/Analysis/LoopCacheAnalysis.h | 29 +- llvm/include/llvm/Analysis/LoopInfo.h | 22 +- llvm/include/llvm/Analysis/LoopInfoImpl.h | 22 +- llvm/include/llvm/Analysis/LoopNestAnalysis.h | 17 +- llvm/include/llvm/Analysis/MLInlineAdvisor.h | 13 +- llvm/include/llvm/Analysis/MemDerefPrinter.h | 24 + .../llvm/Analysis/MemoryDependenceAnalysis.h | 2 +- llvm/include/llvm/Analysis/MemoryLocation.h | 68 +- llvm/include/llvm/Analysis/MemorySSA.h | 61 +- llvm/include/llvm/Analysis/MemorySSAUpdater.h | 9 +- .../llvm/Analysis/ModuleDebugInfoPrinter.h | 29 + llvm/include/llvm/Analysis/MustExecute.h | 19 + .../llvm/Analysis/ObjCARCAnalysisUtils.h | 34 +- .../llvm/Analysis/OptimizationRemarkEmitter.h | 10 +- llvm/include/llvm/Analysis/PhiValues.h | 7 +- .../llvm/Analysis/ProfileSummaryInfo.h | 6 +- llvm/include/llvm/Analysis/RegionInfo.h | 3 - llvm/include/llvm/Analysis/RegionInfoImpl.h | 12 +- llvm/include/llvm/Analysis/RegionPass.h | 2 - .../llvm/Analysis/ReplayInlineAdvisor.h | 41 + llvm/include/llvm/Analysis/ScalarEvolution.h | 277 +- .../llvm/Analysis/ScalarEvolutionDivision.h | 1 + .../Analysis/ScalarEvolutionExpressions.h | 135 +- .../include/llvm/Analysis/SparsePropagation.h | 3 +- llvm/include/llvm/Analysis/StackLifetime.h | 16 +- .../llvm/Analysis/StackSafetyAnalysis.h | 3 +- .../llvm/Analysis/SyncDependenceAnalysis.h | 42 +- .../llvm/Analysis/TargetLibraryInfo.def | 21 + .../include/llvm/Analysis/TargetLibraryInfo.h | 1 + .../llvm/Analysis/TargetTransformInfo.h | 271 +- .../llvm/Analysis/TargetTransformInfoImpl.h | 346 +- .../ImportedFunctionsInliningStatistics.h | 6 + llvm/include/llvm/Analysis/Utils/Local.h | 72 +- llvm/include/llvm/Analysis/Utils/TFUtils.h | 203 +- llvm/include/llvm/Analysis/ValueLattice.h | 11 + llvm/include/llvm/Analysis/ValueTracking.h | 103 +- llvm/include/llvm/Analysis/VecFuncs.def | 146 + llvm/include/llvm/Analysis/VectorUtils.h | 56 +- llvm/include/llvm/BinaryFormat/COFF.h | 1 + llvm/include/llvm/BinaryFormat/Dwarf.def | 19 +- llvm/include/llvm/BinaryFormat/Dwarf.h | 93 +- .../include/llvm/BinaryFormat/DynamicTags.def | 1 + llvm/include/llvm/BinaryFormat/ELF.h | 98 +- .../llvm/BinaryFormat/ELFRelocs/CSKY.def | 74 + .../llvm/BinaryFormat/ELFRelocs/PowerPC64.def | 12 + llvm/include/llvm/BinaryFormat/MachO.h | 5 +- llvm/include/llvm/BinaryFormat/Wasm.h | 49 +- llvm/include/llvm/BinaryFormat/WasmRelocs.def | 5 + .../{Object => BinaryFormat}/WasmTraits.h | 6 +- llvm/include/llvm/BinaryFormat/XCOFF.h | 111 + llvm/include/llvm/Bitcode/BitcodeCommon.h | 30 + .../include/llvm/Bitcode/BitcodeConvenience.h | 486 ++ llvm/include/llvm/Bitcode/BitcodeWriter.h | 16 +- llvm/include/llvm/Bitcode/LLVMBitCodes.h | 25 +- llvm/include/llvm/Bitstream/BitCodes.h | 9 +- llvm/include/llvm/Bitstream/BitstreamWriter.h | 103 +- llvm/include/llvm/CodeGen/Analysis.h | 5 - llvm/include/llvm/CodeGen/AntiDepBreaker.h | 1 - llvm/include/llvm/CodeGen/AsmPrinter.h | 131 +- llvm/include/llvm/CodeGen/AsmPrinterHandler.h | 7 +- .../llvm/CodeGen/BasicBlockSectionUtils.h | 30 + llvm/include/llvm/CodeGen/BasicTTIImpl.h | 489 +- llvm/include/llvm/CodeGen/CalcSpillWeights.h | 70 +- llvm/include/llvm/CodeGen/CallingConvLower.h | 15 +- .../include/llvm/CodeGen/CodeGenPassBuilder.h | 1144 ++++ llvm/include/llvm/CodeGen/CommandFlags.h | 30 +- llvm/include/llvm/CodeGen/DIE.h | 27 +- .../llvm/CodeGen/DbgEntityHistoryCalculator.h | 24 + llvm/include/llvm/CodeGen/DebugHandlerBase.h | 12 +- .../llvm/CodeGen/DwarfStringPoolEntry.h | 4 +- llvm/include/llvm/CodeGen/FastISel.h | 38 +- .../llvm/CodeGen/FunctionLoweringInfo.h | 34 +- .../include/llvm/CodeGen/GlobalISel/CSEInfo.h | 8 +- .../llvm/CodeGen/GlobalISel/CallLowering.h | 150 +- .../llvm/CodeGen/GlobalISel/CombinerHelper.h | 268 +- .../CodeGen/GlobalISel/GISelChangeObserver.h | 2 +- .../llvm/CodeGen/GlobalISel/GISelKnownBits.h | 12 +- .../llvm/CodeGen/GlobalISel/GISelWorkList.h | 3 - .../llvm/CodeGen/GlobalISel/IRTranslator.h | 100 +- .../CodeGen/GlobalISel/InstructionSelector.h | 45 +- .../GlobalISel/InstructionSelectorImpl.h | 77 +- .../GlobalISel/LegalizationArtifactCombiner.h | 124 +- .../llvm/CodeGen/GlobalISel/Legalizer.h | 3 - .../llvm/CodeGen/GlobalISel/LegalizerHelper.h | 81 +- .../llvm/CodeGen/GlobalISel/LegalizerInfo.h | 80 +- .../llvm/CodeGen/GlobalISel/Localizer.h | 8 +- .../llvm/CodeGen/GlobalISel/MIPatternMatch.h | 102 +- .../CodeGen/GlobalISel/MachineIRBuilder.h | 162 +- .../CodeGen/GlobalISel/RegisterBankInfo.h | 23 +- llvm/include/llvm/CodeGen/GlobalISel/Utils.h | 130 +- llvm/include/llvm/CodeGen/ISDOpcodes.h | 108 +- llvm/include/llvm/CodeGen/LexicalScopes.h | 3 - llvm/include/llvm/CodeGen/LiveInterval.h | 34 +- llvm/include/llvm/CodeGen/LiveIntervalUnion.h | 3 + llvm/include/llvm/CodeGen/LiveIntervals.h | 25 +- llvm/include/llvm/CodeGen/LiveRangeEdit.h | 8 +- llvm/include/llvm/CodeGen/LiveRegMatrix.h | 17 +- llvm/include/llvm/CodeGen/LiveRegUnits.h | 3 +- llvm/include/llvm/CodeGen/LiveVariables.h | 54 +- llvm/include/llvm/CodeGen/LowLevelType.h | 4 + llvm/include/llvm/CodeGen/MBFIWrapper.h | 2 + llvm/include/llvm/CodeGen/MIRFormatter.h | 6 +- llvm/include/llvm/CodeGen/MIRYamlMapping.h | 51 +- llvm/include/llvm/CodeGen/MachineBasicBlock.h | 31 +- .../llvm/CodeGen/MachineBlockFrequencyInfo.h | 23 +- .../llvm/CodeGen/MachineCombinerPattern.h | 5 + .../llvm/CodeGen/MachineConstantPool.h | 6 +- .../llvm/CodeGen/MachineDominanceFrontier.h | 1 - llvm/include/llvm/CodeGen/MachineDominators.h | 1 - llvm/include/llvm/CodeGen/MachineFrameInfo.h | 7 +- llvm/include/llvm/CodeGen/MachineFunction.h | 58 +- llvm/include/llvm/CodeGen/MachineInstr.h | 33 +- .../llvm/CodeGen/MachineInstrBuilder.h | 41 +- .../llvm/CodeGen/MachineJumpTableInfo.h | 3 + llvm/include/llvm/CodeGen/MachineLoopInfo.h | 6 + llvm/include/llvm/CodeGen/MachineLoopUtils.h | 4 - llvm/include/llvm/CodeGen/MachineModuleInfo.h | 27 +- llvm/include/llvm/CodeGen/MachineOperand.h | 14 +- llvm/include/llvm/CodeGen/MachineOutliner.h | 3 +- .../include/llvm/CodeGen/MachinePassManager.h | 256 + .../llvm/CodeGen/MachinePassRegistry.def | 197 + llvm/include/llvm/CodeGen/MachinePipeliner.h | 17 +- .../llvm/CodeGen/MachineRegisterInfo.h | 42 +- llvm/include/llvm/CodeGen/MachineSSAUpdater.h | 4 +- llvm/include/llvm/CodeGen/MachineStableHash.h | 30 + .../llvm/CodeGen/MachineTraceMetrics.h | 4 +- .../llvm/CodeGen/MultiHazardRecognizer.h | 47 + .../llvm/CodeGen/NonRelocatableStringpool.h | 4 +- llvm/include/llvm/CodeGen/Passes.h | 32 +- llvm/include/llvm/CodeGen/RDFGraph.h | 4 - llvm/include/llvm/CodeGen/RDFLiveness.h | 38 +- llvm/include/llvm/CodeGen/RDFRegisters.h | 43 +- .../llvm/CodeGen/ReachingDefAnalysis.h | 45 +- llvm/include/llvm/CodeGen/RegAllocPBQP.h | 28 +- llvm/include/llvm/CodeGen/Register.h | 32 +- llvm/include/llvm/CodeGen/RegisterPressure.h | 34 +- .../include/llvm/CodeGen/RegisterScavenging.h | 13 +- .../llvm/CodeGen/ResourcePriorityQueue.h | 1 - llvm/include/llvm/CodeGen/RuntimeLibcalls.h | 5 + llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h | 20 +- .../llvm/CodeGen/ScheduleHazardRecognizer.h | 10 +- llvm/include/llvm/CodeGen/SelectionDAG.h | 138 +- llvm/include/llvm/CodeGen/SelectionDAGISel.h | 2 - llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 230 +- .../llvm/CodeGen/SelectionDAGTargetInfo.h | 2 +- llvm/include/llvm/CodeGen/SlotIndexes.h | 43 +- llvm/include/llvm/CodeGen/StableHashing.h | 112 + llvm/include/llvm/CodeGen/StackMaps.h | 62 +- .../llvm/CodeGen/SwitchLoweringUtils.h | 11 +- llvm/include/llvm/CodeGen/TargetCallingConv.h | 62 +- .../llvm/CodeGen/TargetFrameLowering.h | 24 +- llvm/include/llvm/CodeGen/TargetInstrInfo.h | 121 +- llvm/include/llvm/CodeGen/TargetLowering.h | 126 +- .../CodeGen/TargetLoweringObjectFileImpl.h | 30 +- llvm/include/llvm/CodeGen/TargetPassConfig.h | 28 +- .../include/llvm/CodeGen/TargetRegisterInfo.h | 96 +- .../llvm/CodeGen/TargetSubtargetInfo.h | 4 +- llvm/include/llvm/CodeGen/TileShapeInfo.h | 97 + llvm/include/llvm/CodeGen/ValueTypes.h | 96 +- llvm/include/llvm/CodeGen/ValueTypes.td | 193 +- llvm/include/llvm/CodeGen/VirtRegMap.h | 35 +- llvm/include/llvm/CodeGen/WasmEHFuncInfo.h | 2 + llvm/include/llvm/DWARFLinker/DWARFLinker.h | 104 +- .../llvm/DWARFLinker/DWARFLinkerCompileUnit.h | 33 +- .../llvm/DWARFLinker/DWARFLinkerDeclContext.h | 31 +- llvm/include/llvm/DWARFLinker/DWARFStreamer.h | 2 +- .../llvm/DebugInfo/CodeView/CVRecord.h | 17 +- .../llvm/DebugInfo/CodeView/CVSymbolVisitor.h | 3 - .../DebugInfo/CodeView/CodeViewRecordIO.h | 3 +- .../DebugInfo/CodeView/CodeViewRegisters.def | 36 +- .../CodeView/DebugSubsectionVisitor.h | 3 - .../CodeView/DebugSymbolsSubsection.h | 2 +- .../CodeView/LazyRandomTypeCollection.h | 1 - .../llvm/DebugInfo/CodeView/RecordName.h | 1 - .../llvm/DebugInfo/CodeView/SymbolDumper.h | 2 +- .../llvm/DebugInfo/CodeView/SymbolRecord.h | 3 - .../DebugInfo/CodeView/SymbolRecordHelpers.h | 3 +- .../llvm/DebugInfo/CodeView/TypeCollection.h | 3 +- .../llvm/DebugInfo/CodeView/TypeHashing.h | 17 +- .../llvm/DebugInfo/CodeView/TypeIndex.h | 11 +- .../DebugInfo/CodeView/TypeIndexDiscovery.h | 4 +- .../llvm/DebugInfo/CodeView/TypeRecord.h | 8 +- .../DebugInfo/CodeView/TypeRecordHelpers.h | 3 +- .../DebugInfo/CodeView/TypeStreamMerger.h | 2 +- llvm/include/llvm/DebugInfo/DIContext.h | 18 +- .../llvm/DebugInfo/DWARF/DWARFContext.h | 18 +- .../llvm/DebugInfo/DWARF/DWARFDebugAddr.h | 18 + .../DebugInfo/DWARF/DWARFDebugArangeSet.h | 3 +- .../llvm/DebugInfo/DWARF/DWARFDebugFrame.h | 17 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 12 +- .../llvm/DebugInfo/DWARF/DWARFDebugLoc.h | 2 + .../llvm/DebugInfo/DWARF/DWARFDebugMacro.h | 7 +- .../llvm/DebugInfo/DWARF/DWARFDebugRnglists.h | 3 +- llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h | 6 +- .../llvm/DebugInfo/DWARF/DWARFExpression.h | 16 +- .../llvm/DebugInfo/DWARF/DWARFFormValue.h | 3 + .../llvm/DebugInfo/DWARF/DWARFListTable.h | 66 +- llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h | 37 +- .../llvm/DebugInfo/DWARF/DWARFVerifier.h | 7 +- .../llvm/DebugInfo/MSF/MappedBlockStream.h | 2 - .../PDB/Native/DbiModuleDescriptorBuilder.h | 63 +- .../DebugInfo/PDB/Native/NativeEnumSymbols.h | 41 + .../PDB/Native/NativeFunctionSymbol.h | 6 +- .../PDB/Native/NativeInlineSiteSymbol.h | 46 + .../DebugInfo/PDB/Native/NativeLineNumber.h | 3 +- .../DebugInfo/PDB/Native/NativePublicSymbol.h | 1 - .../llvm/DebugInfo/PDB/Native/NativeSession.h | 11 + .../llvm/DebugInfo/PDB/Native/SymbolCache.h | 48 +- .../llvm/DebugInfo/PDB/Native/TpiStream.h | 2 +- .../DebugInfo/PDB/Native/TpiStreamBuilder.h | 9 +- llvm/include/llvm/DebugInfo/PDB/PDBExtras.h | 6 +- llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h | 8 +- .../llvm/DebugInfo/Symbolize/Symbolize.h | 2 +- llvm/include/llvm/Demangle/ItaniumDemangle.h | 135 +- llvm/include/llvm/Demangle/Utility.h | 2 +- .../llvm/ExecutionEngine/ExecutionEngine.h | 21 - .../llvm/ExecutionEngine/JITEventListener.h | 1 - .../ExecutionEngine/JITLink/EHFrameSupport.h | 33 +- .../llvm/ExecutionEngine/JITLink/ELF.h | 13 +- .../llvm/ExecutionEngine/JITLink/ELF_x86_64.h | 14 +- .../llvm/ExecutionEngine/JITLink/JITLink.h | 91 +- .../ExecutionEngine/JITLink/JITLinkDylib.h | 24 + .../JITLink/JITLinkMemoryManager.h | 19 +- .../llvm/ExecutionEngine/JITLink/MachO.h | 11 +- .../ExecutionEngine/JITLink/MachO_arm64.h | 11 +- .../ExecutionEngine/JITLink/MachO_x86_64.h | 13 +- llvm/include/llvm/ExecutionEngine/JITSymbol.h | 2 +- .../Orc/CompileOnDemandLayer.h | 639 +- .../llvm/ExecutionEngine/Orc/CompileUtils.h | 2 - llvm/include/llvm/ExecutionEngine/Orc/Core.h | 613 +- .../llvm/ExecutionEngine/Orc/ExecutionUtils.h | 110 +- .../ExecutionEngine/Orc/GlobalMappingLayer.h | 111 - .../llvm/ExecutionEngine/Orc/IRCompileLayer.h | 100 +- .../ExecutionEngine/Orc/IRTransformLayer.h | 80 +- .../ExecutionEngine/Orc/IndirectionUtils.h | 55 +- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h | 49 +- .../llvm/ExecutionEngine/Orc/LambdaResolver.h | 84 - llvm/include/llvm/ExecutionEngine/Orc/Layer.h | 42 +- .../ExecutionEngine/Orc/LazyEmittingLayer.h | 267 - .../llvm/ExecutionEngine/Orc/LazyReexports.h | 17 +- .../include/llvm/ExecutionEngine/Orc/Legacy.h | 211 - .../llvm/ExecutionEngine/Orc/MachOPlatform.h | 20 +- .../llvm/ExecutionEngine/Orc/NullResolver.h | 43 - .../ExecutionEngine/Orc/ObjectLinkingLayer.h | 57 +- .../Orc/ObjectTransformLayer.h | 84 +- .../Orc/OrcRPCTargetProcessControl.h | 415 ++ .../Orc/OrcRemoteTargetClient.h | 263 +- .../Orc/OrcRemoteTargetRPCAPI.h | 280 +- .../Orc/OrcRemoteTargetServer.h | 21 +- .../Orc/RTDyldObjectLinkingLayer.h | 387 +- .../ExecutionEngine/Orc/RemoteObjectLayer.h | 564 -- .../Orc/Shared/FDRawByteChannel.h | 79 + .../Orc/{ => Shared}/OrcError.h | 0 .../Orc/{RPC => Shared}/RPCUtils.h | 252 +- .../Orc/{RPC => Shared}/RawByteChannel.h | 25 +- .../Serialization.h} | 421 +- .../Orc/Shared/TargetProcessControlTypes.h | 165 + .../llvm/ExecutionEngine/Orc/Speculation.h | 7 +- .../Orc/TPCDynamicLibrarySearchGenerator.h | 66 + .../ExecutionEngine/Orc/TPCEHFrameRegistrar.h | 54 + .../ExecutionEngine/Orc/TPCIndirectionUtils.h | 222 + .../Orc/TargetProcess/OrcRPCTPCServer.h | 620 ++ .../Orc/TargetProcess/RegisterEHFrames.h | 41 + .../Orc/TargetProcess/TargetExecutionUtils.h | 38 + .../Orc/TargetProcessControl.h | 218 + .../ExecutionEngine/Orc/ThreadSafeModule.h | 2 +- .../llvm/ExecutionEngine/RuntimeDyld.h | 11 +- .../llvm/{Support => FileCheck}/FileCheck.h | 43 +- .../llvm/Frontend/Directive/DirectiveBase.td | 52 +- llvm/include/llvm/Frontend/OpenACC/ACC.td | 132 +- llvm/include/llvm/Frontend/OpenMP/OMP.td | 236 +- .../llvm/Frontend/OpenMP/OMPConstants.h | 44 +- .../include/llvm/Frontend/OpenMP/OMPContext.h | 49 +- .../llvm/Frontend/OpenMP/OMPGridValues.h | 22 +- .../llvm/Frontend/OpenMP/OMPIRBuilder.h | 413 +- .../include/llvm/Frontend/OpenMP/OMPKinds.def | 1014 ++-- llvm/include/llvm/FuzzMutate/IRMutator.h | 11 + llvm/include/llvm/IR/Argument.h | 27 +- llvm/include/llvm/IR/Assumptions.h | 50 + llvm/include/llvm/IR/Attributes.h | 78 +- llvm/include/llvm/IR/Attributes.td | 32 +- llvm/include/llvm/IR/BasicBlock.h | 88 +- llvm/include/llvm/IR/CallingConv.h | 3 + llvm/include/llvm/IR/Constant.h | 30 +- llvm/include/llvm/IR/ConstantRange.h | 26 +- llvm/include/llvm/IR/Constants.h | 99 +- llvm/include/llvm/IR/DIBuilder.h | 44 +- llvm/include/llvm/IR/DataLayout.h | 54 +- llvm/include/llvm/IR/DebugInfoMetadata.h | 238 +- llvm/include/llvm/IR/DebugLoc.h | 16 +- llvm/include/llvm/IR/DerivedTypes.h | 76 +- llvm/include/llvm/IR/DiagnosticInfo.h | 24 +- llvm/include/llvm/IR/Dominators.h | 30 +- llvm/include/llvm/IR/FixedMetadataKinds.def | 5 +- llvm/include/llvm/IR/FixedPointBuilder.h | 465 ++ llvm/include/llvm/IR/Function.h | 46 +- .../llvm/IR/GetElementPtrTypeIterator.h | 2 +- llvm/include/llvm/IR/GlobalObject.h | 69 +- llvm/include/llvm/IR/GlobalVariable.h | 9 +- llvm/include/llvm/IR/IRBuilder.h | 161 +- llvm/include/llvm/IR/IRPrintingPasses.h | 23 +- llvm/include/llvm/IR/InstrTypes.h | 152 +- llvm/include/llvm/IR/Instruction.h | 63 +- llvm/include/llvm/IR/Instructions.h | 78 +- llvm/include/llvm/IR/IntrinsicInst.h | 75 + llvm/include/llvm/IR/Intrinsics.h | 12 +- llvm/include/llvm/IR/Intrinsics.td | 686 ++- llvm/include/llvm/IR/IntrinsicsAArch64.td | 469 +- llvm/include/llvm/IR/IntrinsicsAMDGPU.td | 142 +- llvm/include/llvm/IR/IntrinsicsARM.td | 23 +- llvm/include/llvm/IR/IntrinsicsBPF.td | 10 +- llvm/include/llvm/IR/IntrinsicsNVVM.td | 113 +- llvm/include/llvm/IR/IntrinsicsPowerPC.td | 586 +- llvm/include/llvm/IR/IntrinsicsRISCV.td | 1021 ++++ llvm/include/llvm/IR/IntrinsicsVE.td | 35 + llvm/include/llvm/IR/IntrinsicsVEVL.gen.td | 1213 ++++ llvm/include/llvm/IR/IntrinsicsWebAssembly.td | 196 +- llvm/include/llvm/IR/IntrinsicsX86.td | 153 +- llvm/include/llvm/IR/LLVMContext.h | 16 +- llvm/include/llvm/IR/LLVMRemarkStreamer.h | 11 +- llvm/include/llvm/IR/LegacyPassManagers.h | 5 +- llvm/include/llvm/IR/MDBuilder.h | 5 +- llvm/include/llvm/IR/MatrixBuilder.h | 39 +- llvm/include/llvm/IR/Metadata.def | 2 + llvm/include/llvm/IR/Metadata.h | 30 +- llvm/include/llvm/IR/Module.h | 7 +- llvm/include/llvm/IR/ModuleSummaryIndex.h | 14 +- llvm/include/llvm/IR/OptBisect.h | 20 +- llvm/include/llvm/IR/PassInstrumentation.h | 117 +- llvm/include/llvm/IR/PassManager.h | 138 +- llvm/include/llvm/IR/PassManagerImpl.h | 7 - llvm/include/llvm/IR/PassManagerInternal.h | 22 + llvm/include/llvm/IR/PassTimingInfo.h | 15 +- llvm/include/llvm/IR/PatternMatch.h | 272 +- llvm/include/llvm/IR/PredIteratorCache.h | 4 +- llvm/include/llvm/IR/PrintPasses.h | 44 + llvm/include/llvm/IR/PseudoProbe.h | 66 + llvm/include/llvm/IR/ReplaceConstant.h | 28 + llvm/include/llvm/IR/RuntimeLibcalls.def | 32 +- llvm/include/llvm/IR/Statepoint.h | 50 +- llvm/include/llvm/IR/StructuralHash.h | 34 + llvm/include/llvm/IR/SymbolTableListTraits.h | 8 +- llvm/include/llvm/IR/Type.h | 32 +- llvm/include/llvm/IR/User.h | 2 +- llvm/include/llvm/IR/VPIntrinsics.def | 140 +- llvm/include/llvm/IR/Value.def | 18 + llvm/include/llvm/IR/Value.h | 104 +- llvm/include/llvm/IR/ValueHandle.h | 26 +- llvm/include/llvm/IR/Verifier.h | 2 + llvm/include/llvm/InitializePasses.h | 63 +- .../llvm/InterfaceStub/ELFObjHandler.h | 47 + .../{TextAPI/ELF => InterfaceStub}/ELFStub.h | 8 +- .../ELF => InterfaceStub}/TBEHandler.h | 2 +- llvm/include/llvm/LTO/Config.h | 29 +- llvm/include/llvm/LTO/LTO.h | 12 +- llvm/include/llvm/LTO/LTOBackend.h | 25 +- .../llvm/LTO/legacy/LTOCodeGenerator.h | 18 +- llvm/include/llvm/LTO/legacy/LTOModule.h | 2 - llvm/include/llvm/LinkAllPasses.h | 10 +- llvm/include/llvm/MC/MCAsmBackend.h | 8 +- llvm/include/llvm/MC/MCAsmInfo.h | 50 +- llvm/include/llvm/MC/MCAsmMacro.h | 6 + llvm/include/llvm/MC/MCAssembler.h | 8 +- llvm/include/llvm/MC/MCCodeView.h | 2 - llvm/include/llvm/MC/MCContext.h | 31 +- llvm/include/llvm/MC/MCDwarf.h | 26 +- llvm/include/llvm/MC/MCELFObjectWriter.h | 1 - llvm/include/llvm/MC/MCExpr.h | 32 +- llvm/include/llvm/MC/MCFixup.h | 1 - llvm/include/llvm/MC/MCFragment.h | 52 + llvm/include/llvm/MC/MCInst.h | 2 +- llvm/include/llvm/MC/MCInstPrinter.h | 12 + llvm/include/llvm/MC/MCInstrDesc.h | 31 +- llvm/include/llvm/MC/MCMachObjectWriter.h | 14 +- llvm/include/llvm/MC/MCObjectFileInfo.h | 17 +- llvm/include/llvm/MC/MCObjectStreamer.h | 2 + llvm/include/llvm/MC/MCParser/AsmLexer.h | 1 + llvm/include/llvm/MC/MCParser/MCAsmLexer.h | 22 +- llvm/include/llvm/MC/MCParser/MCAsmParser.h | 30 +- .../llvm/MC/MCParser/MCTargetAsmParser.h | 3 +- llvm/include/llvm/MC/MCPseudoProbe.h | 178 + llvm/include/llvm/MC/MCRegister.h | 25 +- llvm/include/llvm/MC/MCRegisterInfo.h | 1 + llvm/include/llvm/MC/MCSchedule.h | 2 +- llvm/include/llvm/MC/MCSectionXCOFF.h | 18 +- llvm/include/llvm/MC/MCStreamer.h | 51 +- llvm/include/llvm/MC/MCSubtargetInfo.h | 24 +- llvm/include/llvm/MC/MCSymbol.h | 5 +- llvm/include/llvm/MC/MCSymbolWasm.h | 18 + llvm/include/llvm/MC/MCSymbolXCOFF.h | 4 - llvm/include/llvm/MC/MCTargetOptions.h | 1 + llvm/include/llvm/MC/MCWasmObjectWriter.h | 4 + llvm/include/llvm/MC/MCWasmStreamer.h | 4 - llvm/include/llvm/MC/MCWin64EH.h | 7 +- llvm/include/llvm/MC/MCWinCOFFStreamer.h | 1 + llvm/include/llvm/MC/MCWinEH.h | 24 +- llvm/include/llvm/MC/StringTableBuilder.h | 12 +- llvm/include/llvm/MC/SubtargetFeature.h | 2 +- .../llvm/MCA/HardwareUnits/Scheduler.h | 6 +- llvm/include/llvm/Object/ArchiveWriter.h | 6 + llvm/include/llvm/Object/Binary.h | 13 +- llvm/include/llvm/Object/COFF.h | 23 +- llvm/include/llvm/Object/ELF.h | 736 ++- llvm/include/llvm/Object/ELFObjectFile.h | 294 +- llvm/include/llvm/Object/ELFTypes.h | 30 +- llvm/include/llvm/Object/MachO.h | 1 + llvm/include/llvm/Object/MachOUniversal.h | 8 + .../llvm/Object/MachOUniversalWriter.h | 102 + llvm/include/llvm/Object/ObjectFile.h | 6 +- llvm/include/llvm/Object/RelocationResolver.h | 10 +- llvm/include/llvm/Object/StackMapParser.h | 24 +- llvm/include/llvm/Object/SymbolicFile.h | 6 +- llvm/include/llvm/Object/Wasm.h | 20 +- llvm/include/llvm/Object/XCOFFObjectFile.h | 101 + llvm/include/llvm/ObjectYAML/ArchiveYAML.h | 77 + llvm/include/llvm/ObjectYAML/DWARFEmitter.h | 16 +- llvm/include/llvm/ObjectYAML/DWARFYAML.h | 197 +- llvm/include/llvm/ObjectYAML/ELFYAML.h | 332 +- llvm/include/llvm/ObjectYAML/MachOYAML.h | 2 +- llvm/include/llvm/ObjectYAML/MinidumpYAML.h | 2 +- llvm/include/llvm/ObjectYAML/ObjectYAML.h | 2 + llvm/include/llvm/ObjectYAML/WasmYAML.h | 3 + llvm/include/llvm/ObjectYAML/yaml2obj.h | 5 + llvm/include/llvm/Option/ArgList.h | 4 + llvm/include/llvm/Option/OptParser.td | 97 +- llvm/include/llvm/Option/OptTable.h | 28 +- llvm/include/llvm/Option/Option.h | 14 +- llvm/include/llvm/Pass.h | 20 + llvm/include/llvm/PassAnalysisSupport.h | 24 +- llvm/include/llvm/Passes/PassBuilder.h | 188 +- .../llvm/Passes/StandardInstrumentations.h | 230 +- .../ProfileData/Coverage/CoverageMapping.h | 70 +- .../Coverage/CoverageMappingReader.h | 4 +- llvm/include/llvm/ProfileData/GCOV.h | 182 +- llvm/include/llvm/ProfileData/InstrProf.h | 40 +- .../llvm/ProfileData/InstrProfData.inc | 139 +- .../llvm/ProfileData/InstrProfReader.h | 26 +- .../llvm/ProfileData/InstrProfWriter.h | 6 +- llvm/include/llvm/ProfileData/ProfileCommon.h | 4 +- llvm/include/llvm/ProfileData/SampleProf.h | 306 +- .../llvm/ProfileData/SampleProfReader.h | 160 +- .../llvm/ProfileData/SampleProfWriter.h | 207 +- .../llvm/Remarks/BitstreamRemarkParser.h | 6 +- .../llvm/Remarks/HotnessThresholdParser.h | 63 + .../llvm/Support/AArch64TargetParser.def | 35 + .../llvm/Support/AArch64TargetParser.h | 8 +- llvm/include/llvm/Support/AMDGPUMetadata.h | 3 +- .../llvm/Support/AMDHSAKernelDescriptor.h | 72 +- llvm/include/llvm/Support/ARMTargetParser.def | 15 +- llvm/include/llvm/Support/ARMTargetParser.h | 3 +- llvm/include/llvm/Support/ARMWinEH.h | 87 +- llvm/include/llvm/Support/AlignOf.h | 35 +- llvm/include/llvm/Support/Allocator.h | 25 +- llvm/include/llvm/Support/AtomicOrdering.h | 30 +- llvm/include/llvm/Support/BinaryItemStream.h | 3 +- llvm/include/llvm/Support/BinaryStreamRef.h | 8 +- llvm/include/llvm/Support/CFGDiff.h | 225 +- llvm/include/llvm/Support/CFGUpdate.h | 1 - llvm/include/llvm/Support/CheckedArithmetic.h | 4 +- llvm/include/llvm/Support/CommandLine.h | 19 +- llvm/include/llvm/Support/Compiler.h | 24 +- .../llvm/Support/CrashRecoveryContext.h | 12 +- llvm/include/llvm/Support/DOTGraphTraits.h | 3 +- llvm/include/llvm/Support/Error.h | 8 +- llvm/include/llvm/Support/ErrorHandling.h | 6 +- llvm/include/llvm/Support/ErrorOr.h | 6 +- llvm/include/llvm/Support/ExitCodes.h | 33 + llvm/include/llvm/Support/FileCollector.h | 78 +- llvm/include/llvm/Support/FileSystem.h | 88 +- .../llvm/Support/FileSystem/UniqueID.h | 52 + llvm/include/llvm/Support/FormatVariadic.h | 4 +- llvm/include/llvm/Support/GenericDomTree.h | 62 +- .../llvm/Support/GenericDomTreeConstruction.h | 291 +- llvm/include/llvm/Support/GlobPattern.h | 10 + llvm/include/llvm/Support/GraphWriter.h | 8 +- llvm/include/llvm/Support/InitLLVM.h | 3 +- llvm/include/llvm/Support/InstructionCost.h | 238 + llvm/include/llvm/Support/JSON.h | 205 +- llvm/include/llvm/Support/KnownBits.h | 145 +- llvm/include/llvm/Support/LineIterator.h | 8 +- llvm/include/llvm/Support/MachineValueType.h | 332 +- llvm/include/llvm/Support/MathExtras.h | 2 +- llvm/include/llvm/Support/MemoryBuffer.h | 24 +- llvm/include/llvm/Support/MemoryBufferRef.h | 56 + llvm/include/llvm/Support/Parallel.h | 104 +- llvm/include/llvm/Support/Path.h | 38 + llvm/include/llvm/Support/PluginLoader.h | 4 + llvm/include/llvm/Support/Process.h | 10 +- llvm/include/llvm/Support/Program.h | 16 +- .../llvm/Support/RISCVTargetParser.def | 27 + llvm/include/llvm/Support/Signals.h | 6 +- llvm/include/llvm/Support/Signposts.h | 11 +- llvm/include/llvm/Support/SourceMgr.h | 5 + llvm/include/llvm/Support/SuffixTree.h | 4 +- llvm/include/llvm/Support/SwapByteOrder.h | 2 +- .../llvm/Support/SymbolRemappingReader.h | 2 +- llvm/include/llvm/Support/TargetOpcodes.def | 77 +- llvm/include/llvm/Support/TargetParser.h | 51 +- llvm/include/llvm/Support/TargetRegistry.h | 2 + llvm/include/llvm/Support/TaskQueue.h | 2 +- llvm/include/llvm/Support/Threading.h | 12 +- llvm/include/llvm/Support/ToolOutputFile.h | 4 + llvm/include/llvm/Support/TrigramIndex.h | 4 +- llvm/include/llvm/Support/TypeSize.h | 545 +- llvm/include/llvm/Support/VirtualFileSystem.h | 31 +- llvm/include/llvm/Support/Win64EH.h | 8 +- llvm/include/llvm/Support/X86TargetParser.def | 9 + llvm/include/llvm/Support/X86TargetParser.h | 19 +- llvm/include/llvm/Support/YAMLParser.h | 13 +- llvm/include/llvm/Support/YAMLTraits.h | 92 +- llvm/include/llvm/Support/raw_ostream.h | 114 +- llvm/include/llvm/TableGen/DirectiveEmitter.h | 211 + llvm/include/llvm/TableGen/Error.h | 19 +- llvm/include/llvm/TableGen/Record.h | 368 +- llvm/include/llvm/TableGen/SearchableTable.td | 26 +- .../include/llvm/Target/CGPassBuilderOption.h | 65 + llvm/include/llvm/Target/GenericOpcodes.td | 602 +- .../include/llvm/Target/GlobalISel/Combine.td | 351 +- .../Target/GlobalISel/SelectionDAGCompat.td | 34 +- llvm/include/llvm/Target/Target.td | 396 +- llvm/include/llvm/Target/TargetCallingConv.td | 6 +- .../llvm/Target/TargetInstrPredicate.td | 27 +- llvm/include/llvm/Target/TargetItinerary.td | 2 +- .../llvm/Target/TargetLoweringObjectFile.h | 36 +- llvm/include/llvm/Target/TargetMachine.h | 70 +- llvm/include/llvm/Target/TargetOptions.h | 67 +- llvm/include/llvm/Target/TargetPfmCounters.td | 2 + llvm/include/llvm/Target/TargetSchedule.td | 28 +- .../include/llvm/Target/TargetSelectionDAG.td | 271 +- .../llvm/Testing/Support/SupportHelpers.h | 138 + llvm/include/llvm/TextAPI/MachO/Platform.h | 5 +- .../AggressiveInstCombine.h | 1 - llvm/include/llvm/Transforms/Coroutines.h | 2 +- .../llvm/Transforms/Coroutines/CoroCleanup.h | 1 + .../llvm/Transforms/Coroutines/CoroEarly.h | 1 + .../llvm/Transforms/Coroutines/CoroElide.h | 1 + .../llvm/Transforms/Coroutines/CoroSplit.h | 5 + .../llvm/Transforms/HelloNew/HelloWorld.h | 23 + llvm/include/llvm/Transforms/IPO.h | 18 +- .../llvm/Transforms/IPO/AlwaysInliner.h | 1 + .../llvm/Transforms/IPO/Annotation2Metadata.h | 30 + llvm/include/llvm/Transforms/IPO/Attributor.h | 658 +- .../llvm/Transforms/IPO/BlockExtractor.h | 25 + .../Transforms/IPO/CalledValuePropagation.h | 1 - .../include/llvm/Transforms/IPO/CrossDSOCFI.h | 1 - .../Transforms/IPO/DeadArgumentElimination.h | 1 + .../llvm/Transforms/IPO/ForceFunctionAttrs.h | 1 - llvm/include/llvm/Transforms/IPO/IROutliner.h | 358 ++ llvm/include/llvm/Transforms/IPO/Inliner.h | 14 +- .../llvm/Transforms/IPO/LoopExtractor.h | 32 + .../llvm/Transforms/IPO/LowerTypeTests.h | 10 +- llvm/include/llvm/Transforms/IPO/OpenMPOpt.h | 10 + .../Transforms/IPO/SampleContextTracker.h | 141 + .../llvm/Transforms/IPO/SampleProfile.h | 9 +- .../llvm/Transforms/IPO/SampleProfileProbe.h | 106 + .../llvm/Transforms/IPO/StripSymbols.h | 47 + .../llvm/Transforms/IPO/WholeProgramDevirt.h | 3 + .../Transforms/InstCombine/InstCombiner.h | 528 ++ .../include/llvm/Transforms/Instrumentation.h | 8 +- .../Instrumentation/AddressSanitizer.h | 2 + .../Instrumentation/BoundsChecking.h | 1 + .../Instrumentation/DataFlowSanitizer.h | 32 + .../Transforms/Instrumentation/GCOVProfiler.h | 2 +- .../Instrumentation/HWAddressSanitizer.h | 19 + .../Instrumentation/InstrProfiling.h | 5 - .../Transforms/Instrumentation/MemProfiler.h | 51 + .../Instrumentation/MemorySanitizer.h | 1 + .../Instrumentation/SanitizerCoverage.h | 1 + .../Instrumentation/ThreadSanitizer.h | 1 + llvm/include/llvm/Transforms/ObjCARC.h | 18 + llvm/include/llvm/Transforms/Scalar.h | 67 +- .../Transforms/Scalar/AnnotationRemarks.h | 26 + .../llvm/Transforms/Scalar/ConstantHoisting.h | 1 - .../Transforms/Scalar/ConstraintElimination.h | 24 + llvm/include/llvm/Transforms/Scalar/DCE.h | 6 + llvm/include/llvm/Transforms/Scalar/GVN.h | 15 +- .../llvm/Transforms/Scalar/IndVarSimplify.h | 4 + .../Transforms/Scalar/InferAddressSpaces.h | 27 + .../llvm/Transforms/Scalar/InstSimplifyPass.h | 4 - .../llvm/Transforms/Scalar/JumpThreading.h | 71 +- .../llvm/Transforms/Scalar/LoopFlatten.h | 32 + .../Transforms/Scalar/LoopIdiomRecognize.h | 13 + .../llvm/Transforms/Scalar/LoopInterchange.h | 24 + .../llvm/Transforms/Scalar/LoopPassManager.h | 414 +- .../llvm/Transforms/Scalar/LoopReroll.h | 27 + .../llvm/Transforms/Scalar/LoopRotation.h | 4 +- .../llvm/Transforms/Scalar/LoopUnrollPass.h | 2 +- .../Transforms/Scalar/LoopVersioningLICM.h | 25 + .../llvm/Transforms/Scalar/LowerAtomic.h | 1 + .../Transforms/Scalar/LowerExpectIntrinsic.h | 3 + .../Transforms/Scalar/LowerMatrixIntrinsics.h | 8 +- .../llvm/Transforms/Scalar/MemCpyOptimizer.h | 29 +- .../llvm/Transforms/Scalar/NaryReassociate.h | 2 +- llvm/include/llvm/Transforms/Scalar/Reg2Mem.h | 27 + llvm/include/llvm/Transforms/Scalar/SROA.h | 5 +- .../Scalar/ScalarizeMaskedMemIntrin.h | 29 + .../Scalar/SeparateConstOffsetFromGEP.h | 27 + .../llvm/Transforms/Scalar/SimplifyCFG.h | 10 +- .../Scalar/StraightLineStrengthReduce.h | 24 + .../llvm/Transforms/Scalar/StructurizeCFG.h | 20 + llvm/include/llvm/Transforms/Utils.h | 2 +- .../llvm/Transforms/Utils/BasicBlockUtils.h | 131 +- .../llvm/Transforms/Utils/BuildLibCalls.h | 4 + .../llvm/Transforms/Utils/CallGraphUpdater.h | 2 +- llvm/include/llvm/Transforms/Utils/Cloning.h | 36 + llvm/include/llvm/Transforms/Utils/Debugify.h | 65 +- .../llvm/Transforms/Utils/FixIrreducible.h | 20 + .../llvm/Transforms/Utils/InstructionNamer.h | 20 + llvm/include/llvm/Transforms/Utils/Local.h | 118 +- llvm/include/llvm/Transforms/Utils/LoopPeel.h | 40 + .../llvm/Transforms/Utils/LoopRotationUtils.h | 3 +- .../include/llvm/Transforms/Utils/LoopUtils.h | 105 +- .../llvm/Transforms/Utils/LoopVersioning.h | 24 +- .../llvm/Transforms/Utils/LowerSwitch.h | 26 + .../llvm/Transforms/Utils/MatrixUtils.h | 94 + .../llvm/Transforms/Utils/MetaRenamer.h | 26 + .../include/llvm/Transforms/Utils/MisExpect.h | 43 - .../llvm/Transforms/Utils/PredicateInfo.h | 34 +- .../Utils/ScalarEvolutionExpander.h | 856 +-- .../Transforms/Utils/SimplifyCFGOptions.h | 77 + .../llvm/Transforms/Utils/SimplifyIndVar.h | 23 + .../llvm/Transforms/Utils/SimplifyLibCalls.h | 2 +- llvm/include/llvm/Transforms/Utils/SizeOpts.h | 11 - .../llvm/Transforms/Utils/StripGCRelocates.h | 25 + .../Utils/StripNonLineTableDebugInfo.h | 26 + .../Transforms/Utils/UnifyFunctionExitNodes.h | 27 +- .../llvm/Transforms/Utils/UnifyLoopExits.h | 22 + .../llvm/Transforms/Utils/UnrollLoop.h | 17 - .../Vectorize/LoopVectorizationLegality.h | 65 +- .../llvm/Transforms/Vectorize/SLPVectorizer.h | 7 +- llvm/include/llvm/module.modulemap | 25 +- llvm/lib/Analysis/AliasAnalysis.cpp | 100 +- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp | 6 +- llvm/lib/Analysis/AliasSetTracker.cpp | 39 +- llvm/lib/Analysis/Analysis.cpp | 7 +- llvm/lib/Analysis/AssumeBundleQueries.cpp | 5 +- llvm/lib/Analysis/AssumptionCache.cpp | 21 +- llvm/lib/Analysis/BasicAliasAnalysis.cpp | 892 ++- llvm/lib/Analysis/BranchProbabilityInfo.cpp | 942 +-- llvm/lib/Analysis/CFG.cpp | 15 +- llvm/lib/Analysis/CFGPrinter.cpp | 12 +- llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp | 3 +- llvm/lib/Analysis/CGSCCPassManager.cpp | 554 +- llvm/lib/Analysis/CallGraph.cpp | 48 +- llvm/lib/Analysis/CallGraphSCCPass.cpp | 35 +- llvm/lib/Analysis/CallPrinter.cpp | 5 +- llvm/lib/Analysis/CaptureTracking.cpp | 105 +- llvm/lib/Analysis/CodeMetrics.cpp | 15 +- llvm/lib/Analysis/ConstantFolding.cpp | 326 +- llvm/lib/Analysis/ConstraintSystem.cpp | 158 + llvm/lib/Analysis/CostModel.cpp | 13 +- llvm/lib/Analysis/DDG.cpp | 8 +- llvm/lib/Analysis/DDGPrinter.cpp | 150 + llvm/lib/Analysis/Delinearization.cpp | 48 +- llvm/lib/Analysis/DemandedBits.cpp | 105 +- llvm/lib/Analysis/DependenceAnalysis.cpp | 79 +- llvm/lib/Analysis/DependenceGraphBuilder.cpp | 129 +- .../Analysis/DevelopmentModeInlineAdvisor.cpp | 531 ++ llvm/lib/Analysis/DivergenceAnalysis.cpp | 344 +- llvm/lib/Analysis/DomTreeUpdater.cpp | 5 +- llvm/lib/Analysis/EHPersonalities.cpp | 38 +- .../Analysis/FunctionPropertiesAnalysis.cpp | 88 + llvm/lib/Analysis/GlobalsModRef.cpp | 39 +- llvm/lib/Analysis/IRSimilarityIdentifier.cpp | 937 +++ llvm/lib/Analysis/IVDescriptors.cpp | 345 +- .../ImportedFunctionsInliningStatistics.cpp | 14 +- .../IndirectCallPromotionAnalysis.cpp | 4 +- llvm/lib/Analysis/InlineAdvisor.cpp | 188 +- llvm/lib/Analysis/InlineCost.cpp | 263 +- llvm/lib/Analysis/InlineFeaturesAnalysis.cpp | 41 - .../Analysis/InlineSizeEstimatorAnalysis.cpp | 142 +- llvm/lib/Analysis/InstCount.cpp | 89 +- llvm/lib/Analysis/InstructionSimplify.cpp | 1311 ++-- llvm/lib/Analysis/Interval.cpp | 11 - llvm/lib/Analysis/LazyCallGraph.cpp | 297 +- llvm/lib/Analysis/LazyValueInfo.cpp | 342 +- .../lib/Analysis/LegacyDivergenceAnalysis.cpp | 6 +- llvm/lib/Analysis/Lint.cpp | 379 +- llvm/lib/Analysis/Loads.cpp | 69 +- llvm/lib/Analysis/LoopAccessAnalysis.cpp | 166 +- llvm/lib/Analysis/LoopAnalysisManager.cpp | 1 + llvm/lib/Analysis/LoopCacheAnalysis.cpp | 17 +- llvm/lib/Analysis/LoopInfo.cpp | 32 +- llvm/lib/Analysis/LoopNestAnalysis.cpp | 130 +- llvm/lib/Analysis/LoopPass.cpp | 22 +- llvm/lib/Analysis/MLInlineAdvisor.cpp | 65 +- llvm/lib/Analysis/MemDepPrinter.cpp | 4 +- llvm/lib/Analysis/MemDerefPrinter.cpp | 34 + llvm/lib/Analysis/MemoryBuiltins.cpp | 27 +- .../lib/Analysis/MemoryDependenceAnalysis.cpp | 59 +- llvm/lib/Analysis/MemoryLocation.cpp | 86 +- llvm/lib/Analysis/MemorySSA.cpp | 230 +- llvm/lib/Analysis/MemorySSAUpdater.cpp | 102 +- llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp | 56 +- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 4 +- llvm/lib/Analysis/MustExecute.cpp | 98 +- llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp | 15 +- llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp | 20 + llvm/lib/Analysis/ObjCARCInstKind.cpp | 1 - .../Analysis/OptimizationRemarkEmitter.cpp | 30 +- llvm/lib/Analysis/PhiValues.cpp | 1 - llvm/lib/Analysis/RegionInfo.cpp | 3 - llvm/lib/Analysis/RegionPass.cpp | 72 +- llvm/lib/Analysis/ReleaseModeModelRunner.cpp | 7 +- llvm/lib/Analysis/ReplayInlineAdvisor.cpp | 82 + llvm/lib/Analysis/ScalarEvolution.cpp | 2005 +++++-- .../Analysis/ScalarEvolutionAliasAnalysis.cpp | 6 +- llvm/lib/Analysis/ScalarEvolutionDivision.cpp | 12 +- llvm/lib/Analysis/ScopedNoAliasAA.cpp | 28 +- llvm/lib/Analysis/StackLifetime.cpp | 83 +- llvm/lib/Analysis/StackSafetyAnalysis.cpp | 256 +- llvm/lib/Analysis/SyncDependenceAnalysis.cpp | 477 +- llvm/lib/Analysis/TFUtils.cpp | 344 +- llvm/lib/Analysis/TargetLibraryInfo.cpp | 38 +- llvm/lib/Analysis/TargetTransformInfo.cpp | 168 +- llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | 1 + llvm/lib/Analysis/VFABIDemangling.cpp | 10 +- llvm/lib/Analysis/ValueTracking.cpp | 1458 +++-- llvm/lib/Analysis/VectorUtils.cpp | 75 +- llvm/lib/Analysis/models/inliner/README.txt | 3 + .../Analysis/models/inliner/output_spec.json | 14 + llvm/lib/AsmParser/LLLexer.cpp | 8 + llvm/lib/AsmParser/LLParser.cpp | 3738 ++++++------ llvm/lib/AsmParser/LLParser.h | 438 +- llvm/lib/AsmParser/LLToken.h | 7 + llvm/lib/BinaryFormat/Dwarf.cpp | 25 + llvm/lib/BinaryFormat/MachO.cpp | 8 +- llvm/lib/BinaryFormat/MsgPackDocument.cpp | 3 +- llvm/lib/BinaryFormat/Wasm.cpp | 4 + llvm/lib/BinaryFormat/XCOFF.cpp | 78 + llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | 5 + llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 291 +- llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 192 +- llvm/lib/Bitcode/Reader/ValueList.cpp | 3 - llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 223 +- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 37 +- llvm/lib/Bitstream/Reader/BitstreamReader.cpp | 12 +- llvm/lib/CodeGen/AllocationOrder.cpp | 17 +- llvm/lib/CodeGen/AllocationOrder.h | 128 +- llvm/lib/CodeGen/Analysis.cpp | 61 +- llvm/lib/CodeGen/AsmPrinter/AIXException.cpp | 79 + llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp | 14 +- llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp | 4 +- llvm/lib/CodeGen/AsmPrinter/AddressPool.h | 2 +- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 591 +- .../CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 50 +- .../AsmPrinter/AsmPrinterInlineAsm.cpp | 42 +- llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h | 8 +- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 189 +- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 11 +- llvm/lib/CodeGen/AsmPrinter/DIE.cpp | 90 +- llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp | 11 +- llvm/lib/CodeGen/AsmPrinter/DIEHash.h | 4 +- .../AsmPrinter/DbgEntityHistoryCalculator.cpp | 185 +- .../CodeGen/AsmPrinter/DebugHandlerBase.cpp | 76 +- .../CodeGen/AsmPrinter/DwarfCFIException.cpp | 7 +- .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 86 +- .../lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 12 +- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 480 +- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 64 +- llvm/lib/CodeGen/AsmPrinter/DwarfException.h | 14 + .../CodeGen/AsmPrinter/DwarfExpression.cpp | 46 +- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | 14 +- llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 12 +- llvm/lib/CodeGen/AsmPrinter/DwarfFile.h | 3 +- .../CodeGen/AsmPrinter/DwarfStringPool.cpp | 10 +- llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 288 +- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h | 34 +- llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp | 405 +- llvm/lib/CodeGen/AsmPrinter/EHStreamer.h | 43 +- .../lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp | 7 +- .../CodeGen/AsmPrinter/PseudoProbePrinter.cpp | 84 + .../CodeGen/AsmPrinter/PseudoProbePrinter.h | 53 + llvm/lib/CodeGen/AsmPrinter/WasmException.cpp | 11 +- llvm/lib/CodeGen/AsmPrinter/WasmException.h | 1 + llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp | 53 +- llvm/lib/CodeGen/AsmPrinter/WinCFGuard.h | 1 + llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 56 +- llvm/lib/CodeGen/AtomicExpandPass.cpp | 20 +- ...ionsPrepare.cpp => BasicBlockSections.cpp} | 159 +- llvm/lib/CodeGen/BranchFolding.cpp | 16 +- llvm/lib/CodeGen/BranchFolding.h | 3 +- llvm/lib/CodeGen/BranchRelaxation.cpp | 36 +- llvm/lib/CodeGen/BreakFalseDeps.cpp | 32 +- llvm/lib/CodeGen/CalcSpillWeights.cpp | 281 +- llvm/lib/CodeGen/CallingConvLower.cpp | 23 +- llvm/lib/CodeGen/CodeGen.cpp | 6 +- llvm/lib/CodeGen/CodeGenPassBuilder.cpp | 25 + llvm/lib/CodeGen/CodeGenPrepare.cpp | 409 +- llvm/lib/CodeGen/CommandFlags.cpp | 96 +- .../CodeGen/DeadMachineInstructionElim.cpp | 21 +- llvm/lib/CodeGen/DetectDeadLanes.cpp | 5 +- llvm/lib/CodeGen/DwarfEHPrepare.cpp | 232 +- llvm/lib/CodeGen/EarlyIfConversion.cpp | 106 +- llvm/lib/CodeGen/ExpandReductions.cpp | 128 +- .../CodeGen/FixupStatepointCallerSaved.cpp | 362 +- llvm/lib/CodeGen/GCRootLowering.cpp | 5 +- llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp | 28 +- llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp | 34 +- llvm/lib/CodeGen/GlobalISel/CallLowering.cpp | 628 +- llvm/lib/CodeGen/GlobalISel/Combiner.cpp | 5 +- .../lib/CodeGen/GlobalISel/CombinerHelper.cpp | 1974 +++++- .../GlobalISel/GISelChangeObserver.cpp | 2 +- .../lib/CodeGen/GlobalISel/GISelKnownBits.cpp | 249 +- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 898 ++- .../CodeGen/GlobalISel/InlineAsmLowering.cpp | 24 +- .../CodeGen/GlobalISel/InstructionSelect.cpp | 2 +- .../GlobalISel/InstructionSelector.cpp | 14 +- .../CodeGen/GlobalISel/LegalityPredicates.cpp | 24 +- .../CodeGen/GlobalISel/LegalizeMutations.cpp | 10 + llvm/lib/CodeGen/GlobalISel/Legalizer.cpp | 2 +- .../CodeGen/GlobalISel/LegalizerHelper.cpp | 1604 +++-- llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp | 6 +- llvm/lib/CodeGen/GlobalISel/Localizer.cpp | 23 + .../CodeGen/GlobalISel/MachineIRBuilder.cpp | 145 +- .../CodeGen/GlobalISel/RegisterBankInfo.cpp | 3 +- llvm/lib/CodeGen/GlobalISel/Utils.cpp | 394 +- llvm/lib/CodeGen/GlobalMerge.cpp | 5 +- llvm/lib/CodeGen/HardwareLoops.cpp | 51 +- llvm/lib/CodeGen/IfConversion.cpp | 7 +- llvm/lib/CodeGen/ImplicitNullChecks.cpp | 258 +- llvm/lib/CodeGen/InlineSpiller.cpp | 107 +- llvm/lib/CodeGen/InterferenceCache.cpp | 10 +- llvm/lib/CodeGen/InterferenceCache.h | 18 +- llvm/lib/CodeGen/InterleavedAccessPass.cpp | 119 +- .../CodeGen/InterleavedLoadCombinePass.cpp | 17 +- llvm/lib/CodeGen/IntrinsicLowering.cpp | 1 + llvm/lib/CodeGen/LLVMTargetMachine.cpp | 63 +- llvm/lib/CodeGen/LexicalScopes.cpp | 2 +- .../LiveDebugValues/InstrRefBasedImpl.cpp | 3363 +++++++++++ .../LiveDebugValues/LiveDebugValues.cpp | 97 + .../CodeGen/LiveDebugValues/LiveDebugValues.h | 32 + .../VarLocBasedImpl.cpp} | 224 +- llvm/lib/CodeGen/LiveDebugVariables.cpp | 71 +- llvm/lib/CodeGen/LiveDebugVariables.h | 1 - llvm/lib/CodeGen/LiveInterval.cpp | 23 +- llvm/lib/CodeGen/LiveIntervalCalc.cpp | 6 +- llvm/lib/CodeGen/LiveIntervalUnion.cpp | 16 +- llvm/lib/CodeGen/LiveIntervals.cpp | 79 +- llvm/lib/CodeGen/LiveRangeEdit.cpp | 29 +- llvm/lib/CodeGen/LiveRegMatrix.cpp | 52 +- llvm/lib/CodeGen/LiveRegUnits.cpp | 4 - llvm/lib/CodeGen/LiveVariables.cpp | 61 +- llvm/lib/CodeGen/LocalStackSlotAllocation.cpp | 15 +- llvm/lib/CodeGen/LowLevelType.cpp | 16 + llvm/lib/CodeGen/LowerEmuTLS.cpp | 3 +- llvm/lib/CodeGen/MBFIWrapper.cpp | 12 + llvm/lib/CodeGen/MIRCanonicalizerPass.cpp | 15 +- llvm/lib/CodeGen/MIRParser/MILexer.cpp | 11 +- llvm/lib/CodeGen/MIRParser/MILexer.h | 2 + llvm/lib/CodeGen/MIRParser/MIParser.cpp | 34 +- llvm/lib/CodeGen/MIRParser/MIRParser.cpp | 37 +- llvm/lib/CodeGen/MIRPrinter.cpp | 137 +- llvm/lib/CodeGen/MIRVRegNamerUtils.cpp | 14 + llvm/lib/CodeGen/MachineBasicBlock.cpp | 244 +- .../lib/CodeGen/MachineBlockFrequencyInfo.cpp | 15 +- llvm/lib/CodeGen/MachineBlockPlacement.cpp | 84 +- llvm/lib/CodeGen/MachineCSE.cpp | 48 +- llvm/lib/CodeGen/MachineCheckDebugify.cpp | 126 + llvm/lib/CodeGen/MachineCombiner.cpp | 72 +- llvm/lib/CodeGen/MachineCopyPropagation.cpp | 130 +- llvm/lib/CodeGen/MachineDebugify.cpp | 32 +- llvm/lib/CodeGen/MachineFunction.cpp | 125 +- llvm/lib/CodeGen/MachineFunctionPass.cpp | 1 - .../CodeGen/MachineFunctionPrinterPass.cpp | 4 +- llvm/lib/CodeGen/MachineFunctionSplitter.cpp | 155 + llvm/lib/CodeGen/MachineInstr.cpp | 176 +- llvm/lib/CodeGen/MachineLICM.cpp | 169 +- llvm/lib/CodeGen/MachineLoopInfo.cpp | 56 + llvm/lib/CodeGen/MachineLoopUtils.cpp | 11 - llvm/lib/CodeGen/MachineModuleInfo.cpp | 27 +- llvm/lib/CodeGen/MachineOperand.cpp | 30 +- llvm/lib/CodeGen/MachineOutliner.cpp | 21 +- llvm/lib/CodeGen/MachinePassManager.cpp | 121 + llvm/lib/CodeGen/MachinePipeliner.cpp | 51 +- llvm/lib/CodeGen/MachineRegisterInfo.cpp | 25 +- llvm/lib/CodeGen/MachineSSAUpdater.cpp | 11 +- llvm/lib/CodeGen/MachineScheduler.cpp | 282 +- llvm/lib/CodeGen/MachineSink.cpp | 290 +- llvm/lib/CodeGen/MachineStableHash.cpp | 194 + llvm/lib/CodeGen/MachineTraceMetrics.cpp | 28 +- llvm/lib/CodeGen/MachineVerifier.cpp | 412 +- llvm/lib/CodeGen/ModuloSchedule.cpp | 2 - llvm/lib/CodeGen/MultiHazardRecognizer.cpp | 92 + llvm/lib/CodeGen/PHIElimination.cpp | 76 +- llvm/lib/CodeGen/PHIEliminationUtils.cpp | 46 +- llvm/lib/CodeGen/ParallelCG.cpp | 2 + llvm/lib/CodeGen/PeepholeOptimizer.cpp | 165 +- llvm/lib/CodeGen/PostRAHazardRecognizer.cpp | 8 +- llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp | 2 +- llvm/lib/CodeGen/PrologEpilogInserter.cpp | 40 +- llvm/lib/CodeGen/PseudoProbeInserter.cpp | 95 + llvm/lib/CodeGen/RDFGraph.cpp | 5 - llvm/lib/CodeGen/RDFLiveness.cpp | 151 +- llvm/lib/CodeGen/RDFRegisters.cpp | 35 +- llvm/lib/CodeGen/ReachingDefAnalysis.cpp | 184 +- llvm/lib/CodeGen/RegAllocBase.cpp | 34 +- llvm/lib/CodeGen/RegAllocBase.h | 4 +- llvm/lib/CodeGen/RegAllocBasic.cpp | 51 +- llvm/lib/CodeGen/RegAllocFast.cpp | 1389 +++-- llvm/lib/CodeGen/RegAllocGreedy.cpp | 537 +- llvm/lib/CodeGen/RegAllocPBQP.cpp | 117 +- llvm/lib/CodeGen/RegisterClassInfo.cpp | 13 +- llvm/lib/CodeGen/RegisterCoalescer.cpp | 270 +- llvm/lib/CodeGen/RegisterCoalescer.h | 14 +- llvm/lib/CodeGen/RegisterPressure.cpp | 80 +- llvm/lib/CodeGen/RegisterScavenging.cpp | 43 +- llvm/lib/CodeGen/RenameIndependentSubregs.cpp | 10 +- llvm/lib/CodeGen/SafeStack.cpp | 35 +- llvm/lib/CodeGen/SafeStackLayout.cpp | 9 +- llvm/lib/CodeGen/ScheduleDAGInstrs.cpp | 15 +- llvm/lib/CodeGen/ScheduleDAGPrinter.cpp | 2 +- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2375 +++++--- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 259 +- .../SelectionDAG/FunctionLoweringInfo.cpp | 10 +- .../lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 103 +- llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h | 12 +- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 551 +- .../SelectionDAG/LegalizeFloatTypes.cpp | 291 +- .../SelectionDAG/LegalizeIntegerTypes.cpp | 396 +- .../CodeGen/SelectionDAG/LegalizeTypes.cpp | 17 +- llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h | 62 +- .../SelectionDAG/LegalizeTypesGeneric.cpp | 11 +- .../SelectionDAG/LegalizeVectorOps.cpp | 25 +- .../SelectionDAG/LegalizeVectorTypes.cpp | 1143 ++-- .../CodeGen/SelectionDAG/ScheduleDAGFast.cpp | 2 +- .../SelectionDAG/ScheduleDAGRRList.cpp | 17 +- .../SelectionDAG/ScheduleDAGSDNodes.cpp | 31 +- .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 950 +-- .../SelectionDAGAddressAnalysis.cpp | 31 +- .../SelectionDAG/SelectionDAGBuilder.cpp | 805 +-- .../SelectionDAG/SelectionDAGBuilder.h | 22 +- .../SelectionDAG/SelectionDAGDumper.cpp | 53 +- .../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 131 +- .../SelectionDAG/StatepointLowering.cpp | 322 +- .../CodeGen/SelectionDAG/TargetLowering.cpp | 1077 +++- llvm/lib/CodeGen/ShrinkWrap.cpp | 13 +- llvm/lib/CodeGen/SjLjEHPrepare.cpp | 2 +- llvm/lib/CodeGen/SpillPlacement.cpp | 4 - llvm/lib/CodeGen/SplitKit.cpp | 78 +- llvm/lib/CodeGen/SplitKit.h | 13 +- llvm/lib/CodeGen/StackColoring.cpp | 56 +- llvm/lib/CodeGen/StackMaps.cpp | 180 +- llvm/lib/CodeGen/StackProtector.cpp | 22 +- llvm/lib/CodeGen/StackSlotColoring.cpp | 17 +- llvm/lib/CodeGen/SwiftErrorValueTracking.cpp | 4 +- llvm/lib/CodeGen/SwitchLoweringUtils.cpp | 4 +- llvm/lib/CodeGen/TailDuplicator.cpp | 11 +- llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp | 11 +- llvm/lib/CodeGen/TargetInstrInfo.cpp | 44 +- llvm/lib/CodeGen/TargetLoweringBase.cpp | 277 +- .../CodeGen/TargetLoweringObjectFileImpl.cpp | 441 +- llvm/lib/CodeGen/TargetOptionsImpl.cpp | 8 +- llvm/lib/CodeGen/TargetPassConfig.cpp | 303 +- llvm/lib/CodeGen/TargetRegisterInfo.cpp | 53 +- llvm/lib/CodeGen/TargetSubtargetInfo.cpp | 11 +- .../lib/CodeGen/TwoAddressInstructionPass.cpp | 421 +- llvm/lib/CodeGen/TypePromotion.cpp | 12 +- llvm/lib/CodeGen/ValueTypes.cpp | 51 +- llvm/lib/CodeGen/VirtRegMap.cpp | 17 +- llvm/lib/CodeGen/WasmEHPrepare.cpp | 31 +- llvm/lib/CodeGen/WinEHPrepare.cpp | 8 +- llvm/lib/CodeGen/XRayInstrumentation.cpp | 12 +- llvm/lib/DWARFLinker/DWARFLinker.cpp | 415 +- .../DWARFLinker/DWARFLinkerCompileUnit.cpp | 6 +- .../DWARFLinker/DWARFLinkerDeclContext.cpp | 80 +- llvm/lib/DWARFLinker/DWARFStreamer.cpp | 48 +- .../DebugInfo/CodeView/CodeViewRecordIO.cpp | 2 - .../CodeView/DebugFrameDataSubsection.cpp | 7 +- llvm/lib/DebugInfo/CodeView/EnumTables.cpp | 12 +- .../CodeView/LazyRandomTypeCollection.cpp | 10 +- llvm/lib/DebugInfo/CodeView/RecordName.cpp | 8 +- .../CodeView/RecordSerialization.cpp | 2 +- .../DebugInfo/CodeView/TypeIndexDiscovery.cpp | 3 +- .../DebugInfo/CodeView/TypeRecordMapping.cpp | 2 +- .../DebugInfo/CodeView/TypeStreamMerger.cpp | 2 +- .../lib/DebugInfo/DWARF/DWARFAddressRange.cpp | 5 +- llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp | 7 +- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 113 +- .../DebugInfo/DWARF/DWARFDataExtractor.cpp | 14 +- .../DebugInfo/DWARF/DWARFDebugArangeSet.cpp | 27 +- .../lib/DebugInfo/DWARF/DWARFDebugAranges.cpp | 3 +- llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp | 53 +- .../DebugInfo/DWARF/DWARFDebugInfoEntry.cpp | 3 +- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 84 +- llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp | 14 +- llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp | 14 +- .../DebugInfo/DWARF/DWARFDebugRangeList.cpp | 7 + .../DebugInfo/DWARF/DWARFDebugRnglists.cpp | 139 +- llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 39 +- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp | 29 +- llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 8 +- llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp | 4 +- llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp | 9 +- llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp | 7 +- llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 194 +- llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | 8 +- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 42 + llvm/lib/DebugInfo/GSYM/GsymCreator.cpp | 2 +- llvm/lib/DebugInfo/MSF/MSFBuilder.cpp | 6 +- .../PDB/Native/DbiModuleDescriptorBuilder.cpp | 87 +- .../DebugInfo/PDB/Native/DbiStreamBuilder.cpp | 10 +- .../DebugInfo/PDB/Native/GSIStreamBuilder.cpp | 2 +- .../DebugInfo/PDB/Native/NamedStreamMap.cpp | 2 +- .../PDB/Native/NativeEnumSymbols.cpp | 41 + .../PDB/Native/NativeFunctionSymbol.cpp | 98 +- .../PDB/Native/NativeInlineSiteSymbol.cpp | 177 + .../DebugInfo/PDB/Native/NativeLineNumber.cpp | 7 +- .../PDB/Native/NativePublicSymbol.cpp | 6 +- .../DebugInfo/PDB/Native/NativeSession.cpp | 81 +- .../DebugInfo/PDB/Native/NativeSourceFile.cpp | 2 +- .../DebugInfo/PDB/Native/NativeTypeUDT.cpp | 2 +- llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp | 195 +- .../DebugInfo/PDB/Native/TpiStreamBuilder.cpp | 62 +- llvm/lib/DebugInfo/PDB/PDBContext.cpp | 39 +- llvm/lib/DebugInfo/PDB/PDBExtras.cpp | 16 +- .../lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp | 4 +- llvm/lib/DebugInfo/PDB/PDBSymbol.cpp | 17 + llvm/lib/DebugInfo/PDB/UDTLayout.cpp | 8 +- llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp | 6 +- .../Symbolize/SymbolizableObjectFile.cpp | 9 - .../Symbolize/SymbolizableObjectFile.h | 6 +- llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 19 +- llvm/lib/Demangle/Demangle.cpp | 2 +- llvm/lib/Demangle/MicrosoftDemangleNodes.cpp | 1 - llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 15 +- .../IntelJITEvents/IntelJITEventListener.cpp | 382 +- .../IntelJITEvents/IntelJITEventsWrapper.h | 45 +- .../Interpreter/ExternalFunctions.cpp | 2 +- .../JITLink/EHFrameSupport.cpp | 334 +- .../JITLink/EHFrameSupportImpl.h | 24 +- llvm/lib/ExecutionEngine/JITLink/ELF.cpp | 68 +- .../ExecutionEngine/JITLink/ELF_x86_64.cpp | 540 +- llvm/lib/ExecutionEngine/JITLink/JITLink.cpp | 58 +- .../JITLink/JITLinkGeneric.cpp | 62 +- .../ExecutionEngine/JITLink/JITLinkGeneric.h | 16 +- .../JITLink/JITLinkMemoryManager.cpp | 3 +- llvm/lib/ExecutionEngine/JITLink/MachO.cpp | 60 +- .../JITLink/MachOLinkGraphBuilder.cpp | 10 +- .../JITLink/MachOLinkGraphBuilder.h | 4 +- .../ExecutionEngine/JITLink/MachO_arm64.cpp | 113 +- .../ExecutionEngine/JITLink/MachO_x86_64.cpp | 67 +- llvm/lib/ExecutionEngine/MCJIT/MCJIT.h | 10 +- .../Orc/CompileOnDemandLayer.cpp | 76 +- llvm/lib/ExecutionEngine/Orc/Core.cpp | 2504 +++++--- .../ExecutionEngine/Orc/ExecutionUtils.cpp | 40 +- .../ExecutionEngine/Orc/IRCompileLayer.cpp | 6 +- .../ExecutionEngine/Orc/IRTransformLayer.cpp | 6 +- .../ExecutionEngine/Orc/IndirectionUtils.cpp | 21 +- llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 184 +- llvm/lib/ExecutionEngine/Orc/Layer.cpp | 67 +- .../lib/ExecutionEngine/Orc/LazyReexports.cpp | 70 +- llvm/lib/ExecutionEngine/Orc/Legacy.cpp | 68 - .../lib/ExecutionEngine/Orc/MachOPlatform.cpp | 57 +- llvm/lib/ExecutionEngine/Orc/NullResolver.cpp | 37 - .../Orc/ObjectLinkingLayer.cpp | 351 +- .../Orc/ObjectTransformLayer.cpp | 7 +- llvm/lib/ExecutionEngine/Orc/OrcCBindings.cpp | 158 - .../ExecutionEngine/Orc/OrcCBindingsStack.h | 534 -- .../Orc/OrcMCJITReplacement.cpp | 138 - .../ExecutionEngine/Orc/OrcMCJITReplacement.h | 502 -- .../ExecutionEngine/Orc/OrcV2CBindings.cpp | 303 +- .../Orc/RTDyldObjectLinkingLayer.cpp | 153 +- .../{OrcError => Orc/Shared}/OrcError.cpp | 13 +- .../{OrcError => Orc/Shared}/RPCError.cpp | 17 +- .../Orc/Shared/TargetProcessControlTypes.cpp | 44 + .../ExecutionEngine/Orc/SpeculateAnalyses.cpp | 9 +- llvm/lib/ExecutionEngine/Orc/Speculation.cpp | 7 +- .../Orc/TPCDynamicLibrarySearchGenerator.cpp | 70 + .../Orc/TPCEHFrameRegistrar.cpp | 80 + .../Orc/TPCIndirectionUtils.cpp | 423 ++ .../Orc/TargetProcess/RegisterEHFrames.cpp | 208 + .../TargetProcess/TargetExecutionUtils.cpp | 43 + .../Orc/TargetProcessControl.cpp | 153 + .../ExecutionEngine/Orc/ThreadSafeModule.cpp | 2 +- .../RuntimeDyld/RTDyldMemoryManager.cpp | 12 +- .../RuntimeDyld/RuntimeDyld.cpp | 56 +- .../RuntimeDyld/RuntimeDyldChecker.cpp | 4 +- .../RuntimeDyld/RuntimeDyldELF.cpp | 39 +- .../RuntimeDyld/RuntimeDyldImpl.h | 7 +- .../Targets/RuntimeDyldCOFFX86_64.h | 9 +- .../ExecutionEngine/SectionMemoryManager.cpp | 20 +- llvm/lib/{Support => FileCheck}/FileCheck.cpp | 410 +- .../{Support => FileCheck}/FileCheckImpl.h | 55 +- llvm/lib/Frontend/OpenMP/OMPContext.cpp | 38 +- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 886 ++- llvm/lib/FuzzMutate/IRMutator.cpp | 43 + llvm/lib/IR/AsmWriter.cpp | 146 +- llvm/lib/IR/Assumptions.cpp | 36 + llvm/lib/IR/AttributeImpl.h | 7 +- llvm/lib/IR/Attributes.cpp | 241 +- llvm/lib/IR/AutoUpgrade.cpp | 454 +- llvm/lib/IR/BasicBlock.cpp | 144 +- llvm/lib/IR/ConstantFold.cpp | 186 +- llvm/lib/IR/ConstantRange.cpp | 97 +- llvm/lib/IR/Constants.cpp | 403 +- llvm/lib/IR/Core.cpp | 51 +- llvm/lib/IR/DIBuilder.cpp | 47 +- llvm/lib/IR/DataLayout.cpp | 412 +- llvm/lib/IR/DebugInfo.cpp | 35 +- llvm/lib/IR/DebugInfoMetadata.cpp | 142 +- llvm/lib/IR/DebugLoc.cpp | 18 +- llvm/lib/IR/DiagnosticInfo.cpp | 26 +- llvm/lib/IR/Dominators.cpp | 24 +- llvm/lib/IR/Function.cpp | 128 +- llvm/lib/IR/Globals.cpp | 11 +- llvm/lib/IR/IRBuilder.cpp | 148 +- llvm/lib/IR/IRPrintingPasses.cpp | 4 +- llvm/lib/IR/Instruction.cpp | 21 +- llvm/lib/IR/Instructions.cpp | 340 +- llvm/lib/IR/IntrinsicInst.cpp | 37 +- llvm/lib/IR/LLVMContext.cpp | 9 +- llvm/lib/IR/LLVMContextImpl.cpp | 40 +- llvm/lib/IR/LLVMContextImpl.h | 231 +- llvm/lib/IR/LLVMRemarkStreamer.cpp | 17 +- llvm/lib/IR/LegacyPassManager.cpp | 211 +- llvm/lib/IR/MDBuilder.cpp | 32 +- llvm/lib/IR/Mangler.cpp | 32 +- llvm/lib/IR/Metadata.cpp | 409 +- llvm/lib/IR/Module.cpp | 9 +- llvm/lib/IR/ModuleSummaryIndex.cpp | 28 +- llvm/lib/IR/OptBisect.cpp | 2 + llvm/lib/IR/Pass.cpp | 13 +- llvm/lib/IR/PassInstrumentation.cpp | 19 + llvm/lib/IR/PassManager.cpp | 48 + llvm/lib/IR/PassRegistry.cpp | 6 +- llvm/lib/IR/PassTimingInfo.cpp | 60 +- llvm/lib/IR/PrintPasses.cpp | 88 + llvm/lib/IR/ProfileSummary.cpp | 2 +- llvm/lib/IR/PseudoProbe.cpp | 58 + llvm/lib/IR/ReplaceConstant.cpp | 70 + llvm/lib/IR/SafepointIRVerifier.cpp | 3 +- llvm/lib/IR/StructuralHash.cpp | 84 + llvm/lib/IR/Type.cpp | 63 +- llvm/lib/IR/Use.cpp | 25 +- llvm/lib/IR/User.cpp | 2 +- llvm/lib/IR/Value.cpp | 86 +- llvm/lib/IR/Verifier.cpp | 402 +- llvm/lib/IRReader/IRReader.cpp | 8 +- llvm/lib/InterfaceStub/ELFObjHandler.cpp | 680 +++ .../ELF => InterfaceStub}/ELFStub.cpp | 2 +- .../ELF => InterfaceStub}/TBEHandler.cpp | 33 +- llvm/lib/LTO/Caching.cpp | 1 + llvm/lib/LTO/LTO.cpp | 75 +- llvm/lib/LTO/LTOBackend.cpp | 242 +- llvm/lib/LTO/LTOCodeGenerator.cpp | 54 +- llvm/lib/LTO/LTOModule.cpp | 3 + llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 68 +- llvm/lib/Linker/IRMover.cpp | 158 +- llvm/lib/Linker/LinkModules.cpp | 2 +- llvm/lib/MC/ELFObjectWriter.cpp | 35 +- llvm/lib/MC/MCAsmBackend.cpp | 15 +- llvm/lib/MC/MCAsmInfo.cpp | 11 +- llvm/lib/MC/MCAsmInfoXCOFF.cpp | 9 + llvm/lib/MC/MCAsmMacro.cpp | 5 + llvm/lib/MC/MCAsmStreamer.cpp | 152 +- llvm/lib/MC/MCAssembler.cpp | 94 +- llvm/lib/MC/MCCodeView.cpp | 5 +- llvm/lib/MC/MCContext.cpp | 57 +- llvm/lib/MC/MCDwarf.cpp | 29 +- llvm/lib/MC/MCELFStreamer.cpp | 35 +- llvm/lib/MC/MCExpr.cpp | 138 +- llvm/lib/MC/MCFragment.cpp | 24 + llvm/lib/MC/MCObjectFileInfo.cpp | 134 +- llvm/lib/MC/MCObjectStreamer.cpp | 90 +- llvm/lib/MC/MCParser/AsmLexer.cpp | 176 +- llvm/lib/MC/MCParser/AsmParser.cpp | 131 +- llvm/lib/MC/MCParser/COFFAsmParser.cpp | 10 +- llvm/lib/MC/MCParser/COFFMasmParser.cpp | 115 +- llvm/lib/MC/MCParser/DarwinAsmParser.cpp | 1 + llvm/lib/MC/MCParser/ELFAsmParser.cpp | 21 +- llvm/lib/MC/MCParser/MasmParser.cpp | 1902 +++--- llvm/lib/MC/MCParser/WasmAsmParser.cpp | 82 +- llvm/lib/MC/MCPseudoProbe.cpp | 213 + llvm/lib/MC/MCSchedule.cpp | 4 +- llvm/lib/MC/MCSection.cpp | 3 +- llvm/lib/MC/MCSectionELF.cpp | 8 +- llvm/lib/MC/MCSectionMachO.cpp | 20 +- llvm/lib/MC/MCSectionWasm.cpp | 10 +- llvm/lib/MC/MCSectionXCOFF.cpp | 1 + llvm/lib/MC/MCStreamer.cpp | 63 +- llvm/lib/MC/MCSubtargetInfo.cpp | 42 +- llvm/lib/MC/MCSymbolXCOFF.cpp | 10 +- llvm/lib/MC/MCWasmStreamer.cpp | 12 - llvm/lib/MC/MCWin64EH.cpp | 487 +- llvm/lib/MC/MCWinCOFFStreamer.cpp | 14 +- llvm/lib/MC/StringTableBuilder.cpp | 15 +- llvm/lib/MC/WasmObjectWriter.cpp | 936 +-- llvm/lib/MC/WinCOFFObjectWriter.cpp | 6 +- llvm/lib/MC/XCOFFObjectWriter.cpp | 27 +- llvm/lib/MCA/HardwareUnits/LSUnit.cpp | 2 + llvm/lib/MCA/HardwareUnits/RegisterFile.cpp | 17 +- llvm/lib/MCA/HardwareUnits/Scheduler.cpp | 2 +- llvm/lib/MCA/InstrBuilder.cpp | 16 +- llvm/lib/MCA/Stages/InstructionTables.cpp | 3 +- llvm/lib/Object/Archive.cpp | 4 +- llvm/lib/Object/ArchiveWriter.cpp | 179 +- llvm/lib/Object/Binary.cpp | 10 +- llvm/lib/Object/COFFObjectFile.cpp | 74 +- llvm/lib/Object/ELF.cpp | 58 +- llvm/lib/Object/ELFObjectFile.cpp | 155 +- llvm/lib/Object/MachOObjectFile.cpp | 40 +- llvm/lib/Object/MachOUniversal.cpp | 29 + llvm/lib/Object/MachOUniversalWriter.cpp | 337 ++ llvm/lib/Object/ObjectFile.cpp | 5 +- llvm/lib/Object/RelocationResolver.cpp | 300 +- llvm/lib/Object/SymbolSize.cpp | 2 +- llvm/lib/Object/SymbolicFile.cpp | 59 +- llvm/lib/Object/WasmObjectFile.cpp | 350 +- llvm/lib/Object/XCOFFObjectFile.cpp | 303 +- llvm/lib/ObjectYAML/ArchiveEmitter.cpp | 51 + llvm/lib/ObjectYAML/ArchiveYAML.cpp | 58 + llvm/lib/ObjectYAML/COFFEmitter.cpp | 1 - llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp | 25 +- llvm/lib/ObjectYAML/DWARFEmitter.cpp | 1071 +++- llvm/lib/ObjectYAML/DWARFVisitor.cpp | 196 - llvm/lib/ObjectYAML/DWARFVisitor.h | 97 - llvm/lib/ObjectYAML/DWARFYAML.cpp | 168 +- llvm/lib/ObjectYAML/ELFEmitter.cpp | 685 +-- llvm/lib/ObjectYAML/ELFYAML.cpp | 490 +- llvm/lib/ObjectYAML/MachOEmitter.cpp | 46 +- llvm/lib/ObjectYAML/MachOYAML.cpp | 4 +- llvm/lib/ObjectYAML/MinidumpYAML.cpp | 4 +- llvm/lib/ObjectYAML/ObjectYAML.cpp | 9 +- llvm/lib/ObjectYAML/WasmEmitter.cpp | 42 +- llvm/lib/ObjectYAML/WasmYAML.cpp | 13 +- llvm/lib/ObjectYAML/yaml2obj.cpp | 2 + llvm/lib/Option/OptTable.cpp | 109 +- llvm/lib/Option/Option.cpp | 15 +- llvm/lib/Passes/PassBuilder.cpp | 841 ++- llvm/lib/Passes/PassRegistry.def | 83 +- llvm/lib/Passes/StandardInstrumentations.cpp | 744 ++- .../ProfileData/Coverage/CoverageMapping.cpp | 35 +- .../Coverage/CoverageMappingReader.cpp | 53 +- .../Coverage/CoverageMappingWriter.cpp | 16 +- llvm/lib/ProfileData/GCOV.cpp | 930 +-- llvm/lib/ProfileData/InstrProf.cpp | 41 +- llvm/lib/ProfileData/InstrProfReader.cpp | 36 +- llvm/lib/ProfileData/InstrProfWriter.cpp | 12 +- .../lib/ProfileData/ProfileSummaryBuilder.cpp | 11 +- llvm/lib/ProfileData/SampleProf.cpp | 83 +- llvm/lib/ProfileData/SampleProfReader.cpp | 257 +- llvm/lib/ProfileData/SampleProfWriter.cpp | 291 +- llvm/lib/Remarks/BitstreamRemarkParser.cpp | 1 - llvm/lib/Remarks/BitstreamRemarkParser.h | 6 +- llvm/lib/Support/AArch64TargetParser.cpp | 16 +- llvm/lib/Support/AMDGPUMetadata.cpp | 3 +- .../lib/Support/APFixedPoint.cpp | 270 +- llvm/lib/Support/APFloat.cpp | 95 +- llvm/lib/Support/APInt.cpp | 17 +- llvm/lib/Support/ARMAttributeParser.cpp | 2 +- llvm/lib/Support/ARMTargetParser.cpp | 33 +- llvm/lib/Support/CRC.cpp | 2 +- llvm/lib/Support/CachePruning.cpp | 5 +- llvm/lib/Support/CommandLine.cpp | 70 +- llvm/lib/Support/Compression.cpp | 4 +- llvm/lib/Support/ConvertUTFWrapper.cpp | 2 + llvm/lib/Support/CrashRecoveryContext.cpp | 39 +- llvm/lib/Support/DebugCounter.cpp | 2 +- llvm/lib/Support/DynamicLibrary.cpp | 4 +- llvm/lib/Support/ELFAttributeParser.cpp | 2 +- llvm/lib/Support/Error.cpp | 4 + llvm/lib/Support/ErrorHandling.cpp | 11 +- llvm/lib/Support/FileCollector.cpp | 130 +- llvm/lib/Support/FormatVariadic.cpp | 23 +- llvm/lib/Support/Host.cpp | 235 +- llvm/lib/Support/InitLLVM.cpp | 11 +- llvm/lib/Support/InstructionCost.cpp | 24 + llvm/lib/Support/JSON.cpp | 219 +- llvm/lib/Support/KnownBits.cpp | 397 ++ llvm/lib/Support/LineIterator.cpp | 8 +- llvm/lib/Support/LowLevelType.cpp | 2 +- llvm/lib/Support/MemoryBufferRef.cpp | 19 + llvm/lib/Support/Path.cpp | 52 +- llvm/lib/Support/PrettyStackTrace.cpp | 13 +- llvm/lib/Support/Process.cpp | 21 +- llvm/lib/Support/Program.cpp | 14 +- llvm/lib/Support/SHA1.cpp | 2 +- llvm/lib/Support/Signals.cpp | 9 +- llvm/lib/Support/Signposts.cpp | 41 +- llvm/lib/Support/SmallVector.cpp | 68 +- llvm/lib/Support/SourceMgr.cpp | 56 +- llvm/lib/Support/TargetParser.cpp | 175 +- llvm/lib/Support/Timer.cpp | 14 +- llvm/lib/Support/TrigramIndex.cpp | 7 +- llvm/lib/Support/Triple.cpp | 98 +- llvm/lib/Support/Unicode.cpp | 11 + llvm/lib/Support/Unix/Path.inc | 76 +- llvm/lib/Support/Unix/Process.inc | 6 +- llvm/lib/Support/Unix/Program.inc | 6 +- llvm/lib/Support/Unix/Signals.inc | 29 +- llvm/lib/Support/Unix/Threading.inc | 9 +- llvm/lib/Support/VirtualFileSystem.cpp | 158 +- llvm/lib/Support/Windows/Path.inc | 58 +- llvm/lib/Support/Windows/Process.inc | 3 +- llvm/lib/Support/Windows/Program.inc | 59 +- llvm/lib/Support/Windows/Signals.inc | 5 +- llvm/lib/Support/Windows/Threading.inc | 25 +- llvm/lib/Support/X86TargetParser.cpp | 409 +- llvm/lib/Support/YAMLParser.cpp | 155 +- llvm/lib/Support/YAMLTraits.cpp | 75 +- llvm/lib/Support/raw_ostream.cpp | 59 +- llvm/lib/TableGen/DetailedRecordsBackend.cpp | 203 + llvm/lib/TableGen/Error.cpp | 85 +- llvm/lib/TableGen/JSONBackend.cpp | 5 +- llvm/lib/TableGen/Main.cpp | 43 +- llvm/lib/TableGen/Record.cpp | 519 +- llvm/lib/TableGen/TGLexer.cpp | 53 +- llvm/lib/TableGen/TGLexer.h | 28 +- llvm/lib/TableGen/TGParser.cpp | 724 ++- llvm/lib/TableGen/TGParser.h | 5 + llvm/lib/TableGen/TableGenBackendSkeleton.cpp | 64 + llvm/lib/Target/AArch64/AArch64.h | 8 +- llvm/lib/Target/AArch64/AArch64.td | 200 +- .../AArch64/AArch64AdvSIMDScalarPass.cpp | 2 +- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 414 +- .../Target/AArch64/AArch64BranchTargets.cpp | 5 +- .../AArch64/AArch64CallingConvention.cpp | 58 +- llvm/lib/Target/AArch64/AArch64Combine.td | 64 +- .../AArch64/AArch64CompressJumpTables.cpp | 41 +- .../AArch64/AArch64ExpandPseudoInsts.cpp | 44 + .../Target/AArch64/AArch64FalkorHWPFFix.cpp | 10 +- llvm/lib/Target/AArch64/AArch64FastISel.cpp | 18 +- .../Target/AArch64/AArch64FrameLowering.cpp | 721 ++- .../lib/Target/AArch64/AArch64FrameLowering.h | 41 +- .../Target/AArch64/AArch64ISelDAGToDAG.cpp | 218 +- .../Target/AArch64/AArch64ISelLowering.cpp | 3217 ++++++++-- llvm/lib/Target/AArch64/AArch64ISelLowering.h | 139 +- .../lib/Target/AArch64/AArch64InstrFormats.td | 135 +- llvm/lib/Target/AArch64/AArch64InstrGISel.td | 60 + llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 556 +- llvm/lib/Target/AArch64/AArch64InstrInfo.h | 52 +- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 334 +- .../AArch64/AArch64LoadStoreOptimizer.cpp | 43 +- .../lib/Target/AArch64/AArch64MCInstLower.cpp | 6 + .../AArch64/AArch64MachineFunctionInfo.cpp | 82 + .../AArch64/AArch64MachineFunctionInfo.h | 74 +- .../lib/Target/AArch64/AArch64MacroFusion.cpp | 16 +- .../AArch64RedundantCopyElimination.cpp | 5 + .../Target/AArch64/AArch64RegisterInfo.cpp | 162 +- llvm/lib/Target/AArch64/AArch64RegisterInfo.h | 21 +- .../lib/Target/AArch64/AArch64RegisterInfo.td | 29 + .../Target/AArch64/AArch64SIMDInstrOpt.cpp | 10 +- .../lib/Target/AArch64/AArch64SVEInstrInfo.td | 696 ++- llvm/lib/Target/AArch64/AArch64SchedA55.td | 339 ++ llvm/lib/Target/AArch64/AArch64SchedA57.td | 61 +- .../Target/AArch64/AArch64SchedA57WriteRes.td | 19 + llvm/lib/Target/AArch64/AArch64SchedA64FX.td | 3890 ++++++++++++ llvm/lib/Target/AArch64/AArch64SchedTSV110.td | 745 +++ .../AArch64/AArch64SelectionDAGInfo.cpp | 6 +- llvm/lib/Target/AArch64/AArch64StackOffset.h | 139 - .../Target/AArch64/AArch64StackTagging.cpp | 22 +- .../AArch64/AArch64StackTaggingPreRA.cpp | 167 +- llvm/lib/Target/AArch64/AArch64Subtarget.cpp | 22 +- llvm/lib/Target/AArch64/AArch64Subtarget.h | 52 +- .../Target/AArch64/AArch64SystemOperands.td | 253 +- .../Target/AArch64/AArch64TargetMachine.cpp | 57 +- .../lib/Target/AArch64/AArch64TargetMachine.h | 6 + .../AArch64/AArch64TargetTransformInfo.cpp | 196 +- .../AArch64/AArch64TargetTransformInfo.h | 52 +- .../AArch64/AsmParser/AArch64AsmParser.cpp | 646 +- .../Disassembler/AArch64Disassembler.cpp | 45 +- .../AArch64/GISel/AArch64CallLowering.cpp | 115 +- .../AArch64/GISel/AArch64CallLowering.h | 5 +- .../AArch64/GISel/AArch64GlobalISelUtils.h | 29 + .../GISel/AArch64InstructionSelector.cpp | 1829 +++--- .../AArch64/GISel/AArch64LegalizerInfo.cpp | 360 +- .../AArch64/GISel/AArch64LegalizerInfo.h | 2 + .../GISel/AArch64PostLegalizerCombiner.cpp | 547 +- .../GISel/AArch64PostLegalizerLowering.cpp | 704 +++ .../GISel/AArch64PostSelectOptimize.cpp | 187 + .../GISel/AArch64PreLegalizerCombiner.cpp | 29 +- .../AArch64/GISel/AArch64RegisterBankInfo.cpp | 93 +- .../AArch64/GISel/AArch64RegisterBankInfo.h | 15 +- .../lib/Target/AArch64/GISel/select-saddo.mir | 158 + .../lib/Target/AArch64/GISel/select-ssubo.mir | 158 + .../MCTargetDesc/AArch64AddressingModes.h | 6 +- .../MCTargetDesc/AArch64AsmBackend.cpp | 27 +- .../MCTargetDesc/AArch64ELFObjectWriter.cpp | 6 +- .../MCTargetDesc/AArch64ELFStreamer.cpp | 63 + .../MCTargetDesc/AArch64InstPrinter.cpp | 34 +- .../AArch64/MCTargetDesc/AArch64InstPrinter.h | 8 +- .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 +- .../AArch64/MCTargetDesc/AArch64MCExpr.cpp | 1 + .../AArch64/MCTargetDesc/AArch64MCExpr.h | 2 + .../MCTargetDesc/AArch64MCTargetDesc.cpp | 8 +- .../MCTargetDesc/AArch64MachObjectWriter.cpp | 6 +- .../MCTargetDesc/AArch64TargetStreamer.cpp | 57 +- .../MCTargetDesc/AArch64TargetStreamer.h | 22 + .../AArch64WinCOFFObjectWriter.cpp | 28 +- .../MCTargetDesc/AArch64WinCOFFStreamer.cpp | 37 +- llvm/lib/Target/AArch64/SVEInstrFormats.td | 569 +- llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp | 62 +- .../Target/AArch64/Utils/AArch64BaseInfo.cpp | 9 +- .../Target/AArch64/Utils/AArch64BaseInfo.h | 20 +- llvm/lib/Target/AMDGPU/AMDGPU.h | 99 +- llvm/lib/Target/AMDGPU/AMDGPU.td | 197 +- .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 58 +- llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h | 22 +- .../Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp | 31 +- .../AMDGPU/AMDGPUAnnotateKernelFeatures.cpp | 21 +- .../AMDGPU/AMDGPUAnnotateUniformValues.cpp | 28 +- .../Target/AMDGPU/AMDGPUArgumentUsageInfo.cpp | 4 +- .../Target/AMDGPU/AMDGPUArgumentUsageInfo.h | 7 +- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 162 +- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h | 24 +- .../Target/AMDGPU/AMDGPUAtomicOptimizer.cpp | 18 +- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp | 866 ++- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h | 41 +- llvm/lib/Target/AMDGPU/AMDGPUCallingConv.td | 76 +- .../Target/AMDGPU/AMDGPUCodeGenPrepare.cpp | 39 +- llvm/lib/Target/AMDGPU/AMDGPUCombine.td | 32 +- .../Target/AMDGPU/AMDGPUExportClustering.cpp | 10 +- .../Target/AMDGPU/AMDGPUExportClustering.h | 3 +- llvm/lib/Target/AMDGPU/AMDGPUGISel.td | 39 +- .../AMDGPU/AMDGPUGenRegisterBankInfo.def | 12 +- .../Target/AMDGPU/AMDGPUGlobalISelUtils.cpp | 12 +- .../lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h | 38 +- .../AMDGPU/AMDGPUHSAMetadataStreamer.cpp | 122 +- .../Target/AMDGPU/AMDGPUHSAMetadataStreamer.h | 23 +- llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | 603 +- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 237 +- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h | 24 +- llvm/lib/Target/AMDGPU/AMDGPUInline.cpp | 226 - .../AMDGPU/AMDGPUInstCombineIntrinsic.cpp | 1075 ++++ llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp | 10 +- llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h | 25 +- .../AMDGPU/AMDGPUInstructionSelector.cpp | 1103 +++- .../Target/AMDGPU/AMDGPUInstructionSelector.h | 64 +- llvm/lib/Target/AMDGPU/AMDGPUInstructions.td | 159 +- .../AMDGPU/AMDGPULateCodeGenPrepare.cpp | 195 + .../lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | 1261 ++-- llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h | 48 +- llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp | 93 +- llvm/lib/Target/AMDGPU/AMDGPULibFunc.cpp | 5 +- .../Target/AMDGPU/AMDGPULowerIntrinsics.cpp | 10 +- .../AMDGPU/AMDGPULowerKernelArguments.cpp | 53 +- .../AMDGPU/AMDGPULowerKernelAttributes.cpp | 38 +- llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp | 7 +- llvm/lib/Target/AMDGPU/AMDGPUMIRFormatter.cpp | 38 + llvm/lib/Target/AMDGPU/AMDGPUMIRFormatter.h | 47 + .../AMDGPU/AMDGPUMachineCFGStructurizer.cpp | 62 +- .../Target/AMDGPU/AMDGPUMachineFunction.cpp | 36 +- .../lib/Target/AMDGPU/AMDGPUMachineFunction.h | 24 +- .../Target/AMDGPU/AMDGPUMachineModuleInfo.cpp | 1 - .../Target/AMDGPU/AMDGPUMachineModuleInfo.h | 4 - llvm/lib/Target/AMDGPU/AMDGPUMacroFusion.cpp | 4 +- llvm/lib/Target/AMDGPU/AMDGPUMacroFusion.h | 3 +- .../AMDGPUOpenCLEnqueuedBlockLowering.cpp | 5 - llvm/lib/Target/AMDGPU/AMDGPUPTNote.h | 7 +- .../Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp | 4 - .../Target/AMDGPU/AMDGPUPerfHintAnalysis.h | 1 - .../AMDGPU/AMDGPUPostLegalizerCombiner.cpp | 120 +- .../AMDGPU/AMDGPUPreLegalizerCombiner.cpp | 8 +- .../AMDGPU/AMDGPUPrintfRuntimeBinding.cpp | 154 +- .../lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 283 +- .../AMDGPU/AMDGPUPropagateAttributes.cpp | 49 +- .../Target/AMDGPU/AMDGPURegBankCombiner.cpp | 10 +- .../Target/AMDGPU/AMDGPURegisterBankInfo.cpp | 372 +- .../Target/AMDGPU/AMDGPURegisterBankInfo.h | 8 +- llvm/lib/Target/AMDGPU/AMDGPURegisterBanks.td | 2 +- .../AMDGPU/AMDGPURewriteOutArguments.cpp | 33 +- .../Target/AMDGPU/AMDGPUSearchableTables.td | 2 + llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp | 172 +- llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h | 1204 +--- .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 252 +- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h | 23 +- .../Target/AMDGPU/AMDGPUTargetObjectFile.cpp | 9 +- .../AMDGPU/AMDGPUTargetTransformInfo.cpp | 365 +- .../Target/AMDGPU/AMDGPUTargetTransformInfo.h | 106 +- .../AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp | 63 +- .../lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp | 66 +- .../Target/AMDGPU/AMDILCFGStructurizer.cpp | 29 +- llvm/lib/Target/AMDGPU/AMDKernelCodeT.h | 8 +- .../AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 1995 ++++--- llvm/lib/Target/AMDGPU/BUFInstructions.td | 237 +- llvm/lib/Target/AMDGPU/DSInstructions.td | 119 +- .../Disassembler/AMDGPUDisassembler.cpp | 435 +- .../AMDGPU/Disassembler/AMDGPUDisassembler.h | 39 +- llvm/lib/Target/AMDGPU/EXPInstructions.td | 125 + .../Target/AMDGPU/EvergreenInstructions.td | 138 +- llvm/lib/Target/AMDGPU/FLATInstructions.td | 694 ++- llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp | 22 +- .../lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 220 +- llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h | 3 +- llvm/lib/Target/AMDGPU/GCNILPSched.cpp | 1 - .../Target/AMDGPU/GCNIterativeScheduler.cpp | 21 - .../lib/Target/AMDGPU/GCNIterativeScheduler.h | 6 - llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp | 13 - llvm/lib/Target/AMDGPU/GCNNSAReassign.cpp | 39 +- llvm/lib/Target/AMDGPU/GCNProcessors.td | 48 +- llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp | 266 +- llvm/lib/Target/AMDGPU/GCNRegPressure.cpp | 38 +- llvm/lib/Target/AMDGPU/GCNRegPressure.h | 12 +- llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp | 10 +- llvm/lib/Target/AMDGPU/GCNSubtarget.h | 1064 ++++ .../AMDGPU}/InstCombineTables.td | 0 .../AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp | 9 +- .../MCTargetDesc/AMDGPUELFObjectWriter.cpp | 6 - .../AMDGPU/MCTargetDesc/AMDGPUELFStreamer.cpp | 3 +- .../AMDGPU/MCTargetDesc/AMDGPUELFStreamer.h | 6 +- .../AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | 217 +- .../AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h | 12 +- .../AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp | 1 - .../AMDGPU/MCTargetDesc/AMDGPUMCCodeEmitter.h | 2 +- .../MCTargetDesc/AMDGPUMCTargetDesc.cpp | 12 +- .../AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h | 14 +- .../MCTargetDesc/AMDGPUTargetStreamer.cpp | 81 +- .../MCTargetDesc/AMDGPUTargetStreamer.h | 18 +- .../AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp | 9 +- .../AMDGPU/MCTargetDesc/SIMCCodeEmitter.cpp | 16 +- llvm/lib/Target/AMDGPU/MIMGInstructions.td | 129 +- llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp | 4 +- .../lib/Target/AMDGPU/R600ClauseMergePass.cpp | 11 +- .../AMDGPU/R600ControlFlowFinalizer.cpp | 36 +- llvm/lib/Target/AMDGPU/R600Defines.h | 2 - .../Target/AMDGPU/R600EmitClauseMarkers.cpp | 20 +- .../Target/AMDGPU/R600ExpandSpecialInstrs.cpp | 16 +- llvm/lib/Target/AMDGPU/R600FrameLowering.cpp | 13 +- llvm/lib/Target/AMDGPU/R600FrameLowering.h | 4 +- llvm/lib/Target/AMDGPU/R600ISelLowering.cpp | 59 +- llvm/lib/Target/AMDGPU/R600InstrInfo.cpp | 44 +- llvm/lib/Target/AMDGPU/R600InstrInfo.h | 4 +- llvm/lib/Target/AMDGPU/R600Instructions.td | 8 +- .../Target/AMDGPU/R600MachineScheduler.cpp | 15 +- llvm/lib/Target/AMDGPU/R600MachineScheduler.h | 2 +- .../R600OpenCLImageTypeLoweringPass.cpp | 15 - .../AMDGPU/R600OptimizeVectorRegisters.cpp | 23 +- llvm/lib/Target/AMDGPU/R600Packetizer.cpp | 7 +- llvm/lib/Target/AMDGPU/R600RegisterInfo.cpp | 10 +- llvm/lib/Target/AMDGPU/R600RegisterInfo.h | 2 +- llvm/lib/Target/AMDGPU/R600Subtarget.h | 174 + llvm/lib/Target/AMDGPU/SIAddIMGInit.cpp | 13 +- .../Target/AMDGPU/SIAnnotateControlFlow.cpp | 37 +- llvm/lib/Target/AMDGPU/SIDefines.h | 257 +- llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp | 144 +- llvm/lib/Target/AMDGPU/SIFixVGPRCopies.cpp | 3 +- llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp | 239 - llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 327 +- .../lib/Target/AMDGPU/SIFormMemoryClauses.cpp | 55 +- llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 406 +- llvm/lib/Target/AMDGPU/SIFrameLowering.h | 6 +- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2027 ++++--- llvm/lib/Target/AMDGPU/SIISelLowering.h | 56 +- .../lib/Target/AMDGPU/SIInsertHardClauses.cpp | 5 +- llvm/lib/Target/AMDGPU/SIInsertSkips.cpp | 163 +- llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 243 +- llvm/lib/Target/AMDGPU/SIInstrFormats.td | 52 +- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 1559 +++-- llvm/lib/Target/AMDGPU/SIInstrInfo.h | 104 +- llvm/lib/Target/AMDGPU/SIInstrInfo.td | 552 +- llvm/lib/Target/AMDGPU/SIInstructions.td | 566 +- .../Target/AMDGPU/SILoadStoreOptimizer.cpp | 52 +- llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp | 316 +- llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp | 38 +- llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp | 111 +- .../Target/AMDGPU/SIMachineFunctionInfo.cpp | 72 +- .../lib/Target/AMDGPU/SIMachineFunctionInfo.h | 65 +- llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp | 42 +- llvm/lib/Target/AMDGPU/SIMachineScheduler.h | 10 +- llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp | 680 ++- llvm/lib/Target/AMDGPU/SIModeRegister.cpp | 24 +- .../Target/AMDGPU/SIOptimizeExecMasking.cpp | 59 +- .../AMDGPU/SIOptimizeExecMaskingPreRA.cpp | 206 +- llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp | 76 +- llvm/lib/Target/AMDGPU/SIPostRABundler.cpp | 6 +- .../Target/AMDGPU/SIPreAllocateWWMRegs.cpp | 17 +- llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp | 44 +- llvm/lib/Target/AMDGPU/SIProgramInfo.cpp | 56 + llvm/lib/Target/AMDGPU/SIProgramInfo.h | 12 +- llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp | 748 ++- llvm/lib/Target/AMDGPU/SIRegisterInfo.h | 42 +- llvm/lib/Target/AMDGPU/SIRegisterInfo.td | 52 +- .../AMDGPU/SIRemoveShortExecBranches.cpp | 3 +- llvm/lib/Target/AMDGPU/SISchedule.td | 15 +- .../Target/AMDGPU/SIShrinkInstructions.cpp | 146 +- llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp | 204 +- llvm/lib/Target/AMDGPU/SMInstructions.td | 4 +- llvm/lib/Target/AMDGPU/SOPInstructions.td | 623 +- .../Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp | 247 + llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.h | 15 + .../Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 473 +- llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | 191 +- .../Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp | 50 +- .../Target/AMDGPU/Utils/AMDGPUPALMetadata.h | 18 +- .../AMDGPU/Utils/AMDKernelCodeTUtils.cpp | 4 +- .../Target/AMDGPU/Utils/AMDKernelCodeTUtils.h | 2 +- llvm/lib/Target/AMDGPU/VOP1Instructions.td | 29 +- llvm/lib/Target/AMDGPU/VOP2Instructions.td | 225 +- llvm/lib/Target/AMDGPU/VOP3Instructions.td | 588 +- llvm/lib/Target/AMDGPU/VOP3PInstructions.td | 267 +- llvm/lib/Target/AMDGPU/VOPCInstructions.td | 2 +- llvm/lib/Target/AMDGPU/VOPInstructions.td | 38 +- llvm/lib/Target/ARC/ARCISelLowering.cpp | 1 - llvm/lib/Target/ARC/ARCSubtarget.cpp | 2 +- llvm/lib/Target/ARC/ARCSubtarget.h | 2 +- llvm/lib/Target/ARC/ARCTargetMachine.cpp | 4 +- .../Target/ARC/MCTargetDesc/ARCInstPrinter.h | 1 + .../ARC/MCTargetDesc/ARCMCTargetDesc.cpp | 2 +- llvm/lib/Target/ARM/A15SDOptimizer.cpp | 3 +- llvm/lib/Target/ARM/ARM.h | 5 + llvm/lib/Target/ARM/ARM.td | 109 +- llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 48 +- llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 725 ++- llvm/lib/Target/ARM/ARMBaseInstrInfo.h | 221 +- llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp | 21 +- llvm/lib/Target/ARM/ARMBaseRegisterInfo.h | 10 +- llvm/lib/Target/ARM/ARMBlockPlacement.cpp | 231 + llvm/lib/Target/ARM/ARMCallLowering.cpp | 68 +- llvm/lib/Target/ARM/ARMCallLowering.h | 6 +- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 79 +- llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp | 92 +- llvm/lib/Target/ARM/ARMFastISel.cpp | 18 +- llvm/lib/Target/ARM/ARMFeatures.h | 1 + llvm/lib/Target/ARM/ARMFrameLowering.cpp | 13 +- llvm/lib/Target/ARM/ARMFrameLowering.h | 5 +- llvm/lib/Target/ARM/ARMHazardRecognizer.cpp | 190 +- llvm/lib/Target/ARM/ARMHazardRecognizer.h | 46 +- llvm/lib/Target/ARM/ARMISelLowering.cpp | 731 ++- llvm/lib/Target/ARM/ARMISelLowering.h | 46 +- llvm/lib/Target/ARM/ARMInstrFormats.td | 5 +- llvm/lib/Target/ARM/ARMInstrInfo.td | 92 +- llvm/lib/Target/ARM/ARMInstrMVE.td | 801 ++- llvm/lib/Target/ARM/ARMInstrNEON.td | 147 +- llvm/lib/Target/ARM/ARMInstrThumb.td | 13 +- llvm/lib/Target/ARM/ARMInstrThumb2.td | 51 +- llvm/lib/Target/ARM/ARMInstrVFP.td | 51 +- .../lib/Target/ARM/ARMInstructionSelector.cpp | 2 - llvm/lib/Target/ARM/ARMLegalizerInfo.cpp | 2 +- llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 449 +- llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp | 1529 ++--- llvm/lib/Target/ARM/ARMParallelDSP.cpp | 6 +- llvm/lib/Target/ARM/ARMPredicates.td | 5 + llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp | 12 +- llvm/lib/Target/ARM/ARMRegisterInfo.td | 17 + llvm/lib/Target/ARM/ARMSLSHardening.cpp | 416 ++ llvm/lib/Target/ARM/ARMSchedule.td | 66 +- llvm/lib/Target/ARM/ARMScheduleA57.td | 141 +- llvm/lib/Target/ARM/ARMScheduleA57WriteRes.td | 11 +- llvm/lib/Target/ARM/ARMScheduleA9.td | 4 +- llvm/lib/Target/ARM/ARMScheduleM7.td | 488 ++ llvm/lib/Target/ARM/ARMScheduleR52.td | 4 +- llvm/lib/Target/ARM/ARMScheduleSwift.td | 4 +- llvm/lib/Target/ARM/ARMSubtarget.cpp | 14 +- llvm/lib/Target/ARM/ARMSubtarget.h | 19 +- llvm/lib/Target/ARM/ARMTargetMachine.cpp | 28 +- llvm/lib/Target/ARM/ARMTargetMachine.h | 6 + .../lib/Target/ARM/ARMTargetTransformInfo.cpp | 860 ++- llvm/lib/Target/ARM/ARMTargetTransformInfo.h | 54 +- .../lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 28 +- .../ARM/Disassembler/ARMDisassembler.cpp | 7 +- .../ARM/MCTargetDesc/ARMAddressingModes.h | 26 + .../Target/ARM/MCTargetDesc/ARMAsmBackend.cpp | 1 + .../lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h | 2 +- .../ARM/MCTargetDesc/ARMELFStreamer.cpp | 2 - .../Target/ARM/MCTargetDesc/ARMInstPrinter.h | 1 + .../Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp | 1 + .../ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 132 +- .../Target/ARM/MCTargetDesc/ARMMCTargetDesc.h | 15 + .../Target/ARM/MVEGatherScatterLowering.cpp | 253 +- llvm/lib/Target/ARM/MVETailPredUtils.h | 157 + llvm/lib/Target/ARM/MVETailPredication.cpp | 497 +- llvm/lib/Target/ARM/MVEVPTBlockPass.cpp | 23 +- .../Target/ARM/MVEVPTOptimisationsPass.cpp | 460 +- llvm/lib/Target/ARM/Thumb2InstrInfo.cpp | 47 + llvm/lib/Target/ARM/Thumb2InstrInfo.h | 8 + llvm/lib/Target/ARM/Thumb2SizeReduction.cpp | 2 +- llvm/lib/Target/AVR/AVRDevices.td | 21 +- llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp | 147 + llvm/lib/Target/AVR/AVRFrameLowering.cpp | 33 +- llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp | 5 +- llvm/lib/Target/AVR/AVRISelLowering.cpp | 139 +- llvm/lib/Target/AVR/AVRISelLowering.h | 7 + llvm/lib/Target/AVR/AVRInstrInfo.td | 35 +- llvm/lib/Target/AVR/AVRSubtarget.cpp | 6 +- llvm/lib/Target/AVR/AVRSubtarget.h | 2 +- llvm/lib/Target/AVR/AVRTargetMachine.cpp | 2 +- .../lib/Target/AVR/AsmParser/AVRAsmParser.cpp | 5 +- .../Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | 2 +- .../Target/AVR/MCTargetDesc/AVRAsmBackend.h | 6 +- .../Target/AVR/MCTargetDesc/AVRInstPrinter.h | 1 + .../lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp | 14 +- .../AVR/MCTargetDesc/AVRMCTargetDesc.cpp | 2 +- llvm/lib/Target/BPF/BPF.h | 37 +- .../Target/BPF/BPFAbstractMemberAccess.cpp | 323 +- llvm/lib/Target/BPF/BPFAdjustOpt.cpp | 323 + llvm/lib/Target/BPF/BPFCORE.h | 30 + llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp | 130 + llvm/lib/Target/BPF/BPFISelDAGToDAG.cpp | 6 +- llvm/lib/Target/BPF/BPFISelLowering.cpp | 1 - llvm/lib/Target/BPF/BPFInstrFormats.td | 11 +- llvm/lib/Target/BPF/BPFInstrInfo.td | 210 +- llvm/lib/Target/BPF/BPFMIChecking.cpp | 78 +- llvm/lib/Target/BPF/BPFPreserveDIType.cpp | 118 +- llvm/lib/Target/BPF/BPFSubtarget.cpp | 4 +- llvm/lib/Target/BPF/BPFSubtarget.h | 2 +- llvm/lib/Target/BPF/BPFTargetMachine.cpp | 59 +- llvm/lib/Target/BPF/BPFTargetMachine.h | 4 + llvm/lib/Target/BPF/BTFDebug.cpp | 44 +- llvm/lib/Target/BPF/BTFDebug.h | 10 +- .../BPF/Disassembler/BPFDisassembler.cpp | 4 +- .../Target/BPF/MCTargetDesc/BPFAsmBackend.cpp | 5 - .../Target/BPF/MCTargetDesc/BPFInstPrinter.h | 1 + .../BPF/MCTargetDesc/BPFMCCodeEmitter.cpp | 11 +- .../BPF/MCTargetDesc/BPFMCTargetDesc.cpp | 2 +- llvm/lib/Target/CSKY/CSKY.td | 32 + llvm/lib/Target/CSKY/CSKYInstrFormats.td | 528 ++ llvm/lib/Target/CSKY/CSKYInstrInfo.td | 108 + llvm/lib/Target/CSKY/CSKYRegisterInfo.td | 182 + llvm/lib/Target/CSKY/CSKYTargetMachine.cpp | 68 + llvm/lib/Target/CSKY/CSKYTargetMachine.h | 38 + .../CSKY/MCTargetDesc/CSKYAsmBackend.cpp | 69 + .../Target/CSKY/MCTargetDesc/CSKYAsmBackend.h | 39 + .../CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp | 45 + .../CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp | 25 + .../Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.h | 29 + .../CSKY/MCTargetDesc/CSKYMCCodeEmitter.cpp | 71 + .../CSKY/MCTargetDesc/CSKYMCCodeEmitter.h | 61 + .../CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp | 62 + .../CSKY/MCTargetDesc/CSKYMCTargetDesc.h | 48 + .../Target/CSKY/TargetInfo/CSKYTargetInfo.cpp | 20 + .../Target/CSKY/TargetInfo/CSKYTargetInfo.h | 20 + .../Hexagon/AsmParser/HexagonAsmParser.cpp | 6 +- llvm/lib/Target/Hexagon/BitTracker.cpp | 27 +- llvm/lib/Target/Hexagon/BitTracker.h | 17 +- .../Disassembler/HexagonDisassembler.cpp | 6 +- llvm/lib/Target/Hexagon/Hexagon.h | 5 +- llvm/lib/Target/Hexagon/HexagonAsmPrinter.h | 0 .../lib/Target/Hexagon/HexagonBitSimplify.cpp | 76 +- llvm/lib/Target/Hexagon/HexagonBitTracker.cpp | 8 +- llvm/lib/Target/Hexagon/HexagonBitTracker.h | 4 +- .../lib/Target/Hexagon/HexagonBlockRanges.cpp | 6 +- llvm/lib/Target/Hexagon/HexagonBlockRanges.h | 5 +- .../Target/Hexagon/HexagonCFGOptimizer.cpp | 1 + llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp | 16 +- .../Target/Hexagon/HexagonConstExtenders.cpp | 12 +- .../Hexagon/HexagonConstPropagation.cpp | 41 +- .../Target/Hexagon/HexagonCopyToCombine.cpp | 2 + .../lib/Target/Hexagon/HexagonEarlyIfConv.cpp | 6 +- .../Target/Hexagon/HexagonExpandCondsets.cpp | 91 +- .../Target/Hexagon/HexagonFrameLowering.cpp | 13 +- .../lib/Target/Hexagon/HexagonFrameLowering.h | 5 +- llvm/lib/Target/Hexagon/HexagonGenInsert.cpp | 16 +- .../Target/Hexagon/HexagonGenPredicate.cpp | 17 +- .../Target/Hexagon/HexagonHardwareLoops.cpp | 6 +- .../Target/Hexagon/HexagonISelDAGToDAG.cpp | 4 +- .../Target/Hexagon/HexagonISelDAGToDAGHVX.cpp | 229 +- .../Target/Hexagon/HexagonISelLowering.cpp | 162 +- llvm/lib/Target/Hexagon/HexagonISelLowering.h | 801 +-- .../Target/Hexagon/HexagonISelLoweringHVX.cpp | 738 ++- llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 7 +- llvm/lib/Target/Hexagon/HexagonInstrInfo.h | 4 +- .../Target/Hexagon/HexagonIntrinsicsV60.td | 2 +- .../Hexagon/HexagonLoopIdiomRecognition.cpp | 267 +- .../Hexagon/HexagonLoopIdiomRecognition.h | 24 + .../lib/Target/Hexagon/HexagonMCInstLower.cpp | 2 +- .../lib/Target/Hexagon/HexagonOptAddrMode.cpp | 2 +- .../Hexagon/HexagonOptimizeSZextends.cpp | 4 +- llvm/lib/Target/Hexagon/HexagonPatterns.td | 119 +- llvm/lib/Target/Hexagon/HexagonPatternsHVX.td | 236 +- llvm/lib/Target/Hexagon/HexagonPeephole.cpp | 11 +- .../Target/Hexagon/HexagonRegisterInfo.cpp | 2 +- .../lib/Target/Hexagon/HexagonSplitDouble.cpp | 23 +- llvm/lib/Target/Hexagon/HexagonSubtarget.cpp | 89 +- llvm/lib/Target/Hexagon/HexagonSubtarget.h | 30 +- .../Target/Hexagon/HexagonTargetMachine.cpp | 71 +- .../lib/Target/Hexagon/HexagonTargetMachine.h | 2 + .../Hexagon/HexagonTargetObjectFile.cpp | 1 + .../Hexagon/HexagonTargetTransformInfo.cpp | 47 +- .../Hexagon/HexagonTargetTransformInfo.h | 11 +- .../Target/Hexagon/HexagonVectorCombine.cpp | 1487 +++++ .../Hexagon/HexagonVectorLoopCarriedReuse.cpp | 165 +- .../Hexagon/HexagonVectorLoopCarriedReuse.h | 139 + .../MCTargetDesc/HexagonAsmBackend.cpp | 4 +- .../Hexagon/MCTargetDesc/HexagonInstPrinter.h | 1 + .../MCTargetDesc/HexagonMCCompound.cpp | 19 +- .../MCTargetDesc/HexagonMCInstrInfo.cpp | 2 +- .../MCTargetDesc/HexagonMCTargetDesc.cpp | 3 +- .../Hexagon/MCTargetDesc/HexagonShuffler.cpp | 5 +- llvm/lib/Target/Hexagon/RDFDeadCode.cpp | 3 +- llvm/lib/Target/Lanai/LanaiISelLowering.cpp | 5 +- llvm/lib/Target/Lanai/LanaiSubtarget.cpp | 4 +- llvm/lib/Target/Lanai/LanaiSubtarget.h | 3 +- llvm/lib/Target/Lanai/LanaiTargetMachine.cpp | 4 +- llvm/lib/Target/Lanai/LanaiTargetMachine.h | 2 - .../Target/Lanai/LanaiTargetTransformInfo.h | 3 +- .../Lanai/MCTargetDesc/LanaiAsmBackend.cpp | 5 - .../Lanai/MCTargetDesc/LanaiInstPrinter.h | 1 + .../Lanai/MCTargetDesc/LanaiMCTargetDesc.cpp | 2 +- .../MSP430/AsmParser/MSP430AsmParser.cpp | 1 - .../MSP430/MCTargetDesc/MSP430AsmBackend.cpp | 5 - .../MSP430/MCTargetDesc/MSP430InstPrinter.h | 1 + .../MCTargetDesc/MSP430MCTargetDesc.cpp | 2 +- llvm/lib/Target/MSP430/MSP430ISelLowering.cpp | 12 +- llvm/lib/Target/MSP430/MSP430Subtarget.cpp | 4 +- llvm/lib/Target/MSP430/MSP430Subtarget.h | 2 +- llvm/lib/Target/MSP430/MSP430TargetMachine.h | 2 +- .../Target/Mips/AsmParser/MipsAsmParser.cpp | 8 +- .../Target/Mips/MCTargetDesc/MipsABIInfo.cpp | 1 - .../Target/Mips/MCTargetDesc/MipsAsmBackend.h | 9 - .../Mips/MCTargetDesc/MipsInstPrinter.h | 1 + .../Mips/MCTargetDesc/MipsMCTargetDesc.cpp | 2 +- llvm/lib/Target/Mips/Mips.td | 2 +- llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 2 +- llvm/lib/Target/Mips/MipsCallLowering.cpp | 82 +- llvm/lib/Target/Mips/MipsCallLowering.h | 7 +- .../Target/Mips/MipsConstantIslandPass.cpp | 9 +- llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp | 19 +- llvm/lib/Target/Mips/MipsExpandPseudo.cpp | 4 +- llvm/lib/Target/Mips/MipsISelLowering.cpp | 21 +- llvm/lib/Target/Mips/MipsISelLowering.h | 14 - llvm/lib/Target/Mips/MipsInstrFPU.td | 9 + llvm/lib/Target/Mips/MipsInstrInfo.cpp | 2 +- llvm/lib/Target/Mips/MipsInstrInfo.td | 2 +- llvm/lib/Target/Mips/MipsLegalizerInfo.cpp | 11 +- llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp | 13 +- llvm/lib/Target/Mips/MipsRegisterBankInfo.h | 2 +- llvm/lib/Target/Mips/MipsSEFrameLowering.cpp | 11 +- llvm/lib/Target/Mips/MipsSEFrameLowering.h | 5 +- llvm/lib/Target/Mips/MipsSEISelLowering.cpp | 4 +- llvm/lib/Target/Mips/MipsSchedule.td | 3 + llvm/lib/Target/Mips/MipsScheduleGeneric.td | 5 +- llvm/lib/Target/Mips/MipsScheduleP5600.td | 4 +- llvm/lib/Target/Mips/MipsSubtarget.cpp | 32 +- llvm/lib/Target/Mips/MipsSubtarget.h | 2 +- llvm/lib/Target/Mips/MipsTargetMachine.cpp | 27 +- llvm/lib/Target/Mips/MipsTargetMachine.h | 8 + .../NVPTX/MCTargetDesc/NVPTXInstPrinter.h | 1 + .../NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp | 1 + .../NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp | 2 +- llvm/lib/Target/NVPTX/NVPTX.h | 19 + llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 6 +- llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp | 9 +- llvm/lib/Target/NVPTX/NVPTXFrameLowering.h | 5 +- llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 9 +- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | 37 +- llvm/lib/Target/NVPTX/NVPTXISelLowering.h | 3 +- llvm/lib/Target/NVPTX/NVPTXInstrFormats.td | 32 +- llvm/lib/Target/NVPTX/NVPTXInstrInfo.td | 36 +- llvm/lib/Target/NVPTX/NVPTXIntrinsics.td | 68 +- llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp | 9 +- .../Target/NVPTX/NVPTXPrologEpilogPass.cpp | 3 +- llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td | 4 +- llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp | 8 +- llvm/lib/Target/NVPTX/NVPTXSubtarget.h | 2 +- llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp | 31 +- llvm/lib/Target/NVPTX/NVPTXTargetMachine.h | 4 +- .../Target/NVPTX/NVPTXTargetTransformInfo.cpp | 257 + .../Target/NVPTX/NVPTXTargetTransformInfo.h | 3 + llvm/lib/Target/NVPTX/NVVMIntrRange.cpp | 40 +- llvm/lib/Target/NVPTX/NVVMReflect.cpp | 15 +- .../Target/PowerPC/AsmParser/PPCAsmParser.cpp | 267 +- .../PowerPC/Disassembler/PPCDisassembler.cpp | 38 +- .../Target/PowerPC/GISel/PPCCallLowering.cpp | 53 + .../Target/PowerPC/GISel/PPCCallLowering.h | 40 + .../PowerPC/GISel/PPCInstructionSelector.cpp | 92 + .../Target/PowerPC/GISel/PPCLegalizerInfo.cpp | 20 + .../Target/PowerPC/GISel/PPCLegalizerInfo.h | 28 + .../PowerPC/GISel/PPCRegisterBankInfo.cpp | 27 + .../PowerPC/GISel/PPCRegisterBankInfo.h | 39 + .../Target/PowerPC/GISel/PPCRegisterBanks.td | 18 +- .../PowerPC/MCTargetDesc/PPCAsmBackend.cpp | 10 +- .../MCTargetDesc/PPCELFObjectWriter.cpp | 24 + .../PowerPC/MCTargetDesc/PPCELFStreamer.cpp | 118 + .../PowerPC/MCTargetDesc/PPCELFStreamer.h | 7 + .../PowerPC/MCTargetDesc/PPCFixupKinds.h | 3 + .../PowerPC/MCTargetDesc/PPCInstPrinter.cpp | 163 +- .../PowerPC/MCTargetDesc/PPCInstPrinter.h | 86 +- .../PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp | 5 +- .../PowerPC/MCTargetDesc/PPCMCAsmInfo.h | 1 - .../PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp | 63 +- .../PowerPC/MCTargetDesc/PPCMCCodeEmitter.h | 12 +- .../PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp | 26 +- .../PowerPC/MCTargetDesc/PPCMCTargetDesc.h | 13 +- .../MCTargetDesc/PPCXCOFFObjectWriter.cpp | 11 +- llvm/lib/Target/PowerPC/P9InstrResources.td | 2 +- llvm/lib/Target/PowerPC/PPC.h | 63 +- llvm/lib/Target/PowerPC/PPC.td | 56 +- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 668 ++- llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | 26 +- llvm/lib/Target/PowerPC/PPCCCState.cpp | 2 +- llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | 94 +- llvm/lib/Target/PowerPC/PPCCallingConv.td | 28 +- llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp | 26 +- llvm/lib/Target/PowerPC/PPCFastISel.cpp | 19 +- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 498 +- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 835 +-- llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 3637 +++++------- llvm/lib/Target/PowerPC/PPCISelLowering.h | 126 +- llvm/lib/Target/PowerPC/PPCInstr64Bit.td | 112 +- llvm/lib/Target/PowerPC/PPCInstrAltivec.td | 170 +- llvm/lib/Target/PowerPC/PPCInstrFormats.td | 55 +- llvm/lib/Target/PowerPC/PPCInstrHTM.td | 5 +- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 1073 +++- llvm/lib/Target/PowerPC/PPCInstrInfo.h | 126 +- llvm/lib/Target/PowerPC/PPCInstrInfo.td | 452 +- llvm/lib/Target/PowerPC/PPCInstrPrefix.td | 1735 +++++- llvm/lib/Target/PowerPC/PPCInstrQPX.td | 1212 ---- llvm/lib/Target/PowerPC/PPCInstrSPE.td | 10 - llvm/lib/Target/PowerPC/PPCInstrVSX.td | 389 +- .../Target/PowerPC/PPCLoopInstrFormPrep.cpp | 40 +- .../Target/PowerPC/PPCLowerMASSVEntries.cpp | 6 +- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 14 +- llvm/lib/Target/PowerPC/PPCMIPeephole.cpp | 280 +- .../Target/PowerPC/PPCMachineFunctionInfo.cpp | 34 + .../Target/PowerPC/PPCMachineFunctionInfo.h | 37 +- .../Target/PowerPC/PPCMachineScheduler.cpp | 140 +- llvm/lib/Target/PowerPC/PPCMacroFusion.cpp | 4 +- .../lib/Target/PowerPC/PPCPreEmitPeephole.cpp | 240 +- llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp | 161 - .../Target/PowerPC/PPCReduceCRLogicals.cpp | 4 +- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 203 +- llvm/lib/Target/PowerPC/PPCRegisterInfo.h | 27 +- llvm/lib/Target/PowerPC/PPCRegisterInfo.td | 106 +- llvm/lib/Target/PowerPC/PPCScheduleP9.td | 11 +- llvm/lib/Target/PowerPC/PPCSubtarget.cpp | 56 +- llvm/lib/Target/PowerPC/PPCSubtarget.h | 44 +- llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp | 49 +- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 111 +- llvm/lib/Target/PowerPC/PPCTargetMachine.h | 5 + .../Target/PowerPC/PPCTargetTransformInfo.cpp | 373 +- .../Target/PowerPC/PPCTargetTransformInfo.h | 11 +- llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp | 6 +- llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp | 30 +- .../PowerPC/TargetInfo/PowerPCTargetInfo.cpp | 9 +- .../PowerPC/TargetInfo/PowerPCTargetInfo.h | 1 + .../Target/RISCV/AsmParser/RISCVAsmParser.cpp | 665 ++- .../RISCV/Disassembler/RISCVDisassembler.cpp | 30 +- .../RISCV/MCTargetDesc/RISCVAsmBackend.h | 2 +- .../{Utils => MCTargetDesc}/RISCVBaseInfo.cpp | 65 +- .../Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 406 ++ .../RISCV/MCTargetDesc/RISCVELFStreamer.cpp | 4 +- .../RISCV/MCTargetDesc/RISCVInstPrinter.cpp | 39 +- .../RISCV/MCTargetDesc/RISCVInstPrinter.h | 5 +- .../RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | 15 +- .../Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp | 1 - .../RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp | 7 +- .../{Utils => MCTargetDesc}/RISCVMatInt.cpp | 4 +- .../{Utils => MCTargetDesc}/RISCVMatInt.h | 3 +- .../MCTargetDesc/RISCVTargetStreamer.cpp | 34 +- llvm/lib/Target/RISCV/RISCV.h | 5 +- llvm/lib/Target/RISCV/RISCV.td | 78 +- llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp | 4 +- llvm/lib/Target/RISCV/RISCVCallLowering.cpp | 11 +- llvm/lib/Target/RISCV/RISCVCallLowering.h | 6 +- llvm/lib/Target/RISCV/RISCVCleanupVSETVLI.cpp | 131 + .../Target/RISCV/RISCVExpandPseudoInsts.cpp | 58 + llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 145 +- llvm/lib/Target/RISCV/RISCVFrameLowering.h | 5 +- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp | 893 ++- llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h | 21 + llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 1986 ++++++- llvm/lib/Target/RISCV/RISCVISelLowering.h | 125 +- llvm/lib/Target/RISCV/RISCVInstrFormats.td | 85 +- llvm/lib/Target/RISCV/RISCVInstrFormatsV.td | 124 +- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 138 +- llvm/lib/Target/RISCV/RISCVInstrInfo.h | 21 +- llvm/lib/Target/RISCV/RISCVInstrInfo.td | 145 +- llvm/lib/Target/RISCV/RISCVInstrInfoB.td | 893 ++- llvm/lib/Target/RISCV/RISCVInstrInfoC.td | 22 +- llvm/lib/Target/RISCV/RISCVInstrInfoD.td | 22 +- llvm/lib/Target/RISCV/RISCVInstrInfoF.td | 30 +- llvm/lib/Target/RISCV/RISCVInstrInfoM.td | 6 +- llvm/lib/Target/RISCV/RISCVInstrInfoV.td | 753 ++- .../Target/RISCV/RISCVInstrInfoVPseudos.td | 4397 ++++++++++++++ .../Target/RISCV/RISCVInstrInfoVSDPatterns.td | 643 ++ llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td | 371 ++ llvm/lib/Target/RISCV/RISCVMCInstLower.cpp | 98 + .../lib/Target/RISCV/RISCVMergeBaseOffset.cpp | 4 +- llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp | 23 +- llvm/lib/Target/RISCV/RISCVRegisterInfo.td | 393 +- llvm/lib/Target/RISCV/RISCVSchedRocket.td | 233 + llvm/lib/Target/RISCV/RISCVSchedRocket32.td | 227 - llvm/lib/Target/RISCV/RISCVSchedRocket64.td | 228 - llvm/lib/Target/RISCV/RISCVSchedSiFive7.td | 222 + llvm/lib/Target/RISCV/RISCVSchedule.td | 2 +- llvm/lib/Target/RISCV/RISCVSubtarget.cpp | 14 +- llvm/lib/Target/RISCV/RISCVSubtarget.h | 20 +- llvm/lib/Target/RISCV/RISCVSystemOperands.td | 2 + llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 49 +- llvm/lib/Target/RISCV/RISCVTargetMachine.h | 5 +- .../Target/RISCV/RISCVTargetTransformInfo.cpp | 8 +- .../Target/RISCV/RISCVTargetTransformInfo.h | 5 +- llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.h | 223 - .../Target/Sparc/AsmParser/SparcAsmParser.cpp | 162 +- llvm/lib/Target/Sparc/LeonFeatures.td | 0 llvm/lib/Target/Sparc/LeonPasses.cpp | 7 +- llvm/lib/Target/Sparc/LeonPasses.h | 9 +- .../Sparc/MCTargetDesc/SparcAsmBackend.cpp | 6 - .../Sparc/MCTargetDesc/SparcInstPrinter.cpp | 30 +- .../Sparc/MCTargetDesc/SparcInstPrinter.h | 1 + .../Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp | 52 +- .../Target/Sparc/MCTargetDesc/SparcMCExpr.cpp | 77 +- .../Target/Sparc/MCTargetDesc/SparcMCExpr.h | 1 + .../Sparc/MCTargetDesc/SparcMCTargetDesc.cpp | 2 +- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp | 4 +- llvm/lib/Target/Sparc/SparcFrameLowering.cpp | 10 +- llvm/lib/Target/Sparc/SparcFrameLowering.h | 5 +- llvm/lib/Target/Sparc/SparcISelLowering.cpp | 56 +- llvm/lib/Target/Sparc/SparcInstr64Bit.td | 6 +- llvm/lib/Target/Sparc/SparcInstrFormats.td | 4 +- llvm/lib/Target/Sparc/SparcInstrInfo.td | 25 +- llvm/lib/Target/Sparc/SparcRegisterInfo.cpp | 2 +- llvm/lib/Target/Sparc/SparcSchedule.td | 0 llvm/lib/Target/Sparc/SparcSubtarget.cpp | 8 +- llvm/lib/Target/Sparc/SparcSubtarget.h | 4 +- llvm/lib/Target/Sparc/SparcTargetMachine.cpp | 14 +- .../SystemZ/AsmParser/SystemZAsmParser.cpp | 36 +- .../Disassembler/SystemZDisassembler.cpp | 4 +- .../SystemZ/MCTargetDesc/SystemZInstPrinter.h | 1 + .../MCTargetDesc/SystemZMCAsmBackend.cpp | 4 - .../SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp | 2 + .../MCTargetDesc/SystemZMCTargetDesc.cpp | 2 +- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 21 +- .../lib/Target/SystemZ/SystemZElimCompare.cpp | 16 +- llvm/lib/Target/SystemZ/SystemZFeatures.td | 2 +- .../Target/SystemZ/SystemZFrameLowering.cpp | 88 +- .../lib/Target/SystemZ/SystemZFrameLowering.h | 12 +- .../SystemZ/SystemZHazardRecognizer.cpp | 6 +- .../Target/SystemZ/SystemZHazardRecognizer.h | 2 +- .../Target/SystemZ/SystemZISelDAGToDAG.cpp | 44 + .../Target/SystemZ/SystemZISelLowering.cpp | 74 +- llvm/lib/Target/SystemZ/SystemZISelLowering.h | 5 +- .../lib/Target/SystemZ/SystemZInstrFormats.td | 54 + llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp | 12 +- llvm/lib/Target/SystemZ/SystemZInstrInfo.td | 104 +- llvm/lib/Target/SystemZ/SystemZInstrVector.td | 8 +- .../SystemZ/SystemZMachineScheduler.cpp | 1 + llvm/lib/Target/SystemZ/SystemZOperators.td | 35 +- .../Target/SystemZ/SystemZRegisterInfo.cpp | 14 +- llvm/lib/Target/SystemZ/SystemZScheduleZ13.td | 2 +- llvm/lib/Target/SystemZ/SystemZScheduleZ14.td | 2 +- llvm/lib/Target/SystemZ/SystemZScheduleZ15.td | 2 +- .../lib/Target/SystemZ/SystemZScheduleZ196.td | 2 +- .../Target/SystemZ/SystemZScheduleZEC12.td | 2 +- .../SystemZ/SystemZSelectionDAGInfo.cpp | 5 +- llvm/lib/Target/SystemZ/SystemZSubtarget.cpp | 22 +- llvm/lib/Target/SystemZ/SystemZSubtarget.h | 2 +- .../Target/SystemZ/SystemZTargetMachine.cpp | 10 +- .../SystemZ/SystemZTargetTransformInfo.cpp | 33 +- .../SystemZ/SystemZTargetTransformInfo.h | 6 +- llvm/lib/Target/TargetLoweringObjectFile.cpp | 58 + llvm/lib/Target/TargetMachine.cpp | 85 +- llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp | 103 +- .../Target/VE/Disassembler/VEDisassembler.cpp | 55 +- llvm/lib/Target/VE/LVLGen.cpp | 137 + .../Target/VE/MCTargetDesc/VEInstPrinter.h | 1 + .../Target/VE/MCTargetDesc/VEMCTargetDesc.cpp | 6 +- .../lib/Target/VE/TargetInfo/VETargetInfo.cpp | 2 +- llvm/lib/Target/VE/VE.h | 19 + llvm/lib/Target/VE/VE.td | 5 +- llvm/lib/Target/VE/VEAsmPrinter.cpp | 48 +- llvm/lib/Target/VE/VECallingConv.td | 138 +- llvm/lib/Target/VE/VEFrameLowering.cpp | 402 +- llvm/lib/Target/VE/VEFrameLowering.h | 9 +- llvm/lib/Target/VE/VEISelDAGToDAG.cpp | 40 +- llvm/lib/Target/VE/VEISelLowering.cpp | 2238 ++++++- llvm/lib/Target/VE/VEISelLowering.h | 146 +- llvm/lib/Target/VE/VEInstrBuilder.h | 41 + llvm/lib/Target/VE/VEInstrFormats.td | 89 + llvm/lib/Target/VE/VEInstrInfo.cpp | 534 +- llvm/lib/Target/VE/VEInstrInfo.h | 32 + llvm/lib/Target/VE/VEInstrInfo.td | 841 ++- llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td | 1604 +++++ llvm/lib/Target/VE/VEInstrIntrinsicVL.td | 64 + llvm/lib/Target/VE/VEInstrPatternsVec.td | 91 + llvm/lib/Target/VE/VEInstrVec.td | 1510 +++++ llvm/lib/Target/VE/VEMCInstLower.cpp | 8 +- llvm/lib/Target/VE/VERegisterInfo.cpp | 103 +- llvm/lib/Target/VE/VERegisterInfo.h | 2 - llvm/lib/Target/VE/VERegisterInfo.td | 106 +- llvm/lib/Target/VE/VESubtarget.cpp | 64 +- llvm/lib/Target/VE/VESubtarget.h | 21 +- llvm/lib/Target/VE/VETargetMachine.cpp | 32 +- llvm/lib/Target/VE/VETargetTransformInfo.h | 25 +- llvm/lib/Target/VE/VVPInstrInfo.td | 46 + llvm/lib/Target/VE/VVPInstrPatternsVec.td | 71 + llvm/lib/Target/VE/VVPNodes.def | 41 + .../AsmParser/WebAssemblyAsmParser.cpp | 140 +- .../Disassembler/WebAssemblyDisassembler.cpp | 23 + .../MCTargetDesc/WebAssemblyAsmBackend.cpp | 5 - .../MCTargetDesc/WebAssemblyInstPrinter.cpp | 116 +- .../MCTargetDesc/WebAssemblyInstPrinter.h | 7 +- .../MCTargetDesc/WebAssemblyMCCodeEmitter.cpp | 12 +- .../MCTargetDesc/WebAssemblyMCTargetDesc.cpp | 8 +- .../MCTargetDesc/WebAssemblyMCTargetDesc.h | 95 +- .../WebAssemblyTargetStreamer.cpp | 13 +- .../MCTargetDesc/WebAssemblyTargetStreamer.h | 5 + .../WebAssemblyWasmObjectWriter.cpp | 18 +- .../WebAssembly/WebAssemblyAsmPrinter.cpp | 133 +- .../WebAssembly/WebAssemblyAsmPrinter.h | 3 + .../Target/WebAssembly/WebAssemblyCFGSort.cpp | 91 +- .../WebAssembly/WebAssemblyCFGStackify.cpp | 676 +-- .../WebAssemblyDebugValueManager.cpp | 14 +- .../WebAssembly/WebAssemblyExplicitLocals.cpp | 34 +- .../WebAssembly/WebAssemblyFastISel.cpp | 61 +- .../WebAssemblyFixBrTableDefaults.cpp | 45 +- .../lib/Target/WebAssembly/WebAssemblyISD.def | 5 + .../WebAssembly/WebAssemblyISelDAGToDAG.cpp | 38 - .../WebAssembly/WebAssemblyISelLowering.cpp | 333 +- .../WebAssembly/WebAssemblyISelLowering.h | 1 + .../WebAssembly/WebAssemblyInstrAtomics.td | 210 +- .../WebAssembly/WebAssemblyInstrBulkMemory.td | 2 +- .../WebAssembly/WebAssemblyInstrControl.td | 45 +- .../WebAssembly/WebAssemblyInstrInfo.cpp | 42 +- .../WebAssembly/WebAssemblyInstrInfo.td | 43 +- .../WebAssembly/WebAssemblyInstrMemory.td | 2 +- .../Target/WebAssembly/WebAssemblyInstrRef.td | 36 +- .../WebAssembly/WebAssemblyInstrSIMD.td | 1197 ++-- .../WebAssembly/WebAssemblyInstrTable.td | 64 + .../WebAssembly/WebAssemblyLateEHPrepare.cpp | 319 +- .../WebAssemblyLowerEmscriptenEHSjLj.cpp | 110 +- .../WebAssembly/WebAssemblyMCInstLower.cpp | 43 +- .../WebAssemblyOptimizeLiveIntervals.cpp | 2 +- .../WebAssembly/WebAssemblyPeephole.cpp | 7 +- .../WebAssembly/WebAssemblyRegColoring.cpp | 22 +- .../WebAssembly/WebAssemblyRegStackify.cpp | 44 +- .../WebAssembly/WebAssemblyRegisterInfo.cpp | 10 +- .../WebAssembly/WebAssemblyRegisterInfo.td | 6 +- .../WebAssembly/WebAssemblySortRegion.cpp | 78 + .../WebAssembly/WebAssemblySortRegion.h | 91 + .../WebAssembly/WebAssemblySubtarget.cpp | 9 +- .../Target/WebAssembly/WebAssemblySubtarget.h | 2 +- .../WebAssembly/WebAssemblyTargetMachine.cpp | 34 +- .../WebAssembly/WebAssemblyTargetMachine.h | 1 + .../WebAssemblyTargetTransformInfo.cpp | 18 + .../WebAssemblyTargetTransformInfo.h | 3 + .../WebAssembly/WebAssemblyUtilities.cpp | 33 + .../Target/WebAssembly/WebAssemblyUtilities.h | 28 +- .../lib/Target/X86/AsmParser/X86AsmParser.cpp | 1214 +++- llvm/lib/Target/X86/AsmParser/X86Operand.h | 18 +- .../X86/Disassembler/X86Disassembler.cpp | 6 +- .../X86/MCTargetDesc/X86ATTInstPrinter.cpp | 11 + .../X86/MCTargetDesc/X86ATTInstPrinter.h | 1 + .../Target/X86/MCTargetDesc/X86AsmBackend.cpp | 42 +- .../lib/Target/X86/MCTargetDesc/X86BaseInfo.h | 25 +- .../X86/MCTargetDesc/X86ELFObjectWriter.cpp | 9 + .../X86/MCTargetDesc/X86InstPrinterCommon.cpp | 19 + .../X86/MCTargetDesc/X86IntelInstPrinter.cpp | 10 + .../X86/MCTargetDesc/X86IntelInstPrinter.h | 1 + .../X86/MCTargetDesc/X86MCCodeEmitter.cpp | 225 +- .../X86/MCTargetDesc/X86MCTargetDesc.cpp | 13 +- .../Target/X86/MCTargetDesc/X86MCTargetDesc.h | 6 +- .../X86/MCTargetDesc/X86MachObjectWriter.cpp | 2 +- .../X86/MCTargetDesc/X86ShuffleDecode.cpp | 2 +- .../X86/MCTargetDesc/X86WinCOFFStreamer.cpp | 9 +- llvm/lib/Target/X86/X86.h | 11 +- llvm/lib/Target/X86/X86.td | 858 +-- llvm/lib/Target/X86/X86AsmPrinter.cpp | 10 +- llvm/lib/Target/X86/X86AsmPrinter.h | 6 +- .../X86/X86AvoidStoreForwardingBlocks.cpp | 4 +- .../Target/X86/X86CallFrameOptimization.cpp | 23 +- llvm/lib/Target/X86/X86CallLowering.cpp | 70 +- llvm/lib/Target/X86/X86CallLowering.h | 6 +- llvm/lib/Target/X86/X86CallingConv.cpp | 10 + llvm/lib/Target/X86/X86CallingConv.td | 15 +- llvm/lib/Target/X86/X86CmovConversion.cpp | 6 +- llvm/lib/Target/X86/X86CondBrFolding.cpp | 579 -- llvm/lib/Target/X86/X86DomainReassignment.cpp | 48 +- llvm/lib/Target/X86/X86EvexToVex.cpp | 31 +- llvm/lib/Target/X86/X86ExpandPseudo.cpp | 77 +- llvm/lib/Target/X86/X86FastISel.cpp | 96 +- llvm/lib/Target/X86/X86FixupBWInsts.cpp | 5 +- llvm/lib/Target/X86/X86FixupLEAs.cpp | 15 +- llvm/lib/Target/X86/X86FixupSetCC.cpp | 17 +- llvm/lib/Target/X86/X86FlagsCopyLowering.cpp | 8 +- llvm/lib/Target/X86/X86FrameLowering.cpp | 392 +- llvm/lib/Target/X86/X86FrameLowering.h | 31 +- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 659 ++- llvm/lib/Target/X86/X86ISelLowering.cpp | 5181 ++++++++++------ llvm/lib/Target/X86/X86ISelLowering.h | 60 +- .../Target/X86/X86IndirectBranchTracking.cpp | 2 +- llvm/lib/Target/X86/X86IndirectThunks.cpp | 1 - llvm/lib/Target/X86/X86InsertPrefetch.cpp | 8 +- llvm/lib/Target/X86/X86InsertWait.cpp | 6 +- .../Target/X86/X86InstCombineIntrinsic.cpp | 2017 +++++++ llvm/lib/Target/X86/X86InstrAMX.td | 54 +- llvm/lib/Target/X86/X86InstrAVX512.td | 734 +-- llvm/lib/Target/X86/X86InstrArithmetic.td | 9 + llvm/lib/Target/X86/X86InstrCompiler.td | 185 +- llvm/lib/Target/X86/X86InstrFMA.td | 22 +- llvm/lib/Target/X86/X86InstrFPStack.td | 8 +- llvm/lib/Target/X86/X86InstrFoldTables.cpp | 14 + llvm/lib/Target/X86/X86InstrFormats.td | 6 + llvm/lib/Target/X86/X86InstrFragmentsSIMD.td | 36 +- llvm/lib/Target/X86/X86InstrInfo.cpp | 255 +- llvm/lib/Target/X86/X86InstrInfo.h | 32 +- llvm/lib/Target/X86/X86InstrInfo.td | 159 +- llvm/lib/Target/X86/X86InstrKL.td | 86 + llvm/lib/Target/X86/X86InstrMMX.td | 2 + llvm/lib/Target/X86/X86InstrSNP.td | 47 + llvm/lib/Target/X86/X86InstrSSE.td | 205 +- llvm/lib/Target/X86/X86InstrSVM.td | 28 +- llvm/lib/Target/X86/X86InstrSystem.td | 30 +- llvm/lib/Target/X86/X86InstrTDX.td | 39 + .../lib/Target/X86/X86InstructionSelector.cpp | 99 +- llvm/lib/Target/X86/X86InterleavedAccess.cpp | 24 +- llvm/lib/Target/X86/X86IntrinsicsInfo.h | 40 +- llvm/lib/Target/X86/X86LegalizerInfo.cpp | 35 +- .../X86LoadValueInjectionLoadHardening.cpp | 180 +- .../X86/X86LoadValueInjectionRetHardening.cpp | 77 +- llvm/lib/Target/X86/X86LowerAMXType.cpp | 351 ++ llvm/lib/Target/X86/X86MCInstLower.cpp | 69 +- llvm/lib/Target/X86/X86PartialReduction.cpp | 9 +- llvm/lib/Target/X86/X86PreTileConfig.cpp | 265 + llvm/lib/Target/X86/X86RegisterInfo.cpp | 139 +- llvm/lib/Target/X86/X86RegisterInfo.h | 14 +- llvm/lib/Target/X86/X86RegisterInfo.td | 12 +- llvm/lib/Target/X86/X86SchedBroadwell.td | 0 llvm/lib/Target/X86/X86SchedSkylakeServer.td | 0 llvm/lib/Target/X86/X86SelectionDAGInfo.cpp | 8 + .../X86/X86ShuffleDecodeConstantPool.cpp | 53 +- .../Target/X86/X86ShuffleDecodeConstantPool.h | 8 - ...culativeExecutionSideEffectSuppression.cpp | 1 + .../X86/X86SpeculativeLoadHardening.cpp | 17 +- llvm/lib/Target/X86/X86Subtarget.cpp | 98 +- llvm/lib/Target/X86/X86Subtarget.h | 68 +- llvm/lib/Target/X86/X86TargetMachine.cpp | 127 +- llvm/lib/Target/X86/X86TargetMachine.h | 2 + llvm/lib/Target/X86/X86TargetObjectFile.cpp | 8 - llvm/lib/Target/X86/X86TargetObjectFile.h | 2 +- .../lib/Target/X86/X86TargetTransformInfo.cpp | 358 +- llvm/lib/Target/X86/X86TargetTransformInfo.h | 26 +- llvm/lib/Target/X86/X86TileConfig.cpp | 248 + llvm/lib/Target/X86/X86WinEHState.cpp | 2 +- .../XCore/MCTargetDesc/XCoreInstPrinter.h | 1 + .../XCore/MCTargetDesc/XCoreMCTargetDesc.cpp | 2 +- llvm/lib/Target/XCore/XCoreISelLowering.cpp | 18 +- .../Target/XCore/XCoreLowerThreadLocal.cpp | 56 +- llvm/lib/Target/XCore/XCoreSubtarget.cpp | 4 +- llvm/lib/Target/XCore/XCoreSubtarget.h | 2 +- llvm/lib/Target/XCore/XCoreTargetMachine.cpp | 4 +- llvm/lib/Testing/Support/Annotations.cpp | 12 +- llvm/lib/TextAPI/MachO/InterfaceFile.cpp | 2 - llvm/lib/TextAPI/MachO/Platform.cpp | 4 +- llvm/lib/TextAPI/MachO/Target.cpp | 1 + llvm/lib/TextAPI/MachO/TextStub.cpp | 27 +- llvm/lib/TextAPI/MachO/TextStubCommon.cpp | 3 + llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 50 +- .../AggressiveInstCombine.cpp | 147 +- .../TruncInstCombine.cpp | 13 +- .../lib/Transforms/Coroutines/CoroCleanup.cpp | 1 + llvm/lib/Transforms/Coroutines/CoroEarly.cpp | 11 +- llvm/lib/Transforms/Coroutines/CoroElide.cpp | 25 +- llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 1491 +++-- llvm/lib/Transforms/Coroutines/CoroInstr.h | 181 +- llvm/lib/Transforms/Coroutines/CoroInternal.h | 59 +- llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 595 +- llvm/lib/Transforms/Coroutines/Coroutines.cpp | 109 +- llvm/lib/Transforms/HelloNew/HelloWorld.cpp | 17 + llvm/lib/Transforms/IPO/AlwaysInliner.cpp | 55 +- .../Transforms/IPO/Annotation2Metadata.cpp | 106 + llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 44 +- llvm/lib/Transforms/IPO/Attributor.cpp | 542 +- .../Transforms/IPO/AttributorAttributes.cpp | 1306 +++- llvm/lib/Transforms/IPO/BlockExtractor.cpp | 79 +- .../IPO/DeadArgumentElimination.cpp | 31 +- .../lib/Transforms/IPO/ForceFunctionAttrs.cpp | 47 +- llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 265 +- llvm/lib/Transforms/IPO/FunctionImport.cpp | 47 +- llvm/lib/Transforms/IPO/GlobalOpt.cpp | 38 +- llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 100 +- .../Transforms/IPO/IPConstantPropagation.cpp | 308 - llvm/lib/Transforms/IPO/IPO.cpp | 11 +- llvm/lib/Transforms/IPO/IROutliner.cpp | 1764 ++++++ llvm/lib/Transforms/IPO/Inliner.cpp | 100 +- llvm/lib/Transforms/IPO/LoopExtractor.cpp | 133 +- llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 32 +- llvm/lib/Transforms/IPO/MergeFunctions.cpp | 6 +- llvm/lib/Transforms/IPO/OpenMPOpt.cpp | 1352 ++++- llvm/lib/Transforms/IPO/PartialInlining.cpp | 329 +- .../lib/Transforms/IPO/PassManagerBuilder.cpp | 161 +- llvm/lib/Transforms/IPO/PruneEH.cpp | 72 +- .../Transforms/IPO/SampleContextTracker.cpp | 521 ++ llvm/lib/Transforms/IPO/SampleProfile.cpp | 313 +- .../lib/Transforms/IPO/SampleProfileProbe.cpp | 276 + llvm/lib/Transforms/IPO/StripSymbols.cpp | 56 +- .../Transforms/IPO/ThinLTOBitcodeWriter.cpp | 6 +- .../lib/Transforms/IPO/WholeProgramDevirt.cpp | 22 +- .../InstCombine/InstCombineAddSub.cpp | 333 +- .../InstCombine/InstCombineAndOrXor.cpp | 758 +-- .../InstCombine/InstCombineAtomicRMW.cpp | 18 +- .../InstCombine/InstCombineCalls.cpp | 3325 ++--------- .../InstCombine/InstCombineCasts.cpp | 377 +- .../InstCombine/InstCombineCompares.cpp | 502 +- .../InstCombine/InstCombineInternal.h | 409 +- .../InstCombineLoadStoreAlloca.cpp | 234 +- .../InstCombine/InstCombineMulDivRem.cpp | 205 +- .../InstCombine/InstCombineNegator.cpp | 149 +- .../Transforms/InstCombine/InstCombinePHI.cpp | 245 +- .../InstCombine/InstCombineSelect.cpp | 497 +- .../InstCombine/InstCombineShifts.cpp | 208 +- .../InstCombineSimplifyDemanded.cpp | 597 +- .../InstCombine/InstCombineVectorOps.cpp | 434 +- .../InstCombine/InstructionCombining.cpp | 417 +- .../Instrumentation/AddressSanitizer.cpp | 186 +- llvm/lib/Transforms/Instrumentation/CFGMST.h | 17 +- .../Transforms/Instrumentation/CGProfile.cpp | 3 +- .../ControlHeightReduction.cpp | 38 +- .../Instrumentation/DataFlowSanitizer.cpp | 861 ++- .../Instrumentation/GCOVProfiling.cpp | 682 ++- .../Instrumentation/HWAddressSanitizer.cpp | 311 +- .../Instrumentation/IndirectCallPromotion.cpp | 9 +- .../Instrumentation/InstrProfiling.cpp | 109 +- .../Instrumentation/Instrumentation.cpp | 4 +- .../Instrumentation/MemProfiler.cpp | 638 ++ .../Instrumentation/MemorySanitizer.cpp | 411 +- .../Instrumentation/PGOInstrumentation.cpp | 324 +- .../Instrumentation/PGOMemOPSizeOpt.cpp | 38 +- .../Instrumentation/PoisonChecking.cpp | 10 +- .../Instrumentation/SanitizerCoverage.cpp | 124 +- .../Instrumentation/ThreadSanitizer.cpp | 186 +- .../Instrumentation/ValueProfileCollector.cpp | 2 +- .../Instrumentation/ValueProfileCollector.h | 9 +- .../Transforms/ObjCARC/DependencyAnalysis.cpp | 67 +- .../Transforms/ObjCARC/DependencyAnalysis.h | 12 +- llvm/lib/Transforms/ObjCARC/ObjCARC.cpp | 4 +- llvm/lib/Transforms/ObjCARC/ObjCARC.h | 2 - llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp | 78 +- .../Transforms/ObjCARC/ObjCARCContract.cpp | 214 +- llvm/lib/Transforms/ObjCARC/ObjCARCExpand.cpp | 78 +- llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp | 305 +- .../Transforms/ObjCARC/ProvenanceAnalysis.cpp | 25 +- .../Transforms/ObjCARC/ProvenanceAnalysis.h | 12 +- .../ObjCARC/ProvenanceAnalysisEvaluator.cpp | 4 +- llvm/lib/Transforms/ObjCARC/PtrState.cpp | 4 +- llvm/lib/Transforms/Scalar/ADCE.cpp | 2 +- .../Transforms/Scalar/AnnotationRemarks.cpp | 90 + .../Transforms/Scalar/CallSiteSplitting.cpp | 2 +- .../Transforms/Scalar/ConstantHoisting.cpp | 15 +- llvm/lib/Transforms/Scalar/ConstantProp.cpp | 121 - .../Scalar/ConstraintElimination.cpp | 407 ++ .../Scalar/CorrelatedValuePropagation.cpp | 339 +- llvm/lib/Transforms/Scalar/DCE.cpp | 66 +- .../Scalar/DeadStoreElimination.cpp | 1066 ++-- llvm/lib/Transforms/Scalar/DivRemPairs.cpp | 10 +- llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 432 +- llvm/lib/Transforms/Scalar/FlattenCFGPass.cpp | 1 + llvm/lib/Transforms/Scalar/Float2Int.cpp | 1 - llvm/lib/Transforms/Scalar/GVN.cpp | 413 +- llvm/lib/Transforms/Scalar/GVNHoist.cpp | 1387 ++--- llvm/lib/Transforms/Scalar/GVNSink.cpp | 13 +- llvm/lib/Transforms/Scalar/GuardWidening.cpp | 14 +- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 1308 +--- .../Scalar/InductiveRangeCheckElimination.cpp | 104 +- .../Transforms/Scalar/InferAddressSpaces.cpp | 158 +- .../Transforms/Scalar/InstSimplifyPass.cpp | 2 + llvm/lib/Transforms/Scalar/JumpThreading.cpp | 350 +- llvm/lib/Transforms/Scalar/LICM.cpp | 333 +- .../Transforms/Scalar/LoopDataPrefetch.cpp | 2 +- llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 125 +- llvm/lib/Transforms/Scalar/LoopDistribute.cpp | 16 +- llvm/lib/Transforms/Scalar/LoopFlatten.cpp | 728 +++ llvm/lib/Transforms/Scalar/LoopFuse.cpp | 329 +- .../Transforms/Scalar/LoopIdiomRecognize.cpp | 534 +- .../lib/Transforms/Scalar/LoopInterchange.cpp | 135 +- .../Transforms/Scalar/LoopLoadElimination.cpp | 63 +- .../lib/Transforms/Scalar/LoopPassManager.cpp | 343 +- .../lib/Transforms/Scalar/LoopPredication.cpp | 15 +- llvm/lib/Transforms/Scalar/LoopRerollPass.cpp | 66 +- llvm/lib/Transforms/Scalar/LoopRotation.cpp | 45 +- .../lib/Transforms/Scalar/LoopSimplifyCFG.cpp | 28 +- llvm/lib/Transforms/Scalar/LoopSink.cpp | 148 +- .../Transforms/Scalar/LoopStrengthReduce.cpp | 139 +- .../Scalar/LoopUnrollAndJamPass.cpp | 12 +- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 92 +- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 319 +- .../Transforms/Scalar/LoopVersioningLICM.cpp | 110 +- .../Scalar/LowerConstantIntrinsics.cpp | 2 +- .../Scalar/LowerExpectIntrinsic.cpp | 21 +- .../Scalar/LowerMatrixIntrinsics.cpp | 289 +- .../lib/Transforms/Scalar/MemCpyOptimizer.cpp | 852 ++- llvm/lib/Transforms/Scalar/MergeICmps.cpp | 24 +- .../lib/Transforms/Scalar/NaryReassociate.cpp | 90 +- llvm/lib/Transforms/Scalar/NewGVN.cpp | 125 +- .../lib/Transforms/Scalar/PlaceSafepoints.cpp | 9 +- llvm/lib/Transforms/Scalar/Reassociate.cpp | 114 +- llvm/lib/Transforms/Scalar/Reg2Mem.cpp | 120 +- .../Scalar/RewriteStatepointsForGC.cpp | 147 +- llvm/lib/Transforms/Scalar/SCCP.cpp | 414 +- llvm/lib/Transforms/Scalar/SROA.cpp | 303 +- llvm/lib/Transforms/Scalar/Scalar.cpp | 37 +- .../Scalar}/ScalarizeMaskedMemIntrin.cpp | 123 +- llvm/lib/Transforms/Scalar/Scalarizer.cpp | 9 +- .../Scalar/SeparateConstOffsetFromGEP.cpp | 84 +- .../Transforms/Scalar/SimpleLoopUnswitch.cpp | 74 +- .../lib/Transforms/Scalar/SimplifyCFGPass.cpp | 188 +- llvm/lib/Transforms/Scalar/Sink.cpp | 80 +- .../Transforms/Scalar/SpeculateAroundPHIs.cpp | 11 +- .../Scalar/SpeculativeExecution.cpp | 9 +- .../Scalar/StraightLineStrengthReduce.cpp | 101 +- llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | 167 +- .../Scalar/TailRecursionElimination.cpp | 146 +- .../Scalar/WarnMissedTransforms.cpp | 6 +- .../lib/Transforms/Utils/AMDGPUEmitPrintf.cpp | 3 - .../Transforms/Utils/AssumeBundleBuilder.cpp | 5 +- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 320 +- .../Transforms/Utils/BreakCriticalEdges.cpp | 35 +- llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 481 +- .../lib/Transforms/Utils/CallGraphUpdater.cpp | 5 +- .../Transforms/Utils/CallPromotionUtils.cpp | 13 +- .../Utils/CanonicalizeFreezeInLoops.cpp | 4 +- llvm/lib/Transforms/Utils/CloneFunction.cpp | 142 +- llvm/lib/Transforms/Utils/CloneModule.cpp | 15 +- llvm/lib/Transforms/Utils/CodeExtractor.cpp | 60 +- llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | 41 +- llvm/lib/Transforms/Utils/Debugify.cpp | 103 +- .../Utils/EntryExitInstrumenter.cpp | 13 +- .../lib/Transforms/Utils/EscapeEnumerator.cpp | 5 +- llvm/lib/Transforms/Utils/Evaluator.cpp | 14 +- llvm/lib/Transforms/Utils/FixIrreducible.cpp | 32 +- .../Transforms/Utils/FunctionComparator.cpp | 25 +- llvm/lib/Transforms/Utils/GlobalStatus.cpp | 3 +- llvm/lib/Transforms/Utils/GuardUtils.cpp | 2 +- .../Transforms/Utils/InjectTLIMappings.cpp | 4 +- llvm/lib/Transforms/Utils/InlineFunction.cpp | 257 +- .../lib/Transforms/Utils/InstructionNamer.cpp | 61 +- llvm/lib/Transforms/Utils/LCSSA.cpp | 84 +- llvm/lib/Transforms/Utils/Local.cpp | 736 ++- .../{LoopUnrollPeel.cpp => LoopPeel.cpp} | 89 +- .../Transforms/Utils/LoopRotationUtils.cpp | 108 +- llvm/lib/Transforms/Utils/LoopSimplify.cpp | 24 +- llvm/lib/Transforms/Utils/LoopUnroll.cpp | 129 +- .../lib/Transforms/Utils/LoopUnrollAndJam.cpp | 35 +- .../Transforms/Utils/LoopUnrollRuntime.cpp | 33 +- llvm/lib/Transforms/Utils/LoopUtils.cpp | 485 +- llvm/lib/Transforms/Utils/LoopVersioning.cpp | 150 +- llvm/lib/Transforms/Utils/LowerInvoke.cpp | 2 +- llvm/lib/Transforms/Utils/LowerSwitch.cpp | 397 +- llvm/lib/Transforms/Utils/MatrixUtils.cpp | 104 + llvm/lib/Transforms/Utils/MetaRenamer.cpp | 203 +- llvm/lib/Transforms/Utils/MisExpect.cpp | 178 - llvm/lib/Transforms/Utils/PredicateInfo.cpp | 223 +- .../Utils/PromoteMemoryToRegister.cpp | 118 +- llvm/lib/Transforms/Utils/SSAUpdater.cpp | 19 +- .../Utils/ScalarEvolutionExpander.cpp | 753 ++- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 1888 +++--- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 1130 +++- .../lib/Transforms/Utils/SimplifyLibCalls.cpp | 105 +- llvm/lib/Transforms/Utils/SizeOpts.cpp | 5 - .../lib/Transforms/Utils/StripGCRelocates.cpp | 46 +- .../Utils/StripNonLineTableDebugInfo.cpp | 23 +- .../Utils/UnifyFunctionExitNodes.cpp | 115 +- llvm/lib/Transforms/Utils/UnifyLoopExits.cpp | 53 +- .../Utils/UniqueInternalLinkageNames.cpp | 23 +- llvm/lib/Transforms/Utils/Utils.cpp | 10 +- llvm/lib/Transforms/Utils/VNCoercion.cpp | 35 +- llvm/lib/Transforms/Utils/ValueMapper.cpp | 28 +- .../Vectorize/LoadStoreVectorizer.cpp | 18 +- .../Vectorize/LoopVectorizationLegality.cpp | 104 +- .../Vectorize/LoopVectorizationPlanner.h | 48 +- .../Transforms/Vectorize/LoopVectorize.cpp | 3681 ++++++++---- .../Transforms/Vectorize/SLPVectorizer.cpp | 2254 +++---- .../Transforms/Vectorize/VPRecipeBuilder.h | 10 +- llvm/lib/Transforms/Vectorize/VPlan.cpp | 302 +- llvm/lib/Transforms/Vectorize/VPlan.h | 606 +- .../Transforms/Vectorize/VPlanPredicator.cpp | 4 +- llvm/lib/Transforms/Vectorize/VPlanSLP.cpp | 25 +- .../Transforms/Vectorize/VPlanTransforms.cpp | 10 +- llvm/lib/Transforms/Vectorize/VPlanValue.h | 212 +- .../Transforms/Vectorize/VPlanVerifier.cpp | 8 +- .../Transforms/Vectorize/VectorCombine.cpp | 207 +- .../WindowsManifest/WindowsManifestMerger.cpp | 6 +- llvm/lib/XRay/InstrumentationMap.cpp | 24 +- llvm/tools/bugpoint/CrashDebugger.cpp | 2 +- llvm/tools/bugpoint/ExecutionDriver.cpp | 18 +- llvm/tools/bugpoint/ExtractFunction.cpp | 2 +- llvm/tools/bugpoint/OptimizerDriver.cpp | 3 + llvm/tools/bugpoint/ToolRunner.cpp | 2 +- llvm/tools/llc/llc.cpp | 124 +- llvm/tools/lli/ChildTarget/ChildTarget.cpp | 6 +- llvm/tools/lli/RemoteJITUtils.h | 72 +- llvm/tools/lli/lli.cpp | 28 +- llvm/tools/llvm-ar/llvm-ar.cpp | 2 +- llvm/tools/llvm-cov/CodeCoverage.cpp | 96 +- llvm/tools/llvm-cov/CoverageExporterJson.cpp | 100 +- llvm/tools/llvm-cov/CoverageExporterLcov.cpp | 99 +- llvm/tools/llvm-cov/CoverageReport.cpp | 49 +- llvm/tools/llvm-cov/CoverageSummaryInfo.cpp | 42 +- llvm/tools/llvm-cov/CoverageSummaryInfo.h | 49 +- llvm/tools/llvm-cov/CoverageViewOptions.h | 6 + llvm/tools/llvm-cov/SourceCoverageView.cpp | 23 +- llvm/tools/llvm-cov/SourceCoverageView.h | 28 + .../tools/llvm-cov/SourceCoverageViewHTML.cpp | 76 +- llvm/tools/llvm-cov/SourceCoverageViewHTML.h | 3 + .../tools/llvm-cov/SourceCoverageViewText.cpp | 50 +- llvm/tools/llvm-cov/SourceCoverageViewText.h | 3 + llvm/tools/llvm-cov/gcov.cpp | 26 +- llvm/tools/llvm-diff/DifferenceEngine.cpp | 2 +- llvm/tools/llvm-dwarfdump/Statistics.cpp | 202 +- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 4 +- llvm/tools/llvm-dwp/llvm-dwp.cpp | 52 +- llvm/tools/llvm-link/llvm-link.cpp | 53 +- llvm/tools/llvm-lto/llvm-lto.cpp | 46 +- llvm/tools/llvm-lto2/llvm-lto2.cpp | 21 +- llvm/tools/llvm-mc/llvm-mc.cpp | 8 + llvm/tools/llvm-mca/CodeRegion.cpp | 1 - llvm/tools/llvm-mca/PipelinePrinter.cpp | 2 +- llvm/tools/llvm-mca/PipelinePrinter.h | 4 +- .../llvm-mca/Views/BottleneckAnalysis.cpp | 47 +- .../tools/llvm-mca/Views/BottleneckAnalysis.h | 13 +- .../tools/llvm-mca/Views/DispatchStatistics.h | 1 + .../llvm-mca/Views/InstructionInfoView.cpp | 127 +- .../llvm-mca/Views/InstructionInfoView.h | 28 +- llvm/tools/llvm-mca/Views/InstructionView.cpp | 60 + llvm/tools/llvm-mca/Views/InstructionView.h | 67 + .../llvm-mca/Views/RegisterFileStatistics.h | 3 + .../llvm-mca/Views/ResourcePressureView.cpp | 52 +- .../llvm-mca/Views/ResourcePressureView.h | 10 +- .../Views/RetireControlUnitStatistics.h | 3 + .../llvm-mca/Views/SchedulerStatistics.h | 1 + llvm/tools/llvm-mca/Views/SummaryView.cpp | 54 +- llvm/tools/llvm-mca/Views/SummaryView.h | 18 +- llvm/tools/llvm-mca/Views/TimelineView.cpp | 68 +- llvm/tools/llvm-mca/Views/TimelineView.h | 11 +- llvm/tools/llvm-mca/Views/View.cpp | 3 + llvm/tools/llvm-mca/Views/View.h | 18 + llvm/tools/llvm-mca/llvm-mca.cpp | 22 +- llvm/tools/llvm-nm/llvm-nm.cpp | 1082 ++-- llvm/tools/llvm-objcopy/BitcodeStripOpts.td | 24 + llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 38 +- llvm/tools/llvm-objcopy/COFF/Object.cpp | 69 +- llvm/tools/llvm-objcopy/COFF/Object.h | 4 +- llvm/tools/llvm-objcopy/CopyConfig.cpp | 132 +- llvm/tools/llvm-objcopy/CopyConfig.h | 9 + llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 153 +- llvm/tools/llvm-objcopy/ELF/Object.cpp | 899 ++- llvm/tools/llvm-objcopy/ELF/Object.h | 264 +- .../tools/llvm-objcopy/InstallNameToolOpts.td | 10 + .../llvm-objcopy/MachO/MachOLayoutBuilder.cpp | 14 +- .../llvm-objcopy/MachO/MachOLayoutBuilder.h | 8 +- .../tools/llvm-objcopy/MachO/MachOObjcopy.cpp | 148 +- llvm/tools/llvm-objcopy/MachO/MachOObjcopy.h | 4 + llvm/tools/llvm-objcopy/MachO/MachOReader.cpp | 51 +- llvm/tools/llvm-objcopy/MachO/MachOReader.h | 6 +- llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp | 14 +- llvm/tools/llvm-objcopy/MachO/Object.cpp | 59 +- llvm/tools/llvm-objcopy/MachO/Object.h | 15 +- llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 108 +- llvm/tools/llvm-objcopy/llvm-objcopy.h | 34 +- llvm/tools/llvm-objcopy/wasm/Object.cpp | 4 +- llvm/tools/llvm-objcopy/wasm/WasmObjcopy.cpp | 1 - llvm/tools/llvm-objdump/ELFDump.cpp | 49 +- llvm/tools/llvm-objdump/MachODump.cpp | 90 +- llvm/tools/llvm-objdump/llvm-objdump.cpp | 253 +- llvm/tools/llvm-objdump/llvm-objdump.h | 6 +- llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp | 17 +- llvm/tools/llvm-pdbutil/FormatUtil.cpp | 7 +- llvm/tools/llvm-pdbutil/FormatUtil.h | 4 +- .../llvm-pdbutil/MinimalSymbolDumper.cpp | 13 +- llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 4 +- llvm/tools/llvm-profdata/llvm-profdata.cpp | 1202 +++- llvm/tools/llvm-readobj/ARMEHABIPrinter.h | 135 +- llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp | 211 +- llvm/tools/llvm-readobj/ARMWinEHPrinter.h | 12 + llvm/tools/llvm-readobj/COFFDumper.cpp | 64 +- llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h | 86 +- llvm/tools/llvm-readobj/ELFDumper.cpp | 5272 ++++++++--------- llvm/tools/llvm-readobj/Error.cpp | 56 - llvm/tools/llvm-readobj/Error.h | 40 - llvm/tools/llvm-readobj/MachODumper.cpp | 39 +- llvm/tools/llvm-readobj/ObjDumper.cpp | 52 +- llvm/tools/llvm-readobj/ObjDumper.h | 49 +- llvm/tools/llvm-readobj/WasmDumper.cpp | 16 +- llvm/tools/llvm-readobj/Win64EHDumper.cpp | 5 +- .../llvm-readobj/WindowsResourceDumper.cpp | 1 - llvm/tools/llvm-readobj/XCOFFDumper.cpp | 15 +- llvm/tools/llvm-readobj/llvm-readobj.cpp | 153 +- llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 2 + llvm/tools/llvm-size/llvm-size.cpp | 4 +- llvm/tools/llvm-stress/llvm-stress.cpp | 38 +- llvm/tools/llvm-symbolizer/Opts.td | 71 + .../tools/llvm-symbolizer/llvm-symbolizer.cpp | 376 +- llvm/tools/llvm-xray/xray-account.cpp | 84 +- llvm/tools/llvm-xray/xray-account.h | 31 +- llvm/tools/llvm-xray/xray-graph.cpp | 3 +- llvm/tools/llvm-xray/xray-stacks.cpp | 23 +- llvm/tools/opt/NewPMDriver.cpp | 158 +- llvm/tools/opt/NewPMDriver.h | 13 +- llvm/tools/opt/opt.cpp | 277 +- llvm/utils/TableGen/AsmMatcherEmitter.cpp | 139 +- llvm/utils/TableGen/AsmWriterEmitter.cpp | 113 +- llvm/utils/TableGen/AsmWriterInst.cpp | 7 +- llvm/utils/TableGen/CallingConvEmitter.cpp | 18 +- llvm/utils/TableGen/CodeEmitterGen.cpp | 8 +- llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 34 +- llvm/utils/TableGen/CodeGenDAGPatterns.h | 8 +- llvm/utils/TableGen/CodeGenInstruction.cpp | 2 +- llvm/utils/TableGen/CodeGenIntrinsics.h | 10 +- llvm/utils/TableGen/CodeGenMapTable.cpp | 26 +- llvm/utils/TableGen/CodeGenRegisters.cpp | 19 +- llvm/utils/TableGen/CodeGenRegisters.h | 4 +- llvm/utils/TableGen/CodeGenSchedule.cpp | 351 +- llvm/utils/TableGen/CodeGenSchedule.h | 13 +- llvm/utils/TableGen/CodeGenTarget.cpp | 255 +- llvm/utils/TableGen/CodeGenTarget.h | 9 +- llvm/utils/TableGen/DAGISelEmitter.cpp | 14 +- llvm/utils/TableGen/DAGISelMatcher.h | 20 +- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 226 +- llvm/utils/TableGen/DAGISelMatcherGen.cpp | 10 +- llvm/utils/TableGen/DFAEmitter.cpp | 5 +- llvm/utils/TableGen/DFAPacketizerEmitter.cpp | 2 +- llvm/utils/TableGen/DirectiveEmitter.cpp | 758 ++- llvm/utils/TableGen/ExegesisEmitter.cpp | 2 +- .../utils/TableGen/FixedLenDecoderEmitter.cpp | 44 +- llvm/utils/TableGen/GICombinerEmitter.cpp | 55 +- .../TableGen/GlobalISel/CodeExpander.cpp | 23 +- llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp | 2 +- .../TableGen/GlobalISel/GIMatchDagInstr.cpp | 2 +- .../utils/TableGen/GlobalISel/GIMatchTree.cpp | 15 +- llvm/utils/TableGen/GlobalISel/GIMatchTree.h | 5 +- llvm/utils/TableGen/GlobalISelEmitter.cpp | 802 ++- llvm/utils/TableGen/InstrInfoEmitter.cpp | 39 +- llvm/utils/TableGen/IntrinsicEmitter.cpp | 16 +- llvm/utils/TableGen/OptParserEmitter.cpp | 303 +- llvm/utils/TableGen/PredicateExpander.cpp | 22 +- llvm/utils/TableGen/PredicateExpander.h | 3 + llvm/utils/TableGen/PseudoLoweringEmitter.cpp | 114 +- .../TableGen/RISCVCompressInstEmitter.cpp | 234 +- llvm/utils/TableGen/RegisterBankEmitter.cpp | 19 +- llvm/utils/TableGen/RegisterInfoEmitter.cpp | 47 +- .../utils/TableGen/SearchableTableEmitter.cpp | 227 +- llvm/utils/TableGen/SubtargetEmitter.cpp | 122 +- llvm/utils/TableGen/SubtargetFeatureInfo.cpp | 5 +- llvm/utils/TableGen/SubtargetFeatureInfo.h | 5 - llvm/utils/TableGen/TableGen.cpp | 30 +- .../WebAssemblyDisassemblerEmitter.cpp | 15 +- llvm/utils/TableGen/X86DisassemblerTables.cpp | 2 +- llvm/utils/TableGen/X86FoldTablesEmitter.cpp | 27 +- llvm/utils/TableGen/X86RecognizableInstr.cpp | 5 +- openmp/runtime/src/dllexports | 6 + openmp/runtime/src/i18n/en_US.txt | 11 +- openmp/runtime/src/include/omp-tools.h.var | 141 +- openmp/runtime/src/include/omp.h.var | 93 +- openmp/runtime/src/include/omp_lib.f.var | 1052 ---- openmp/runtime/src/include/omp_lib.f90.var | 98 +- openmp/runtime/src/include/omp_lib.h.var | 104 +- openmp/runtime/src/kmp.h | 453 +- openmp/runtime/src/kmp_affinity.cpp | 166 +- openmp/runtime/src/kmp_affinity.h | 91 +- openmp/runtime/src/kmp_alloc.cpp | 136 +- openmp/runtime/src/kmp_atomic.cpp | 252 +- openmp/runtime/src/kmp_atomic.h | 2 +- openmp/runtime/src/kmp_barrier.cpp | 77 +- openmp/runtime/src/kmp_config.h.cmake | 18 + openmp/runtime/src/kmp_csupport.cpp | 176 +- openmp/runtime/src/kmp_debugger.cpp | 2 +- openmp/runtime/src/kmp_dispatch.cpp | 65 +- openmp/runtime/src/kmp_dispatch_hier.h | 14 +- openmp/runtime/src/kmp_environment.cpp | 7 +- openmp/runtime/src/kmp_error.cpp | 3 - openmp/runtime/src/kmp_ftn_entry.h | 26 +- openmp/runtime/src/kmp_ftn_os.h | 2 + openmp/runtime/src/kmp_global.cpp | 10 + openmp/runtime/src/kmp_gsupport.cpp | 400 +- openmp/runtime/src/kmp_i18n.h | 2 +- openmp/runtime/src/kmp_itt.inl | 59 +- openmp/runtime/src/kmp_lock.cpp | 181 +- openmp/runtime/src/kmp_lock.h | 15 +- openmp/runtime/src/kmp_os.h | 51 +- openmp/runtime/src/kmp_platform.h | 6 - openmp/runtime/src/kmp_runtime.cpp | 510 +- openmp/runtime/src/kmp_safe_c_api.h | 6 +- openmp/runtime/src/kmp_sched.cpp | 10 + openmp/runtime/src/kmp_settings.cpp | 569 +- openmp/runtime/src/kmp_stats.cpp | 57 +- openmp/runtime/src/kmp_stats.h | 5 +- openmp/runtime/src/kmp_str.cpp | 58 +- openmp/runtime/src/kmp_str.h | 9 +- openmp/runtime/src/kmp_stub.cpp | 17 +- openmp/runtime/src/kmp_stub.h | 4 +- openmp/runtime/src/kmp_taskdeps.cpp | 53 +- openmp/runtime/src/kmp_taskdeps.h | 30 +- openmp/runtime/src/kmp_tasking.cpp | 498 +- openmp/runtime/src/kmp_threadprivate.cpp | 10 +- openmp/runtime/src/kmp_utility.cpp | 2 +- openmp/runtime/src/kmp_wait_release.cpp | 26 +- openmp/runtime/src/kmp_wait_release.h | 236 +- openmp/runtime/src/kmp_wrapper_getpid.h | 2 +- openmp/runtime/src/ompt-event-specific.h | 8 +- openmp/runtime/src/ompt-general.cpp | 119 +- openmp/runtime/src/ompt-specific.cpp | 4 +- openmp/runtime/src/ompt-specific.h | 31 +- openmp/runtime/src/z_Linux_asm.S | 18 +- openmp/runtime/src/z_Linux_util.cpp | 256 +- openmp/runtime/src/z_Windows_NT_util.cpp | 71 +- 4834 files changed, 365644 insertions(+), 165259 deletions(-) create mode 100644 clang/include/clang-c/Rewrite.h create mode 100644 clang/include/clang/APINotes/APINotesYAMLCompiler.h create mode 100644 clang/include/clang/APINotes/Types.h create mode 100644 clang/include/clang/AST/IgnoreExpr.h create mode 100644 clang/include/clang/Analysis/Analyses/CalledOnceCheck.h create mode 100644 clang/include/clang/Analysis/IssueHash.h create mode 100644 clang/include/clang/Basic/DirectoryEntry.h create mode 100644 clang/include/clang/Basic/FileEntry.h create mode 100644 clang/include/clang/Basic/PPCTypes.def create mode 100644 clang/include/clang/Basic/ProfileList.h create mode 100644 clang/include/clang/Basic/TargetID.h create mode 100644 clang/include/clang/IndexSerialization/SerializablePathCollection.h delete mode 100644 clang/include/clang/StaticAnalyzer/Core/IssueHash.h mode change 100755 => 100644 clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h rename clang/include/clang/Tooling/{Core => Refactoring}/Lookup.h (93%) create mode 100644 clang/include/clang/Tooling/Syntax/Nodes.td create mode 100644 clang/include/clang/Tooling/Syntax/Syntax.td create mode 100644 clang/lib/APINotes/APINotesFormat.h create mode 100644 clang/lib/APINotes/APINotesTypes.cpp create mode 100644 clang/lib/APINotes/APINotesYAMLCompiler.cpp create mode 100644 clang/lib/Analysis/CalledOnceCheck.cpp rename clang/lib/{StaticAnalyzer/Core => Analysis}/IssueHash.cpp (80%) create mode 100644 clang/lib/Basic/FileEntry.cpp create mode 100644 clang/lib/Basic/OpenCLOptions.cpp create mode 100644 clang/lib/Basic/ProfileList.cpp create mode 100644 clang/lib/Basic/TargetID.cpp create mode 100644 clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp create mode 100644 clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h create mode 100644 clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp create mode 100644 clang/lib/CodeGen/CGOpenMPRuntimeGPU.h create mode 100644 clang/lib/Driver/ToolChains/ZOS.cpp create mode 100644 clang/lib/Driver/ToolChains/ZOS.h create mode 100644 clang/lib/Format/MacroExpander.cpp create mode 100644 clang/lib/Format/Macros.h mode change 100644 => 100755 clang/lib/Format/TokenAnnotator.cpp create mode 100644 clang/lib/Headers/__clang_hip_cmath.h create mode 100644 clang/lib/Headers/avxvnniintrin.h create mode 100644 clang/lib/Headers/hresetintrin.h create mode 100644 clang/lib/Headers/keylockerintrin.h create mode 100644 clang/lib/Headers/openmp_wrappers/complex_cmath.h create mode 100644 clang/lib/Headers/uintrintrin.h create mode 100644 clang/lib/Headers/x86gprintrin.h delete mode 100644 clang/lib/Index/SimpleFormatContext.h create mode 100644 clang/lib/IndexSerialization/SerializablePathCollection.cpp create mode 100644 clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp create mode 100644 clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp mode change 100755 => 100644 clang/lib/StaticAnalyzer/Checkers/Yaml.h rename clang/lib/Tooling/{Core => Refactoring}/Lookup.cpp (99%) create mode 100644 clang/utils/TableGen/ClangSyntaxEmitter.cpp create mode 100644 compiler-rt/.clang-tidy create mode 100644 compiler-rt/include/sanitizer/memprof_interface.h create mode 100644 compiler-rt/lib/builtins/aarch64/lse.S create mode 100644 compiler-rt/lib/builtins/divmodti4.c create mode 100644 compiler-rt/lib/builtins/extendhftf2.c create mode 100644 compiler-rt/lib/builtins/fp_div_impl.inc create mode 100644 compiler-rt/lib/builtins/int_mulo_impl.inc create mode 100644 compiler-rt/lib/builtins/int_mulv_impl.inc create mode 100644 compiler-rt/lib/builtins/trunctfhf2.c create mode 100644 compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp create mode 100644 compiler-rt/lib/gwp_asan/optional/backtrace_fuchsia.cpp create mode 100644 compiler-rt/lib/gwp_asan/optional/printf.h create mode 100644 compiler-rt/lib/gwp_asan/optional/segv_handler_fuchsia.cpp create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/common_fuchsia.cpp create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.cpp create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_fuchsia.h create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.h create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.cpp create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/mutex_posix.h create mode 100644 compiler-rt/lib/gwp_asan/platform_specific/utilities_fuchsia.cpp delete mode 100644 compiler-rt/lib/gwp_asan/random.cpp delete mode 100644 compiler-rt/lib/gwp_asan/random.h create mode 100644 compiler-rt/lib/gwp_asan/utilities.cpp create mode 100644 compiler-rt/lib/memprof/README.txt create mode 100644 compiler-rt/lib/memprof/memprof.syms.extra create mode 100644 compiler-rt/lib/memprof/memprof_allocator.cpp create mode 100644 compiler-rt/lib/memprof/memprof_allocator.h create mode 100644 compiler-rt/lib/memprof/memprof_descriptions.cpp create mode 100644 compiler-rt/lib/memprof/memprof_descriptions.h create mode 100644 compiler-rt/lib/memprof/memprof_flags.cpp create mode 100644 compiler-rt/lib/memprof/memprof_flags.h create mode 100644 compiler-rt/lib/memprof/memprof_flags.inc create mode 100644 compiler-rt/lib/memprof/memprof_init_version.h create mode 100644 compiler-rt/lib/memprof/memprof_interceptors.cpp create mode 100644 compiler-rt/lib/memprof/memprof_interceptors.h create mode 100644 compiler-rt/lib/memprof/memprof_interceptors_memintrinsics.cpp create mode 100644 compiler-rt/lib/memprof/memprof_interceptors_memintrinsics.h create mode 100644 compiler-rt/lib/memprof/memprof_interface_internal.h create mode 100644 compiler-rt/lib/memprof/memprof_internal.h create mode 100644 compiler-rt/lib/memprof/memprof_linux.cpp create mode 100644 compiler-rt/lib/memprof/memprof_malloc_linux.cpp create mode 100644 compiler-rt/lib/memprof/memprof_mapping.h create mode 100644 compiler-rt/lib/memprof/memprof_new_delete.cpp create mode 100644 compiler-rt/lib/memprof/memprof_posix.cpp create mode 100644 compiler-rt/lib/memprof/memprof_preinit.cpp create mode 100644 compiler-rt/lib/memprof/memprof_rtl.cpp create mode 100644 compiler-rt/lib/memprof/memprof_shadow_setup.cpp create mode 100644 compiler-rt/lib/memprof/memprof_stack.cpp create mode 100644 compiler-rt/lib/memprof/memprof_stack.h create mode 100644 compiler-rt/lib/memprof/memprof_stats.cpp create mode 100644 compiler-rt/lib/memprof/memprof_stats.h create mode 100644 compiler-rt/lib/memprof/memprof_thread.cpp create mode 100644 compiler-rt/lib/memprof/memprof_thread.h create mode 100644 compiler-rt/lib/memprof/weak_symbols.txt create mode 100644 compiler-rt/lib/profile/InstrProfilingVersionVar.c mode change 100755 => 100644 compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc create mode 100644 compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S create mode 100644 compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_fuchsia.h create mode 100644 compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_riscv64.inc create mode 100644 compiler-rt/lib/scudo/standalone/options.h create mode 100644 libcxx/include/__availability create mode 100644 libcxx/include/__bits create mode 100644 libcxx/include/__memory/allocator_traits.h create mode 100644 libcxx/include/__memory/base.h create mode 100644 libcxx/include/__memory/pointer_traits.h create mode 100644 libcxx/include/__memory/utilities.h create mode 100644 libcxx/src/ios.instantiations.cpp create mode 100644 lld/COFF/CallGraphSort.cpp create mode 100644 lld/COFF/CallGraphSort.h create mode 100644 lld/ELF/Arch/PPCInsns.def create mode 100644 lld/MachO/DriverUtils.cpp create mode 100644 lld/MachO/Dwarf.cpp create mode 100644 lld/MachO/Dwarf.h create mode 100644 lld/MachO/LTO.cpp create mode 100644 lld/MachO/LTO.h create mode 100644 lld/MachO/ObjC.cpp create mode 100644 lld/MachO/ObjC.h create mode 100644 lld/MachO/UnwindInfoSection.cpp create mode 100644 lld/MachO/UnwindInfoSection.h create mode 100644 lld/docs/ELF/warn_backrefs.rst create mode 100644 lld/docs/error_handling_script.rst create mode 100644 lldb/bindings/lua/lua-swigsafecast.swig create mode 100644 lldb/bindings/lua/lua-wrapper.swig rename lldb/bindings/{ => lua}/lua.swig (54%) create mode 100644 lldb/bindings/python/python-typemaps.h rename lldb/bindings/{ => python}/python.swig (66%) create mode 100644 lldb/docs/_lldb/__init__.py create mode 100644 lldb/docs/design/overview.rst create mode 100644 lldb/docs/design/reproducers.rst create mode 100644 lldb/docs/design/sbapi.rst create mode 100644 lldb/docs/design/structureddataplugins.md create mode 100644 lldb/docs/man/lldb-server.rst create mode 100644 lldb/docs/python_api.rst create mode 100644 lldb/docs/python_api_enums.rst create mode 100644 lldb/include/lldb/Breakpoint/StoppointHitCounter.h delete mode 100644 lldb/include/lldb/Breakpoint/StoppointLocation.h create mode 100644 lldb/include/lldb/Breakpoint/StoppointSite.h create mode 100644 lldb/include/lldb/Interpreter/OptionValueFileColonLine.h create mode 100644 lldb/include/lldb/Target/PostMortemProcess.h create mode 100644 lldb/include/lldb/Target/ProcessTrace.h create mode 100644 lldb/include/lldb/Target/Runtime.h create mode 100644 lldb/include/lldb/Target/ThreadTrace.h create mode 100644 lldb/include/lldb/Target/Trace.h create mode 100644 lldb/include/lldb/Target/TraceSessionFileParser.h create mode 100644 lldb/include/lldb/Utility/OptionDefinition.h create mode 100644 lldb/include/lldb/Utility/ReproducerProvider.h create mode 100644 lldb/include/lldb/Utility/UnimplementedError.h delete mode 100644 lldb/source/Breakpoint/StoppointLocation.cpp create mode 100644 lldb/source/Breakpoint/StoppointSite.cpp rename lldb/source/{Interpreter => Commands}/CommandObjectRegexCommand.cpp (88%) rename lldb/{include/lldb/Interpreter => source/Commands}/CommandObjectRegexCommand.h (81%) create mode 100644 lldb/source/Commands/CommandObjectScript.cpp rename lldb/source/{Interpreter => Commands}/CommandObjectScript.h (56%) create mode 100644 lldb/source/Commands/CommandObjectSession.cpp create mode 100644 lldb/source/Commands/CommandObjectSession.h create mode 100644 lldb/source/Commands/CommandObjectThreadUtil.cpp create mode 100644 lldb/source/Commands/CommandObjectThreadUtil.h create mode 100644 lldb/source/Commands/CommandObjectTrace.cpp create mode 100644 lldb/source/Commands/CommandObjectTrace.h create mode 100644 lldb/source/Commands/CommandOptionsProcessLaunch.cpp create mode 100644 lldb/source/Commands/CommandOptionsProcessLaunch.h delete mode 100644 lldb/source/Interpreter/CommandObjectScript.cpp create mode 100644 lldb/source/Interpreter/OptionValueFileColonLine.cpp create mode 100644 lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp create mode 100644 lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD.cpp create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD.h create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp create mode 100644 lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.h create mode 100644 lldb/source/Plugins/Process/Utility/LinuxPTraceDefines_arm64sve.h create mode 100644 lldb/source/Plugins/Process/Utility/NativeRegisterContextWatchpoint_x86.cpp create mode 100644 lldb/source/Plugins/Process/Utility/NativeRegisterContextWatchpoint_x86.h create mode 100644 lldb/source/Plugins/Process/Utility/RegisterContext_x86.cpp create mode 100644 lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h create mode 100644 lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp create mode 100644 lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h create mode 100644 lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp create mode 100644 lldb/source/Plugins/Trace/intel-pt/DecodedThread.h create mode 100644 lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp create mode 100644 lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h create mode 100644 lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp create mode 100644 lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h create mode 100644 lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td create mode 100644 lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp create mode 100644 lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h create mode 100644 lldb/source/Target/ProcessTrace.cpp create mode 100644 lldb/source/Target/ThreadTrace.cpp create mode 100644 lldb/source/Target/Trace.cpp create mode 100644 lldb/source/Target/TraceSessionFileParser.cpp create mode 100644 lldb/source/Utility/ReproducerProvider.cpp create mode 100644 lldb/source/Utility/TraceOptions.cpp create mode 100644 lldb/source/Utility/UnimplementedError.cpp create mode 100644 lldb/tools/lldb-server/LLGSOptions.td create mode 100644 llvm/include/llvm-c/LLJIT.h delete mode 100644 llvm/include/llvm-c/LinkTimeOptimizer.h delete mode 100644 llvm/include/llvm-c/OrcBindings.h create mode 100644 llvm/include/llvm-c/OrcEE.h rename clang/include/clang/Basic/FixedPoint.h => llvm/include/llvm/ADT/APFixedPoint.h (72%) create mode 100644 llvm/include/llvm/Analysis/ConstraintSystem.h create mode 100644 llvm/include/llvm/Analysis/DDGPrinter.h create mode 100644 llvm/include/llvm/Analysis/Delinearization.h create mode 100644 llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h create mode 100644 llvm/include/llvm/Analysis/IRSimilarityIdentifier.h delete mode 100644 llvm/include/llvm/Analysis/InlineFeaturesAnalysis.h create mode 100644 llvm/include/llvm/Analysis/InstCount.h create mode 100644 llvm/include/llvm/Analysis/MemDerefPrinter.h create mode 100644 llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h create mode 100644 llvm/include/llvm/Analysis/ReplayInlineAdvisor.h rename llvm/include/llvm/{Transforms => Analysis}/Utils/ImportedFunctionsInliningStatistics.h (98%) create mode 100644 llvm/include/llvm/BinaryFormat/ELFRelocs/CSKY.def rename llvm/include/llvm/{Object => BinaryFormat}/WasmTraits.h (94%) create mode 100644 llvm/include/llvm/Bitcode/BitcodeCommon.h create mode 100644 llvm/include/llvm/Bitcode/BitcodeConvenience.h create mode 100644 llvm/include/llvm/CodeGen/BasicBlockSectionUtils.h create mode 100644 llvm/include/llvm/CodeGen/CodeGenPassBuilder.h create mode 100644 llvm/include/llvm/CodeGen/MachinePassManager.h create mode 100644 llvm/include/llvm/CodeGen/MachinePassRegistry.def create mode 100644 llvm/include/llvm/CodeGen/MachineStableHash.h create mode 100644 llvm/include/llvm/CodeGen/MultiHazardRecognizer.h create mode 100644 llvm/include/llvm/CodeGen/StableHashing.h create mode 100644 llvm/include/llvm/CodeGen/TileShapeInfo.h create mode 100644 llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h create mode 100644 llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h create mode 100644 llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/LambdaResolver.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/Legacy.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/NullResolver.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h rename llvm/include/llvm/ExecutionEngine/Orc/{ => Shared}/OrcError.h (100%) rename llvm/include/llvm/ExecutionEngine/Orc/{RPC => Shared}/RPCUtils.h (89%) rename llvm/include/llvm/ExecutionEngine/Orc/{RPC => Shared}/RawByteChannel.h (88%) rename llvm/include/llvm/ExecutionEngine/Orc/{RPC/RPCSerialization.h => Shared/Serialization.h} (64%) create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TPCEHFrameRegistrar.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TPCIndirectionUtils.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/OrcRPCTPCServer.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h create mode 100644 llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h rename llvm/include/llvm/{Support => FileCheck}/FileCheck.h (85%) create mode 100644 llvm/include/llvm/IR/Assumptions.h create mode 100644 llvm/include/llvm/IR/FixedPointBuilder.h create mode 100644 llvm/include/llvm/IR/IntrinsicsVE.td create mode 100644 llvm/include/llvm/IR/IntrinsicsVEVL.gen.td create mode 100644 llvm/include/llvm/IR/PrintPasses.h create mode 100644 llvm/include/llvm/IR/PseudoProbe.h create mode 100644 llvm/include/llvm/IR/ReplaceConstant.h create mode 100644 llvm/include/llvm/IR/StructuralHash.h create mode 100644 llvm/include/llvm/InterfaceStub/ELFObjHandler.h rename llvm/include/llvm/{TextAPI/ELF => InterfaceStub}/ELFStub.h (93%) rename llvm/include/llvm/{TextAPI/ELF => InterfaceStub}/TBEHandler.h (100%) create mode 100644 llvm/include/llvm/MC/MCPseudoProbe.h create mode 100644 llvm/include/llvm/Object/MachOUniversalWriter.h create mode 100644 llvm/include/llvm/ObjectYAML/ArchiveYAML.h create mode 100644 llvm/include/llvm/Remarks/HotnessThresholdParser.h create mode 100644 llvm/include/llvm/Support/ExitCodes.h create mode 100644 llvm/include/llvm/Support/FileSystem/UniqueID.h create mode 100644 llvm/include/llvm/Support/InstructionCost.h create mode 100644 llvm/include/llvm/Support/MemoryBufferRef.h create mode 100644 llvm/include/llvm/Support/RISCVTargetParser.def create mode 100644 llvm/include/llvm/TableGen/DirectiveEmitter.h create mode 100644 llvm/include/llvm/Target/CGPassBuilderOption.h create mode 100644 llvm/include/llvm/Transforms/HelloNew/HelloWorld.h create mode 100644 llvm/include/llvm/Transforms/IPO/Annotation2Metadata.h create mode 100644 llvm/include/llvm/Transforms/IPO/BlockExtractor.h create mode 100644 llvm/include/llvm/Transforms/IPO/IROutliner.h create mode 100644 llvm/include/llvm/Transforms/IPO/LoopExtractor.h create mode 100644 llvm/include/llvm/Transforms/IPO/SampleContextTracker.h create mode 100644 llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h create mode 100644 llvm/include/llvm/Transforms/IPO/StripSymbols.h create mode 100644 llvm/include/llvm/Transforms/InstCombine/InstCombiner.h create mode 100644 llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h create mode 100644 llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h create mode 100644 llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h create mode 100644 llvm/include/llvm/Transforms/Scalar/ConstraintElimination.h create mode 100644 llvm/include/llvm/Transforms/Scalar/InferAddressSpaces.h create mode 100644 llvm/include/llvm/Transforms/Scalar/LoopFlatten.h create mode 100644 llvm/include/llvm/Transforms/Scalar/LoopInterchange.h create mode 100644 llvm/include/llvm/Transforms/Scalar/LoopReroll.h create mode 100644 llvm/include/llvm/Transforms/Scalar/LoopVersioningLICM.h create mode 100644 llvm/include/llvm/Transforms/Scalar/Reg2Mem.h create mode 100644 llvm/include/llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h create mode 100644 llvm/include/llvm/Transforms/Scalar/SeparateConstOffsetFromGEP.h create mode 100644 llvm/include/llvm/Transforms/Scalar/StraightLineStrengthReduce.h create mode 100644 llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h create mode 100644 llvm/include/llvm/Transforms/Utils/FixIrreducible.h create mode 100644 llvm/include/llvm/Transforms/Utils/InstructionNamer.h create mode 100644 llvm/include/llvm/Transforms/Utils/LoopPeel.h create mode 100644 llvm/include/llvm/Transforms/Utils/LowerSwitch.h create mode 100644 llvm/include/llvm/Transforms/Utils/MatrixUtils.h create mode 100644 llvm/include/llvm/Transforms/Utils/MetaRenamer.h delete mode 100644 llvm/include/llvm/Transforms/Utils/MisExpect.h create mode 100644 llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h create mode 100644 llvm/include/llvm/Transforms/Utils/StripGCRelocates.h create mode 100644 llvm/include/llvm/Transforms/Utils/StripNonLineTableDebugInfo.h create mode 100644 llvm/include/llvm/Transforms/Utils/UnifyLoopExits.h create mode 100644 llvm/lib/Analysis/ConstraintSystem.cpp create mode 100644 llvm/lib/Analysis/DDGPrinter.cpp create mode 100644 llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp create mode 100644 llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp create mode 100644 llvm/lib/Analysis/IRSimilarityIdentifier.cpp rename llvm/lib/{Transforms/Utils => Analysis}/ImportedFunctionsInliningStatistics.cpp (92%) delete mode 100644 llvm/lib/Analysis/InlineFeaturesAnalysis.cpp create mode 100644 llvm/lib/Analysis/ReplayInlineAdvisor.cpp create mode 100644 llvm/lib/Analysis/models/inliner/README.txt create mode 100644 llvm/lib/Analysis/models/inliner/output_spec.json create mode 100644 llvm/lib/CodeGen/AsmPrinter/AIXException.cpp create mode 100644 llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp create mode 100644 llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.h rename llvm/lib/CodeGen/{BBSectionsPrepare.cpp => BasicBlockSections.cpp} (85%) create mode 100644 llvm/lib/CodeGen/CodeGenPassBuilder.cpp create mode 100644 llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp create mode 100644 llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp create mode 100644 llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h rename llvm/lib/CodeGen/{LiveDebugValues.cpp => LiveDebugValues/VarLocBasedImpl.cpp} (93%) create mode 100644 llvm/lib/CodeGen/MachineCheckDebugify.cpp create mode 100644 llvm/lib/CodeGen/MachineFunctionSplitter.cpp create mode 100644 llvm/lib/CodeGen/MachinePassManager.cpp create mode 100644 llvm/lib/CodeGen/MachineStableHash.cpp create mode 100644 llvm/lib/CodeGen/MultiHazardRecognizer.cpp create mode 100644 llvm/lib/CodeGen/PseudoProbeInserter.cpp create mode 100644 llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp create mode 100644 llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp delete mode 100644 llvm/lib/ExecutionEngine/Orc/Legacy.cpp delete mode 100644 llvm/lib/ExecutionEngine/Orc/NullResolver.cpp delete mode 100644 llvm/lib/ExecutionEngine/Orc/OrcCBindings.cpp delete mode 100644 llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h delete mode 100644 llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp delete mode 100644 llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h rename llvm/lib/ExecutionEngine/{OrcError => Orc/Shared}/OrcError.cpp (95%) rename llvm/lib/ExecutionEngine/{OrcError => Orc/Shared}/RPCError.cpp (83%) create mode 100644 llvm/lib/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TPCEHFrameRegistrar.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TPCIndirectionUtils.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp create mode 100644 llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp rename llvm/lib/{Support => FileCheck}/FileCheck.cpp (89%) rename llvm/lib/{Support => FileCheck}/FileCheckImpl.h (94%) create mode 100644 llvm/lib/IR/Assumptions.cpp create mode 100644 llvm/lib/IR/PrintPasses.cpp create mode 100644 llvm/lib/IR/PseudoProbe.cpp create mode 100644 llvm/lib/IR/ReplaceConstant.cpp create mode 100644 llvm/lib/IR/StructuralHash.cpp create mode 100644 llvm/lib/InterfaceStub/ELFObjHandler.cpp rename llvm/lib/{TextAPI/ELF => InterfaceStub}/ELFStub.cpp (95%) rename llvm/lib/{TextAPI/ELF => InterfaceStub}/TBEHandler.cpp (85%) create mode 100644 llvm/lib/MC/MCPseudoProbe.cpp create mode 100644 llvm/lib/Object/MachOUniversalWriter.cpp create mode 100644 llvm/lib/ObjectYAML/ArchiveEmitter.cpp create mode 100644 llvm/lib/ObjectYAML/ArchiveYAML.cpp delete mode 100644 llvm/lib/ObjectYAML/DWARFVisitor.cpp delete mode 100644 llvm/lib/ObjectYAML/DWARFVisitor.h rename clang/lib/Basic/FixedPoint.cpp => llvm/lib/Support/APFixedPoint.cpp (56%) create mode 100644 llvm/lib/Support/InstructionCost.cpp create mode 100644 llvm/lib/Support/MemoryBufferRef.cpp create mode 100644 llvm/lib/TableGen/DetailedRecordsBackend.cpp create mode 100644 llvm/lib/TableGen/TableGenBackendSkeleton.cpp create mode 100644 llvm/lib/Target/AArch64/AArch64SchedA55.td create mode 100644 llvm/lib/Target/AArch64/AArch64SchedA64FX.td create mode 100644 llvm/lib/Target/AArch64/AArch64SchedTSV110.td delete mode 100644 llvm/lib/Target/AArch64/AArch64StackOffset.h create mode 100644 llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h create mode 100644 llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp create mode 100644 llvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp create mode 100644 llvm/lib/Target/AArch64/GISel/select-saddo.mir create mode 100644 llvm/lib/Target/AArch64/GISel/select-ssubo.mir delete mode 100644 llvm/lib/Target/AMDGPU/AMDGPUInline.cpp create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp create mode 100644 llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUMIRFormatter.cpp create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUMIRFormatter.h create mode 100644 llvm/lib/Target/AMDGPU/EXPInstructions.td create mode 100644 llvm/lib/Target/AMDGPU/GCNSubtarget.h rename llvm/lib/{Transforms/InstCombine => Target/AMDGPU}/InstCombineTables.td (100%) create mode 100644 llvm/lib/Target/AMDGPU/R600Subtarget.h delete mode 100644 llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp create mode 100644 llvm/lib/Target/AMDGPU/SIProgramInfo.cpp create mode 100644 llvm/lib/Target/ARM/ARMBlockPlacement.cpp create mode 100644 llvm/lib/Target/ARM/ARMSLSHardening.cpp create mode 100644 llvm/lib/Target/ARM/ARMScheduleM7.td create mode 100644 llvm/lib/Target/ARM/MVETailPredUtils.h create mode 100644 llvm/lib/Target/BPF/BPFAdjustOpt.cpp create mode 100644 llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp create mode 100644 llvm/lib/Target/CSKY/CSKY.td create mode 100644 llvm/lib/Target/CSKY/CSKYInstrFormats.td create mode 100644 llvm/lib/Target/CSKY/CSKYInstrInfo.td create mode 100644 llvm/lib/Target/CSKY/CSKYRegisterInfo.td create mode 100644 llvm/lib/Target/CSKY/CSKYTargetMachine.cpp create mode 100644 llvm/lib/Target/CSKY/CSKYTargetMachine.h create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.h create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.cpp create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.h create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp create mode 100644 llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.h create mode 100644 llvm/lib/Target/CSKY/TargetInfo/CSKYTargetInfo.cpp create mode 100644 llvm/lib/Target/CSKY/TargetInfo/CSKYTargetInfo.h mode change 100755 => 100644 llvm/lib/Target/Hexagon/HexagonAsmPrinter.h create mode 100644 llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.h create mode 100644 llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp create mode 100644 llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.h create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCCallLowering.cpp create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCCallLowering.h create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCInstructionSelector.cpp create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCLegalizerInfo.cpp create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCLegalizerInfo.h create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp create mode 100644 llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h rename clang/lib/Frontend/FrontendTiming.cpp => llvm/lib/Target/PowerPC/GISel/PPCRegisterBanks.td (60%) delete mode 100644 llvm/lib/Target/PowerPC/PPCInstrQPX.td delete mode 100644 llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp rename llvm/lib/Target/RISCV/{Utils => MCTargetDesc}/RISCVBaseInfo.cpp (60%) create mode 100644 llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h rename llvm/lib/Target/RISCV/{Utils => MCTargetDesc}/RISCVMatInt.cpp (97%) rename llvm/lib/Target/RISCV/{Utils => MCTargetDesc}/RISCVMatInt.h (95%) create mode 100644 llvm/lib/Target/RISCV/RISCVCleanupVSETVLI.cpp create mode 100644 llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td create mode 100644 llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td create mode 100644 llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td create mode 100644 llvm/lib/Target/RISCV/RISCVSchedRocket.td delete mode 100644 llvm/lib/Target/RISCV/RISCVSchedRocket32.td delete mode 100644 llvm/lib/Target/RISCV/RISCVSchedRocket64.td create mode 100644 llvm/lib/Target/RISCV/RISCVSchedSiFive7.td delete mode 100644 llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.h mode change 100755 => 100644 llvm/lib/Target/Sparc/LeonFeatures.td mode change 100755 => 100644 llvm/lib/Target/Sparc/LeonPasses.cpp mode change 100755 => 100644 llvm/lib/Target/Sparc/LeonPasses.h mode change 100755 => 100644 llvm/lib/Target/Sparc/SparcSchedule.td create mode 100644 llvm/lib/Target/VE/LVLGen.cpp create mode 100644 llvm/lib/Target/VE/VEInstrBuilder.h create mode 100644 llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td create mode 100644 llvm/lib/Target/VE/VEInstrIntrinsicVL.td create mode 100644 llvm/lib/Target/VE/VEInstrPatternsVec.td create mode 100644 llvm/lib/Target/VE/VEInstrVec.td create mode 100644 llvm/lib/Target/VE/VVPInstrInfo.td create mode 100644 llvm/lib/Target/VE/VVPInstrPatternsVec.td create mode 100644 llvm/lib/Target/VE/VVPNodes.def create mode 100644 llvm/lib/Target/WebAssembly/WebAssemblyInstrTable.td create mode 100644 llvm/lib/Target/WebAssembly/WebAssemblySortRegion.cpp create mode 100644 llvm/lib/Target/WebAssembly/WebAssemblySortRegion.h delete mode 100644 llvm/lib/Target/X86/X86CondBrFolding.cpp mode change 100755 => 100644 llvm/lib/Target/X86/X86EvexToVex.cpp create mode 100644 llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp create mode 100644 llvm/lib/Target/X86/X86InstrKL.td create mode 100644 llvm/lib/Target/X86/X86InstrSNP.td create mode 100644 llvm/lib/Target/X86/X86InstrTDX.td create mode 100644 llvm/lib/Target/X86/X86LowerAMXType.cpp create mode 100644 llvm/lib/Target/X86/X86PreTileConfig.cpp mode change 100755 => 100644 llvm/lib/Target/X86/X86SchedBroadwell.td mode change 100755 => 100644 llvm/lib/Target/X86/X86SchedSkylakeServer.td create mode 100644 llvm/lib/Target/X86/X86TileConfig.cpp create mode 100644 llvm/lib/Transforms/HelloNew/HelloWorld.cpp create mode 100644 llvm/lib/Transforms/IPO/Annotation2Metadata.cpp delete mode 100644 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp create mode 100644 llvm/lib/Transforms/IPO/IROutliner.cpp create mode 100644 llvm/lib/Transforms/IPO/SampleContextTracker.cpp create mode 100644 llvm/lib/Transforms/IPO/SampleProfileProbe.cpp create mode 100644 llvm/lib/Transforms/Instrumentation/MemProfiler.cpp create mode 100644 llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp delete mode 100644 llvm/lib/Transforms/Scalar/ConstantProp.cpp create mode 100644 llvm/lib/Transforms/Scalar/ConstraintElimination.cpp create mode 100644 llvm/lib/Transforms/Scalar/LoopFlatten.cpp rename llvm/lib/{CodeGen => Transforms/Scalar}/ScalarizeMaskedMemIntrin.cpp (88%) rename llvm/lib/Transforms/Utils/{LoopUnrollPeel.cpp => LoopPeel.cpp} (91%) create mode 100644 llvm/lib/Transforms/Utils/MatrixUtils.cpp delete mode 100644 llvm/lib/Transforms/Utils/MisExpect.cpp create mode 100644 llvm/tools/llvm-mca/Views/InstructionView.cpp create mode 100644 llvm/tools/llvm-mca/Views/InstructionView.h create mode 100644 llvm/tools/llvm-objcopy/BitcodeStripOpts.td delete mode 100644 llvm/tools/llvm-readobj/Error.cpp delete mode 100644 llvm/tools/llvm-readobj/Error.h create mode 100644 llvm/tools/llvm-symbolizer/Opts.td delete mode 100644 openmp/runtime/src/include/omp_lib.f.var diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 5fa728d6d66..e305283bbaf 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -33,7 +33,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 60 +#define CINDEX_VERSION_MINOR 61 #define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1)) @@ -2052,62 +2052,58 @@ enum CXCursorKind { */ CXCursor_CXXFunctionalCastExpr = 128, - /** OpenCL's addrspace_cast<> expression. - */ - CXCursor_CXXAddrspaceCastExpr = 129, - /** A C++ typeid expression (C++ [expr.typeid]). */ - CXCursor_CXXTypeidExpr = 130, + CXCursor_CXXTypeidExpr = 129, /** [C++ 2.13.5] C++ Boolean Literal. */ - CXCursor_CXXBoolLiteralExpr = 131, + CXCursor_CXXBoolLiteralExpr = 130, /** [C++0x 2.14.7] C++ Pointer Literal. */ - CXCursor_CXXNullPtrLiteralExpr = 132, + CXCursor_CXXNullPtrLiteralExpr = 131, /** Represents the "this" expression in C++ */ - CXCursor_CXXThisExpr = 133, + CXCursor_CXXThisExpr = 132, /** [C++ 15] C++ Throw Expression. * * This handles 'throw' and 'throw' assignment-expression. When * assignment-expression isn't present, Op will be null. */ - CXCursor_CXXThrowExpr = 134, + CXCursor_CXXThrowExpr = 133, /** A new expression for memory allocation and constructor calls, e.g: * "new CXXNewExpr(foo)". */ - CXCursor_CXXNewExpr = 135, + CXCursor_CXXNewExpr = 134, /** A delete expression for memory deallocation and destructor calls, * e.g. "delete[] pArray". */ - CXCursor_CXXDeleteExpr = 136, + CXCursor_CXXDeleteExpr = 135, /** A unary expression. (noexcept, sizeof, or other traits) */ - CXCursor_UnaryExpr = 137, + CXCursor_UnaryExpr = 136, /** An Objective-C string literal i.e. @"foo". */ - CXCursor_ObjCStringLiteral = 138, + CXCursor_ObjCStringLiteral = 137, /** An Objective-C \@encode expression. */ - CXCursor_ObjCEncodeExpr = 139, + CXCursor_ObjCEncodeExpr = 138, /** An Objective-C \@selector expression. */ - CXCursor_ObjCSelectorExpr = 140, + CXCursor_ObjCSelectorExpr = 139, /** An Objective-C \@protocol expression. */ - CXCursor_ObjCProtocolExpr = 141, + CXCursor_ObjCProtocolExpr = 140, /** An Objective-C "bridged" cast expression, which casts between * Objective-C pointers and C pointers, transferring ownership in the process. @@ -2116,7 +2112,7 @@ enum CXCursorKind { * NSString *str = (__bridge_transfer NSString *)CFCreateString(); * \endcode */ - CXCursor_ObjCBridgedCastExpr = 142, + CXCursor_ObjCBridgedCastExpr = 141, /** Represents a C++0x pack expansion that produces a sequence of * expressions. @@ -2131,7 +2127,7 @@ enum CXCursorKind { * } * \endcode */ - CXCursor_PackExpansionExpr = 143, + CXCursor_PackExpansionExpr = 142, /** Represents an expression that computes the length of a parameter * pack. @@ -2143,7 +2139,7 @@ enum CXCursorKind { * }; * \endcode */ - CXCursor_SizeOfPackExpr = 144, + CXCursor_SizeOfPackExpr = 143, /* Represents a C++ lambda expression that produces a local function * object. @@ -2157,39 +2153,43 @@ enum CXCursorKind { * } * \endcode */ - CXCursor_LambdaExpr = 145, + CXCursor_LambdaExpr = 144, /** Objective-c Boolean Literal. */ - CXCursor_ObjCBoolLiteralExpr = 146, + CXCursor_ObjCBoolLiteralExpr = 145, /** Represents the "self" expression in an Objective-C method. */ - CXCursor_ObjCSelfExpr = 147, + CXCursor_ObjCSelfExpr = 146, /** OpenMP 5.0 [2.1.5, Array Section]. */ - CXCursor_OMPArraySectionExpr = 148, + CXCursor_OMPArraySectionExpr = 147, /** Represents an @available(...) check. */ - CXCursor_ObjCAvailabilityCheckExpr = 149, + CXCursor_ObjCAvailabilityCheckExpr = 148, /** * Fixed point literal */ - CXCursor_FixedPointLiteral = 150, + CXCursor_FixedPointLiteral = 149, /** OpenMP 5.0 [2.1.4, Array Shaping]. */ - CXCursor_OMPArrayShapingExpr = 151, + CXCursor_OMPArrayShapingExpr = 150, /** * OpenMP 5.0 [2.1.6 Iterators] */ - CXCursor_OMPIteratorExpr = 152, + CXCursor_OMPIteratorExpr = 151, - CXCursor_LastExpr = CXCursor_OMPIteratorExpr, + /** OpenCL's addrspace_cast<> expression. + */ + CXCursor_CXXAddrspaceCastExpr = 152, + + CXCursor_LastExpr = CXCursor_CXXAddrspaceCastExpr, /* Statements */ CXCursor_FirstStmt = 200, @@ -2940,6 +2940,26 @@ CINDEX_LINKAGE int clang_getCursorPlatformAvailability( CINDEX_LINKAGE void clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); +/** + * If cursor refers to a variable declaration and it has initializer returns + * cursor referring to the initializer otherwise return null cursor. + */ +CINDEX_LINKAGE CXCursor clang_Cursor_getVarDeclInitializer(CXCursor cursor); + +/** + * If cursor refers to a variable declaration that has global storage returns 1. + * If cursor refers to a variable declaration that doesn't have global storage + * returns 0. Otherwise returns -1. + */ +CINDEX_LINKAGE int clang_Cursor_hasVarDeclGlobalStorage(CXCursor cursor); + +/** + * If cursor refers to a variable declaration that has external storage + * returns 1. If cursor refers to a variable declaration that doesn't have + * external storage returns 0. Otherwise returns -1. + */ +CINDEX_LINKAGE int clang_Cursor_hasVarDeclExternalStorage(CXCursor cursor); + /** * Describe the "language" of the entity referred to by a cursor. */ @@ -3841,7 +3861,15 @@ enum CXTypeNullabilityKind { /** * Nullability is not applicable to this type. */ - CXTypeNullability_Invalid = 3 + CXTypeNullability_Invalid = 3, + + /** + * Generally behaves like Nullable, except when used in a block parameter that + * was imported into a swift async method. There, swift will assume that the + * parameter can get null even if no error occured. _Nullable parameters are + * assumed to only get null on error. + */ + CXTypeNullability_NullableResult = 4 }; /** diff --git a/clang/include/clang-c/Rewrite.h b/clang/include/clang-c/Rewrite.h new file mode 100644 index 00000000000..ce1b05594b3 --- /dev/null +++ b/clang/include/clang-c/Rewrite.h @@ -0,0 +1,63 @@ +/*===-- clang-c/Rewrite.h - C CXRewriter --------------------------*- C -*-===*\ +|* *| +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| +|* Exceptions. *| +|* See https://llvm.org/LICENSE.txt for license information. *| +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| +|* *| +|*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_CLANG_C_REWRITE_H +#define LLVM_CLANG_C_REWRITE_H + +#include "clang-c/CXString.h" +#include "clang-c/ExternC.h" +#include "clang-c/Index.h" +#include "clang-c/Platform.h" + +LLVM_CLANG_C_EXTERN_C_BEGIN + +typedef void *CXRewriter; + +/** + * Create CXRewriter. + */ +CINDEX_LINKAGE CXRewriter clang_CXRewriter_create(CXTranslationUnit TU); + +/** + * Insert the specified string at the specified location in the original buffer. + */ +CINDEX_LINKAGE void clang_CXRewriter_insertTextBefore(CXRewriter Rew, CXSourceLocation Loc, + const char *Insert); + +/** + * Replace the specified range of characters in the input with the specified + * replacement. + */ +CINDEX_LINKAGE void clang_CXRewriter_replaceText(CXRewriter Rew, CXSourceRange ToBeReplaced, + const char *Replacement); + +/** + * Remove the specified range. + */ +CINDEX_LINKAGE void clang_CXRewriter_removeText(CXRewriter Rew, CXSourceRange ToBeRemoved); + +/** + * Save all changed files to disk. + * Returns 1 if any files were not saved successfully, returns 0 otherwise. + */ +CINDEX_LINKAGE int clang_CXRewriter_overwriteChangedFiles(CXRewriter Rew); + +/** + * Write out rewritten version of the main file to stdout. + */ +CINDEX_LINKAGE void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew); + +/** + * Free the given CXRewriter. + */ +CINDEX_LINKAGE void clang_CXRewriter_dispose(CXRewriter Rew); + +LLVM_CLANG_C_EXTERN_C_END + +#endif diff --git a/clang/include/clang/APINotes/APINotesYAMLCompiler.h b/clang/include/clang/APINotes/APINotesYAMLCompiler.h new file mode 100644 index 00000000000..6098d0ee36f --- /dev/null +++ b/clang/include/clang/APINotes/APINotesYAMLCompiler.h @@ -0,0 +1,24 @@ +//===-- APINotesYAMLCompiler.h - API Notes YAML Format Reader ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H +#define LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/raw_ostream.h" + +namespace clang { +namespace api_notes { +/// Parses the APINotes YAML content and writes the representation back to the +/// specified stream. This provides a means of testing the YAML processing of +/// the APINotes format. +bool parseAndDumpAPINotes(llvm::StringRef YI, llvm::raw_ostream &OS); +} // namespace api_notes +} // namespace clang + +#endif diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h new file mode 100644 index 00000000000..d9bf2f07291 --- /dev/null +++ b/clang/include/clang/APINotes/Types.h @@ -0,0 +1,734 @@ +//===-- Types.h - API Notes Data Types --------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_APINOTES_TYPES_H +#define LLVM_CLANG_APINOTES_TYPES_H + +#include "clang/Basic/Specifiers.h" +#include "llvm/ADT/Optional.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { +namespace api_notes { +enum class RetainCountConventionKind { + None, + CFReturnsRetained, + CFReturnsNotRetained, + NSReturnsRetained, + NSReturnsNotRetained, +}; + +/// The payload for an enum_extensibility attribute. This is a tri-state rather +/// than just a boolean because the presence of the attribute indicates +/// auditing. +enum class EnumExtensibilityKind { + None, + Open, + Closed, +}; + +/// The kind of a swift_wrapper/swift_newtype. +enum class SwiftNewTypeKind { + None, + Struct, + Enum, +}; + +/// Describes API notes data for any entity. +/// +/// This is used as the base of all API notes. +class CommonEntityInfo { +public: + /// Message to use when this entity is unavailable. + std::string UnavailableMsg; + + /// Whether this entity is marked unavailable. + unsigned Unavailable : 1; + + /// Whether this entity is marked unavailable in Swift. + unsigned UnavailableInSwift : 1; + +private: + /// Whether SwiftPrivate was specified. + unsigned SwiftPrivateSpecified : 1; + + /// Whether this entity is considered "private" to a Swift overlay. + unsigned SwiftPrivate : 1; + +public: + /// Swift name of this entity. + std::string SwiftName; + + CommonEntityInfo() + : Unavailable(0), UnavailableInSwift(0), SwiftPrivateSpecified(0), + SwiftPrivate(0) {} + + llvm::Optional isSwiftPrivate() const { + return SwiftPrivateSpecified ? llvm::Optional(SwiftPrivate) + : llvm::None; + } + + void setSwiftPrivate(llvm::Optional Private) { + SwiftPrivateSpecified = Private.hasValue(); + SwiftPrivate = Private.hasValue() ? *Private : 0; + } + + friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &); + + CommonEntityInfo &operator|=(const CommonEntityInfo &RHS) { + // Merge unavailability. + if (RHS.Unavailable) { + Unavailable = true; + if (UnavailableMsg.empty()) + UnavailableMsg = RHS.UnavailableMsg; + } + + if (RHS.UnavailableInSwift) { + UnavailableInSwift = true; + if (UnavailableMsg.empty()) + UnavailableMsg = RHS.UnavailableMsg; + } + + if (!SwiftPrivateSpecified) + setSwiftPrivate(RHS.isSwiftPrivate()); + + if (SwiftName.empty()) + SwiftName = RHS.SwiftName; + + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const CommonEntityInfo &LHS, + const CommonEntityInfo &RHS) { + return LHS.UnavailableMsg == RHS.UnavailableMsg && + LHS.Unavailable == RHS.Unavailable && + LHS.UnavailableInSwift == RHS.UnavailableInSwift && + LHS.SwiftPrivateSpecified == RHS.SwiftPrivateSpecified && + LHS.SwiftPrivate == RHS.SwiftPrivate && LHS.SwiftName == RHS.SwiftName; +} + +inline bool operator!=(const CommonEntityInfo &LHS, + const CommonEntityInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes for types. +class CommonTypeInfo : public CommonEntityInfo { + /// The Swift type to which a given type is bridged. + /// + /// Reflects the swift_bridge attribute. + llvm::Optional SwiftBridge; + + /// The NS error domain for this type. + llvm::Optional NSErrorDomain; + +public: + CommonTypeInfo() : CommonEntityInfo() {} + + const llvm::Optional &getSwiftBridge() const { + return SwiftBridge; + } + + void setSwiftBridge(const llvm::Optional &SwiftType) { + SwiftBridge = SwiftType; + } + + void setSwiftBridge(const llvm::Optional &SwiftType) { + SwiftBridge = SwiftType + ? llvm::Optional(std::string(*SwiftType)) + : llvm::None; + } + + const llvm::Optional &getNSErrorDomain() const { + return NSErrorDomain; + } + + void setNSErrorDomain(const llvm::Optional &Domain) { + NSErrorDomain = Domain; + } + + void setNSErrorDomain(const llvm::Optional &Domain) { + NSErrorDomain = + Domain ? llvm::Optional(std::string(*Domain)) : llvm::None; + } + + friend bool operator==(const CommonTypeInfo &, const CommonTypeInfo &); + + CommonTypeInfo &operator|=(const CommonTypeInfo &RHS) { + // Merge inherited info. + static_cast(*this) |= RHS; + + if (!SwiftBridge) + setSwiftBridge(RHS.getSwiftBridge()); + if (!NSErrorDomain) + setNSErrorDomain(RHS.getNSErrorDomain()); + + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.SwiftBridge == RHS.SwiftBridge && + LHS.NSErrorDomain == RHS.NSErrorDomain; +} + +inline bool operator!=(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes data for an Objective-C class or protocol. +class ObjCContextInfo : public CommonTypeInfo { + /// Whether this class has a default nullability. + unsigned HasDefaultNullability : 1; + + /// The default nullability. + unsigned DefaultNullability : 2; + + /// Whether this class has designated initializers recorded. + unsigned HasDesignatedInits : 1; + + unsigned SwiftImportAsNonGenericSpecified : 1; + unsigned SwiftImportAsNonGeneric : 1; + + unsigned SwiftObjCMembersSpecified : 1; + unsigned SwiftObjCMembers : 1; + +public: + ObjCContextInfo() + : CommonTypeInfo(), HasDefaultNullability(0), DefaultNullability(0), + HasDesignatedInits(0), SwiftImportAsNonGenericSpecified(false), + SwiftImportAsNonGeneric(false), SwiftObjCMembersSpecified(false), + SwiftObjCMembers(false) {} + + /// Determine the default nullability for properties and methods of this + /// class. + /// + /// eturns the default nullability, if implied, or None if there is no + llvm::Optional getDefaultNullability() const { + return HasDefaultNullability + ? llvm::Optional( + static_cast(DefaultNullability)) + : llvm::None; + } + + /// Set the default nullability for properties and methods of this class. + void setDefaultNullability(NullabilityKind Kind) { + HasDefaultNullability = true; + DefaultNullability = static_cast(Kind); + } + + bool hasDesignatedInits() const { return HasDesignatedInits; } + void setHasDesignatedInits(bool Value) { HasDesignatedInits = Value; } + + llvm::Optional getSwiftImportAsNonGeneric() const { + return SwiftImportAsNonGenericSpecified + ? llvm::Optional(SwiftImportAsNonGeneric) + : llvm::None; + } + void setSwiftImportAsNonGeneric(llvm::Optional Value) { + SwiftImportAsNonGenericSpecified = Value.hasValue(); + SwiftImportAsNonGeneric = Value.hasValue() ? *Value : false; + } + + llvm::Optional getSwiftObjCMembers() const { + return SwiftObjCMembersSpecified ? llvm::Optional(SwiftObjCMembers) + : llvm::None; + } + void setSwiftObjCMembers(llvm::Optional Value) { + SwiftObjCMembersSpecified = Value.hasValue(); + SwiftObjCMembers = Value.hasValue() ? *Value : false; + } + + /// Strip off any information within the class information structure that is + /// module-local, such as 'audited' flags. + void stripModuleLocalInfo() { + HasDefaultNullability = false; + DefaultNullability = 0; + } + + friend bool operator==(const ObjCContextInfo &, const ObjCContextInfo &); + + ObjCContextInfo &operator|=(const ObjCContextInfo &RHS) { + // Merge inherited info. + static_cast(*this) |= RHS; + + // Merge nullability. + if (!getDefaultNullability()) + if (auto Nullability = RHS.getDefaultNullability()) + setDefaultNullability(*Nullability); + + if (!SwiftImportAsNonGenericSpecified) + setSwiftImportAsNonGeneric(RHS.getSwiftImportAsNonGeneric()); + + if (!SwiftObjCMembersSpecified) + setSwiftObjCMembers(RHS.getSwiftObjCMembers()); + + HasDesignatedInits |= RHS.HasDesignatedInits; + + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS); +}; + +inline bool operator==(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.getDefaultNullability() == RHS.getDefaultNullability() && + LHS.HasDesignatedInits == RHS.HasDesignatedInits && + LHS.getSwiftImportAsNonGeneric() == RHS.getSwiftImportAsNonGeneric() && + LHS.getSwiftObjCMembers() == RHS.getSwiftObjCMembers(); +} + +inline bool operator!=(const ObjCContextInfo &LHS, const ObjCContextInfo &RHS) { + return !(LHS == RHS); +} + +/// API notes for a variable/property. +class VariableInfo : public CommonEntityInfo { + /// Whether this property has been audited for nullability. + unsigned NullabilityAudited : 1; + + /// The kind of nullability for this property. Only valid if the nullability + /// has been audited. + unsigned Nullable : 2; + + /// The C type of the variable, as a string. + std::string Type; + +public: + VariableInfo() : CommonEntityInfo(), NullabilityAudited(false), Nullable(0) {} + + llvm::Optional getNullability() const { + return NullabilityAudited ? llvm::Optional( + static_cast(Nullable)) + : llvm::None; + } + + void setNullabilityAudited(NullabilityKind kind) { + NullabilityAudited = true; + Nullable = static_cast(kind); + } + + const std::string &getType() const { return Type; } + void setType(const std::string &type) { Type = type; } + + friend bool operator==(const VariableInfo &, const VariableInfo &); + + VariableInfo &operator|=(const VariableInfo &RHS) { + static_cast(*this) |= RHS; + + if (!NullabilityAudited && RHS.NullabilityAudited) + setNullabilityAudited(*RHS.getNullability()); + if (Type.empty()) + Type = RHS.Type; + + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const VariableInfo &LHS, const VariableInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.NullabilityAudited == RHS.NullabilityAudited && + LHS.Nullable == RHS.Nullable && LHS.Type == RHS.Type; +} + +inline bool operator!=(const VariableInfo &LHS, const VariableInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes data for an Objective-C property. +class ObjCPropertyInfo : public VariableInfo { + unsigned SwiftImportAsAccessorsSpecified : 1; + unsigned SwiftImportAsAccessors : 1; + +public: + ObjCPropertyInfo() + : VariableInfo(), SwiftImportAsAccessorsSpecified(false), + SwiftImportAsAccessors(false) {} + + llvm::Optional getSwiftImportAsAccessors() const { + return SwiftImportAsAccessorsSpecified + ? llvm::Optional(SwiftImportAsAccessors) + : llvm::None; + } + void setSwiftImportAsAccessors(llvm::Optional Value) { + SwiftImportAsAccessorsSpecified = Value.hasValue(); + SwiftImportAsAccessors = Value.hasValue() ? *Value : false; + } + + friend bool operator==(const ObjCPropertyInfo &, const ObjCPropertyInfo &); + + /// Merge class-wide information into the given property. + ObjCPropertyInfo &operator|=(const ObjCContextInfo &RHS) { + static_cast(*this) |= RHS; + + // Merge nullability. + if (!getNullability()) + if (auto Nullable = RHS.getDefaultNullability()) + setNullabilityAudited(*Nullable); + + return *this; + } + + ObjCPropertyInfo &operator|=(const ObjCPropertyInfo &RHS) { + static_cast(*this) |= RHS; + + if (!SwiftImportAsAccessorsSpecified) + setSwiftImportAsAccessors(RHS.getSwiftImportAsAccessors()); + + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const ObjCPropertyInfo &LHS, + const ObjCPropertyInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.getSwiftImportAsAccessors() == RHS.getSwiftImportAsAccessors(); +} + +inline bool operator!=(const ObjCPropertyInfo &LHS, + const ObjCPropertyInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes a function or method parameter. +class ParamInfo : public VariableInfo { + /// Whether noescape was specified. + unsigned NoEscapeSpecified : 1; + + /// Whether the this parameter has the 'noescape' attribute. + unsigned NoEscape : 1; + + /// A biased RetainCountConventionKind, where 0 means "unspecified". + /// + /// Only relevant for out-parameters. + unsigned RawRetainCountConvention : 3; + +public: + ParamInfo() + : VariableInfo(), NoEscapeSpecified(false), NoEscape(false), + RawRetainCountConvention() {} + + llvm::Optional isNoEscape() const { + if (!NoEscapeSpecified) + return llvm::None; + return NoEscape; + } + void setNoEscape(llvm::Optional Value) { + NoEscapeSpecified = Value.hasValue(); + NoEscape = Value.hasValue() ? *Value : false; + } + + llvm::Optional getRetainCountConvention() const { + if (!RawRetainCountConvention) + return llvm::None; + return static_cast(RawRetainCountConvention - 1); + } + void + setRetainCountConvention(llvm::Optional Value) { + RawRetainCountConvention = + Value.hasValue() ? static_cast(Value.getValue()) + 1 : 0; + assert(getRetainCountConvention() == Value && "bitfield too small"); + } + + ParamInfo &operator|=(const ParamInfo &RHS) { + static_cast(*this) |= RHS; + + if (!NoEscapeSpecified && RHS.NoEscapeSpecified) { + NoEscapeSpecified = true; + NoEscape = RHS.NoEscape; + } + + if (!RawRetainCountConvention) + RawRetainCountConvention = RHS.RawRetainCountConvention; + + return *this; + } + + friend bool operator==(const ParamInfo &, const ParamInfo &); + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const ParamInfo &LHS, const ParamInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.NoEscapeSpecified == RHS.NoEscapeSpecified && + LHS.NoEscape == RHS.NoEscape && + LHS.RawRetainCountConvention == RHS.RawRetainCountConvention; +} + +inline bool operator!=(const ParamInfo &LHS, const ParamInfo &RHS) { + return !(LHS == RHS); +} + +/// API notes for a function or method. +class FunctionInfo : public CommonEntityInfo { +private: + static constexpr const unsigned NullabilityKindMask = 0x3; + static constexpr const unsigned NullabilityKindSize = 2; + + static constexpr const unsigned ReturnInfoIndex = 0; + +public: + // If yes, we consider all types to be non-nullable unless otherwise noted. + // If this flag is not set, the pointer types are considered to have + // unknown nullability. + + /// Whether the signature has been audited with respect to nullability. + unsigned NullabilityAudited : 1; + + /// Number of types whose nullability is encoded with the NullabilityPayload. + unsigned NumAdjustedNullable : 8; + + /// A biased RetainCountConventionKind, where 0 means "unspecified". + unsigned RawRetainCountConvention : 3; + + // NullabilityKindSize bits are used to encode the nullability. The info + // about the return type is stored at position 0, followed by the nullability + // of the parameters. + + /// Stores the nullability of the return type and the parameters. + uint64_t NullabilityPayload = 0; + + /// The result type of this function, as a C type. + std::string ResultType; + + /// The function parameters. + std::vector Params; + + FunctionInfo() + : CommonEntityInfo(), NullabilityAudited(false), NumAdjustedNullable(0), + RawRetainCountConvention() {} + + static unsigned getMaxNullabilityIndex() { + return ((sizeof(NullabilityPayload) * CHAR_BIT) / NullabilityKindSize); + } + + void addTypeInfo(unsigned index, NullabilityKind kind) { + assert(index <= getMaxNullabilityIndex()); + assert(static_cast(kind) < NullabilityKindMask); + + NullabilityAudited = true; + if (NumAdjustedNullable < index + 1) + NumAdjustedNullable = index + 1; + + // Mask the bits. + NullabilityPayload &= + ~(NullabilityKindMask << (index * NullabilityKindSize)); + + // Set the value. + unsigned kindValue = (static_cast(kind)) + << (index * NullabilityKindSize); + NullabilityPayload |= kindValue; + } + + /// Adds the return type info. + void addReturnTypeInfo(NullabilityKind kind) { + addTypeInfo(ReturnInfoIndex, kind); + } + + /// Adds the parameter type info. + void addParamTypeInfo(unsigned index, NullabilityKind kind) { + addTypeInfo(index + 1, kind); + } + + NullabilityKind getParamTypeInfo(unsigned index) const { + return getTypeInfo(index + 1); + } + + NullabilityKind getReturnTypeInfo() const { return getTypeInfo(0); } + + llvm::Optional getRetainCountConvention() const { + if (!RawRetainCountConvention) + return llvm::None; + return static_cast(RawRetainCountConvention - 1); + } + void + setRetainCountConvention(llvm::Optional Value) { + RawRetainCountConvention = + Value.hasValue() ? static_cast(Value.getValue()) + 1 : 0; + assert(getRetainCountConvention() == Value && "bitfield too small"); + } + + friend bool operator==(const FunctionInfo &, const FunctionInfo &); + +private: + NullabilityKind getTypeInfo(unsigned index) const { + assert(NullabilityAudited && + "Checking the type adjustment on non-audited method."); + + // If we don't have info about this parameter, return the default. + if (index > NumAdjustedNullable) + return NullabilityKind::NonNull; + auto nullability = NullabilityPayload >> (index * NullabilityKindSize); + return static_cast(nullability & NullabilityKindMask); + } + +public: + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.NullabilityAudited == RHS.NullabilityAudited && + LHS.NumAdjustedNullable == RHS.NumAdjustedNullable && + LHS.NullabilityPayload == RHS.NullabilityPayload && + LHS.ResultType == RHS.ResultType && LHS.Params == RHS.Params && + LHS.RawRetainCountConvention == RHS.RawRetainCountConvention; +} + +inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes data for an Objective-C method. +class ObjCMethodInfo : public FunctionInfo { +public: + /// Whether this is a designated initializer of its class. + unsigned DesignatedInit : 1; + + /// Whether this is a required initializer. + unsigned RequiredInit : 1; + + ObjCMethodInfo() + : FunctionInfo(), DesignatedInit(false), RequiredInit(false) {} + + friend bool operator==(const ObjCMethodInfo &, const ObjCMethodInfo &); + + ObjCMethodInfo &operator|=(const ObjCContextInfo &RHS) { + // Merge Nullability. + if (!NullabilityAudited) { + if (auto Nullable = RHS.getDefaultNullability()) { + NullabilityAudited = true; + addTypeInfo(0, *Nullable); + } + } + return *this; + } + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS); +}; + +inline bool operator==(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.DesignatedInit == RHS.DesignatedInit && + LHS.RequiredInit == RHS.RequiredInit; +} + +inline bool operator!=(const ObjCMethodInfo &LHS, const ObjCMethodInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes data for a global variable. +class GlobalVariableInfo : public VariableInfo { +public: + GlobalVariableInfo() : VariableInfo() {} +}; + +/// Describes API notes data for a global function. +class GlobalFunctionInfo : public FunctionInfo { +public: + GlobalFunctionInfo() : FunctionInfo() {} +}; + +/// Describes API notes data for an enumerator. +class EnumConstantInfo : public CommonEntityInfo { +public: + EnumConstantInfo() : CommonEntityInfo() {} +}; + +/// Describes API notes data for a tag. +class TagInfo : public CommonTypeInfo { + unsigned HasFlagEnum : 1; + unsigned IsFlagEnum : 1; + +public: + llvm::Optional EnumExtensibility; + + TagInfo() : CommonTypeInfo(), HasFlagEnum(0), IsFlagEnum(0) {} + + llvm::Optional isFlagEnum() const { + if (HasFlagEnum) + return IsFlagEnum; + return llvm::None; + } + void setFlagEnum(llvm::Optional Value) { + HasFlagEnum = Value.hasValue(); + IsFlagEnum = Value.hasValue() ? *Value : false; + } + + TagInfo &operator|=(const TagInfo &RHS) { + static_cast(*this) |= RHS; + + if (!HasFlagEnum && HasFlagEnum) + setFlagEnum(RHS.isFlagEnum()); + + if (!EnumExtensibility.hasValue()) + EnumExtensibility = RHS.EnumExtensibility; + + return *this; + } + + friend bool operator==(const TagInfo &, const TagInfo &); + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS); +}; + +inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.isFlagEnum() == RHS.isFlagEnum() && + LHS.EnumExtensibility == RHS.EnumExtensibility; +} + +inline bool operator!=(const TagInfo &LHS, const TagInfo &RHS) { + return !(LHS == RHS); +} + +/// Describes API notes data for a typedef. +class TypedefInfo : public CommonTypeInfo { +public: + llvm::Optional SwiftWrapper; + + TypedefInfo() : CommonTypeInfo() {} + + TypedefInfo &operator|=(const TypedefInfo &RHS) { + static_cast(*this) |= RHS; + if (!SwiftWrapper.hasValue()) + SwiftWrapper = RHS.SwiftWrapper; + return *this; + } + + friend bool operator==(const TypedefInfo &, const TypedefInfo &); + + LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const; +}; + +inline bool operator==(const TypedefInfo &LHS, const TypedefInfo &RHS) { + return static_cast(LHS) == RHS && + LHS.SwiftWrapper == RHS.SwiftWrapper; +} + +inline bool operator!=(const TypedefInfo &LHS, const TypedefInfo &RHS) { + return !(LHS == RHS); +} +} // namespace api_notes +} // namespace clang + +#endif diff --git a/clang/include/clang/ARCMigrate/FileRemapper.h b/clang/include/clang/ARCMigrate/FileRemapper.h index 76b65b2f688..4da68a678be 100644 --- a/clang/include/clang/ARCMigrate/FileRemapper.h +++ b/clang/include/clang/ARCMigrate/FileRemapper.h @@ -12,11 +12,13 @@ #include "clang/Basic/LLVM.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include namespace llvm { class MemoryBuffer; + class MemoryBufferRef; } namespace clang { @@ -55,6 +57,12 @@ public: void applyMappings(PreprocessorOptions &PPOpts) const; + /// Iterate through all the mappings. + void forEachMapping( + llvm::function_ref CaptureFile, + llvm::function_ref + CaptureBuffer) const; + void clear(StringRef outputDir = StringRef()); private: diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h index cca92b5f823..5f4ac02f53c 100644 --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -13,14 +13,20 @@ #ifndef LLVM_CLANG_AST_APVALUE_H #define LLVM_CLANG_AST_APVALUE_H -#include "clang/Basic/FixedPoint.h" #include "clang/Basic/LLVM.h" +#include "llvm/ADT/APFixedPoint.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APSInt.h" +#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/Support/AlignOf.h" namespace clang { +namespace serialization { +template class BasicReaderBase; +} // end namespace serialization + class AddrLabelExpr; class ASTContext; class CharUnits; @@ -32,6 +38,7 @@ namespace clang { struct PrintingPolicy; class Type; class ValueDecl; + class QualType; /// Symbolic representation of typeid(T) for some type T. class TypeInfoLValue { @@ -113,6 +120,7 @@ namespace clang { /// [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset], /// [Vector: N * APValue], [Array: N * APValue] class APValue { + typedef llvm::APFixedPoint APFixedPoint; typedef llvm::APSInt APSInt; typedef llvm::APFloat APFloat; public: @@ -147,6 +155,8 @@ public: static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type); static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo); + void Profile(llvm::FoldingSetNodeID &ID) const; + template bool is() const { return Ptr.is(); } @@ -167,11 +177,14 @@ public: QualType getTypeInfoType() const; QualType getDynamicAllocType() const; + QualType getType() const; + friend bool operator==(const LValueBase &LHS, const LValueBase &RHS); friend bool operator!=(const LValueBase &LHS, const LValueBase &RHS) { return !(LHS == RHS); } friend llvm::hash_code hash_value(const LValueBase &Base); + friend struct llvm::DenseMapInfo; private: PtrTy Ptr; @@ -199,8 +212,7 @@ public: public: LValuePathEntry() : Value() {} - LValuePathEntry(BaseOrMemberType BaseOrMember) - : Value{reinterpret_cast(BaseOrMember.getOpaqueValue())} {} + LValuePathEntry(BaseOrMemberType BaseOrMember); static LValuePathEntry ArrayIndex(uint64_t Index) { LValuePathEntry Result; Result.Value = Index; @@ -213,6 +225,8 @@ public: } uint64_t getAsArrayIndex() const { return Value; } + void Profile(llvm::FoldingSetNodeID &ID) const; + friend bool operator==(LValuePathEntry A, LValuePathEntry B) { return A.Value == B.Value; } @@ -223,12 +237,22 @@ public: return llvm::hash_value(A.Value); } }; + class LValuePathSerializationHelper { + const void *ElemTy; + + public: + ArrayRef Path; + + LValuePathSerializationHelper(ArrayRef, QualType); + QualType getType(); + }; struct NoLValuePath {}; struct UninitArray {}; struct UninitStruct {}; - friend class ASTReader; - friend class ASTWriter; + template friend class clang::serialization::BasicReaderBase; + friend class ASTImporter; + friend class ASTNodeImporter; private: ValueKind Kind; @@ -302,7 +326,7 @@ public: MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I)); } APValue(const APValue &RHS); - APValue(APValue &&RHS) : Kind(None) { swap(RHS); } + APValue(APValue &&RHS); APValue(LValueBase B, const CharUnits &O, NoLValuePath N, bool IsNullPtr = false) : Kind(None) { @@ -337,6 +361,9 @@ public: return Result; } + APValue &operator=(const APValue &RHS); + APValue &operator=(APValue &&RHS); + ~APValue() { if (Kind != None && Kind != Indeterminate) DestroyDataAndMakeUninit(); @@ -352,6 +379,11 @@ public: /// Swaps the contents of this and the given APValue. void swap(APValue &RHS); + /// profile this value. There is no guarantee that values of different + /// types will not produce the same profiled value, so the type should + /// typically also be profiled if it's not implied by the context. + void Profile(llvm::FoldingSetNodeID &ID) const; + ValueKind getKind() const { return Kind; } bool isAbsent() const { return Kind == None; } @@ -375,11 +407,14 @@ public: void dump(raw_ostream &OS, const ASTContext &Context) const; void printPretty(raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const; + void printPretty(raw_ostream &OS, const PrintingPolicy &Policy, QualType Ty, + const ASTContext *Ctx = nullptr) const; + std::string getAsString(const ASTContext &Ctx, QualType Ty) const; APSInt &getInt() { assert(isInt() && "Invalid accessor"); - return *(APSInt*)(char*)Data.buffer; + return *(APSInt *)(char *)&Data; } const APSInt &getInt() const { return const_cast(this)->getInt(); @@ -393,7 +428,7 @@ public: APFloat &getFloat() { assert(isFloat() && "Invalid accessor"); - return *(APFloat*)(char*)Data.buffer; + return *(APFloat *)(char *)&Data; } const APFloat &getFloat() const { return const_cast(this)->getFloat(); @@ -401,7 +436,7 @@ public: APFixedPoint &getFixedPoint() { assert(isFixedPoint() && "Invalid accessor"); - return *(APFixedPoint *)(char *)Data.buffer; + return *(APFixedPoint *)(char *)&Data; } const APFixedPoint &getFixedPoint() const { return const_cast(this)->getFixedPoint(); @@ -409,7 +444,7 @@ public: APSInt &getComplexIntReal() { assert(isComplexInt() && "Invalid accessor"); - return ((ComplexAPSInt*)(char*)Data.buffer)->Real; + return ((ComplexAPSInt *)(char *)&Data)->Real; } const APSInt &getComplexIntReal() const { return const_cast(this)->getComplexIntReal(); @@ -417,7 +452,7 @@ public: APSInt &getComplexIntImag() { assert(isComplexInt() && "Invalid accessor"); - return ((ComplexAPSInt*)(char*)Data.buffer)->Imag; + return ((ComplexAPSInt *)(char *)&Data)->Imag; } const APSInt &getComplexIntImag() const { return const_cast(this)->getComplexIntImag(); @@ -425,7 +460,7 @@ public: APFloat &getComplexFloatReal() { assert(isComplexFloat() && "Invalid accessor"); - return ((ComplexAPFloat*)(char*)Data.buffer)->Real; + return ((ComplexAPFloat *)(char *)&Data)->Real; } const APFloat &getComplexFloatReal() const { return const_cast(this)->getComplexFloatReal(); @@ -433,7 +468,7 @@ public: APFloat &getComplexFloatImag() { assert(isComplexFloat() && "Invalid accessor"); - return ((ComplexAPFloat*)(char*)Data.buffer)->Imag; + return ((ComplexAPFloat *)(char *)&Data)->Imag; } const APFloat &getComplexFloatImag() const { return const_cast(this)->getComplexFloatImag(); @@ -454,20 +489,20 @@ public: APValue &getVectorElt(unsigned I) { assert(isVector() && "Invalid accessor"); assert(I < getVectorLength() && "Index out of range"); - return ((Vec*)(char*)Data.buffer)->Elts[I]; + return ((Vec *)(char *)&Data)->Elts[I]; } const APValue &getVectorElt(unsigned I) const { return const_cast(this)->getVectorElt(I); } unsigned getVectorLength() const { assert(isVector() && "Invalid accessor"); - return ((const Vec*)(const void *)Data.buffer)->NumElts; + return ((const Vec *)(const void *)&Data)->NumElts; } APValue &getArrayInitializedElt(unsigned I) { assert(isArray() && "Invalid accessor"); assert(I < getArrayInitializedElts() && "Index out of range"); - return ((Arr*)(char*)Data.buffer)->Elts[I]; + return ((Arr *)(char *)&Data)->Elts[I]; } const APValue &getArrayInitializedElt(unsigned I) const { return const_cast(this)->getArrayInitializedElt(I); @@ -478,35 +513,37 @@ public: APValue &getArrayFiller() { assert(isArray() && "Invalid accessor"); assert(hasArrayFiller() && "No array filler"); - return ((Arr*)(char*)Data.buffer)->Elts[getArrayInitializedElts()]; + return ((Arr *)(char *)&Data)->Elts[getArrayInitializedElts()]; } const APValue &getArrayFiller() const { return const_cast(this)->getArrayFiller(); } unsigned getArrayInitializedElts() const { assert(isArray() && "Invalid accessor"); - return ((const Arr*)(const void *)Data.buffer)->NumElts; + return ((const Arr *)(const void *)&Data)->NumElts; } unsigned getArraySize() const { assert(isArray() && "Invalid accessor"); - return ((const Arr*)(const void *)Data.buffer)->ArrSize; + return ((const Arr *)(const void *)&Data)->ArrSize; } unsigned getStructNumBases() const { assert(isStruct() && "Invalid accessor"); - return ((const StructData*)(const char*)Data.buffer)->NumBases; + return ((const StructData *)(const char *)&Data)->NumBases; } unsigned getStructNumFields() const { assert(isStruct() && "Invalid accessor"); - return ((const StructData*)(const char*)Data.buffer)->NumFields; + return ((const StructData *)(const char *)&Data)->NumFields; } APValue &getStructBase(unsigned i) { assert(isStruct() && "Invalid accessor"); - return ((StructData*)(char*)Data.buffer)->Elts[i]; + assert(i < getStructNumBases() && "base class index OOB"); + return ((StructData *)(char *)&Data)->Elts[i]; } APValue &getStructField(unsigned i) { assert(isStruct() && "Invalid accessor"); - return ((StructData*)(char*)Data.buffer)->Elts[getStructNumBases() + i]; + assert(i < getStructNumFields() && "field index OOB"); + return ((StructData *)(char *)&Data)->Elts[getStructNumBases() + i]; } const APValue &getStructBase(unsigned i) const { return const_cast(this)->getStructBase(i); @@ -517,11 +554,11 @@ public: const FieldDecl *getUnionField() const { assert(isUnion() && "Invalid accessor"); - return ((const UnionData*)(const char*)Data.buffer)->Field; + return ((const UnionData *)(const char *)&Data)->Field; } APValue &getUnionValue() { assert(isUnion() && "Invalid accessor"); - return *((UnionData*)(char*)Data.buffer)->Value; + return *((UnionData *)(char *)&Data)->Value; } const APValue &getUnionValue() const { return const_cast(this)->getUnionValue(); @@ -533,119 +570,125 @@ public: const AddrLabelExpr* getAddrLabelDiffLHS() const { assert(isAddrLabelDiff() && "Invalid accessor"); - return ((const AddrLabelDiffData*)(const char*)Data.buffer)->LHSExpr; + return ((const AddrLabelDiffData *)(const char *)&Data)->LHSExpr; } const AddrLabelExpr* getAddrLabelDiffRHS() const { assert(isAddrLabelDiff() && "Invalid accessor"); - return ((const AddrLabelDiffData*)(const char*)Data.buffer)->RHSExpr; + return ((const AddrLabelDiffData *)(const char *)&Data)->RHSExpr; } void setInt(APSInt I) { assert(isInt() && "Invalid accessor"); - *(APSInt *)(char *)Data.buffer = std::move(I); + *(APSInt *)(char *)&Data = std::move(I); } void setFloat(APFloat F) { assert(isFloat() && "Invalid accessor"); - *(APFloat *)(char *)Data.buffer = std::move(F); + *(APFloat *)(char *)&Data = std::move(F); } void setFixedPoint(APFixedPoint FX) { assert(isFixedPoint() && "Invalid accessor"); - *(APFixedPoint *)(char *)Data.buffer = std::move(FX); + *(APFixedPoint *)(char *)&Data = std::move(FX); } void setVector(const APValue *E, unsigned N) { - assert(isVector() && "Invalid accessor"); - ((Vec*)(char*)Data.buffer)->Elts = new APValue[N]; - ((Vec*)(char*)Data.buffer)->NumElts = N; + MutableArrayRef InternalElts = setVectorUninit(N); for (unsigned i = 0; i != N; ++i) - ((Vec*)(char*)Data.buffer)->Elts[i] = E[i]; + InternalElts[i] = E[i]; } void setComplexInt(APSInt R, APSInt I) { assert(R.getBitWidth() == I.getBitWidth() && "Invalid complex int (type mismatch)."); assert(isComplexInt() && "Invalid accessor"); - ((ComplexAPSInt *)(char *)Data.buffer)->Real = std::move(R); - ((ComplexAPSInt *)(char *)Data.buffer)->Imag = std::move(I); + ((ComplexAPSInt *)(char *)&Data)->Real = std::move(R); + ((ComplexAPSInt *)(char *)&Data)->Imag = std::move(I); } void setComplexFloat(APFloat R, APFloat I) { assert(&R.getSemantics() == &I.getSemantics() && "Invalid complex float (type mismatch)."); assert(isComplexFloat() && "Invalid accessor"); - ((ComplexAPFloat *)(char *)Data.buffer)->Real = std::move(R); - ((ComplexAPFloat *)(char *)Data.buffer)->Imag = std::move(I); + ((ComplexAPFloat *)(char *)&Data)->Real = std::move(R); + ((ComplexAPFloat *)(char *)&Data)->Imag = std::move(I); } void setLValue(LValueBase B, const CharUnits &O, NoLValuePath, bool IsNullPtr); void setLValue(LValueBase B, const CharUnits &O, ArrayRef Path, bool OnePastTheEnd, bool IsNullPtr); - void setUnion(const FieldDecl *Field, const APValue &Value) { - assert(isUnion() && "Invalid accessor"); - ((UnionData*)(char*)Data.buffer)->Field = Field; - *((UnionData*)(char*)Data.buffer)->Value = Value; - } + void setUnion(const FieldDecl *Field, const APValue &Value); void setAddrLabelDiff(const AddrLabelExpr* LHSExpr, const AddrLabelExpr* RHSExpr) { - ((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr; - ((AddrLabelDiffData*)(char*)Data.buffer)->RHSExpr = RHSExpr; - } - - /// Assign by swapping from a copy of the RHS. - APValue &operator=(APValue RHS) { - swap(RHS); - return *this; + ((AddrLabelDiffData *)(char *)&Data)->LHSExpr = LHSExpr; + ((AddrLabelDiffData *)(char *)&Data)->RHSExpr = RHSExpr; } private: void DestroyDataAndMakeUninit(); void MakeInt() { assert(isAbsent() && "Bad state change"); - new ((void*)Data.buffer) APSInt(1); + new ((void *)&Data) APSInt(1); Kind = Int; } void MakeFloat() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) APFloat(0.0); + new ((void *)(char *)&Data) APFloat(0.0); Kind = Float; } void MakeFixedPoint(APFixedPoint &&FX) { assert(isAbsent() && "Bad state change"); - new ((void *)(char *)Data.buffer) APFixedPoint(std::move(FX)); + new ((void *)(char *)&Data) APFixedPoint(std::move(FX)); Kind = FixedPoint; } void MakeVector() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) Vec(); + new ((void *)(char *)&Data) Vec(); Kind = Vector; } void MakeComplexInt() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) ComplexAPSInt(); + new ((void *)(char *)&Data) ComplexAPSInt(); Kind = ComplexInt; } void MakeComplexFloat() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) ComplexAPFloat(); + new ((void *)(char *)&Data) ComplexAPFloat(); Kind = ComplexFloat; } void MakeLValue(); void MakeArray(unsigned InitElts, unsigned Size); void MakeStruct(unsigned B, unsigned M) { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) StructData(B, M); + new ((void *)(char *)&Data) StructData(B, M); Kind = Struct; } void MakeUnion() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) UnionData(); + new ((void *)(char *)&Data) UnionData(); Kind = Union; } void MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember, ArrayRef Path); void MakeAddrLabelDiff() { assert(isAbsent() && "Bad state change"); - new ((void*)(char*)Data.buffer) AddrLabelDiffData(); + new ((void *)(char *)&Data) AddrLabelDiffData(); Kind = AddrLabelDiff; } + +private: + /// The following functions are used as part of initialization, during + /// deserialization and importing. Reserve the space so that it can be + /// filled in by those steps. + MutableArrayRef setVectorUninit(unsigned N) { + assert(isVector() && "Invalid accessor"); + Vec *V = ((Vec *)(char *)&Data); + V->Elts = new APValue[N]; + V->NumElts = N; + return {V->Elts, V->NumElts}; + } + MutableArrayRef + setLValueUninit(LValueBase B, const CharUnits &O, unsigned Size, + bool OnePastTheEnd, bool IsNullPtr); + MutableArrayRef + setMemberPointerUninit(const ValueDecl *Member, bool IsDerivedMember, + unsigned Size); }; } // end namespace clang. diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 2b988be60da..ce47d54e44b 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -36,6 +36,7 @@ #include "clang/Basic/Linkage.h" #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/PartialDiagnostic.h" +#include "clang/Basic/ProfileList.h" #include "clang/Basic/SanitizerBlacklist.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/Specifiers.h" @@ -43,6 +44,7 @@ #include "llvm/ADT/APSInt.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/MapVector.h" @@ -60,6 +62,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/TypeSize.h" #include #include #include @@ -72,6 +75,8 @@ namespace llvm { +class APFixedPoint; +class FixedPointSemantics; struct fltSemantics; template class SmallPtrSet; @@ -79,7 +84,6 @@ template class SmallPtrSet; namespace clang { -class APFixedPoint; class APValue; class ASTMutationListener; class ASTRecordLayout; @@ -97,7 +101,6 @@ class ParentMapContext; class DynTypedNode; class DynTypedNodeList; class Expr; -class FixedPointSemantics; class GlobalDecl; class MangleContext; class MangleNumberingContext; @@ -169,6 +172,16 @@ struct TypeInfo { : Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {} }; +struct TypeInfoChars { + CharUnits Width; + CharUnits Align; + bool AlignIsRequired : 1; + + TypeInfoChars() : AlignIsRequired(false) {} + TypeInfoChars(CharUnits Width, CharUnits Align, bool AlignIsRequired) + : Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {} +}; + /// Holds long-lived AST nodes (such as types and decls) that can be /// referred to throughout the semantic analysis of a file. class ASTContext : public RefCountedBase { @@ -277,8 +290,8 @@ class ASTContext : public RefCountedBase { /// Mapping from GUIDs to the corresponding MSGuidDecl. mutable llvm::FoldingSet MSGuidDecls; - /// Used to cleanups APValues stored in the AST. - mutable llvm::SmallVector APValueCleanups; + /// Mapping from APValues to the corresponding TemplateParamObjects. + mutable llvm::FoldingSet TemplateParamObjectDecls; /// A cache mapping a string value to a StringLiteral object with the same /// value. @@ -554,6 +567,10 @@ private: /// should be imbued with the XRay "always" or "never" attributes. std::unique_ptr XRayFilter; + /// ProfileList object that is used by the profile instrumentation + /// to decide which entities should be instrumented. + std::unique_ptr ProfList; + /// The allocator used to create AST objects. /// /// AST objects are never destructed; rather, all memory associated with the @@ -561,7 +578,7 @@ private: mutable llvm::BumpPtrAllocator BumpAlloc; /// Allocator for partial diagnostics. - PartialDiagnostic::StorageAllocator DiagAllocator; + PartialDiagnostic::DiagStorageAllocator DiagAllocator; /// The current C++ ABI. std::unique_ptr ABI; @@ -640,7 +657,7 @@ public: /// Return the total memory used for various side tables. size_t getSideTableAllocatedMemory() const; - PartialDiagnostic::StorageAllocator &getDiagAllocator() { + PartialDiagnostic::DiagStorageAllocator &getDiagAllocator() { return DiagAllocator; } @@ -663,6 +680,14 @@ public: const LangOptions& getLangOpts() const { return LangOpts; } + // If this condition is false, typo correction must be performed eagerly + // rather than delayed in many places, as it makes use of dependent types. + // the condition is false for clang's C-only codepath, as it doesn't support + // dependent types yet. + bool isDependenceAllowed() const { + return LangOpts.CPlusPlus || LangOpts.RecoveryAST; + } + const SanitizerBlacklist &getSanitizerBlacklist() const { return *SanitizerBL; } @@ -671,6 +696,8 @@ public: return *XRayFilter; } + const ProfileList &getProfileList() const { return *ProfList; } + DiagnosticsEngine &getDiagnostics() const; FullSourceLoc getFullLoc(SourceLocation Loc) const { @@ -987,6 +1014,9 @@ public: #define SVE_TYPE(Name, Id, SingletonId) \ CanQualType SingletonId; #include "clang/Basic/AArch64SVEACLETypes.def" +#define PPC_VECTOR_TYPE(Name, Id, Size) \ + CanQualType Id##Ty; +#include "clang/Basic/PPCTypes.def" // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. mutable QualType AutoDeductTy; // Deduction against 'auto'. @@ -999,6 +1029,9 @@ public: // Implicitly-declared type 'struct _GUID'. mutable TagDecl *MSGuidTagDecl = nullptr; + /// Keep track of CUDA/HIP static device variables referenced by host code. + llvm::DenseSet CUDAStaticDeviceVarReferencedByHost; + ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins); ASTContext(const ASTContext &) = delete; @@ -1297,6 +1330,21 @@ public: /// Returns a vla type where known sizes are replaced with [*]. QualType getVariableArrayDecayedType(QualType Ty) const; + // Convenience struct to return information about a builtin vector type. + struct BuiltinVectorTypeInfo { + QualType ElementType; + llvm::ElementCount EC; + unsigned NumVectors; + BuiltinVectorTypeInfo(QualType ElementType, llvm::ElementCount EC, + unsigned NumVectors) + : ElementType(ElementType), EC(EC), NumVectors(NumVectors) {} + }; + + /// Returns the element type, element count and number of vectors + /// (in case of tuple) for a builtin vector type. + BuiltinVectorTypeInfo + getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const; + /// Return the unique reference to a scalable vector type of the specified /// element type and scalable number of elements. /// @@ -1390,7 +1438,7 @@ public: /// Return the unique reference to the type for the specified /// typedef-name decl. QualType getTypedefType(const TypedefNameDecl *Decl, - QualType Canon = QualType()) const; + QualType Underlying = QualType()) const; QualType getRecordType(const RecordDecl *Decl) const; @@ -1459,8 +1507,16 @@ public: void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl &Args); + /// Form a pack expansion type with the given pattern. + /// \param NumExpansions The number of expansions for the pack, if known. + /// \param ExpectPackInType If \c false, we should not expect \p Pattern to + /// contain an unexpanded pack. This only makes sense if the pack + /// expansion is used in a context where the arity is inferred from + /// elsewhere, such as if the pattern contains a placeholder type or + /// if this is the canonical type of another pack expansion type. QualType getPackExpansionType(QualType Pattern, - Optional NumExpansions); + Optional NumExpansions, + bool ExpectPackInType = true); QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl = nullptr) const; @@ -1957,9 +2013,9 @@ public: unsigned char getFixedPointScale(QualType Ty) const; unsigned char getFixedPointIBits(QualType Ty) const; - FixedPointSemantics getFixedPointSemantics(QualType Ty) const; - APFixedPoint getFixedPointMax(QualType Ty) const; - APFixedPoint getFixedPointMin(QualType Ty) const; + llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const; + llvm::APFixedPoint getFixedPointMax(QualType Ty) const; + llvm::APFixedPoint getFixedPointMin(QualType Ty) const; DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const; @@ -1998,6 +2054,10 @@ public: GE_Missing_ucontext }; + QualType DecodeTypeStr(const char *&Str, const ASTContext &Context, + ASTContext::GetBuiltinTypeError &Error, + bool &RequireICE, bool AllowTypeModifiers) const; + /// Return the type for the specified builtin. /// /// If \p IntegerConstantArgs is non-null, it is filled in with a bitmask of @@ -2030,6 +2090,15 @@ public: /// types. bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec); + /// Return true if the given types are an SVE builtin and a VectorType that + /// is a fixed-length representation of the SVE builtin for a specific + /// vector-length. + bool areCompatibleSveTypes(QualType FirstType, QualType SecondType); + + /// Return true if the given vector types are lax-compatible SVE vector types, + /// false otherwise. + bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType); + /// Return true if the type has been explicitly qualified with ObjC ownership. /// A type may be implicitly qualified with ownership under ObjC ARC, and in /// some cases the compiler treats these differently. @@ -2101,16 +2170,25 @@ public: } unsigned getTypeUnadjustedAlign(const Type *T) const; - /// Return the ABI-specified alignment of a type, in bits, or 0 if + /// Return the alignment of a type, in bits, or 0 if /// the type is incomplete and we cannot determine the alignment (for - /// example, from alignment attributes). - unsigned getTypeAlignIfKnown(QualType T) const; + /// example, from alignment attributes). The returned alignment is the + /// Preferred alignment if NeedsPreferredAlignment is true, otherwise is the + /// ABI alignment. + unsigned getTypeAlignIfKnown(QualType T, + bool NeedsPreferredAlignment = false) const; /// Return the ABI-specified alignment of a (complete) type \p T, in /// characters. CharUnits getTypeAlignInChars(QualType T) const; CharUnits getTypeAlignInChars(const Type *T) const; + /// Return the PreferredAlignment of a (complete) type \p T, in + /// characters. + CharUnits getPreferredTypeAlignInChars(QualType T) const { + return toCharUnitsFromBits(getPreferredTypeAlign(T)); + } + /// getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, /// in characters, before alignment adjustments. This method does not work on /// incomplete types. @@ -2119,10 +2197,10 @@ public: // getTypeInfoDataSizeInChars - Return the size of a type, in chars. If the // type is a record, its data size is returned. - std::pair getTypeInfoDataSizeInChars(QualType T) const; + TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const; - std::pair getTypeInfoInChars(const Type *T) const; - std::pair getTypeInfoInChars(QualType T) const; + TypeInfoChars getTypeInfoInChars(const Type *T) const; + TypeInfoChars getTypeInfoInChars(QualType T) const; /// Determine if the alignment the type has was required using an /// alignment attribute. @@ -2133,7 +2211,12 @@ public: /// the current target, in bits. /// /// This can be different than the ABI alignment in cases where it is - /// beneficial for performance to overalign a data type. + /// beneficial for performance or backwards compatibility preserving to + /// overalign a data type. (Note: despite the name, the preferred alignment + /// is ABI-impacting, and not an optimization.) + unsigned getPreferredTypeAlign(QualType T) const { + return getPreferredTypeAlign(T.getTypePtr()); + } unsigned getPreferredTypeAlign(const Type *T) const; /// Return the default alignment for __attribute__((aligned)) on @@ -2226,6 +2309,10 @@ public: const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const; + /// Find the 'this' offset for the member path in a pointer-to-member + /// APValue. + CharUnits getMemberPointerPathAdjustment(const APValue &MP) const; + bool isNearlyEmpty(const CXXRecordDecl *RD) const; VTableContextBase *getVTableContext(); @@ -2321,12 +2408,10 @@ public: return (*SuperTnullability == NullabilityKind::NonNull && *SubTnullability == NullabilityKind::Nullable); } - else { - // For the return type, it's okay for the superclass method to specify - // "nullable" and the subclass method specify "nonnull" - return (*SuperTnullability == NullabilityKind::Nullable && - *SubTnullability == NullabilityKind::NonNull); - } + // For the return type, it's okay for the superclass method to specify + // "nullable" and the subclass method specify "nonnull" + return (*SuperTnullability == NullabilityKind::Nullable && + *SubTnullability == NullabilityKind::NonNull); } return true; } @@ -2806,6 +2891,11 @@ public: /// GUID value. MSGuidDecl *getMSGuidDecl(MSGuidDeclParts Parts) const; + /// Return the template parameter object of the given type with the given + /// value. + TemplateParamObjectDecl *getTemplateParamObjectDecl(QualType T, + const APValue &V) const; + /// Parses the target attributes passed in, and returns only the ones that are /// valid feature names. ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const; @@ -3001,13 +3091,12 @@ public: }; struct SectionInfo { - DeclaratorDecl *Decl; + NamedDecl *Decl; SourceLocation PragmaSectionLocation; int SectionFlags; SectionInfo() = default; - SectionInfo(DeclaratorDecl *Decl, - SourceLocation PragmaSectionLocation, + SectionInfo(NamedDecl *Decl, SourceLocation PragmaSectionLocation, int SectionFlags) : Decl(Decl), PragmaSectionLocation(PragmaSectionLocation), SectionFlags(SectionFlags) {} @@ -3018,6 +3107,12 @@ public: /// Return a new OMPTraitInfo object owned by this context. OMPTraitInfo &getNewOMPTraitInfo(); + /// Whether a C++ static variable may be externalized. + bool mayExternalizeStaticVar(const Decl *D) const; + + /// Whether a C++ static variable should be externalized. + bool shouldExternalizeStaticVar(const Decl *D) const; + private: /// All OMPTraitInfo objects live in this collection, one per /// `pragma omp [begin] declare variant` directive. @@ -3025,8 +3120,8 @@ private: }; /// Insertion operator for diagnostics. -const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const ASTContext::SectionInfo &Section); +const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const ASTContext::SectionInfo &Section); /// Utility function for constructing a nullary selector. inline Selector GetNullarySelector(StringRef name, ASTContext &Ctx) { diff --git a/clang/include/clang/AST/ASTFwd.h b/clang/include/clang/AST/ASTFwd.h index 65319a19728..649b5711342 100644 --- a/clang/include/clang/AST/ASTFwd.h +++ b/clang/include/clang/AST/ASTFwd.h @@ -27,9 +27,9 @@ class Type; #include "clang/AST/TypeNodes.inc" class CXXCtorInitializer; class OMPClause; -#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class; -#include "llvm/Frontend/OpenMP/OMPKinds.def" - +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) class Class; +#include "llvm/Frontend/OpenMP/OMP.inc" } // end namespace clang diff --git a/clang/include/clang/AST/ASTImporter.h b/clang/include/clang/AST/ASTImporter.h index 205d7ec6775..a6d822ba2ea 100644 --- a/clang/include/clang/AST/ASTImporter.h +++ b/clang/include/clang/AST/ASTImporter.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_AST_ASTIMPORTER_H #define LLVM_CLANG_AST_ASTIMPORTER_H +#include "clang/AST/APValue.h" #include "clang/AST/DeclBase.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/ExprCXX.h" @@ -503,6 +504,13 @@ class TypeSourceInfo; /// "to" context, or the import error. llvm::Expected Import(const CXXBaseSpecifier *FromSpec); + /// Import the given APValue from the "from" context into + /// the "to" context. + /// + /// \return the equivalent APValue in the "to" context or the import + /// error. + llvm::Expected Import(const APValue &FromValue); + /// Import the definition of the given declaration, including all of /// the declarations it contains. LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From); diff --git a/clang/include/clang/AST/ASTNodeTraverser.h b/clang/include/clang/AST/ASTNodeTraverser.h index 26656b7162b..bb5b0c73f02 100644 --- a/clang/include/clang/AST/ASTNodeTraverser.h +++ b/clang/include/clang/AST/ASTNodeTraverser.h @@ -82,8 +82,12 @@ public: bool getDeserialize() const { return Deserialize; } void SetTraversalKind(TraversalKind TK) { Traversal = TK; } + TraversalKind GetTraversalKind() const { return Traversal; } void Visit(const Decl *D) { + if (Traversal == TK_IgnoreUnlessSpelledInSource && D->isImplicit()) + return; + getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(D); if (!D) @@ -100,6 +104,14 @@ public: // Decls within functions are visited by the body. if (!isa(*D) && !isa(*D)) { + if (Traversal != TK_AsIs) { + if (const auto *CTSD = dyn_cast(D)) { + auto SK = CTSD->getSpecializationKind(); + if (SK == TSK_ExplicitInstantiationDeclaration || + SK == TSK_ExplicitInstantiationDefinition) + return; + } + } if (const auto *DC = dyn_cast(D)) dumpDeclContext(DC); } @@ -114,9 +126,6 @@ public: switch (Traversal) { case TK_AsIs: break; - case TK_IgnoreImplicitCastsAndParentheses: - S = E->IgnoreParenImpCasts(); - break; case TK_IgnoreUnlessSpelledInSource: S = E->IgnoreUnlessSpelledInSource(); break; @@ -135,7 +144,9 @@ public: if (isa(S) || isa(S)) return; - if (isa(S) && Traversal == TK_IgnoreUnlessSpelledInSource) + if (Traversal == TK_IgnoreUnlessSpelledInSource && + isa(S)) return; for (const Stmt *SubStmt : S->children()) @@ -176,6 +187,8 @@ public: } void Visit(const CXXCtorInitializer *Init) { + if (Traversal == TK_IgnoreUnlessSpelledInSource && !Init->isWritten()) + return; getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(Init); Visit(Init->getInit()); @@ -392,6 +405,9 @@ public: if (const Expr *TRC = D->getTrailingRequiresClause()) Visit(TRC); + if (Traversal == TK_IgnoreUnlessSpelledInSource && D->isDefaulted()) + return; + if (const auto *C = dyn_cast(D)) for (const auto *I : C->inits()) Visit(I); @@ -408,6 +424,9 @@ public: } void VisitVarDecl(const VarDecl *D) { + if (Traversal == TK_IgnoreUnlessSpelledInSource && D->isCXXForRangeDecl()) + return; + if (D->hasInit()) Visit(D->getInit()); } @@ -481,8 +500,10 @@ public: Visit(D->getTemplatedDecl()); - for (const auto *Child : D->specializations()) - dumpTemplateDeclSpecialization(Child); + if (Traversal == TK_AsIs) { + for (const auto *Child : D->specializations()) + dumpTemplateDeclSpecialization(Child); + } } void VisitTypeAliasDecl(const TypeAliasDecl *D) { @@ -543,9 +564,7 @@ public: void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { if (const auto *TC = D->getTypeConstraint()) - if (TC->hasExplicitTemplateArgs()) - for (const auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments()) - dumpTemplateArgumentLoc(ArgLoc); + Visit(TC->getImmediatelyDeclaredConstraint()); if (D->hasDefaultArgument()) Visit(D->getDefaultArgument(), SourceRange(), D->getDefaultArgStorage().getInheritedFrom(), @@ -574,6 +593,12 @@ public: Visit(D->getConstraintExpr()); } + void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *CSE) { + if (CSE->hasExplicitTemplateArgs()) + for (const auto &ArgLoc : CSE->getTemplateArgsAsWritten()->arguments()) + dumpTemplateArgumentLoc(ArgLoc); + } + void VisitUsingShadowDecl(const UsingShadowDecl *D) { if (auto *TD = dyn_cast(D->getUnderlyingDecl())) Visit(TD->getTypeForDecl()); @@ -702,6 +727,35 @@ public: Visit(CatchParam); } + void VisitCXXForRangeStmt(const CXXForRangeStmt *Node) { + if (Traversal == TK_IgnoreUnlessSpelledInSource) { + Visit(Node->getInit()); + Visit(Node->getLoopVariable()); + Visit(Node->getRangeInit()); + Visit(Node->getBody()); + } + } + + void VisitCallExpr(const CallExpr *Node) { + for (const auto *Child : + make_filter_range(Node->children(), [this](const Stmt *Child) { + if (Traversal != TK_IgnoreUnlessSpelledInSource) + return false; + return !isa(Child); + })) { + Visit(Child); + } + } + + void VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *Node) { + if (Traversal == TK_IgnoreUnlessSpelledInSource) { + Visit(Node->getLHS()); + Visit(Node->getRHS()); + } else { + ConstStmtVisitor::VisitCXXRewrittenBinaryOperator(Node); + } + } + void VisitExpressionTemplateArgument(const TemplateArgument &TA) { Visit(TA.getAsExpr()); } diff --git a/clang/include/clang/AST/ASTStructuralEquivalence.h b/clang/include/clang/AST/ASTStructuralEquivalence.h index 36a42070fd2..c958a16aba2 100644 --- a/clang/include/clang/AST/ASTStructuralEquivalence.h +++ b/clang/include/clang/AST/ASTStructuralEquivalence.h @@ -97,6 +97,13 @@ struct StructuralEquivalenceContext { /// \c VisitedDecls members) and can cause faulty equivalent results. bool IsEquivalent(QualType T1, QualType T2); + /// Determine whether the two statements are structurally equivalent. + /// Implementation functions (all static functions in + /// ASTStructuralEquivalence.cpp) must never call this function because that + /// will wreak havoc the internal state (\c DeclsToCheck and + /// \c VisitedDecls members) and can cause faulty equivalent results. + bool IsEquivalent(Stmt *S1, Stmt *S2); + /// Find the index of the given anonymous struct/union within its /// context. /// diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h index 328b7bce6ba..57195a9d606 100644 --- a/clang/include/clang/AST/ASTTypeTraits.h +++ b/clang/include/clang/AST/ASTTypeTraits.h @@ -40,10 +40,6 @@ enum TraversalKind { /// Will traverse all child nodes. TK_AsIs, - /// Will not traverse implicit casts and parentheses. - /// Corresponds to Expr::IgnoreParenImpCasts() - TK_IgnoreImplicitCastsAndParentheses, - /// Ignore AST nodes not written in the source TK_IgnoreUnlessSpelledInSource }; @@ -104,6 +100,8 @@ public: static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1, ASTNodeKind Kind2); + ASTNodeKind getCladeKind() const; + /// Hooks for using ASTNodeKind as a key in a DenseMap. struct DenseMapInfo { // ASTNodeKind() is a good empty key because it is represented as a 0. @@ -132,6 +130,7 @@ private: enum NodeKindId { NKI_None, NKI_TemplateArgument, + NKI_TemplateArgumentLoc, NKI_TemplateName, NKI_NestedNameSpecifierLoc, NKI_QualType, @@ -150,8 +149,9 @@ private: #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type, #include "clang/AST/TypeNodes.inc" NKI_OMPClause, -#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class, -#include "llvm/Frontend/OpenMP/OMPKinds.def" +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) NKI_##Class, +#include "llvm/Frontend/OpenMP/OMP.inc" NKI_NumberOfKinds }; @@ -191,6 +191,7 @@ private: }; KIND_TO_KIND_ID(CXXCtorInitializer) KIND_TO_KIND_ID(TemplateArgument) +KIND_TO_KIND_ID(TemplateArgumentLoc) KIND_TO_KIND_ID(TemplateName) KIND_TO_KIND_ID(NestedNameSpecifier) KIND_TO_KIND_ID(NestedNameSpecifierLoc) @@ -207,8 +208,9 @@ KIND_TO_KIND_ID(CXXBaseSpecifier) #include "clang/AST/StmtNodes.inc" #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type) #include "clang/AST/TypeNodes.inc" -#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class) -#include "llvm/Frontend/OpenMP/OMPKinds.def" +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class) +#include "llvm/Frontend/OpenMP/OMP.inc" #undef KIND_TO_KIND_ID inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) { @@ -248,9 +250,8 @@ public: /// in the \c DynTypedNode, and the returned pointer points at /// the storage inside DynTypedNode. For those nodes, do not /// use the pointer outside the scope of the DynTypedNode. - template - const T *get() const { - return BaseConverter::get(NodeKind, Storage.buffer); + template const T *get() const { + return BaseConverter::get(NodeKind, &Storage); } /// Retrieve the stored node as type \c T. @@ -258,7 +259,7 @@ public: /// Similar to \c get(), but asserts that the type is what we are expecting. template const T &getUnchecked() const { - return BaseConverter::getUnchecked(NodeKind, Storage.buffer); + return BaseConverter::getUnchecked(NodeKind, &Storage); } ASTNodeKind getNodeKind() const { return NodeKind; } @@ -270,7 +271,7 @@ public: /// method returns NULL. const void *getMemoizationData() const { return NodeKind.hasPointerIdentity() - ? *reinterpret_cast(Storage.buffer) + ? *reinterpret_cast(&Storage) : nullptr; } @@ -392,12 +393,12 @@ private: /// Converter that uses dyn_cast from a stored BaseT*. template struct DynCastPtrConverter { - static const T *get(ASTNodeKind NodeKind, const char Storage[]) { + static const T *get(ASTNodeKind NodeKind, const void *Storage) { if (ASTNodeKind::getFromNodeKind().isBaseOf(NodeKind)) return &getUnchecked(NodeKind, Storage); return nullptr; } - static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) { + static const T &getUnchecked(ASTNodeKind NodeKind, const void *Storage) { assert(ASTNodeKind::getFromNodeKind().isBaseOf(NodeKind)); return *cast(static_cast( *reinterpret_cast(Storage))); @@ -405,19 +406,19 @@ private: static DynTypedNode create(const BaseT &Node) { DynTypedNode Result; Result.NodeKind = ASTNodeKind::getFromNode(Node); - new (Result.Storage.buffer) const void *(&Node); + new (&Result.Storage) const void *(&Node); return Result; } }; /// Converter that stores T* (by pointer). template struct PtrConverter { - static const T *get(ASTNodeKind NodeKind, const char Storage[]) { + static const T *get(ASTNodeKind NodeKind, const void *Storage) { if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) return &getUnchecked(NodeKind, Storage); return nullptr; } - static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) { + static const T &getUnchecked(ASTNodeKind NodeKind, const void *Storage) { assert(ASTNodeKind::getFromNodeKind().isSame(NodeKind)); return *static_cast( *reinterpret_cast(Storage)); @@ -425,26 +426,26 @@ private: static DynTypedNode create(const T &Node) { DynTypedNode Result; Result.NodeKind = ASTNodeKind::getFromNodeKind(); - new (Result.Storage.buffer) const void *(&Node); + new (&Result.Storage) const void *(&Node); return Result; } }; /// Converter that stores T (by value). template struct ValueConverter { - static const T *get(ASTNodeKind NodeKind, const char Storage[]) { + static const T *get(ASTNodeKind NodeKind, const void *Storage) { if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) return reinterpret_cast(Storage); return nullptr; } - static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) { + static const T &getUnchecked(ASTNodeKind NodeKind, const void *Storage) { assert(ASTNodeKind::getFromNodeKind().isSame(NodeKind)); return *reinterpret_cast(Storage); } static DynTypedNode create(const T &Node) { DynTypedNode Result; Result.NodeKind = ASTNodeKind::getFromNodeKind(); - new (Result.Storage.buffer) T(Node); + new (&Result.Storage) T(Node); return Result; } }; @@ -456,12 +457,13 @@ private: /// Note that we can store \c Decls, \c Stmts, \c Types, /// \c NestedNameSpecifiers and \c CXXCtorInitializer by pointer as they are /// guaranteed to be unique pointers pointing to dedicated storage in the AST. - /// \c QualTypes, \c NestedNameSpecifierLocs, \c TypeLocs and - /// \c TemplateArguments on the other hand do not have storage or unique - /// pointers and thus need to be stored by value. + /// \c QualTypes, \c NestedNameSpecifierLocs, \c TypeLocs, + /// \c TemplateArguments and \c TemplateArgumentLocs on the other hand do not + /// have storage or unique pointers and thus need to be stored by value. llvm::AlignedCharArrayUnion Storage; + TemplateArgumentLoc, NestedNameSpecifierLoc, + QualType, TypeLoc> + Storage; }; template @@ -496,6 +498,10 @@ template <> struct DynTypedNode::BaseConverter< TemplateArgument, void> : public ValueConverter {}; +template <> +struct DynTypedNode::BaseConverter + : public ValueConverter {}; + template <> struct DynTypedNode::BaseConverter< TemplateName, void> : public ValueConverter {}; @@ -527,20 +533,6 @@ template struct DynTypedNode::BaseConverter { } }; -// Previously these types were defined in the clang::ast_type_traits namespace. -// Provide typedefs so that legacy code can be fixed asynchronously. -namespace ast_type_traits { -using DynTypedNode = ::clang::DynTypedNode; -using ASTNodeKind = ::clang::ASTNodeKind; -using TraversalKind = ::clang::TraversalKind; - -constexpr TraversalKind TK_AsIs = ::clang::TK_AsIs; -constexpr TraversalKind TK_IgnoreImplicitCastsAndParentheses = - ::clang::TK_IgnoreImplicitCastsAndParentheses; -constexpr TraversalKind TK_IgnoreUnlessSpelledInSource = - ::clang::TK_IgnoreUnlessSpelledInSource; -} // namespace ast_type_traits - } // end namespace clang namespace llvm { diff --git a/clang/include/clang/AST/AbstractBasicReader.h b/clang/include/clang/AST/AbstractBasicReader.h index d7b3a9da88e..5505d661b44 100644 --- a/clang/include/clang/AST/AbstractBasicReader.h +++ b/clang/include/clang/AST/AbstractBasicReader.h @@ -177,6 +177,40 @@ public: return llvm::APInt(bitWidth, numWords, &data[0]); } + llvm::FixedPointSemantics readFixedPointSemantics() { + unsigned width = asImpl().readUInt32(); + unsigned scale = asImpl().readUInt32(); + unsigned tmp = asImpl().readUInt32(); + bool isSigned = tmp & 0x1; + bool isSaturated = tmp & 0x2; + bool hasUnsignedPadding = tmp & 0x4; + return llvm::FixedPointSemantics(width, scale, isSigned, isSaturated, + hasUnsignedPadding); + } + + APValue::LValuePathSerializationHelper readLValuePathSerializationHelper( + SmallVectorImpl &path) { + auto elemTy = asImpl().readQualType(); + unsigned pathLength = asImpl().readUInt32(); + for (unsigned i = 0; i < pathLength; ++i) { + if (elemTy->template getAs()) { + unsigned int_ = asImpl().readUInt32(); + Decl *decl = asImpl().template readDeclAs(); + if (auto *recordDecl = dyn_cast(decl)) + elemTy = getASTContext().getRecordType(recordDecl); + else + elemTy = cast(decl)->getType(); + path.push_back( + APValue::LValuePathEntry(APValue::BaseOrMemberType(decl, int_))); + } else { + elemTy = getASTContext().getAsArrayType(elemTy)->getElementType(); + path.push_back( + APValue::LValuePathEntry::ArrayIndex(asImpl().readUInt32())); + } + } + return APValue::LValuePathSerializationHelper(path, elemTy); + } + Qualifiers readQualifiers() { static_assert(sizeof(Qualifiers().getAsOpaqueValue()) <= sizeof(uint32_t), "update this if the value size changes"); diff --git a/clang/include/clang/AST/AbstractBasicWriter.h b/clang/include/clang/AST/AbstractBasicWriter.h index 0a6730c86bb..75aef734ba9 100644 --- a/clang/include/clang/AST/AbstractBasicWriter.h +++ b/clang/include/clang/AST/AbstractBasicWriter.h @@ -9,6 +9,7 @@ #ifndef CLANG_AST_ABSTRACTBASICWRITER_H #define CLANG_AST_ABSTRACTBASICWRITER_H +#include "clang/AST/ASTContext.h" #include "clang/AST/DeclTemplate.h" namespace clang { @@ -121,6 +122,7 @@ template class DataStreamBasicWriter : public BasicWriterBase { protected: using BasicWriterBase::asImpl; + DataStreamBasicWriter(ASTContext &ctx) : BasicWriterBase(ctx) {} public: /// Implement property-find by ignoring it. We rely on properties being @@ -163,6 +165,39 @@ public: asImpl().writeUInt64(words[i]); } + void writeFixedPointSemantics(const llvm::FixedPointSemantics &sema) { + asImpl().writeUInt32(sema.getWidth()); + asImpl().writeUInt32(sema.getScale()); + asImpl().writeUInt32(sema.isSigned() | sema.isSaturated() << 1 | + sema.hasUnsignedPadding() << 2); + } + + void writeLValuePathSerializationHelper( + APValue::LValuePathSerializationHelper lvaluePath) { + ArrayRef path = lvaluePath.Path; + QualType elemTy = lvaluePath.getType(); + asImpl().writeQualType(elemTy); + asImpl().writeUInt32(path.size()); + auto &ctx = ((BasicWriterBase *)this)->getASTContext(); + for (auto elem : path) { + if (elemTy->getAs()) { + asImpl().writeUInt32(elem.getAsBaseOrMember().getInt()); + const Decl *baseOrMember = elem.getAsBaseOrMember().getPointer(); + if (const auto *recordDecl = dyn_cast(baseOrMember)) { + asImpl().writeDeclRef(recordDecl); + elemTy = ctx.getRecordType(recordDecl); + } else { + const auto *valueDecl = cast(baseOrMember); + asImpl().writeDeclRef(valueDecl); + elemTy = valueDecl->getType(); + } + } else { + asImpl().writeUInt32(elem.getAsArrayIndex()); + elemTy = ctx.getAsArrayType(elemTy)->getElementType(); + } + } + } + void writeQualifiers(Qualifiers value) { static_assert(sizeof(value.getAsOpaqueValue()) <= sizeof(uint32_t), "update this if the value size changes"); diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h index 1b457337d65..e453733ab92 100644 --- a/clang/include/clang/AST/Attr.h +++ b/clang/include/clang/AST/Attr.h @@ -162,6 +162,21 @@ public: } }; +class DeclOrStmtAttr : public InheritableAttr { +protected: + DeclOrStmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed, + bool InheritEvenIfAlreadyPresent) + : InheritableAttr(Context, CommonInfo, AK, IsLateParsed, + InheritEvenIfAlreadyPresent) {} + +public: + static bool classof(const Attr *A) { + return A->getKind() >= attr::FirstDeclOrStmtAttr && + A->getKind() <= attr::LastDeclOrStmtAttr; + } +}; + class InheritableParamAttr : public InheritableAttr { protected: InheritableParamAttr(ASTContext &Context, @@ -259,7 +274,10 @@ public: /// Construct from a result from \c serialize. static ParamIdx deserialize(SerialType S) { - ParamIdx P(*reinterpret_cast(&S)); + // Using this two-step static_cast via void * instead of reinterpret_cast + // silences a -Wstrict-aliasing false positive from GCC7 and earlier. + void *ParamIdxPtr = static_cast(&S); + ParamIdx P(*static_cast(ParamIdxPtr)); assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin"); return P; } @@ -334,29 +352,28 @@ static_assert(sizeof(ParamIdx) == sizeof(ParamIdx::SerialType), struct ParsedTargetAttr { std::vector Features; StringRef Architecture; + StringRef Tune; StringRef BranchProtection; bool DuplicateArchitecture = false; + bool DuplicateTune = false; bool operator ==(const ParsedTargetAttr &Other) const { return DuplicateArchitecture == Other.DuplicateArchitecture && - Architecture == Other.Architecture && Features == Other.Features; + DuplicateTune == Other.DuplicateTune && + Architecture == Other.Architecture && + Tune == Other.Tune && + BranchProtection == Other.BranchProtection && + Features == Other.Features; } }; #include "clang/AST/Attrs.inc" -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const Attr *At) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const Attr *At) { DB.AddTaggedVal(reinterpret_cast(At), DiagnosticsEngine::ak_attr); return DB; } - -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - const Attr *At) { - PD.AddTaggedVal(reinterpret_cast(At), - DiagnosticsEngine::ak_attr); - return PD; -} } // end namespace clang #endif diff --git a/clang/include/clang/AST/CXXInheritance.h b/clang/include/clang/AST/CXXInheritance.h index 8b1bcb367b3..709f08bff82 100644 --- a/clang/include/clang/AST/CXXInheritance.h +++ b/clang/include/clang/AST/CXXInheritance.h @@ -149,12 +149,6 @@ class CXXBasePaths { /// to help build the set of paths. CXXBasePath ScratchPath; - /// Array of the declarations that have been found. This - /// array is constructed only if needed, e.g., to iterate over the - /// results within LookupResult. - std::unique_ptr DeclsFound; - unsigned NumDeclsFound = 0; - /// FindAmbiguities - Whether Sema::IsDerivedFrom should try find /// ambiguous paths while it is looking for a path from a derived /// type to a base type. @@ -170,8 +164,6 @@ class CXXBasePaths { /// is also recorded. bool DetectVirtual; - void ComputeDeclsFound(); - bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record, CXXRecordDecl::BaseMatchesCallback BaseMatches, bool LookupInDependent = false); @@ -198,8 +190,6 @@ public: using decl_range = llvm::iterator_range; - decl_range found_decls(); - /// Determine whether the path from the most-derived type to the /// given base type is ambiguous (i.e., it refers to multiple subobjects of /// the same base type). diff --git a/clang/include/clang/AST/CXXRecordDeclDefinitionBits.def b/clang/include/clang/AST/CXXRecordDeclDefinitionBits.def index 33e65f8ebf4..d15d6698860 100644 --- a/clang/include/clang/AST/CXXRecordDeclDefinitionBits.def +++ b/clang/include/clang/AST/CXXRecordDeclDefinitionBits.def @@ -131,6 +131,10 @@ FIELD(HasUninitializedFields, 1, NO_MERGE) /// constructors from a base class. FIELD(HasInheritedConstructor, 1, NO_MERGE) +/// True if there are any member using-declarations that inherit +/// default constructors from a base class. +FIELD(HasInheritedDefaultConstructor, 1, NO_MERGE) + /// True if there are any member using-declarations named /// 'operator='. FIELD(HasInheritedAssignment, 1, NO_MERGE) @@ -210,6 +214,9 @@ FIELD(DefaultedDestructorIsConstexpr, 1, NO_MERGE) /// member or base class of non-literal or volatile type. FIELD(HasNonLiteralTypeFieldsOrBases, 1, NO_MERGE) +/// True if this class is a structural type, assuming it is a literal type. +FIELD(StructuralIfLiteral, 1, NO_MERGE) + /// Whether we have a C++11 user-provided default constructor (not /// explicitly deleted or defaulted). FIELD(UserProvidedDefaultConstructor, 1, NO_MERGE) diff --git a/clang/include/clang/AST/CanonicalType.h b/clang/include/clang/AST/CanonicalType.h index 488284713bc..15d7e9efc26 100644 --- a/clang/include/clang/AST/CanonicalType.h +++ b/clang/include/clang/AST/CanonicalType.h @@ -215,8 +215,8 @@ inline CanQualType Type::getCanonicalTypeUnqualified() const { return CanQualType::CreateUnsafe(getCanonicalTypeInternal()); } -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - CanQualType T) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + CanQualType T) { DB << static_cast(T); return DB; } diff --git a/clang/include/clang/AST/CommentLexer.h b/clang/include/clang/AST/CommentLexer.h index 138fdaca0ff..94f778501e7 100644 --- a/clang/include/clang/AST/CommentLexer.h +++ b/clang/include/clang/AST/CommentLexer.h @@ -62,13 +62,6 @@ class Token { /// The actual kind of the token. tok::TokenKind Kind; - /// Length of the token spelling in comment. Can be 0 for synthenized - /// tokens. - unsigned Length; - - /// Contains text value associated with a token. - const char *TextPtr; - /// Integer value associated with a token. /// /// If the token is a known command, contains command ID and TextPtr is @@ -76,6 +69,13 @@ class Token { /// contains the length of the string that starts at TextPtr. unsigned IntVal; + /// Length of the token spelling in comment. Can be 0 for synthenized + /// tokens. + unsigned Length; + + /// Contains text value associated with a token. + const char *TextPtr; + public: SourceLocation getLocation() const LLVM_READONLY { return Loc; } void setLocation(SourceLocation SL) { Loc = SL; } @@ -232,7 +232,6 @@ private: const char *const BufferStart; const char *const BufferEnd; - SourceLocation FileLoc; const char *BufferPtr; @@ -240,7 +239,14 @@ private: /// to newline or BufferEnd, for C comments points to star in '*/'. const char *CommentEnd; - enum LexerCommentState { + SourceLocation FileLoc; + + /// If true, the commands, html tags, etc will be parsed and reported as + /// separate tokens inside the comment body. If false, the comment text will + /// be parsed into text and newline tokens. + bool ParseCommands; + + enum LexerCommentState : uint8_t { LCS_BeforeComment, LCS_InsideBCPLComment, LCS_InsideCComment, @@ -250,7 +256,7 @@ private: /// Low-level lexer state, track if we are inside or outside of comment. LexerCommentState CommentState; - enum LexerState { + enum LexerState : uint8_t { /// Lexing normal comment text LS_Normal, @@ -280,11 +286,6 @@ private: /// command, including command marker. SmallString<16> VerbatimBlockEndCommandName; - /// If true, the commands, html tags, etc will be parsed and reported as - /// separate tokens inside the comment body. If false, the comment text will - /// be parsed into text and newline tokens. - bool ParseCommands; - /// Given a character reference name (e.g., "lt"), return the character that /// it stands for (e.g., "<"). StringRef resolveHTMLNamedCharacterReference(StringRef Name) const; diff --git a/clang/include/clang/AST/ComputeDependence.h b/clang/include/clang/AST/ComputeDependence.h index ac2daf9eb95..04e8e2c7d2c 100644 --- a/clang/include/clang/AST/ComputeDependence.h +++ b/clang/include/clang/AST/ComputeDependence.h @@ -70,6 +70,7 @@ class CXXPseudoDestructorExpr; class OverloadExpr; class DependentScopeDeclRefExpr; class CXXConstructExpr; +class CXXDefaultInitExpr; class LambdaExpr; class CXXUnresolvedConstructExpr; class CXXDependentScopeMemberExpr; @@ -106,7 +107,7 @@ class ObjCMessageExpr; ExprDependence computeDependence(FullExpr *E); ExprDependence computeDependence(OpaqueValueExpr *E); ExprDependence computeDependence(ParenExpr *E); -ExprDependence computeDependence(UnaryOperator *E); +ExprDependence computeDependence(UnaryOperator *E, const ASTContext &Ctx); ExprDependence computeDependence(UnaryExprOrTypeTraitExpr *E); ExprDependence computeDependence(ArraySubscriptExpr *E); ExprDependence computeDependence(MatrixSubscriptExpr *E); @@ -153,6 +154,7 @@ ExprDependence computeDependence(OverloadExpr *E, bool KnownDependent, bool KnownContainsUnexpandedParameterPack); ExprDependence computeDependence(DependentScopeDeclRefExpr *E); ExprDependence computeDependence(CXXConstructExpr *E); +ExprDependence computeDependence(CXXDefaultInitExpr *E); ExprDependence computeDependence(LambdaExpr *E, bool ContainsUnexpandedParameterPack); ExprDependence computeDependence(CXXUnresolvedConstructExpr *E); diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 28faa2c1fc7..47c282f0a63 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -265,10 +265,25 @@ public: // FIXME: Deprecated, move clients to getName(). std::string getNameAsString() const { return Name.getAsString(); } + /// Pretty-print the unqualified name of this declaration. Can be overloaded + /// by derived classes to provide a more user-friendly name when appropriate. virtual void printName(raw_ostream &os) const; /// Get the actual, stored name of the declaration, which may be a special /// name. + /// + /// Note that generally in diagnostics, the non-null \p NamedDecl* itself + /// should be sent into the diagnostic instead of using the result of + /// \p getDeclName(). + /// + /// A \p DeclarationName in a diagnostic will just be streamed to the output, + /// which will directly result in a call to \p DeclarationName::print. + /// + /// A \p NamedDecl* in a diagnostic will also ultimately result in a call to + /// \p DeclarationName::print, but with two customisation points along the + /// way (\p getNameForDiagnostic and \p printName). These are used to print + /// the template arguments if any, and to provide a user-friendly name for + /// some entities (such as unnamed variables and anonymous records). DeclarationName getDeclName() const { return Name; } /// Set the name of this declaration. @@ -788,18 +803,11 @@ struct EvaluatedStmt { /// Whether this statement is being evaluated. bool IsEvaluating : 1; - /// Whether we already checked whether this statement was an - /// integral constant expression. - bool CheckedICE : 1; - - /// Whether we are checking whether this statement is an - /// integral constant expression. - bool CheckingICE : 1; - - /// Whether this statement is an integral constant expression, - /// or in C++11, whether the statement is a constant expression. Only - /// valid if CheckedICE is true. - bool IsICE : 1; + /// Whether this variable is known to have constant initialization. This is + /// currently only computed in C++, for static / thread storage duration + /// variables that might have constant initialization and for variables that + /// are usable in constant expressions. + bool HasConstantInitialization : 1; /// Whether this variable is known to have constant destruction. That is, /// whether running the destructor on the initial value is a side-effect @@ -808,12 +816,18 @@ struct EvaluatedStmt { /// non-trivial. bool HasConstantDestruction : 1; + /// In C++98, whether the initializer is an ICE. This affects whether the + /// variable is usable in constant expressions. + bool HasICEInit : 1; + bool CheckedForICEInit : 1; + Stmt *Value; APValue Evaluated; EvaluatedStmt() - : WasEvaluated(false), IsEvaluating(false), CheckedICE(false), - CheckingICE(false), IsICE(false), HasConstantDestruction(false) {} + : WasEvaluated(false), IsEvaluating(false), + HasConstantInitialization(false), HasConstantDestruction(false), + HasICEInit(false), CheckedForICEInit(false) {} }; /// Represents a variable declaration or definition. @@ -1248,22 +1262,29 @@ public: /// constant expression, according to the relevant language standard. /// This only checks properties of the declaration, and does not check /// whether the initializer is in fact a constant expression. - bool mightBeUsableInConstantExpressions(ASTContext &C) const; + /// + /// This corresponds to C++20 [expr.const]p3's notion of a + /// "potentially-constant" variable. + bool mightBeUsableInConstantExpressions(const ASTContext &C) const; /// Determine whether this variable's value can be used in a /// constant expression, according to the relevant language standard, /// including checking whether it was initialized by a constant expression. - bool isUsableInConstantExpressions(ASTContext &C) const; + bool isUsableInConstantExpressions(const ASTContext &C) const; EvaluatedStmt *ensureEvaluatedStmt() const; + EvaluatedStmt *getEvaluatedStmt() const; /// Attempt to evaluate the value of the initializer attached to this - /// declaration, and produce notes explaining why it cannot be evaluated or is - /// not a constant expression. Returns a pointer to the value if evaluation - /// succeeded, 0 otherwise. + /// declaration, and produce notes explaining why it cannot be evaluated. + /// Returns a pointer to the value if evaluation succeeded, 0 otherwise. APValue *evaluateValue() const; - APValue *evaluateValue(SmallVectorImpl &Notes) const; +private: + APValue *evaluateValueImpl(SmallVectorImpl &Notes, + bool IsConstantInitialization) const; + +public: /// Return the already-evaluated value of this variable's /// initializer, or NULL if the value is not yet known. Returns pointer /// to untyped APValue if the value could not be evaluated. @@ -1272,25 +1293,29 @@ public: /// Evaluate the destruction of this variable to determine if it constitutes /// constant destruction. /// - /// \pre isInitICE() + /// \pre hasConstantInitialization() /// \return \c true if this variable has constant destruction, \c false if /// not. bool evaluateDestruction(SmallVectorImpl &Notes) const; - /// Determines whether it is already known whether the - /// initializer is an integral constant expression or not. - bool isInitKnownICE() const; - - /// Determines whether the initializer is an integral constant - /// expression, or in C++11, whether the initializer is a constant - /// expression. + /// Determine whether this variable has constant initialization. /// - /// \pre isInitKnownICE() - bool isInitICE() const; + /// This is only set in two cases: when the language semantics require + /// constant initialization (globals in C and some globals in C++), and when + /// the variable is usable in constant expressions (constexpr, const int, and + /// reference variables in C++). + bool hasConstantInitialization() const; - /// Determine whether the value of the initializer attached to this - /// declaration is an integral constant expression. - bool checkInitIsICE() const; + /// Determine whether the initializer of this variable is an integer constant + /// expression. For use in C++98, where this affects whether the variable is + /// usable in constant expressions. + bool hasICEInitializer(const ASTContext &Context) const; + + /// Evaluate the initializer of this variable to determine whether it's a + /// constant initializer. Should only be called once, after completing the + /// definition of the variable. + bool checkForConstantInitialization( + SmallVectorImpl &Notes) const; void setInitStyle(InitializationStyle Style) { VarDeclBits.InitStyle = Style; @@ -1639,6 +1664,9 @@ public: return ParmVarDeclBits.IsObjCMethodParam; } + /// Determines whether this parameter is destroyed in the callee function. + bool isDestroyedInCallee() const; + unsigned getFunctionScopeDepth() const { if (ParmVarDeclBits.IsObjCMethodParam) return 0; return ParmVarDeclBits.ScopeDepthOrObjCQuals; @@ -1956,7 +1984,7 @@ public: SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified = false, bool hasWrittenPrototype = true, - ConstexprSpecKind ConstexprKind = CSK_unspecified, + ConstexprSpecKind ConstexprKind = ConstexprSpecKind::Unspecified, Expr *TrailingRequiresClause = nullptr) { DeclarationNameInfo NameInfo(N, NLoc); return FunctionDecl::Create(C, DC, StartLoc, NameInfo, T, TInfo, SC, @@ -2028,7 +2056,14 @@ public: /// /// The variant that accepts a FunctionDecl pointer will set that function /// declaration to the declaration that is a definition (if there is one). - bool isDefined(const FunctionDecl *&Definition) const; + /// + /// \param CheckForPendingFriendDefinition If \c true, also check for friend + /// declarations that were instantiataed from function definitions. + /// Such a declaration behaves as if it is a definition for the + /// purpose of redefinition checking, but isn't actually a "real" + /// definition until its body is instantiated. + bool isDefined(const FunctionDecl *&Definition, + bool CheckForPendingFriendDefinition = false) const; bool isDefined() const { const FunctionDecl* Definition; @@ -2074,6 +2109,11 @@ public: willHaveBody() || hasDefiningAttr(); } + /// Determine whether this specific declaration of the function is a friend + /// declaration that was instantiated from a function definition. Such + /// declarations behave like definitions in some contexts. + bool isThisDeclarationInstantiatedFromAFriendDefinition() const; + /// Returns whether this specific declaration of the function has a body. bool doesThisDeclarationHaveABody() const { return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) || @@ -2196,19 +2236,19 @@ public: /// Whether this is a (C++11) constexpr function or constexpr constructor. bool isConstexpr() const { - return FunctionDeclBits.ConstexprKind != CSK_unspecified; + return getConstexprKind() != ConstexprSpecKind::Unspecified; } void setConstexprKind(ConstexprSpecKind CSK) { - FunctionDeclBits.ConstexprKind = CSK; + FunctionDeclBits.ConstexprKind = static_cast(CSK); } ConstexprSpecKind getConstexprKind() const { return static_cast(FunctionDeclBits.ConstexprKind); } bool isConstexprSpecified() const { - return FunctionDeclBits.ConstexprKind == CSK_constexpr; + return getConstexprKind() == ConstexprSpecKind::Constexpr; } bool isConsteval() const { - return FunctionDeclBits.ConstexprKind == CSK_consteval; + return getConstexprKind() == ConstexprSpecKind::Consteval; } /// Whether the instantiation of this function is pending. @@ -2231,10 +2271,6 @@ public: bool usesSEHTry() const { return FunctionDeclBits.UsesSEHTry; } void setUsesSEHTry(bool UST) { FunctionDeclBits.UsesSEHTry = UST; } - /// Indicates the function uses Floating Point constrained intrinsics - bool usesFPIntrin() const { return FunctionDeclBits.UsesFPIntrin; } - void setUsesFPIntrin(bool Val) { FunctionDeclBits.UsesFPIntrin = Val; } - /// Whether this function has been deleted. /// /// A function that is "deleted" (via the C++0x "= delete" syntax) @@ -4498,14 +4534,8 @@ public: /// Insertion operator for diagnostics. This allows sending NamedDecl's /// into a diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const NamedDecl* ND) { - DB.AddTaggedVal(reinterpret_cast(ND), - DiagnosticsEngine::ak_nameddecl); - return DB; -} -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - const NamedDecl* ND) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, + const NamedDecl *ND) { PD.AddTaggedVal(reinterpret_cast(ND), DiagnosticsEngine::ak_nameddecl); return PD; diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 4f33ff104ff..15eb29f7253 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1246,8 +1246,7 @@ public: using IteratorBase = llvm::iterator_adaptor_base; + std::random_access_iterator_tag, NamedDecl *>; class iterator : public IteratorBase { value_type SingleElement; diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 2b8d7e879a0..e32101bb227 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -744,9 +744,14 @@ public: /// /// This value is used for lazy creation of default constructors. bool needsImplicitDefaultConstructor() const { - return !data().UserDeclaredConstructor && - !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) && - (!isLambda() || lambdaIsDefaultConstructibleAndAssignable()); + return (!data().UserDeclaredConstructor && + !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) && + (!isLambda() || lambdaIsDefaultConstructibleAndAssignable())) || + // FIXME: Proposed fix to core wording issue: if a class inherits + // a default constructor and doesn't explicitly declare one, one + // is declared implicitly. + (data().HasInheritedDefaultConstructor && + !(data().DeclaredSpecialMembers & SMF_DefaultConstructor)); } /// Determine whether this class has any user-declared constructors. @@ -1008,8 +1013,13 @@ public: /// Retrieve the lambda static invoker, the address of which /// is returned by the conversion operator, and the body of which - /// is forwarded to the lambda call operator. + /// is forwarded to the lambda call operator. The version that does not + /// take a calling convention uses the 'default' calling convention for free + /// functions if the Lambda's calling convention was not modified via + /// attribute. Otherwise, it will return the calling convention specified for + /// the lambda. CXXMethodDecl *getLambdaStaticInvoker() const; + CXXMethodDecl *getLambdaStaticInvoker(CallingConv CC) const; /// Retrieve the generic lambda's template parameter list. /// Returns null if the class does not represent a lambda or a generic @@ -1025,7 +1035,7 @@ public: } /// Set the captures for this lambda closure type. - void setCaptures(ArrayRef Captures); + void setCaptures(ASTContext &Context, ArrayRef Captures); /// For a closure type, retrieve the mapping from captured /// variables and \c this to the non-static data members that store the @@ -1396,6 +1406,11 @@ public: hasTrivialDefaultConstructor()); } + /// Determine whether this is a structural type. + bool isStructural() const { + return isLiteral() && data().StructuralIfLiteral; + } + /// If this record is an instantiation of a member class, /// retrieves the member class from which it was instantiated. /// @@ -1612,58 +1627,6 @@ public: CXXBasePath &Path, const CXXRecordDecl *BaseRecord); - /// Base-class lookup callback that determines whether there exists - /// a tag with the given name. - /// - /// This callback can be used with \c lookupInBases() to find tag members - /// of the given name within a C++ class hierarchy. - static bool FindTagMember(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, DeclarationName Name); - - /// Base-class lookup callback that determines whether there exists - /// a member with the given name. - /// - /// This callback can be used with \c lookupInBases() to find members - /// of the given name within a C++ class hierarchy. - static bool FindOrdinaryMember(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, DeclarationName Name); - - /// Base-class lookup callback that determines whether there exists - /// a member with the given name. - /// - /// This callback can be used with \c lookupInBases() to find members - /// of the given name within a C++ class hierarchy, including dependent - /// classes. - static bool - FindOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, DeclarationName Name); - - /// Base-class lookup callback that determines whether there exists - /// an OpenMP declare reduction member with the given name. - /// - /// This callback can be used with \c lookupInBases() to find members - /// of the given name within a C++ class hierarchy. - static bool FindOMPReductionMember(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, DeclarationName Name); - - /// Base-class lookup callback that determines whether there exists - /// an OpenMP declare mapper member with the given name. - /// - /// This callback can be used with \c lookupInBases() to find members - /// of the given name within a C++ class hierarchy. - static bool FindOMPMapperMember(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, DeclarationName Name); - - /// Base-class lookup callback that determines whether there exists - /// a member with the given name that can be used in a nested-name-specifier. - /// - /// This callback can be used with \c lookupInBases() to find members of - /// the given name within a C++ class hierarchy that can occur within - /// nested-name-specifiers. - static bool FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier, - CXXBasePath &Path, - DeclarationName Name); - /// Retrieve the final overriders for each virtual member /// function in the class hierarchy where this class is the /// most-derived class in the class hierarchy. @@ -1672,12 +1635,20 @@ public: /// Get the indirect primary bases for this class. void getIndirectPrimaryBases(CXXIndirectPrimaryBaseSet& Bases) const; + /// Determine whether this class has a member with the given name, possibly + /// in a non-dependent base class. + /// + /// No check for ambiguity is performed, so this should never be used when + /// implementing language semantics, but it may be appropriate for warnings, + /// static analysis, or similar. + bool hasMemberName(DeclarationName N) const; + /// Performs an imprecise lookup of a dependent name in this class. /// /// This function does not follow strict semantic rules and should be used /// only when lookup rules can be relaxed, e.g. indexing. std::vector - lookupDependentName(const DeclarationName &Name, + lookupDependentName(DeclarationName Name, llvm::function_ref Filter); /// Renders and displays an inheritance diagram @@ -1877,7 +1848,7 @@ private: const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation) : FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo, - SC_None, false, CSK_unspecified), + SC_None, false, ConstexprSpecKind::Unspecified), ExplicitSpec(ES) { if (EndLocation.isValid()) setRangeEnd(EndLocation); @@ -4070,11 +4041,8 @@ public: /// Insertion operator for diagnostics. This allows sending an AccessSpecifier /// into a diagnostic with <<. -const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - AccessSpecifier AS); - -const PartialDiagnostic &operator<<(const PartialDiagnostic &DB, - AccessSpecifier AS); +const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + AccessSpecifier AS); } // namespace clang diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 5613ed8370c..b1bce069920 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -320,6 +320,13 @@ public: return const_cast(this)->getClassInterface(); } + /// If this method is declared or implemented in a category, return + /// that category. + ObjCCategoryDecl *getCategory(); + const ObjCCategoryDecl *getCategory() const { + return const_cast(this)->getCategory(); + } + Selector getSelector() const { return getDeclName().getObjCSelector(); } QualType getReturnType() const { return MethodDeclType; } @@ -649,20 +656,8 @@ public: /// \endcode class ObjCTypeParamList final : private llvm::TrailingObjects { - /// Stores the components of a SourceRange as a POD. - struct PODSourceRange { - unsigned Begin; - unsigned End; - }; - - union { - /// Location of the left and right angle brackets. - PODSourceRange Brackets; - - // Used only for alignment. - ObjCTypeParamDecl *AlignmentHack; - }; - + /// Location of the left and right angle brackets. + SourceRange Brackets; /// The number of parameters in the list, which are tail-allocated. unsigned NumParams; @@ -710,17 +705,9 @@ public: return *(end() - 1); } - SourceLocation getLAngleLoc() const { - return SourceLocation::getFromRawEncoding(Brackets.Begin); - } - - SourceLocation getRAngleLoc() const { - return SourceLocation::getFromRawEncoding(Brackets.End); - } - - SourceRange getSourceRange() const { - return SourceRange(getLAngleLoc(), getRAngleLoc()); - } + SourceLocation getLAngleLoc() const { return Brackets.getBegin(); } + SourceLocation getRAngleLoc() const { return Brackets.getEnd(); } + SourceRange getSourceRange() const { return Brackets; } /// Gather the default set of type arguments to be substituted for /// these type parameters when dealing with an unspecialized type. @@ -2171,6 +2158,14 @@ public: data().ReferencedProtocols.set(List, Num, Locs, C); } + /// This is true iff the protocol is tagged with the + /// `objc_non_runtime_protocol` attribute. + bool isNonRuntimeProtocol() const; + + /// Get the set of all protocols implied by this protocols inheritance + /// hierarchy. + void getImpliedProtocols(llvm::DenseSet &IPs) const; + ObjCProtocolDecl *lookupProtocolNamed(IdentifierInfo *PName); // Lookup a method. First, we search locally. If a method isn't diff --git a/clang/include/clang/AST/DeclOpenMP.h b/clang/include/clang/AST/DeclOpenMP.h index 154ecb97769..4aa5bde92e1 100644 --- a/clang/include/clang/AST/DeclOpenMP.h +++ b/clang/include/clang/AST/DeclOpenMP.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_AST_DECLOPENMP_H #define LLVM_CLANG_AST_DECLOPENMP_H +#include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" @@ -24,6 +25,76 @@ namespace clang { +/// This is a basic class for representing single OpenMP declarative directive. +/// +template class OMPDeclarativeDirective : public U { + friend class ASTDeclReader; + friend class ASTDeclWriter; + + /// Get the clauses storage. + MutableArrayRef getClauses() { + if (!Data) + return llvm::None; + return Data->getClauses(); + } + +protected: + /// Data, associated with the directive. + OMPChildren *Data = nullptr; + + /// Build instance of directive. + template + OMPDeclarativeDirective(Params &&... P) : U(std::forward(P)...) {} + + template + static T *createDirective(const ASTContext &C, DeclContext *DC, + ArrayRef Clauses, unsigned NumChildren, + Params &&... P) { + auto *Inst = new (C, DC, size(Clauses.size(), NumChildren)) + T(DC, std::forward(P)...); + Inst->Data = OMPChildren::Create(Inst + 1, Clauses, + /*AssociatedStmt=*/nullptr, NumChildren); + Inst->Data->setClauses(Clauses); + return Inst; + } + + template + static T *createEmptyDirective(const ASTContext &C, unsigned ID, + unsigned NumClauses, unsigned NumChildren, + Params &&... P) { + auto *Inst = new (C, ID, size(NumClauses, NumChildren)) + T(nullptr, std::forward(P)...); + Inst->Data = OMPChildren::CreateEmpty( + Inst + 1, NumClauses, /*HasAssociatedStmt=*/false, NumChildren); + return Inst; + } + + static size_t size(unsigned NumClauses, unsigned NumChildren) { + return OMPChildren::size(NumClauses, /*HasAssociatedStmt=*/false, + NumChildren); + } + +public: + /// Get number of clauses. + unsigned getNumClauses() const { + if (!Data) + return 0; + return Data->getNumClauses(); + } + + /// Returns specified clause. + /// + /// \param I Number of clause. + /// + OMPClause *getClause(unsigned I) const { return clauses()[I]; } + + ArrayRef clauses() const { + if (!Data) + return llvm::None; + return Data->getClauses(); + } +}; + /// This represents '#pragma omp threadprivate ...' directive. /// For example, in the following, both 'a' and 'A::b' are threadprivate: /// @@ -36,25 +107,23 @@ namespace clang { /// }; /// \endcode /// -class OMPThreadPrivateDecl final - : public Decl, - private llvm::TrailingObjects { - friend class ASTDeclReader; - friend TrailingObjects; - - unsigned NumVars; +class OMPThreadPrivateDecl final : public OMPDeclarativeDirective { + friend class OMPDeclarativeDirective; virtual void anchor(); - OMPThreadPrivateDecl(Kind DK, DeclContext *DC, SourceLocation L) : - Decl(DK, DC, L), NumVars(0) { } + OMPThreadPrivateDecl(DeclContext *DC = nullptr, + SourceLocation L = SourceLocation()) + : OMPDeclarativeDirective(OMPThreadPrivate, DC, L) {} ArrayRef getVars() const { - return llvm::makeArrayRef(getTrailingObjects(), NumVars); + auto **Storage = reinterpret_cast(Data->getChildren().data()); + return llvm::makeArrayRef(Storage, Data->getNumChildren()); } MutableArrayRef getVars() { - return MutableArrayRef(getTrailingObjects(), NumVars); + auto **Storage = reinterpret_cast(Data->getChildren().data()); + return llvm::makeMutableArrayRef(Storage, Data->getNumChildren()); } void setVars(ArrayRef VL); @@ -71,8 +140,8 @@ public: typedef llvm::iterator_range varlist_range; typedef llvm::iterator_range varlist_const_range; - unsigned varlist_size() const { return NumVars; } - bool varlist_empty() const { return NumVars == 0; } + unsigned varlist_size() const { return Data->getNumChildren(); } + bool varlist_empty() const { return Data->getChildren().empty(); } varlist_range varlists() { return varlist_range(varlist_begin(), varlist_end()); @@ -94,7 +163,7 @@ public: /// 'float': /// /// \code -/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \ +/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) /// initializer (omp_priv = 0) /// \endcode /// @@ -214,11 +283,11 @@ public: /// \code /// #pragma omp declare mapper(mid: struct vec v) map(v.len, v.data[0:N]) /// \endcode -class OMPDeclareMapperDecl final : public ValueDecl, public DeclContext { +class OMPDeclareMapperDecl final : public OMPDeclarativeDirective, + public DeclContext { + friend class OMPDeclarativeDirective; friend class ASTDeclReader; - - /// Clauses associated with this mapper declaration - MutableArrayRef Clauses; + friend class ASTDeclWriter; /// Mapper variable, which is 'v' in the example above Expr *MapperVarRef = nullptr; @@ -230,42 +299,36 @@ class OMPDeclareMapperDecl final : public ValueDecl, public DeclContext { void anchor() override; - OMPDeclareMapperDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName Name, QualType Ty, - DeclarationName VarName, + OMPDeclareMapperDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, + QualType Ty, DeclarationName VarName, OMPDeclareMapperDecl *PrevDeclInScope) - : ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), VarName(VarName), + : OMPDeclarativeDirective(OMPDeclareMapper, DC, L, Name, Ty), + DeclContext(OMPDeclareMapper), VarName(VarName), PrevDeclInScope(PrevDeclInScope) {} void setPrevDeclInScope(OMPDeclareMapperDecl *Prev) { PrevDeclInScope = Prev; } - /// Sets an array of clauses to this mapper declaration - void setClauses(ArrayRef CL); - public: /// Creates declare mapper node. static OMPDeclareMapperDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, QualType T, DeclarationName VarName, + ArrayRef Clauses, OMPDeclareMapperDecl *PrevDeclInScope); /// Creates deserialized declare mapper node. static OMPDeclareMapperDecl *CreateDeserialized(ASTContext &C, unsigned ID, unsigned N); - /// Creates an array of clauses to this mapper declaration and intializes - /// them. - void CreateClauses(ASTContext &C, ArrayRef CL); - using clauselist_iterator = MutableArrayRef::iterator; using clauselist_const_iterator = ArrayRef::iterator; using clauselist_range = llvm::iterator_range; using clauselist_const_range = llvm::iterator_range; - unsigned clauselist_size() const { return Clauses.size(); } - bool clauselist_empty() const { return Clauses.empty(); } + unsigned clauselist_size() const { return Data->getNumClauses(); } + bool clauselist_empty() const { return Data->getClauses().empty(); } clauselist_range clauselists() { return clauselist_range(clauselist_begin(), clauselist_end()); @@ -273,16 +336,24 @@ public: clauselist_const_range clauselists() const { return clauselist_const_range(clauselist_begin(), clauselist_end()); } - clauselist_iterator clauselist_begin() { return Clauses.begin(); } - clauselist_iterator clauselist_end() { return Clauses.end(); } - clauselist_const_iterator clauselist_begin() const { return Clauses.begin(); } - clauselist_const_iterator clauselist_end() const { return Clauses.end(); } + clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); } + clauselist_iterator clauselist_end() { return Data->getClauses().end(); } + clauselist_const_iterator clauselist_begin() const { + return Data->getClauses().begin(); + } + clauselist_const_iterator clauselist_end() const { + return Data->getClauses().end(); + } /// Get the variable declared in the mapper - Expr *getMapperVarRef() { return MapperVarRef; } - const Expr *getMapperVarRef() const { return MapperVarRef; } + Expr *getMapperVarRef() { return cast_or_null(Data->getChildren()[0]); } + const Expr *getMapperVarRef() const { + return cast_or_null(Data->getChildren()[0]); + } /// Set the variable declared in the mapper - void setMapperVarRef(Expr *MapperVarRefE) { MapperVarRef = MapperVarRefE; } + void setMapperVarRef(Expr *MapperVarRefE) { + Data->getChildren()[0] = MapperVarRefE; + } /// Get the name of the variable declared in the mapper DeclarationName getVarName() { return VarName; } @@ -342,34 +413,14 @@ public: /// #pragma omp requires unified_address /// \endcode /// -class OMPRequiresDecl final - : public Decl, - private llvm::TrailingObjects { +class OMPRequiresDecl final : public OMPDeclarativeDirective { + friend class OMPDeclarativeDirective; friend class ASTDeclReader; - friend TrailingObjects; - - // Number of clauses associated with this requires declaration - unsigned NumClauses = 0; virtual void anchor(); - OMPRequiresDecl(Kind DK, DeclContext *DC, SourceLocation L) - : Decl(DK, DC, L), NumClauses(0) {} - - /// Returns an array of immutable clauses associated with this requires - /// declaration - ArrayRef getClauses() const { - return llvm::makeArrayRef(getTrailingObjects(), NumClauses); - } - - /// Returns an array of clauses associated with this requires declaration - MutableArrayRef getClauses() { - return MutableArrayRef(getTrailingObjects(), - NumClauses); - } - - /// Sets an array of clauses to this requires declaration - void setClauses(ArrayRef CL); + OMPRequiresDecl(DeclContext *DC, SourceLocation L) + : OMPDeclarativeDirective(OMPRequires, DC, L) {} public: /// Create requires node. @@ -384,8 +435,8 @@ public: using clauselist_range = llvm::iterator_range; using clauselist_const_range = llvm::iterator_range; - unsigned clauselist_size() const { return NumClauses; } - bool clauselist_empty() const { return NumClauses == 0; } + unsigned clauselist_size() const { return Data->getNumClauses(); } + bool clauselist_empty() const { return Data->getClauses().empty(); } clauselist_range clauselists() { return clauselist_range(clauselist_begin(), clauselist_end()); @@ -393,13 +444,13 @@ public: clauselist_const_range clauselists() const { return clauselist_const_range(clauselist_begin(), clauselist_end()); } - clauselist_iterator clauselist_begin() { return getClauses().begin(); } - clauselist_iterator clauselist_end() { return getClauses().end(); } + clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); } + clauselist_iterator clauselist_end() { return Data->getClauses().end(); } clauselist_const_iterator clauselist_begin() const { - return getClauses().begin(); + return Data->getClauses().begin(); } clauselist_const_iterator clauselist_end() const { - return getClauses().end(); + return Data->getClauses().end(); } static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -419,53 +470,27 @@ public: /// }; /// \endcode /// -class OMPAllocateDecl final - : public Decl, - private llvm::TrailingObjects { +class OMPAllocateDecl final : public OMPDeclarativeDirective { + friend class OMPDeclarativeDirective; friend class ASTDeclReader; - friend TrailingObjects; - - /// Number of variable within the allocate directive. - unsigned NumVars = 0; - /// Number of clauses associated with the allocate directive. - unsigned NumClauses = 0; - - size_t numTrailingObjects(OverloadToken) const { - return NumVars; - } - size_t numTrailingObjects(OverloadToken) const { - return NumClauses; - } virtual void anchor(); - OMPAllocateDecl(Kind DK, DeclContext *DC, SourceLocation L) - : Decl(DK, DC, L) {} + OMPAllocateDecl(DeclContext *DC, SourceLocation L) + : OMPDeclarativeDirective(OMPAllocate, DC, L) {} ArrayRef getVars() const { - return llvm::makeArrayRef(getTrailingObjects(), NumVars); + auto **Storage = reinterpret_cast(Data->getChildren().data()); + return llvm::makeArrayRef(Storage, Data->getNumChildren()); } MutableArrayRef getVars() { - return MutableArrayRef(getTrailingObjects(), NumVars); + auto **Storage = reinterpret_cast(Data->getChildren().data()); + return llvm::makeMutableArrayRef(Storage, Data->getNumChildren()); } void setVars(ArrayRef VL); - /// Returns an array of immutable clauses associated with this directive. - ArrayRef getClauses() const { - return llvm::makeArrayRef(getTrailingObjects(), NumClauses); - } - - /// Returns an array of clauses associated with this directive. - MutableArrayRef getClauses() { - return MutableArrayRef(getTrailingObjects(), - NumClauses); - } - - /// Sets an array of clauses to this requires declaration - void setClauses(ArrayRef CL); - public: static OMPAllocateDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, ArrayRef VL, @@ -482,11 +507,10 @@ public: using clauselist_range = llvm::iterator_range; using clauselist_const_range = llvm::iterator_range; - - unsigned varlist_size() const { return NumVars; } - bool varlist_empty() const { return NumVars == 0; } - unsigned clauselist_size() const { return NumClauses; } - bool clauselist_empty() const { return NumClauses == 0; } + unsigned varlist_size() const { return Data->getNumChildren(); } + bool varlist_empty() const { return Data->getChildren().empty(); } + unsigned clauselist_size() const { return Data->getNumClauses(); } + bool clauselist_empty() const { return Data->getClauses().empty(); } varlist_range varlists() { return varlist_range(varlist_begin(), varlist_end()); @@ -505,13 +529,13 @@ public: clauselist_const_range clauselists() const { return clauselist_const_range(clauselist_begin(), clauselist_end()); } - clauselist_iterator clauselist_begin() { return getClauses().begin(); } - clauselist_iterator clauselist_end() { return getClauses().end(); } + clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); } + clauselist_iterator clauselist_end() { return Data->getClauses().end(); } clauselist_const_iterator clauselist_begin() const { - return getClauses().begin(); + return Data->getClauses().begin(); } clauselist_const_iterator clauselist_end() const { - return getClauses().end(); + return Data->getClauses().end(); } static bool classof(const Decl *D) { return classofKind(D->getKind()); } diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index e9c4879b41e..7fbf6294970 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -77,7 +77,7 @@ class TemplateParameterList final /// The number of template parameters in this template /// parameter list. - unsigned NumParams : 30; + unsigned NumParams : 29; /// Whether this template parameter list contains an unexpanded parameter /// pack. @@ -204,10 +204,6 @@ public: bool OmitTemplateKW = false) const; void print(raw_ostream &Out, const ASTContext &Context, const PrintingPolicy &Policy, bool OmitTemplateKW = false) const; - -public: - // FIXME: workaround for MSVC 2013; remove when no longer needed - using FixedSizeStorageOwner = TrailingObjects::FixedSizeStorageOwner; }; /// Stores a list of template parameters and the associated @@ -2270,7 +2266,7 @@ protected: /// Retrieve the set of partial specializations of this class /// template. llvm::FoldingSetVector & - getPartialSpecializations(); + getPartialSpecializations() const; ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, @@ -2367,7 +2363,7 @@ public: /// Retrieve the partial specializations as an ordered list. void getPartialSpecializations( - SmallVectorImpl &PS); + SmallVectorImpl &PS) const; /// Find a class template partial specialization with the given /// type T. @@ -3099,7 +3095,7 @@ protected: /// Retrieve the set of partial specializations of this class /// template. llvm::FoldingSetVector & - getPartialSpecializations(); + getPartialSpecializations() const; VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, @@ -3195,7 +3191,7 @@ public: /// Retrieve the partial specializations as an ordered list. void getPartialSpecializations( - SmallVectorImpl &PS); + SmallVectorImpl &PS) const; /// Find a variable template partial specialization which was /// instantiated @@ -3230,7 +3226,7 @@ public: static bool classofKind(Kind K) { return K == VarTemplate; } }; -// \brief Declaration of a C++2a concept. +/// Declaration of a C++2a concept. class ConceptDecl : public TemplateDecl, public Mergeable { protected: Expr *ConstraintExpr; @@ -3259,6 +3255,9 @@ public: return isa(getTemplateParameters()->getParam(0)); } + ConceptDecl *getCanonicalDecl() override { return getFirstDecl(); } + const ConceptDecl *getCanonicalDecl() const { return getFirstDecl(); } + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classofKind(Kind K) { return K == Concept; } @@ -3268,6 +3267,74 @@ public: friend class ASTDeclWriter; }; +/// A template parameter object. +/// +/// Template parameter objects represent values of class type used as template +/// arguments. There is one template parameter object for each such distinct +/// value used as a template argument across the program. +/// +/// \code +/// struct A { int x, y; }; +/// template struct S; +/// S s1; +/// S s2; // same type, argument is same TemplateParamObjectDecl. +/// \endcode +class TemplateParamObjectDecl : public ValueDecl, + public Mergeable, + public llvm::FoldingSetNode { +private: + /// The value of this template parameter object. + APValue Value; + + TemplateParamObjectDecl(DeclContext *DC, QualType T, const APValue &V) + : ValueDecl(TemplateParamObject, DC, SourceLocation(), DeclarationName(), + T), + Value(V) {} + + static TemplateParamObjectDecl *Create(const ASTContext &C, QualType T, + const APValue &V); + static TemplateParamObjectDecl *CreateDeserialized(ASTContext &C, + unsigned ID); + + /// Only ASTContext::getTemplateParamObjectDecl and deserialization + /// create these. + friend class ASTContext; + friend class ASTReader; + friend class ASTDeclReader; + +public: + /// Print this template parameter object in a human-readable format. + void printName(llvm::raw_ostream &OS) const override; + + /// Print this object as an equivalent expression. + void printAsExpr(llvm::raw_ostream &OS) const; + + /// Print this object as an initializer suitable for a variable of the + /// object's type. + void printAsInit(llvm::raw_ostream &OS) const; + + const APValue &getValue() const { return Value; } + + static void Profile(llvm::FoldingSetNodeID &ID, QualType T, + const APValue &V) { + ID.AddPointer(T.getCanonicalType().getAsOpaquePtr()); + V.Profile(ID); + } + void Profile(llvm::FoldingSetNodeID &ID) { + Profile(ID, getType(), getValue()); + } + + TemplateParamObjectDecl *getCanonicalDecl() override { + return getFirstDecl(); + } + const TemplateParamObjectDecl *getCanonicalDecl() const { + return getFirstDecl(); + } + + static bool classof(const Decl *D) { return classofKind(D->getKind()); } + static bool classofKind(Kind K) { return K == TemplateParamObject; } +}; + inline NamedDecl *getAsNamedDecl(TemplateParameter P) { if (auto *PD = P.dyn_cast()) return PD; @@ -3286,6 +3353,36 @@ inline TemplateDecl *getAsTypeTemplateDecl(Decl *D) { : nullptr; } +/// Check whether the template parameter is a pack expansion, and if so, +/// determine the number of parameters produced by that expansion. For instance: +/// +/// \code +/// template struct A { +/// template class ...TTs, typename ...Us> struct B; +/// }; +/// \endcode +/// +/// In \c A::B, \c NTs and \c TTs have expanded pack size 2, and \c Us +/// is not a pack expansion, so returns an empty Optional. +inline Optional getExpandedPackSize(const NamedDecl *Param) { + if (const auto *TTP = dyn_cast(Param)) { + if (TTP->isExpandedParameterPack()) + return TTP->getNumExpansionParameters(); + } + + if (const auto *NTTP = dyn_cast(Param)) { + if (NTTP->isExpandedParameterPack()) + return NTTP->getNumExpansionTypes(); + } + + if (const auto *TTP = dyn_cast(Param)) { + if (TTP->isExpandedParameterPack()) + return TTP->getNumExpansionTemplateParameters(); + } + + return None; +} + } // namespace clang #endif // LLVM_CLANG_AST_DECLTEMPLATE_H diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h index 82f6868e3a7..3cb0a02ff49 100644 --- a/clang/include/clang/AST/DeclarationName.h +++ b/clang/include/clang/AST/DeclarationName.h @@ -811,19 +811,10 @@ private: SourceLocation getEndLocPrivate() const; }; -/// Insertion operator for diagnostics. This allows sending DeclarationName's -/// into a diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - DeclarationName N) { - DB.AddTaggedVal(N.getAsOpaqueInteger(), - DiagnosticsEngine::ak_declarationname); - return DB; -} - /// Insertion operator for partial diagnostics. This allows binding /// DeclarationName's into a partial diagnostic with <<. -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - DeclarationName N) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, + DeclarationName N) { PD.AddTaggedVal(N.getAsOpaqueInteger(), DiagnosticsEngine::ak_declarationname); return PD; @@ -857,6 +848,16 @@ struct DenseMapInfo { } }; +template <> struct PointerLikeTypeTraits { + static inline void *getAsVoidPointer(clang::DeclarationName P) { + return P.getAsOpaquePtr(); + } + static inline clang::DeclarationName getFromVoidPointer(void *P) { + return clang::DeclarationName::getFromOpaquePtr(P); + } + static constexpr int NumLowBitsAvailable = 0; +}; + } // namespace llvm // The definition of AssumedTemplateStorage is factored out of TemplateName to diff --git a/clang/include/clang/AST/DependenceFlags.h b/clang/include/clang/AST/DependenceFlags.h index 14a7ffaecb2..ca96b65574b 100644 --- a/clang/include/clang/AST/DependenceFlags.h +++ b/clang/include/clang/AST/DependenceFlags.h @@ -41,6 +41,7 @@ struct ExprDependenceScope { TypeInstantiation = Type | Instantiation, ValueInstantiation = Value | Instantiation, TypeValueInstantiation = Type | Value | Instantiation, + ErrorDependent = Error | ValueInstantiation, LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Error) }; diff --git a/clang/include/clang/AST/DependentDiagnostic.h b/clang/include/clang/AST/DependentDiagnostic.h index 0a98dec0c25..18276d54d54 100644 --- a/clang/include/clang/AST/DependentDiagnostic.h +++ b/clang/include/clang/AST/DependentDiagnostic.h @@ -48,7 +48,7 @@ public: QualType BaseObjectType, const PartialDiagnostic &PDiag) { DependentDiagnostic *DD = Create(Context, Parent, PDiag); - DD->AccessData.Loc = Loc.getRawEncoding(); + DD->AccessData.Loc = Loc; DD->AccessData.IsMember = IsMemberAccess; DD->AccessData.Access = AS; DD->AccessData.TargetDecl = TargetDecl; @@ -73,7 +73,7 @@ public: SourceLocation getAccessLoc() const { assert(getKind() == Access); - return SourceLocation::getFromRawEncoding(AccessData.Loc); + return AccessData.Loc; } NamedDecl *getAccessTarget() const { @@ -100,8 +100,8 @@ private: friend class DependentStoredDeclsMap; DependentDiagnostic(const PartialDiagnostic &PDiag, - PartialDiagnostic::Storage *Storage) - : Diag(PDiag, Storage) {} + DiagnosticStorage *Storage) + : Diag(PDiag, Storage) {} static DependentDiagnostic *Create(ASTContext &Context, DeclContext *Parent, @@ -112,7 +112,7 @@ private: PartialDiagnostic Diag; struct { - unsigned Loc; + SourceLocation Loc; unsigned Access : 2; unsigned IsMember : 1; NamedDecl *TargetDecl; diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index c13b9711928..a44d0696743 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -24,7 +24,6 @@ #include "clang/AST/TemplateBase.h" #include "clang/AST/Type.h" #include "clang/Basic/CharInfo.h" -#include "clang/Basic/FixedPoint.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/SyncScope.h" #include "clang/Basic/TypeTraits.h" @@ -414,6 +413,10 @@ public: return ClassifyImpl(Ctx, &Loc); } + /// Returns the set of floating point options that apply to this expression. + /// Only meaningful for operations on floating point values. + FPOptions getFPFeaturesInEffect(const LangOptions &LO) const; + /// getValueKindForType - Given a formal return or parameter type, /// give its value kind. static ExprValueKind getValueKindForType(QualType T) { @@ -522,16 +525,15 @@ public: /// semantically correspond to a bool. bool isKnownToHaveBooleanValue(bool Semantic = true) const; - /// isIntegerConstantExpr - Return true if this expression is a valid integer - /// constant expression, and, if so, return its value in Result. If not a - /// valid i-c-e, return false and fill in Loc (if specified) with the location - /// of the invalid expression. + /// isIntegerConstantExpr - Return the value if this expression is a valid + /// integer constant expression. If not a valid i-c-e, return None and fill + /// in Loc (if specified) with the location of the invalid expression. /// /// Note: This does not perform the implicit conversions required by C++11 /// [expr.const]p5. - bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, - SourceLocation *Loc = nullptr, - bool isEvaluated = true) const; + Optional getIntegerConstantExpr(const ASTContext &Ctx, + SourceLocation *Loc = nullptr, + bool isEvaluated = true) const; bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc = nullptr) const; @@ -697,7 +699,8 @@ public: /// notes will be produced if the expression is not a constant expression. bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx, const VarDecl *VD, - SmallVectorImpl &Notes) const; + SmallVectorImpl &Notes, + bool IsConstantInitializer) const; /// EvaluateWithSubstitution - Evaluate an expression as if from the context /// of a call to the given function with the given arguments, inside an @@ -708,13 +711,26 @@ public: ArrayRef Args, const Expr *This = nullptr) const; - /// Indicates how the constant expression will be used. - enum ConstExprUsage { EvaluateForCodeGen, EvaluateForMangling }; + enum class ConstantExprKind { + /// An integer constant expression (an array bound, enumerator, case value, + /// bit-field width, or similar) or similar. + Normal, + /// A non-class template argument. Such a value is only used for mangling, + /// not for code generation, so can refer to dllimported functions. + NonClassTemplateArgument, + /// A class template argument. Such a value is used for code generation. + ClassTemplateArgument, + /// An immediate invocation. The destruction of the end result of this + /// evaluation is not part of the evaluation, but all other temporaries + /// are destroyed. + ImmediateInvocation, + }; - /// Evaluate an expression that is required to be a constant expression. - bool EvaluateAsConstantExpr(EvalResult &Result, ConstExprUsage Usage, - const ASTContext &Ctx, - bool InPlace = false) const; + /// Evaluate an expression that is required to be a constant expression. Does + /// not check the syntactic constraints for C and C++98 constant expressions. + bool EvaluateAsConstantExpr( + EvalResult &Result, const ASTContext &Ctx, + ConstantExprKind Kind = ConstantExprKind::Normal) const; /// If the current Expr is a pointer, this will try to statically /// determine the number of bytes available where the pointer is pointing. @@ -869,9 +885,9 @@ public: /// Skip conversion operators. If this Expr is a call to a conversion /// operator, return the argument. - Expr *IgnoreConversionOperator() LLVM_READONLY; - const Expr *IgnoreConversionOperator() const { - return const_cast(this)->IgnoreConversionOperator(); + Expr *IgnoreConversionOperatorSingleStep() LLVM_READONLY; + const Expr *IgnoreConversionOperatorSingleStep() const { + return const_cast(this)->IgnoreConversionOperatorSingleStep(); } /// Skip past any parentheses and lvalue casts which might surround this @@ -903,9 +919,9 @@ public: /// * What IgnoreParens() skips /// * CastExpr which represent a derived-to-base cast (CK_DerivedToBase, /// CK_UncheckedDerivedToBase and CK_NoOp) - Expr *ignoreParenBaseCasts() LLVM_READONLY; - const Expr *ignoreParenBaseCasts() const { - return const_cast(this)->ignoreParenBaseCasts(); + Expr *IgnoreParenBaseCasts() LLVM_READONLY; + const Expr *IgnoreParenBaseCasts() const { + return const_cast(this)->IgnoreParenBaseCasts(); } /// Determine whether this expression is a default function argument. @@ -962,6 +978,13 @@ public: T->getStmtClass() <= lastExprConstant; } }; +// PointerLikeTypeTraits is specialized so it can be used with a forward-decl of +// Expr. Verify that we got it right. +static_assert(llvm::PointerLikeTypeTraits::NumLowBitsAvailable <= + llvm::detail::ConstantLog2::value, + "PointerLikeTypeTraits assumes too much alignment."); + +using ConstantExprKind = Expr::ConstantExprKind; //===----------------------------------------------------------------------===// // Wrapper Expressions. @@ -1261,7 +1284,7 @@ public: ValueDecl *getDecl() { return D; } const ValueDecl *getDecl() const { return D; } - void setDecl(ValueDecl *NewD) { D = NewD; } + void setDecl(ValueDecl *NewD); DeclarationNameInfo getNameInfo() const { return DeclarationNameInfo(getDecl()->getDeclName(), getLocation(), DNLoc); @@ -1923,17 +1946,13 @@ public: /// [C99 6.4.2.2] - A predefined identifier such as __func__. class PredefinedExpr final : public Expr, - private llvm::TrailingObjects { + private llvm::TrailingObjects { friend class ASTStmtReader; friend TrailingObjects; // PredefinedExpr is optionally followed by a single trailing // "Stmt *" for the predefined identifier. It is present if and only if // hasFunctionName() is true and is always a "StringLiteral *". - // It can also be followed by a Expr* in the case of a - // __builtin_unique_stable_name with an expression, or TypeSourceInfo * if - // __builtin_unique_stable_name with a type. public: enum IdentKind { @@ -1946,18 +1965,12 @@ public: PrettyFunction, /// The same as PrettyFunction, except that the /// 'virtual' keyword is omitted for virtual member functions. - PrettyFunctionNoVirtual, - UniqueStableNameType, - UniqueStableNameExpr, + PrettyFunctionNoVirtual }; private: PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK, StringLiteral *SL); - PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK, - TypeSourceInfo *Info); - PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK, - Expr *E); explicit PredefinedExpr(EmptyShell Empty, bool HasFunctionName); @@ -1970,39 +1983,10 @@ private: *getTrailingObjects() = SL; } - void setTypeSourceInfo(TypeSourceInfo *Info) { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameType && - "TypeSourceInfo only valid for UniqueStableName of a Type"); - *getTrailingObjects() = Info; - } - - void setExpr(Expr *E) { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameExpr && - "TypeSourceInfo only valid for UniqueStableName of n Expression."); - *getTrailingObjects() = E; - } - - size_t numTrailingObjects(OverloadToken) const { - return hasFunctionName(); - } - - size_t numTrailingObjects(OverloadToken) const { - return getIdentKind() == UniqueStableNameType && !hasFunctionName(); - } - size_t numTrailingObjects(OverloadToken) const { - return getIdentKind() == UniqueStableNameExpr && !hasFunctionName(); - } - public: /// Create a PredefinedExpr. static PredefinedExpr *Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, IdentKind IK, StringLiteral *SL); - static PredefinedExpr *Create(const ASTContext &Ctx, SourceLocation L, - QualType FNTy, IdentKind IK, StringLiteral *SL, - TypeSourceInfo *Info); - static PredefinedExpr *Create(const ASTContext &Ctx, SourceLocation L, - QualType FNTy, IdentKind IK, StringLiteral *SL, - Expr *E); /// Create an empty PredefinedExpr. static PredefinedExpr *CreateEmpty(const ASTContext &Ctx, @@ -2027,34 +2011,12 @@ public: : nullptr; } - TypeSourceInfo *getTypeSourceInfo() { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameType && - "TypeSourceInfo only valid for UniqueStableName of a Type"); - return *getTrailingObjects(); - } - - const TypeSourceInfo *getTypeSourceInfo() const { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameType && - "TypeSourceInfo only valid for UniqueStableName of a Type"); - return *getTrailingObjects(); - } - - Expr *getExpr() { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameExpr && - "TypeSourceInfo only valid for UniqueStableName of n Expression."); - return *getTrailingObjects(); - } - - const Expr *getExpr() const { - assert(!hasFunctionName() && getIdentKind() == UniqueStableNameExpr && - "TypeSourceInfo only valid for UniqueStableName of n Expression."); - return *getTrailingObjects(); - } - static StringRef getIdentKindName(IdentKind IK); + StringRef getIdentKindName() const { + return getIdentKindName(getIdentKind()); + } + static std::string ComputeName(IdentKind IK, const Decl *CurrentDecl); - static std::string ComputeName(ASTContext &Context, IdentKind IK, - const QualType Ty); SourceLocation getBeginLoc() const { return getLocation(); } SourceLocation getEndLoc() const { return getLocation(); } @@ -2273,12 +2235,12 @@ public: /// Is FPFeatures in Trailing Storage? bool hasStoredFPFeatures() const { return UnaryOperatorBits.HasFPFeatures; } -protected: - /// Get FPFeatures from trailing storage + /// Get FPFeatures from trailing storage. FPOptionsOverride getStoredFPFeatures() const { return getTrailingFPFeatures(); } +protected: /// Set FPFeatures in trailing storage, used only by Serialization void setStoredFPFeatures(FPOptionsOverride F) { getTrailingFPFeatures() = F; } @@ -2788,6 +2750,8 @@ class CallExpr : public Expr { // // * An array of getNumArgs() "Stmt *" for the argument expressions. // + // * An optional of type FPOptionsOverride. + // // Note that we store the offset in bytes from the this pointer to the start // of the trailing objects. It would be perfectly possible to compute it // based on the dynamic kind of the CallExpr. However 1.) we have plenty of @@ -2809,6 +2773,15 @@ class CallExpr : public Expr { /// this pointer to the trailing objects. static unsigned offsetToTrailingObjects(StmtClass SC); + unsigned getSizeOfTrailingStmts() const { + return (1 + getNumPreArgs() + getNumArgs()) * sizeof(Stmt *); + } + + size_t getOffsetOfTrailingFPFeatures() const { + assert(hasStoredFPFeatures()); + return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts(); + } + public: enum class ADLCallKind : bool { NotADL, UsesADL }; static constexpr ADLCallKind NotADL = ADLCallKind::NotADL; @@ -2819,16 +2792,19 @@ protected: /// allocated for the trailing objects. CallExpr(StmtClass SC, Expr *Fn, ArrayRef PreArgs, ArrayRef Args, QualType Ty, ExprValueKind VK, - SourceLocation RParenLoc, unsigned MinNumArgs, ADLCallKind UsesADL); + SourceLocation RParenLoc, FPOptionsOverride FPFeatures, + unsigned MinNumArgs, ADLCallKind UsesADL); /// Build an empty call expression, for deserialization. CallExpr(StmtClass SC, unsigned NumPreArgs, unsigned NumArgs, - EmptyShell Empty); + bool hasFPFeatures, EmptyShell Empty); /// Return the size in bytes needed for the trailing objects. /// Used by the derived classes to allocate the right amount of storage. - static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs) { - return (1 + NumPreArgs + NumArgs) * sizeof(Stmt *); + static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs, + bool HasFPFeatures) { + return (1 + NumPreArgs + NumArgs) * sizeof(Stmt *) + + HasFPFeatures * sizeof(FPOptionsOverride); } Stmt *getPreArg(unsigned I) { @@ -2846,22 +2822,43 @@ protected: unsigned getNumPreArgs() const { return CallExprBits.NumPreArgs; } + /// Return a pointer to the trailing FPOptions + FPOptionsOverride *getTrailingFPFeatures() { + assert(hasStoredFPFeatures()); + return reinterpret_cast( + reinterpret_cast(this) + CallExprBits.OffsetToTrailingObjects + + getSizeOfTrailingStmts()); + } + const FPOptionsOverride *getTrailingFPFeatures() const { + assert(hasStoredFPFeatures()); + return reinterpret_cast( + reinterpret_cast(this) + + CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts()); + } + public: - /// Create a call expression. Fn is the callee expression, Args is the - /// argument array, Ty is the type of the call expression (which is *not* - /// the return type in general), VK is the value kind of the call expression - /// (lvalue, rvalue, ...), and RParenLoc is the location of the right - /// parenthese in the call expression. MinNumArgs specifies the minimum - /// number of arguments. The actual number of arguments will be the greater - /// of Args.size() and MinNumArgs. This is used in a few places to allocate - /// enough storage for the default arguments. UsesADL specifies whether the - /// callee was found through argument-dependent lookup. + /// Create a call expression. + /// \param Fn The callee expression, + /// \param Args The argument array, + /// \param Ty The type of the call expression (which is *not* the return + /// type in general), + /// \param VK The value kind of the call expression (lvalue, rvalue, ...), + /// \param RParenLoc The location of the right parenthesis in the call + /// expression. + /// \param FPFeatures Floating-point features associated with the call, + /// \param MinNumArgs Specifies the minimum number of arguments. The actual + /// number of arguments will be the greater of Args.size() + /// and MinNumArgs. This is used in a few places to allocate + /// enough storage for the default arguments. + /// \param UsesADL Specifies whether the callee was found through + /// argument-dependent lookup. /// /// Note that you can use CreateTemporary if you need a temporary call /// expression on the stack. static CallExpr *Create(const ASTContext &Ctx, Expr *Fn, ArrayRef Args, QualType Ty, ExprValueKind VK, - SourceLocation RParenLoc, unsigned MinNumArgs = 0, + SourceLocation RParenLoc, + FPOptionsOverride FPFeatures, unsigned MinNumArgs = 0, ADLCallKind UsesADL = NotADL); /// Create a temporary call expression with no arguments in the memory @@ -2878,7 +2875,7 @@ public: /// Create an empty call expression, for deserialization. static CallExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, - EmptyShell Empty); + bool HasFPFeatures, EmptyShell Empty); Expr *getCallee() { return cast(getTrailingStmts()[FN]); } const Expr *getCallee() const { return cast(getTrailingStmts()[FN]); } @@ -2892,6 +2889,8 @@ public: } bool usesADL() const { return getADLCallKind() == UsesADL; } + bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; } + Decl *getCalleeDecl() { return getCallee()->getReferencedDeclOfCallee(); } const Decl *getCalleeDecl() const { return getCallee()->getReferencedDeclOfCallee(); @@ -2984,6 +2983,31 @@ public: /// this function call. unsigned getNumCommas() const { return getNumArgs() ? getNumArgs() - 1 : 0; } + /// Get FPOptionsOverride from trailing storage. + FPOptionsOverride getStoredFPFeatures() const { + assert(hasStoredFPFeatures()); + return *getTrailingFPFeatures(); + } + /// Set FPOptionsOverride in trailing storage. Used only by Serialization. + void setStoredFPFeatures(FPOptionsOverride F) { + assert(hasStoredFPFeatures()); + *getTrailingFPFeatures() = F; + } + + // Get the FP features status of this operator. Only meaningful for + // operations on floating point types. + FPOptions getFPFeaturesInEffect(const LangOptions &LO) const { + if (hasStoredFPFeatures()) + return getStoredFPFeatures().applyOverrides(LO); + return FPOptions::defaultWithoutTrailingStorage(LO); + } + + FPOptionsOverride getFPFeatures() const { + if (hasStoredFPFeatures()) + return getStoredFPFeatures(); + return FPOptionsOverride(); + } + /// getBuiltinCallee - If this is a call to a builtin, return the builtin ID /// of the callee. If not, return 0. unsigned getBuiltinCallee() const; @@ -3143,7 +3167,7 @@ public: /// The returned declaration will be a FieldDecl or (in C++) a VarDecl (for /// static data members), a CXXMethodDecl, or an EnumConstantDecl. ValueDecl *getMemberDecl() const { return MemberDecl; } - void setMemberDecl(ValueDecl *D) { MemberDecl = D; } + void setMemberDecl(ValueDecl *D); /// Retrieves the declaration found by lookup. DeclAccessPair getFoundDecl() const { @@ -3380,9 +3404,11 @@ class CastExpr : public Expr { } CXXBaseSpecifier **path_buffer(); + friend class ASTStmtReader; + protected: CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, - Expr *op, unsigned BasePathSize) + Expr *op, unsigned BasePathSize, bool HasFPFeatures) : Expr(SC, ty, VK, OK_Ordinary), Op(op) { CastExprBits.Kind = kind; CastExprBits.PartOfExplicitCast = false; @@ -3391,17 +3417,27 @@ protected: "BasePathSize overflow!"); setDependence(computeDependence(this)); assert(CastConsistency()); + CastExprBits.HasFPFeatures = HasFPFeatures; } /// Construct an empty cast. - CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize) - : Expr(SC, Empty) { + CastExpr(StmtClass SC, EmptyShell Empty, unsigned BasePathSize, + bool HasFPFeatures) + : Expr(SC, Empty) { CastExprBits.PartOfExplicitCast = false; CastExprBits.BasePathSize = BasePathSize; + CastExprBits.HasFPFeatures = HasFPFeatures; assert((CastExprBits.BasePathSize == BasePathSize) && "BasePathSize overflow!"); } + /// Return a pointer to the trailing FPOptions. + /// \pre hasStoredFPFeatures() == true + FPOptionsOverride *getTrailingFPFeatures(); + const FPOptionsOverride *getTrailingFPFeatures() const { + return const_cast(this)->getTrailingFPFeatures(); + } + public: CastKind getCastKind() const { return (CastKind) CastExprBits.Kind; } void setCastKind(CastKind K) { CastExprBits.Kind = K; } @@ -3446,6 +3482,28 @@ public: return getTargetFieldForToUnionCast(getType(), getSubExpr()->getType()); } + bool hasStoredFPFeatures() const { return CastExprBits.HasFPFeatures; } + + /// Get FPOptionsOverride from trailing storage. + FPOptionsOverride getStoredFPFeatures() const { + assert(hasStoredFPFeatures()); + return *getTrailingFPFeatures(); + } + + // Get the FP features status of this operation. Only meaningful for + // operations on floating point types. + FPOptions getFPFeaturesInEffect(const LangOptions &LO) const { + if (hasStoredFPFeatures()) + return getStoredFPFeatures().applyOverrides(LO); + return FPOptions::defaultWithoutTrailingStorage(LO); + } + + FPOptionsOverride getFPFeatures() const { + if (hasStoredFPFeatures()) + return getStoredFPFeatures(); + return FPOptionsOverride(); + } + static const FieldDecl *getTargetFieldForToUnionCast(QualType unionType, QualType opType); static const FieldDecl *getTargetFieldForToUnionCast(const RecordDecl *RD, @@ -3483,21 +3541,35 @@ public: /// @endcode class ImplicitCastExpr final : public CastExpr, - private llvm::TrailingObjects { + private llvm::TrailingObjects { ImplicitCastExpr(QualType ty, CastKind kind, Expr *op, - unsigned BasePathLength, ExprValueKind VK) - : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength) { } + unsigned BasePathLength, FPOptionsOverride FPO, + ExprValueKind VK) + : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, BasePathLength, + FPO.requiresTrailingStorage()) { + if (hasStoredFPFeatures()) + *getTrailingFPFeatures() = FPO; + } /// Construct an empty implicit cast. - explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize) - : CastExpr(ImplicitCastExprClass, Shell, PathSize) { } + explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize, + bool HasFPFeatures) + : CastExpr(ImplicitCastExprClass, Shell, PathSize, HasFPFeatures) {} + + unsigned numTrailingObjects(OverloadToken) const { + return path_size(); + } public: enum OnStack_t { OnStack }; ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op, - ExprValueKind VK) - : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0) { + ExprValueKind VK, FPOptionsOverride FPO) + : CastExpr(ImplicitCastExprClass, ty, VK, kind, op, 0, + FPO.requiresTrailingStorage()) { + if (hasStoredFPFeatures()) + *getTrailingFPFeatures() = FPO; } bool isPartOfExplicitCast() const { return CastExprBits.PartOfExplicitCast; } @@ -3508,10 +3580,10 @@ public: static ImplicitCastExpr *Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, - ExprValueKind Cat); + ExprValueKind Cat, FPOptionsOverride FPO); static ImplicitCastExpr *CreateEmpty(const ASTContext &Context, - unsigned PathSize); + unsigned PathSize, bool HasFPFeatures); SourceLocation getBeginLoc() const LLVM_READONLY { return getSubExpr()->getBeginLoc(); @@ -3552,12 +3624,14 @@ class ExplicitCastExpr : public CastExpr { protected: ExplicitCastExpr(StmtClass SC, QualType exprTy, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, - TypeSourceInfo *writtenTy) - : CastExpr(SC, exprTy, VK, kind, op, PathSize), TInfo(writtenTy) {} + bool HasFPFeatures, TypeSourceInfo *writtenTy) + : CastExpr(SC, exprTy, VK, kind, op, PathSize, HasFPFeatures), + TInfo(writtenTy) {} /// Construct an empty explicit cast. - ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize) - : CastExpr(SC, Shell, PathSize) { } + ExplicitCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize, + bool HasFPFeatures) + : CastExpr(SC, Shell, PathSize, HasFPFeatures) {} public: /// getTypeInfoAsWritten - Returns the type source info for the type @@ -3580,29 +3654,38 @@ public: /// (Type)expr. For example: @c (int)f. class CStyleCastExpr final : public ExplicitCastExpr, - private llvm::TrailingObjects { + private llvm::TrailingObjects { SourceLocation LPLoc; // the location of the left paren SourceLocation RPLoc; // the location of the right paren CStyleCastExpr(QualType exprTy, ExprValueKind vk, CastKind kind, Expr *op, - unsigned PathSize, TypeSourceInfo *writtenTy, - SourceLocation l, SourceLocation r) - : ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize, - writtenTy), LPLoc(l), RPLoc(r) {} + unsigned PathSize, FPOptionsOverride FPO, + TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation r) + : ExplicitCastExpr(CStyleCastExprClass, exprTy, vk, kind, op, PathSize, + FPO.requiresTrailingStorage(), writtenTy), + LPLoc(l), RPLoc(r) { + if (hasStoredFPFeatures()) + *getTrailingFPFeatures() = FPO; + } /// Construct an empty C-style explicit cast. - explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize) - : ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize) { } + explicit CStyleCastExpr(EmptyShell Shell, unsigned PathSize, + bool HasFPFeatures) + : ExplicitCastExpr(CStyleCastExprClass, Shell, PathSize, HasFPFeatures) {} + + unsigned numTrailingObjects(OverloadToken) const { + return path_size(); + } public: - static CStyleCastExpr *Create(const ASTContext &Context, QualType T, - ExprValueKind VK, CastKind K, - Expr *Op, const CXXCastPath *BasePath, - TypeSourceInfo *WrittenTy, SourceLocation L, - SourceLocation R); + static CStyleCastExpr * + Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, + Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO, + TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R); static CStyleCastExpr *CreateEmpty(const ASTContext &Context, - unsigned PathSize); + unsigned PathSize, bool HasFPFeatures); SourceLocation getLParenLoc() const { return LPLoc; } void setLParenLoc(SourceLocation L) { LPLoc = L; } @@ -4690,6 +4773,13 @@ public: setDependence(getDependence() | expr->getDependence()); } + /// Mark the semantic form of the InitListExpr as error when the semantic + /// analysis fails. + void markError() { + assert(isSemanticForm()); + setDependence(getDependence() | ExprDependence::ErrorDependent); + } + /// Reserve space for some number of initializers. void reserveInits(const ASTContext &C, unsigned NumInits); @@ -4904,10 +4994,10 @@ public: uintptr_t NameOrField; /// The location of the '.' in the designated initializer. - unsigned DotLoc; + SourceLocation DotLoc; /// The location of the field name in the designated initializer. - unsigned FieldLoc; + SourceLocation FieldLoc; }; /// An array or GNU array-range designator, e.g., "[9]" or "[10..15]". @@ -4916,12 +5006,12 @@ public: /// initializer expression's list of subexpressions. unsigned Index; /// The location of the '[' starting the array range designator. - unsigned LBracketLoc; + SourceLocation LBracketLoc; /// The location of the ellipsis separating the start and end /// indices. Only valid for GNU array-range designators. - unsigned EllipsisLoc; + SourceLocation EllipsisLoc; /// The location of the ']' terminating the array range designator. - unsigned RBracketLoc; + SourceLocation RBracketLoc; }; /// Represents a single C99 designator. @@ -4953,29 +5043,32 @@ public: Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc, SourceLocation FieldLoc) : Kind(FieldDesignator) { + new (&Field) DesignatedInitExpr::FieldDesignator; Field.NameOrField = reinterpret_cast(FieldName) | 0x01; - Field.DotLoc = DotLoc.getRawEncoding(); - Field.FieldLoc = FieldLoc.getRawEncoding(); + Field.DotLoc = DotLoc; + Field.FieldLoc = FieldLoc; } /// Initializes an array designator. Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation RBracketLoc) : Kind(ArrayDesignator) { + new (&ArrayOrRange) DesignatedInitExpr::ArrayOrRangeDesignator; ArrayOrRange.Index = Index; - ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding(); - ArrayOrRange.EllipsisLoc = SourceLocation().getRawEncoding(); - ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding(); + ArrayOrRange.LBracketLoc = LBracketLoc; + ArrayOrRange.EllipsisLoc = SourceLocation(); + ArrayOrRange.RBracketLoc = RBracketLoc; } /// Initializes a GNU array-range designator. Designator(unsigned Index, SourceLocation LBracketLoc, SourceLocation EllipsisLoc, SourceLocation RBracketLoc) : Kind(ArrayRangeDesignator) { + new (&ArrayOrRange) DesignatedInitExpr::ArrayOrRangeDesignator; ArrayOrRange.Index = Index; - ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding(); - ArrayOrRange.EllipsisLoc = EllipsisLoc.getRawEncoding(); - ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding(); + ArrayOrRange.LBracketLoc = LBracketLoc; + ArrayOrRange.EllipsisLoc = EllipsisLoc; + ArrayOrRange.RBracketLoc = RBracketLoc; } bool isFieldDesignator() const { return Kind == FieldDesignator; } @@ -4999,30 +5092,30 @@ public: SourceLocation getDotLoc() const { assert(Kind == FieldDesignator && "Only valid on a field designator"); - return SourceLocation::getFromRawEncoding(Field.DotLoc); + return Field.DotLoc; } SourceLocation getFieldLoc() const { assert(Kind == FieldDesignator && "Only valid on a field designator"); - return SourceLocation::getFromRawEncoding(Field.FieldLoc); + return Field.FieldLoc; } SourceLocation getLBracketLoc() const { assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) && "Only valid on an array or array-range designator"); - return SourceLocation::getFromRawEncoding(ArrayOrRange.LBracketLoc); + return ArrayOrRange.LBracketLoc; } SourceLocation getRBracketLoc() const { assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) && "Only valid on an array or array-range designator"); - return SourceLocation::getFromRawEncoding(ArrayOrRange.RBracketLoc); + return ArrayOrRange.RBracketLoc; } SourceLocation getEllipsisLoc() const { assert(Kind == ArrayRangeDesignator && "Only valid on an array-range designator"); - return SourceLocation::getFromRawEncoding(ArrayOrRange.EllipsisLoc); + return ArrayOrRange.EllipsisLoc; } unsigned getFirstExprIndex() const { @@ -6240,9 +6333,6 @@ public: /// /// One can also reliably suppress all bogus errors on expressions containing /// recovery expressions by examining results of Expr::containsErrors(). -/// -/// FIXME: RecoveryExpr is currently generated by default in C++ mode only, as -/// dependence isn't handled properly on several C-only codepaths. class RecoveryExpr final : public Expr, private llvm::TrailingObjects { public: diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index 6f0b68479b9..fbeeb4004f7 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -84,7 +84,6 @@ class CXXOperatorCallExpr final : public CallExpr { friend class ASTStmtWriter; SourceRange Range; - FPOptionsOverride Overrides; // CXXOperatorCallExpr has some trailing objects belonging // to CallExpr. See CallExpr for the details. @@ -96,7 +95,7 @@ class CXXOperatorCallExpr final : public CallExpr { SourceLocation OperatorLoc, FPOptionsOverride FPFeatures, ADLCallKind UsesADL); - CXXOperatorCallExpr(unsigned NumArgs, EmptyShell Empty); + CXXOperatorCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty); public: static CXXOperatorCallExpr * @@ -106,7 +105,8 @@ public: ADLCallKind UsesADL = NotADL); static CXXOperatorCallExpr *CreateEmpty(const ASTContext &Ctx, - unsigned NumArgs, EmptyShell Empty); + unsigned NumArgs, bool HasFPFeatures, + EmptyShell Empty); /// Returns the kind of overloaded operator that this expression refers to. OverloadedOperatorKind getOperator() const { @@ -164,11 +164,6 @@ public: static bool classof(const Stmt *T) { return T->getStmtClass() == CXXOperatorCallExprClass; } - - // Set the FPFeatures status of this operator. Only meaningful for - // operations on floating point types. - void setFPFeatures(FPOptionsOverride F) { Overrides = F; } - FPOptionsOverride getFPFeatures() const { return Overrides; } }; /// Represents a call to a member function that @@ -184,18 +179,20 @@ class CXXMemberCallExpr final : public CallExpr { // to CallExpr. See CallExpr for the details. CXXMemberCallExpr(Expr *Fn, ArrayRef Args, QualType Ty, - ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs); + ExprValueKind VK, SourceLocation RP, + FPOptionsOverride FPOptions, unsigned MinNumArgs); - CXXMemberCallExpr(unsigned NumArgs, EmptyShell Empty); + CXXMemberCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty); public: static CXXMemberCallExpr *Create(const ASTContext &Ctx, Expr *Fn, ArrayRef Args, QualType Ty, ExprValueKind VK, SourceLocation RP, + FPOptionsOverride FPFeatures, unsigned MinNumArgs = 0); static CXXMemberCallExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, - EmptyShell Empty); + bool HasFPFeatures, EmptyShell Empty); /// Retrieve the implicit object argument for the member call. /// @@ -242,18 +239,21 @@ class CUDAKernelCallExpr final : public CallExpr { CUDAKernelCallExpr(Expr *Fn, CallExpr *Config, ArrayRef Args, QualType Ty, ExprValueKind VK, SourceLocation RP, - unsigned MinNumArgs); + FPOptionsOverride FPFeatures, unsigned MinNumArgs); - CUDAKernelCallExpr(unsigned NumArgs, EmptyShell Empty); + CUDAKernelCallExpr(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty); public: static CUDAKernelCallExpr *Create(const ASTContext &Ctx, Expr *Fn, CallExpr *Config, ArrayRef Args, QualType Ty, ExprValueKind VK, - SourceLocation RP, unsigned MinNumArgs = 0); + SourceLocation RP, + FPOptionsOverride FPFeatures, + unsigned MinNumArgs = 0); static CUDAKernelCallExpr *CreateEmpty(const ASTContext &Ctx, - unsigned NumArgs, EmptyShell Empty); + unsigned NumArgs, bool HasFPFeatures, + EmptyShell Empty); const CallExpr *getConfig() const { return cast_or_null(getPreArg(CONFIG)); @@ -320,6 +320,16 @@ public: bool isReversed() const { return CXXRewrittenBinaryOperatorBits.IsReversed; } BinaryOperatorKind getOperator() const { return getDecomposedForm().Opcode; } + BinaryOperatorKind getOpcode() const { return getOperator(); } + static StringRef getOpcodeStr(BinaryOperatorKind Op) { + return BinaryOperator::getOpcodeStr(Op); + } + StringRef getOpcodeStr() const { + return BinaryOperator::getOpcodeStr(getOpcode()); + } + bool isComparisonOp() const { return true; } + bool isAssignmentOp() const { return false; } + const Expr *getLHS() const { return getDecomposedForm().LHS; } const Expr *getRHS() const { return getDecomposedForm().RHS; } @@ -374,16 +384,17 @@ private: protected: friend class ASTStmtReader; - CXXNamedCastExpr(StmtClass SC, QualType ty, ExprValueKind VK, - CastKind kind, Expr *op, unsigned PathSize, + CXXNamedCastExpr(StmtClass SC, QualType ty, ExprValueKind VK, CastKind kind, + Expr *op, unsigned PathSize, bool HasFPFeatures, TypeSourceInfo *writtenTy, SourceLocation l, - SourceLocation RParenLoc, - SourceRange AngleBrackets) - : ExplicitCastExpr(SC, ty, VK, kind, op, PathSize, writtenTy), Loc(l), - RParenLoc(RParenLoc), AngleBrackets(AngleBrackets) {} + SourceLocation RParenLoc, SourceRange AngleBrackets) + : ExplicitCastExpr(SC, ty, VK, kind, op, PathSize, HasFPFeatures, + writtenTy), + Loc(l), RParenLoc(RParenLoc), AngleBrackets(AngleBrackets) {} - explicit CXXNamedCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize) - : ExplicitCastExpr(SC, Shell, PathSize) {} + explicit CXXNamedCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize, + bool HasFPFeatures) + : ExplicitCastExpr(SC, Shell, PathSize, HasFPFeatures) {} public: const char *getCastName() const; @@ -419,29 +430,39 @@ public: /// \c static_cast(1.0). class CXXStaticCastExpr final : public CXXNamedCastExpr, - private llvm::TrailingObjects { + private llvm::TrailingObjects { CXXStaticCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op, unsigned pathSize, TypeSourceInfo *writtenTy, - SourceLocation l, SourceLocation RParenLoc, - SourceRange AngleBrackets) + FPOptionsOverride FPO, SourceLocation l, + SourceLocation RParenLoc, SourceRange AngleBrackets) : CXXNamedCastExpr(CXXStaticCastExprClass, ty, vk, kind, op, pathSize, - writtenTy, l, RParenLoc, AngleBrackets) {} + FPO.requiresTrailingStorage(), writtenTy, l, RParenLoc, + AngleBrackets) { + if (hasStoredFPFeatures()) + *getTrailingFPFeatures() = FPO; + } - explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize) - : CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize) {} + explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize, + bool HasFPFeatures) + : CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize, + HasFPFeatures) {} + + unsigned numTrailingObjects(OverloadToken) const { + return path_size(); + } public: friend class CastExpr; friend TrailingObjects; - static CXXStaticCastExpr *Create(const ASTContext &Context, QualType T, - ExprValueKind VK, CastKind K, Expr *Op, - const CXXCastPath *Path, - TypeSourceInfo *Written, SourceLocation L, - SourceLocation RParenLoc, - SourceRange AngleBrackets); + static CXXStaticCastExpr * + Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, + Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, + FPOptionsOverride FPO, SourceLocation L, SourceLocation RParenLoc, + SourceRange AngleBrackets); static CXXStaticCastExpr *CreateEmpty(const ASTContext &Context, - unsigned PathSize); + unsigned PathSize, bool hasFPFeatures); static bool classof(const Stmt *T) { return T->getStmtClass() == CXXStaticCastExprClass; @@ -456,15 +477,17 @@ public: class CXXDynamicCastExpr final : public CXXNamedCastExpr, private llvm::TrailingObjects { - CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind, - Expr *op, unsigned pathSize, TypeSourceInfo *writtenTy, + CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind, Expr *op, + unsigned pathSize, TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc, SourceRange AngleBrackets) : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, VK, kind, op, pathSize, - writtenTy, l, RParenLoc, AngleBrackets) {} + /*HasFPFeatures*/ false, writtenTy, l, RParenLoc, + AngleBrackets) {} explicit CXXDynamicCastExpr(EmptyShell Empty, unsigned pathSize) - : CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize) {} + : CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize, + /*HasFPFeatures*/ false) {} public: friend class CastExpr; @@ -499,16 +522,17 @@ class CXXReinterpretCastExpr final : public CXXNamedCastExpr, private llvm::TrailingObjects { - CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind, - Expr *op, unsigned pathSize, - TypeSourceInfo *writtenTy, SourceLocation l, - SourceLocation RParenLoc, + CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op, + unsigned pathSize, TypeSourceInfo *writtenTy, + SourceLocation l, SourceLocation RParenLoc, SourceRange AngleBrackets) : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, vk, kind, op, - pathSize, writtenTy, l, RParenLoc, AngleBrackets) {} + pathSize, /*HasFPFeatures*/ false, writtenTy, l, + RParenLoc, AngleBrackets) {} CXXReinterpretCastExpr(EmptyShell Empty, unsigned pathSize) - : CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize) {} + : CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize, + /*HasFPFeatures*/ false) {} public: friend class CastExpr; @@ -541,11 +565,13 @@ class CXXConstCastExpr final CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op, TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc, SourceRange AngleBrackets) - : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, - 0, writtenTy, l, RParenLoc, AngleBrackets) {} + : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, 0, + /*HasFPFeatures*/ false, writtenTy, l, RParenLoc, + AngleBrackets) {} explicit CXXConstCastExpr(EmptyShell Empty) - : CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0) {} + : CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0, + /*HasFPFeatures*/ false) {} public: friend class CastExpr; @@ -578,10 +604,12 @@ class CXXAddrspaceCastExpr final TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc, SourceRange AngleBrackets) : CXXNamedCastExpr(CXXAddrspaceCastExprClass, ty, VK, Kind, op, 0, - writtenTy, l, RParenLoc, AngleBrackets) {} + /*HasFPFeatures*/ false, writtenTy, l, RParenLoc, + AngleBrackets) {} explicit CXXAddrspaceCastExpr(EmptyShell Empty) - : CXXNamedCastExpr(CXXAddrspaceCastExprClass, Empty, 0) {} + : CXXNamedCastExpr(CXXAddrspaceCastExprClass, Empty, 0, + /*HasFPFeatures*/ false) {} public: friend class CastExpr; @@ -619,18 +647,20 @@ class UserDefinedLiteral final : public CallExpr { UserDefinedLiteral(Expr *Fn, ArrayRef Args, QualType Ty, ExprValueKind VK, SourceLocation LitEndLoc, - SourceLocation SuffixLoc); + SourceLocation SuffixLoc, FPOptionsOverride FPFeatures); - UserDefinedLiteral(unsigned NumArgs, EmptyShell Empty); + UserDefinedLiteral(unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty); public: static UserDefinedLiteral *Create(const ASTContext &Ctx, Expr *Fn, ArrayRef Args, QualType Ty, ExprValueKind VK, SourceLocation LitEndLoc, - SourceLocation SuffixLoc); + SourceLocation SuffixLoc, + FPOptionsOverride FPFeatures); static UserDefinedLiteral *CreateEmpty(const ASTContext &Ctx, - unsigned NumArgs, EmptyShell Empty); + unsigned NumArgs, bool HasFPOptions, + EmptyShell Empty); /// The kind of literal operator which is invoked. enum LiteralOperatorKind { @@ -838,6 +868,10 @@ public: /// evaluated, per C++11 [expr.typeid]p3. bool isPotentiallyEvaluated() const; + /// Best-effort check if the expression operand refers to a most derived + /// object. This is not a strong guarantee. + bool isMostDerived(ASTContext &Context) const; + bool isTypeOperand() const { return Operand.is(); } /// Retrieves the type operand of this typeid() expression after @@ -1691,34 +1725,43 @@ public: /// \endcode class CXXFunctionalCastExpr final : public ExplicitCastExpr, - private llvm::TrailingObjects { + private llvm::TrailingObjects { SourceLocation LParenLoc; SourceLocation RParenLoc; CXXFunctionalCastExpr(QualType ty, ExprValueKind VK, - TypeSourceInfo *writtenTy, - CastKind kind, Expr *castExpr, unsigned pathSize, - SourceLocation lParenLoc, SourceLocation rParenLoc) - : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, - castExpr, pathSize, writtenTy), - LParenLoc(lParenLoc), RParenLoc(rParenLoc) {} + TypeSourceInfo *writtenTy, CastKind kind, + Expr *castExpr, unsigned pathSize, + FPOptionsOverride FPO, SourceLocation lParenLoc, + SourceLocation rParenLoc) + : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, castExpr, + pathSize, FPO.requiresTrailingStorage(), writtenTy), + LParenLoc(lParenLoc), RParenLoc(rParenLoc) { + if (hasStoredFPFeatures()) + *getTrailingFPFeatures() = FPO; + } - explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize) - : ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize) {} + explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize, + bool HasFPFeatures) + : ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize, + HasFPFeatures) {} + + unsigned numTrailingObjects(OverloadToken) const { + return path_size(); + } public: friend class CastExpr; friend TrailingObjects; - static CXXFunctionalCastExpr *Create(const ASTContext &Context, QualType T, - ExprValueKind VK, - TypeSourceInfo *Written, - CastKind Kind, Expr *Op, - const CXXCastPath *Path, - SourceLocation LPLoc, - SourceLocation RPLoc); - static CXXFunctionalCastExpr *CreateEmpty(const ASTContext &Context, - unsigned PathSize); + static CXXFunctionalCastExpr * + Create(const ASTContext &Context, QualType T, ExprValueKind VK, + TypeSourceInfo *Written, CastKind Kind, Expr *Op, + const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc, + SourceLocation RPLoc); + static CXXFunctionalCastExpr * + CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures); SourceLocation getLParenLoc() const { return LParenLoc; } void setLParenLoc(SourceLocation L) { LParenLoc = L; } @@ -1996,6 +2039,9 @@ public: /// invented by use of an auto parameter). ArrayRef getExplicitTemplateParameters() const; + /// Get the trailing requires clause, if any. + Expr *getTrailingRequiresClause() const; + /// Whether this is a generic lambda. bool isGenericLambda() const { return getTemplateParameterList(); } @@ -3394,17 +3440,18 @@ class CXXUnresolvedConstructExpr final /// The location of the right parentheses (')'). SourceLocation RParenLoc; - CXXUnresolvedConstructExpr(TypeSourceInfo *TSI, SourceLocation LParenLoc, - ArrayRef Args, SourceLocation RParenLoc); + CXXUnresolvedConstructExpr(QualType T, TypeSourceInfo *TSI, + SourceLocation LParenLoc, ArrayRef Args, + SourceLocation RParenLoc); CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs) - : Expr(CXXUnresolvedConstructExprClass, Empty) { + : Expr(CXXUnresolvedConstructExprClass, Empty), TSI(nullptr) { CXXUnresolvedConstructExprBits.NumArgs = NumArgs; } public: static CXXUnresolvedConstructExpr *Create(const ASTContext &Context, - TypeSourceInfo *Type, + QualType T, TypeSourceInfo *TSI, SourceLocation LParenLoc, ArrayRef Args, SourceLocation RParenLoc); @@ -3436,43 +3483,43 @@ public: bool isListInitialization() const { return LParenLoc.isInvalid(); } /// Retrieve the number of arguments. - unsigned arg_size() const { return CXXUnresolvedConstructExprBits.NumArgs; } + unsigned getNumArgs() const { return CXXUnresolvedConstructExprBits.NumArgs; } using arg_iterator = Expr **; using arg_range = llvm::iterator_range; arg_iterator arg_begin() { return getTrailingObjects(); } - arg_iterator arg_end() { return arg_begin() + arg_size(); } + arg_iterator arg_end() { return arg_begin() + getNumArgs(); } arg_range arguments() { return arg_range(arg_begin(), arg_end()); } using const_arg_iterator = const Expr* const *; using const_arg_range = llvm::iterator_range; const_arg_iterator arg_begin() const { return getTrailingObjects(); } - const_arg_iterator arg_end() const { return arg_begin() + arg_size(); } + const_arg_iterator arg_end() const { return arg_begin() + getNumArgs(); } const_arg_range arguments() const { return const_arg_range(arg_begin(), arg_end()); } Expr *getArg(unsigned I) { - assert(I < arg_size() && "Argument index out-of-range"); + assert(I < getNumArgs() && "Argument index out-of-range"); return arg_begin()[I]; } const Expr *getArg(unsigned I) const { - assert(I < arg_size() && "Argument index out-of-range"); + assert(I < getNumArgs() && "Argument index out-of-range"); return arg_begin()[I]; } void setArg(unsigned I, Expr *E) { - assert(I < arg_size() && "Argument index out-of-range"); + assert(I < getNumArgs() && "Argument index out-of-range"); arg_begin()[I] = E; } SourceLocation getBeginLoc() const LLVM_READONLY; SourceLocation getEndLoc() const LLVM_READONLY { - if (!RParenLoc.isValid() && arg_size() > 0) - return getArg(arg_size() - 1)->getEndLoc(); + if (!RParenLoc.isValid() && getNumArgs() > 0) + return getArg(getNumArgs() - 1)->getEndLoc(); return RParenLoc; } @@ -3483,13 +3530,13 @@ public: // Iterators child_range children() { auto **begin = reinterpret_cast(arg_begin()); - return child_range(begin, begin + arg_size()); + return child_range(begin, begin + getNumArgs()); } const_child_range children() const { auto **begin = reinterpret_cast( const_cast(this)->arg_begin()); - return const_child_range(begin, begin + arg_size()); + return const_child_range(begin, begin + getNumArgs()); } }; @@ -4199,8 +4246,10 @@ class SubstNonTypeTemplateParmExpr : public Expr { friend class ASTReader; friend class ASTStmtReader; - /// The replaced parameter. - NonTypeTemplateParmDecl *Param; + /// The replaced parameter and a flag indicating if it was a reference + /// parameter. For class NTTPs, we can't determine that based on the value + /// category alone. + llvm::PointerIntPair ParamAndRef; /// The replacement expression. Stmt *Replacement; @@ -4211,10 +4260,10 @@ class SubstNonTypeTemplateParmExpr : public Expr { public: SubstNonTypeTemplateParmExpr(QualType Ty, ExprValueKind ValueKind, SourceLocation Loc, - NonTypeTemplateParmDecl *Param, + NonTypeTemplateParmDecl *Param, bool RefParam, Expr *Replacement) : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary), - Param(Param), Replacement(Replacement) { + ParamAndRef(Param, RefParam), Replacement(Replacement) { SubstNonTypeTemplateParmExprBits.NameLoc = Loc; setDependence(computeDependence(this)); } @@ -4227,7 +4276,14 @@ public: Expr *getReplacement() const { return cast(Replacement); } - NonTypeTemplateParmDecl *getParameter() const { return Param; } + NonTypeTemplateParmDecl *getParameter() const { + return ParamAndRef.getPointer(); + } + + bool isReferenceParameter() const { return ParamAndRef.getInt(); } + + /// Determine the substituted type of the template parameter. + QualType getParameterType(const ASTContext &Ctx) const; static bool classof(const Stmt *s) { return s->getStmtClass() == SubstNonTypeTemplateParmExprClass; @@ -4476,6 +4532,10 @@ public: return getValueKind() == VK_LValue; } + /// Determine whether this temporary object is usable in constant + /// expressions, as specified in C++20 [expr.const]p4. + bool isUsableInConstantExpressions(const ASTContext &Context) const; + SourceLocation getBeginLoc() const LLVM_READONLY { return getSubExpr()->getBeginLoc(); } @@ -4517,31 +4577,38 @@ class CXXFoldExpr : public Expr { friend class ASTStmtReader; friend class ASTStmtWriter; + enum SubExpr { Callee, LHS, RHS, Count }; + SourceLocation LParenLoc; SourceLocation EllipsisLoc; SourceLocation RParenLoc; // When 0, the number of expansions is not known. Otherwise, this is one more // than the number of expansions. unsigned NumExpansions; - Stmt *SubExprs[2]; + Stmt *SubExprs[SubExpr::Count]; BinaryOperatorKind Opcode; public: - CXXFoldExpr(QualType T, SourceLocation LParenLoc, Expr *LHS, - BinaryOperatorKind Opcode, SourceLocation EllipsisLoc, Expr *RHS, - SourceLocation RParenLoc, Optional NumExpansions) + CXXFoldExpr(QualType T, UnresolvedLookupExpr *Callee, + SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Opcode, + SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, + Optional NumExpansions) : Expr(CXXFoldExprClass, T, VK_RValue, OK_Ordinary), LParenLoc(LParenLoc), EllipsisLoc(EllipsisLoc), RParenLoc(RParenLoc), NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), Opcode(Opcode) { - SubExprs[0] = LHS; - SubExprs[1] = RHS; + SubExprs[SubExpr::Callee] = Callee; + SubExprs[SubExpr::LHS] = LHS; + SubExprs[SubExpr::RHS] = RHS; setDependence(computeDependence(this)); } CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {} - Expr *getLHS() const { return static_cast(SubExprs[0]); } - Expr *getRHS() const { return static_cast(SubExprs[1]); } + UnresolvedLookupExpr *getCallee() const { + return static_cast(SubExprs[SubExpr::Callee]); + } + Expr *getLHS() const { return static_cast(SubExprs[SubExpr::LHS]); } + Expr *getRHS() const { return static_cast(SubExprs[SubExpr::RHS]); } /// Does this produce a right-associated sequence of operators? bool isRightFold() const { @@ -4557,6 +4624,8 @@ public: /// Get the operand that doesn't contain a pack, for a binary fold. Expr *getInit() const { return isLeftFold() ? getLHS() : getRHS(); } + SourceLocation getLParenLoc() const { return LParenLoc; } + SourceLocation getRParenLoc() const { return RParenLoc; } SourceLocation getEllipsisLoc() const { return EllipsisLoc; } BinaryOperatorKind getOperator() const { return Opcode; } @@ -4566,19 +4635,33 @@ public: return None; } - SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; } + SourceLocation getBeginLoc() const LLVM_READONLY { + if (LParenLoc.isValid()) + return LParenLoc; + if (isLeftFold()) + return getEllipsisLoc(); + return getLHS()->getBeginLoc(); + } - SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } + SourceLocation getEndLoc() const LLVM_READONLY { + if (RParenLoc.isValid()) + return RParenLoc; + if (isRightFold()) + return getEllipsisLoc(); + return getRHS()->getEndLoc(); + } static bool classof(const Stmt *T) { return T->getStmtClass() == CXXFoldExprClass; } // Iterators - child_range children() { return child_range(SubExprs, SubExprs + 2); } + child_range children() { + return child_range(SubExprs, SubExprs + SubExpr::Count); + } const_child_range children() const { - return const_child_range(SubExprs, SubExprs + 2); + return const_child_range(SubExprs, SubExprs + SubExpr::Count); } }; @@ -4796,7 +4879,7 @@ class BuiltinBitCastExpr final private llvm::TrailingObjects { friend class ASTStmtReader; friend class CastExpr; - friend class TrailingObjects; + friend TrailingObjects; SourceLocation KWLoc; SourceLocation RParenLoc; @@ -4805,11 +4888,11 @@ public: BuiltinBitCastExpr(QualType T, ExprValueKind VK, CastKind CK, Expr *SrcExpr, TypeSourceInfo *DstType, SourceLocation KWLoc, SourceLocation RParenLoc) - : ExplicitCastExpr(BuiltinBitCastExprClass, T, VK, CK, SrcExpr, 0, + : ExplicitCastExpr(BuiltinBitCastExprClass, T, VK, CK, SrcExpr, 0, false, DstType), KWLoc(KWLoc), RParenLoc(RParenLoc) {} BuiltinBitCastExpr(EmptyShell Empty) - : ExplicitCastExpr(BuiltinBitCastExprClass, Empty, 0) {} + : ExplicitCastExpr(BuiltinBitCastExprClass, Empty, 0, false) {} SourceLocation getBeginLoc() const LLVM_READONLY { return KWLoc; } SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } diff --git a/clang/include/clang/AST/ExprConcepts.h b/clang/include/clang/AST/ExprConcepts.h index 2a88ed5175d..1544c498ef6 100644 --- a/clang/include/clang/AST/ExprConcepts.h +++ b/clang/include/clang/AST/ExprConcepts.h @@ -126,7 +126,11 @@ public: } SourceLocation getEndLoc() const LLVM_READONLY { - return ArgsAsWritten->RAngleLoc; + // If the ConceptSpecializationExpr is the ImmediatelyDeclaredConstraint + // of a TypeConstraint written syntactically as a constrained-parameter, + // there may not be a template argument list. + return ArgsAsWritten->RAngleLoc.isValid() ? ArgsAsWritten->RAngleLoc + : ConceptName.getEndLoc(); } // Iterators diff --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h index 4b39d9ab96a..17eec517269 100644 --- a/clang/include/clang/AST/ExprObjC.h +++ b/clang/include/clang/AST/ExprObjC.h @@ -1639,12 +1639,12 @@ public: CastKind CK, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *Operand) : ExplicitCastExpr(ObjCBridgedCastExprClass, TSInfo->getType(), VK_RValue, - CK, Operand, 0, TSInfo), + CK, Operand, 0, false, TSInfo), LParenLoc(LParenLoc), BridgeKeywordLoc(BridgeKeywordLoc), Kind(Kind) {} /// Construct an empty Objective-C bridged cast. explicit ObjCBridgedCastExpr(EmptyShell Shell) - : ExplicitCastExpr(ObjCBridgedCastExprClass, Shell, 0) {} + : ExplicitCastExpr(ObjCBridgedCastExprClass, Shell, 0, false) {} SourceLocation getLParenLoc() const { return LParenLoc; } diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h index def877b9181..caae0770931 100644 --- a/clang/include/clang/AST/ExternalASTSource.h +++ b/clang/include/clang/AST/ExternalASTSource.h @@ -161,10 +161,6 @@ public: /// Retrieve the module that corresponds to the given module ID. virtual Module *getModule(unsigned ID) { return nullptr; } - /// Determine whether D comes from a PCH which was built with a corresponding - /// object file. - virtual bool DeclIsFromPCHWithObjectFile(const Decl *D) { return false; } - /// Return a descriptor for the corresponding module, if one exists. virtual llvm::Optional getSourceDescriptor(unsigned ID); diff --git a/clang/include/clang/AST/GlobalDecl.h b/clang/include/clang/AST/GlobalDecl.h index d8ac498be54..8cb56fb4ae9 100644 --- a/clang/include/clang/AST/GlobalDecl.h +++ b/clang/include/clang/AST/GlobalDecl.h @@ -32,6 +32,7 @@ enum class DynamicInitKind : unsigned { NoStub = 0, Initializer, AtExit, + GlobalArrayDestructor }; enum class KernelReferenceKind : unsigned { diff --git a/clang/include/clang/AST/IgnoreExpr.h b/clang/include/clang/AST/IgnoreExpr.h new file mode 100644 index 00000000000..1c2b538e5b6 --- /dev/null +++ b/clang/include/clang/AST/IgnoreExpr.h @@ -0,0 +1,161 @@ +//===--- IgnoreExpr.h - Ignore intermediate Expressions -----------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines common functions to ignore intermediate expression nodes +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_IGNOREEXPR_H +#define LLVM_CLANG_AST_IGNOREEXPR_H + +#include "clang/AST/Expr.h" +#include "clang/AST/ExprCXX.h" + +namespace clang { +namespace detail { +/// Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *, +/// Return Fn_n(...(Fn_1(E))) +inline Expr *IgnoreExprNodesImpl(Expr *E) { return E; } +template +Expr *IgnoreExprNodesImpl(Expr *E, FnTy &&Fn, FnTys &&... Fns) { + return IgnoreExprNodesImpl(Fn(E), std::forward(Fns)...); +} +} // namespace detail + +/// Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *, +/// Recursively apply each of the functions to E until reaching a fixed point. +/// Note that a null E is valid; in this case nothing is done. +template Expr *IgnoreExprNodes(Expr *E, FnTys &&... Fns) { + Expr *LastE = nullptr; + while (E != LastE) { + LastE = E; + E = detail::IgnoreExprNodesImpl(E, std::forward(Fns)...); + } + return E; +} + +template +const Expr *IgnoreExprNodes(const Expr *E, FnTys &&...Fns) { + return const_cast(IgnoreExprNodes(E, std::forward(Fns)...)); +} + +inline Expr *IgnoreImplicitCastsSingleStep(Expr *E) { + if (auto *ICE = dyn_cast(E)) + return ICE->getSubExpr(); + + if (auto *FE = dyn_cast(E)) + return FE->getSubExpr(); + + return E; +} + +inline Expr *IgnoreImplicitCastsExtraSingleStep(Expr *E) { + // FIXME: Skip MaterializeTemporaryExpr and SubstNonTypeTemplateParmExpr in + // addition to what IgnoreImpCasts() skips to account for the current + // behaviour of IgnoreParenImpCasts(). + Expr *SubE = IgnoreImplicitCastsSingleStep(E); + if (SubE != E) + return SubE; + + if (auto *MTE = dyn_cast(E)) + return MTE->getSubExpr(); + + if (auto *NTTP = dyn_cast(E)) + return NTTP->getReplacement(); + + return E; +} + +inline Expr *IgnoreCastsSingleStep(Expr *E) { + if (auto *CE = dyn_cast(E)) + return CE->getSubExpr(); + + if (auto *FE = dyn_cast(E)) + return FE->getSubExpr(); + + if (auto *MTE = dyn_cast(E)) + return MTE->getSubExpr(); + + if (auto *NTTP = dyn_cast(E)) + return NTTP->getReplacement(); + + return E; +} + +inline Expr *IgnoreLValueCastsSingleStep(Expr *E) { + // Skip what IgnoreCastsSingleStep skips, except that only + // lvalue-to-rvalue casts are skipped. + if (auto *CE = dyn_cast(E)) + if (CE->getCastKind() != CK_LValueToRValue) + return E; + + return IgnoreCastsSingleStep(E); +} + +inline Expr *IgnoreBaseCastsSingleStep(Expr *E) { + if (auto *CE = dyn_cast(E)) + if (CE->getCastKind() == CK_DerivedToBase || + CE->getCastKind() == CK_UncheckedDerivedToBase || + CE->getCastKind() == CK_NoOp) + return CE->getSubExpr(); + + return E; +} + +inline Expr *IgnoreImplicitSingleStep(Expr *E) { + Expr *SubE = IgnoreImplicitCastsSingleStep(E); + if (SubE != E) + return SubE; + + if (auto *MTE = dyn_cast(E)) + return MTE->getSubExpr(); + + if (auto *BTE = dyn_cast(E)) + return BTE->getSubExpr(); + + return E; +} + +inline Expr *IgnoreImplicitAsWrittenSingleStep(Expr *E) { + if (auto *ICE = dyn_cast(E)) + return ICE->getSubExprAsWritten(); + + return IgnoreImplicitSingleStep(E); +} + +inline Expr *IgnoreParensOnlySingleStep(Expr *E) { + if (auto *PE = dyn_cast(E)) + return PE->getSubExpr(); + return E; +} + +inline Expr *IgnoreParensSingleStep(Expr *E) { + if (auto *PE = dyn_cast(E)) + return PE->getSubExpr(); + + if (auto *UO = dyn_cast(E)) { + if (UO->getOpcode() == UO_Extension) + return UO->getSubExpr(); + } + + else if (auto *GSE = dyn_cast(E)) { + if (!GSE->isResultDependent()) + return GSE->getResultExpr(); + } + + else if (auto *CE = dyn_cast(E)) { + if (!CE->isConditionDependent()) + return CE->getChosenSubExpr(); + } + + return E; +} + +} // namespace clang + +#endif // LLVM_CLANG_AST_IGNOREEXPR_H diff --git a/clang/include/clang/AST/Mangle.h b/clang/include/clang/AST/Mangle.h index 011d1faab8e..0e8d6dd53d8 100644 --- a/clang/include/clang/AST/Mangle.h +++ b/clang/include/clang/AST/Mangle.h @@ -123,8 +123,11 @@ public: void mangleBlock(const DeclContext *DC, const BlockDecl *BD, raw_ostream &Out); - void mangleObjCMethodNameWithoutSize(const ObjCMethodDecl *MD, raw_ostream &); - void mangleObjCMethodName(const ObjCMethodDecl *MD, raw_ostream &); + void mangleObjCMethodName(const ObjCMethodDecl *MD, raw_ostream &OS, + bool includePrefixByte = true, + bool includeCategoryNamespace = true); + void mangleObjCMethodNameAsSourceName(const ObjCMethodDecl *MD, + raw_ostream &); virtual void mangleStaticGuardVariable(const VarDecl *D, raw_ostream &) = 0; @@ -149,14 +152,9 @@ public: }; class ItaniumMangleContext : public MangleContext { - bool IsUniqueNameMangler = false; public: explicit ItaniumMangleContext(ASTContext &C, DiagnosticsEngine &D) : MangleContext(C, D, MK_Itanium) {} - explicit ItaniumMangleContext(ASTContext &C, DiagnosticsEngine &D, - bool IsUniqueNameMangler) - : MangleContext(C, D, MK_Itanium), - IsUniqueNameMangler(IsUniqueNameMangler) {} virtual void mangleCXXVTable(const CXXRecordDecl *RD, raw_ostream &) = 0; virtual void mangleCXXVTT(const CXXRecordDecl *RD, raw_ostream &) = 0; @@ -177,15 +175,12 @@ public: virtual void mangleDynamicStermFinalizer(const VarDecl *D, raw_ostream &) = 0; - bool isUniqueNameMangler() { return IsUniqueNameMangler; } - static bool classof(const MangleContext *C) { return C->getKind() == MK_Itanium; } static ItaniumMangleContext *create(ASTContext &Context, - DiagnosticsEngine &Diags, - bool IsUniqueNameMangler = false); + DiagnosticsEngine &Diags); }; class MicrosoftMangleContext : public MangleContext { diff --git a/clang/include/clang/AST/NestedNameSpecifier.h b/clang/include/clang/AST/NestedNameSpecifier.h index 540ac3df48f..8bc3e25c0f4 100644 --- a/clang/include/clang/AST/NestedNameSpecifier.h +++ b/clang/include/clang/AST/NestedNameSpecifier.h @@ -17,6 +17,7 @@ #include "clang/AST/DependenceFlags.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/Support/Compiler.h" @@ -518,8 +519,8 @@ public: /// Insertion operator for diagnostics. This allows sending /// NestedNameSpecifiers into a diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - NestedNameSpecifier *NNS) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + NestedNameSpecifier *NNS) { DB.AddTaggedVal(reinterpret_cast(NNS), DiagnosticsEngine::ak_nestednamespec); return DB; @@ -527,4 +528,33 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, } // namespace clang +namespace llvm { + +template <> struct DenseMapInfo { + using FirstInfo = DenseMapInfo; + using SecondInfo = DenseMapInfo; + + static clang::NestedNameSpecifierLoc getEmptyKey() { + return clang::NestedNameSpecifierLoc(FirstInfo::getEmptyKey(), + SecondInfo::getEmptyKey()); + } + + static clang::NestedNameSpecifierLoc getTombstoneKey() { + return clang::NestedNameSpecifierLoc(FirstInfo::getTombstoneKey(), + SecondInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const clang::NestedNameSpecifierLoc &PairVal) { + return hash_combine( + FirstInfo::getHashValue(PairVal.getNestedNameSpecifier()), + SecondInfo::getHashValue(PairVal.getOpaqueData())); + } + + static bool isEqual(const clang::NestedNameSpecifierLoc &LHS, + const clang::NestedNameSpecifierLoc &RHS) { + return LHS == RHS; + } +}; +} // namespace llvm + #endif // LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index 6de7b6deb51..877c1d87d8a 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -16,6 +16,7 @@ #ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H #define LLVM_CLANG_AST_OPENMPCLAUSE_H +#include "clang/AST/ASTFwd.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/Expr.h" @@ -27,6 +28,7 @@ #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/MapVector.h" +#include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" @@ -4737,8 +4739,9 @@ public: /// subscript it may not have any associated declaration. In that case the /// associated declaration is set to nullptr. class MappableComponent { - /// Expression associated with the component. - Expr *AssociatedExpression = nullptr; + /// Pair of Expression and Non-contiguous pair associated with the + /// component. + llvm::PointerIntPair AssociatedExpressionNonContiguousPr; /// Declaration associated with the declaration. If the component does /// not have a declaration (e.g. array subscripts or section), this is set @@ -4748,14 +4751,22 @@ public: public: explicit MappableComponent() = default; explicit MappableComponent(Expr *AssociatedExpression, - ValueDecl *AssociatedDeclaration) - : AssociatedExpression(AssociatedExpression), + ValueDecl *AssociatedDeclaration, + bool IsNonContiguous) + : AssociatedExpressionNonContiguousPr(AssociatedExpression, + IsNonContiguous), AssociatedDeclaration( AssociatedDeclaration ? cast(AssociatedDeclaration->getCanonicalDecl()) : nullptr) {} - Expr *getAssociatedExpression() const { return AssociatedExpression; } + Expr *getAssociatedExpression() const { + return AssociatedExpressionNonContiguousPr.getPointer(); + } + + bool isNonContiguous() const { + return AssociatedExpressionNonContiguousPr.getInt(); + } ValueDecl *getAssociatedDeclaration() const { return AssociatedDeclaration; @@ -4820,6 +4831,11 @@ class OMPMappableExprListClause : public OMPVarListClause, /// Total number of components in this clause. unsigned NumComponents; + /// Whether this clause is possible to have user-defined mappers associated. + /// It should be true for map, to, and from clauses, and false for + /// use_device_ptr and is_device_ptr. + const bool SupportsMapper; + /// C++ nested name specifier for the associated user-defined mapper. NestedNameSpecifierLoc MapperQualifierLoc; @@ -4840,19 +4856,21 @@ protected: /// NumUniqueDeclarations: number of unique base declarations in this clause; /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. + /// \param SupportsMapper Indicates whether this clause is possible to have + /// user-defined mappers associated. /// \param MapperQualifierLocPtr C++ nested name specifier for the associated /// user-defined mapper. /// \param MapperIdInfoPtr The identifier of associated user-defined mapper. OMPMappableExprListClause( OpenMPClauseKind K, const OMPVarListLocTy &Locs, - const OMPMappableExprListSizeTy &Sizes, + const OMPMappableExprListSizeTy &Sizes, bool SupportsMapper = false, NestedNameSpecifierLoc *MapperQualifierLocPtr = nullptr, DeclarationNameInfo *MapperIdInfoPtr = nullptr) : OMPVarListClause(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc, Sizes.NumVars), NumUniqueDeclarations(Sizes.NumUniqueDeclarations), NumComponentLists(Sizes.NumComponentLists), - NumComponents(Sizes.NumComponents) { + NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) { if (MapperQualifierLocPtr) MapperQualifierLoc = *MapperQualifierLocPtr; if (MapperIdInfoPtr) @@ -5051,6 +5069,8 @@ protected: /// Get the user-defined mapper references that are in the trailing objects of /// the class. MutableArrayRef getUDMapperRefs() { + assert(SupportsMapper && + "Must be a clause that is possible to have user-defined mappers"); return llvm::makeMutableArrayRef( static_cast(this)->template getTrailingObjects() + OMPVarListClause::varlist_size(), @@ -5060,8 +5080,10 @@ protected: /// Get the user-defined mappers references that are in the trailing objects /// of the class. ArrayRef getUDMapperRefs() const { + assert(SupportsMapper && + "Must be a clause that is possible to have user-defined mappers"); return llvm::makeArrayRef( - static_cast(this)->template getTrailingObjects() + + static_cast(this)->template getTrailingObjects() + OMPVarListClause::varlist_size(), OMPVarListClause::varlist_size()); } @@ -5071,6 +5093,8 @@ protected: void setUDMapperRefs(ArrayRef DMDs) { assert(DMDs.size() == OMPVarListClause::varlist_size() && "Unexpected number of user-defined mappers."); + assert(SupportsMapper && + "Must be a clause that is possible to have user-defined mappers"); std::copy(DMDs.begin(), DMDs.end(), getUDMapperRefs().begin()); } @@ -5107,6 +5131,12 @@ public: // The list number associated with the current declaration. ArrayRef::iterator NumListsCur; + // Whether this clause is possible to have user-defined mappers associated. + const bool SupportsMapper; + + // The user-defined mapper associated with the current declaration. + ArrayRef::iterator MapperCur; + // Remaining lists for the current declaration. unsigned RemainingLists = 0; @@ -5127,16 +5157,20 @@ public: explicit const_component_lists_iterator( ArrayRef UniqueDecls, ArrayRef DeclsListNum, ArrayRef CumulativeListSizes, - MappableExprComponentListRef Components) + MappableExprComponentListRef Components, bool SupportsMapper, + ArrayRef Mappers) : const_component_lists_iterator::iterator_adaptor_base( Components.begin()), DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()), + SupportsMapper(SupportsMapper), ListSizeCur(CumulativeListSizes.begin()), ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) { assert(UniqueDecls.size() == DeclsListNum.size() && "Inconsistent number of declarations and list sizes!"); if (!DeclsListNum.empty()) RemainingLists = *NumListsCur; + if (SupportsMapper) + MapperCur = Mappers.begin(); } /// Construct an iterator that scan lists for a given declaration \a @@ -5144,9 +5178,11 @@ public: explicit const_component_lists_iterator( const ValueDecl *Declaration, ArrayRef UniqueDecls, ArrayRef DeclsListNum, ArrayRef CumulativeListSizes, - MappableExprComponentListRef Components) + MappableExprComponentListRef Components, bool SupportsMapper, + ArrayRef Mappers) : const_component_lists_iterator(UniqueDecls, DeclsListNum, - CumulativeListSizes, Components) { + CumulativeListSizes, Components, + SupportsMapper, Mappers) { // Look for the desired declaration. While we are looking for it, we // update the state so that we know the component where a given list // starts. @@ -5161,6 +5197,9 @@ public: std::advance(ListSizeCur, *NumListsCur - 1); PrevListSize = *ListSizeCur; ++ListSizeCur; + + if (SupportsMapper) + ++MapperCur; } // If we didn't find any declaration, advance the iterator to after the @@ -5186,14 +5225,20 @@ public: // Return the array with the current list. The sizes are cumulative, so the // array size is the difference between the current size and previous one. - std::pair + std::tuple operator*() const { assert(ListSizeCur != ListSizeEnd && "Invalid iterator!"); - return std::make_pair( + const ValueDecl *Mapper = nullptr; + if (SupportsMapper && *MapperCur) + Mapper = cast(cast(*MapperCur)->getDecl()); + return std::make_tuple( *DeclCur, - MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize)); + MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize), + Mapper); } - std::pair + std::tuple operator->() const { return **this; } @@ -5216,6 +5261,8 @@ public: if (!(--RemainingLists)) { ++DeclCur; ++NumListsCur; + if (SupportsMapper) + ++MapperCur; RemainingLists = *NumListsCur; assert(RemainingLists && "No lists in the following declaration??"); } @@ -5233,13 +5280,15 @@ public: const_component_lists_iterator component_lists_begin() const { return const_component_lists_iterator( getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(), - getComponentsRef()); + getComponentsRef(), SupportsMapper, + SupportsMapper ? getUDMapperRefs() : llvm::None); } const_component_lists_iterator component_lists_end() const { return const_component_lists_iterator( ArrayRef(), ArrayRef(), ArrayRef(), MappableExprComponentListRef(getComponentsRef().end(), - getComponentsRef().end())); + getComponentsRef().end()), + SupportsMapper, llvm::None); } const_component_lists_range component_lists() const { return {component_lists_begin(), component_lists_end()}; @@ -5251,7 +5300,8 @@ public: decl_component_lists_begin(const ValueDecl *VD) const { return const_component_lists_iterator( VD, getUniqueDeclsRef(), getDeclNumListsRef(), - getComponentListSizesRef(), getComponentsRef()); + getComponentListSizesRef(), getComponentsRef(), SupportsMapper, + SupportsMapper ? getUDMapperRefs() : llvm::None); } const_component_lists_iterator decl_component_lists_end() const { return component_lists_end(); @@ -5354,7 +5404,7 @@ private: /// Map-type-modifiers for the 'map' clause. OpenMPMapModifierKind MapTypeModifiers[NumberOfOMPMapClauseModifiers] = { OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown, - OMPC_MAP_MODIFIER_unknown}; + OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown}; /// Location of map-type-modifiers for the 'map' clause. SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers]; @@ -5399,7 +5449,8 @@ private: SourceLocation MapLoc, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes, - &MapperQualifierLoc, &MapperIdInfo), + /*SupportsMapper=*/true, &MapperQualifierLoc, + &MapperIdInfo), MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) { assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() && "Unexpected number of map type modifiers."); @@ -5419,8 +5470,8 @@ private: /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), - Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes, + /*SupportsMapper=*/true) {} /// Set map-type-modifier for the clause. /// @@ -6289,8 +6340,20 @@ class OMPToClause final : public OMPMappableExprListClause, friend OMPVarListClause; friend TrailingObjects; + /// Motion-modifiers for the 'to' clause. + OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = { + OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown}; + + /// Location of motion-modifiers for the 'to' clause. + SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers]; + + /// Colon location. + SourceLocation ColonLoc; + /// Build clause with number of variables \a NumVars. /// + /// \param TheMotionModifiers Motion-modifiers. + /// \param TheMotionModifiersLoc Locations of motion-modifiers. /// \param MapperQualifierLoc C++ nested name specifier for the associated /// user-defined mapper. /// \param MapperIdInfo The identifier of associated user-defined mapper. @@ -6302,12 +6365,24 @@ class OMPToClause final : public OMPMappableExprListClause, /// NumUniqueDeclarations: number of unique base declarations in this clause; /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. - explicit OMPToClause(NestedNameSpecifierLoc MapperQualifierLoc, + explicit OMPToClause(ArrayRef TheMotionModifiers, + ArrayRef TheMotionModifiersLoc, + NestedNameSpecifierLoc MapperQualifierLoc, DeclarationNameInfo MapperIdInfo, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) : OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes, - &MapperQualifierLoc, &MapperIdInfo) {} + /*SupportsMapper=*/true, &MapperQualifierLoc, + &MapperIdInfo) { + assert(llvm::array_lengthof(MotionModifiers) == TheMotionModifiers.size() && + "Unexpected number of motion modifiers."); + llvm::copy(TheMotionModifiers, std::begin(MotionModifiers)); + + assert(llvm::array_lengthof(MotionModifiersLoc) == + TheMotionModifiersLoc.size() && + "Unexpected number of motion modifier locations."); + llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc)); + } /// Build an empty clause. /// @@ -6317,8 +6392,31 @@ class OMPToClause final : public OMPMappableExprListClause, /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), - Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes, + /*SupportsMapper=*/true) {} + + /// Set motion-modifier for the clause. + /// + /// \param I index for motion-modifier. + /// \param T motion-modifier for the clause. + void setMotionModifier(unsigned I, OpenMPMotionModifierKind T) { + assert(I < NumberOfOMPMotionModifiers && + "Unexpected index to store motion modifier, exceeds array size."); + MotionModifiers[I] = T; + } + + /// Set location for the motion-modifier. + /// + /// \param I index for motion-modifier location. + /// \param TLoc motion-modifier location. + void setMotionModifierLoc(unsigned I, SourceLocation TLoc) { + assert(I < NumberOfOMPMotionModifiers && + "Index to store motion modifier location exceeds array size."); + MotionModifiersLoc[I] = TLoc; + } + + /// Set colon location. + void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6344,6 +6442,8 @@ public: /// \param Vars The original expression used in the clause. /// \param Declarations Declarations used in the clause. /// \param ComponentLists Component lists used in the clause. + /// \param MotionModifiers Motion-modifiers. + /// \param MotionModifiersLoc Location of motion-modifiers. /// \param UDMapperRefs References to user-defined mappers associated with /// expressions used in the clause. /// \param UDMQualifierLoc C++ nested name specifier for the associated @@ -6354,6 +6454,8 @@ public: ArrayRef Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef UDMapperRefs, + ArrayRef MotionModifiers, + ArrayRef MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId); @@ -6368,6 +6470,38 @@ public: static OMPToClause *CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes); + /// Fetches the motion-modifier at 'Cnt' index of array of modifiers. + /// + /// \param Cnt index for motion-modifier. + OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY { + assert(Cnt < NumberOfOMPMotionModifiers && + "Requested modifier exceeds the total number of modifiers."); + return MotionModifiers[Cnt]; + } + + /// Fetches the motion-modifier location at 'Cnt' index of array of modifiers' + /// locations. + /// + /// \param Cnt index for motion-modifier location. + SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY { + assert(Cnt < NumberOfOMPMotionModifiers && + "Requested modifier location exceeds total number of modifiers."); + return MotionModifiersLoc[Cnt]; + } + + /// Fetches ArrayRef of motion-modifiers. + ArrayRef getMotionModifiers() const LLVM_READONLY { + return llvm::makeArrayRef(MotionModifiers); + } + + /// Fetches ArrayRef of location of motion-modifiers. + ArrayRef getMotionModifiersLoc() const LLVM_READONLY { + return llvm::makeArrayRef(MotionModifiersLoc); + } + + /// Get colon location. + SourceLocation getColonLoc() const { return ColonLoc; } + child_range children() { return child_range(reinterpret_cast(varlist_begin()), reinterpret_cast(varlist_end())); @@ -6408,8 +6542,20 @@ class OMPFromClause final friend OMPVarListClause; friend TrailingObjects; + /// Motion-modifiers for the 'from' clause. + OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = { + OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown}; + + /// Location of motion-modifiers for the 'from' clause. + SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers]; + + /// Colon location. + SourceLocation ColonLoc; + /// Build clause with number of variables \a NumVars. /// + /// \param TheMotionModifiers Motion-modifiers. + /// \param TheMotionModifiersLoc Locations of motion-modifiers. /// \param MapperQualifierLoc C++ nested name specifier for the associated /// user-defined mapper. /// \param MapperIdInfo The identifier of associated user-defined mapper. @@ -6421,12 +6567,24 @@ class OMPFromClause final /// NumUniqueDeclarations: number of unique base declarations in this clause; /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. - explicit OMPFromClause(NestedNameSpecifierLoc MapperQualifierLoc, + explicit OMPFromClause(ArrayRef TheMotionModifiers, + ArrayRef TheMotionModifiersLoc, + NestedNameSpecifierLoc MapperQualifierLoc, DeclarationNameInfo MapperIdInfo, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) : OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes, - &MapperQualifierLoc, &MapperIdInfo) {} + /*SupportsMapper=*/true, &MapperQualifierLoc, + &MapperIdInfo) { + assert(llvm::array_lengthof(MotionModifiers) == TheMotionModifiers.size() && + "Unexpected number of motion modifiers."); + llvm::copy(TheMotionModifiers, std::begin(MotionModifiers)); + + assert(llvm::array_lengthof(MotionModifiersLoc) == + TheMotionModifiersLoc.size() && + "Unexpected number of motion modifier locations."); + llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc)); + } /// Build an empty clause. /// @@ -6437,7 +6595,30 @@ class OMPFromClause final /// NumComponents: total number of expression components in the clause. explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes) : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(), - Sizes) {} + Sizes, /*SupportsMapper=*/true) {} + + /// Set motion-modifier for the clause. + /// + /// \param I index for motion-modifier. + /// \param T motion-modifier for the clause. + void setMotionModifier(unsigned I, OpenMPMotionModifierKind T) { + assert(I < NumberOfOMPMotionModifiers && + "Unexpected index to store motion modifier, exceeds array size."); + MotionModifiers[I] = T; + } + + /// Set location for the motion-modifier. + /// + /// \param I index for motion-modifier location. + /// \param TLoc motion-modifier location. + void setMotionModifierLoc(unsigned I, SourceLocation TLoc) { + assert(I < NumberOfOMPMotionModifiers && + "Index to store motion modifier location exceeds array size."); + MotionModifiersLoc[I] = TLoc; + } + + /// Set colon location. + void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6463,18 +6644,21 @@ public: /// \param Vars The original expression used in the clause. /// \param Declarations Declarations used in the clause. /// \param ComponentLists Component lists used in the clause. + /// \param MotionModifiers Motion-modifiers. + /// \param MotionModifiersLoc Location of motion-modifiers. /// \param UDMapperRefs References to user-defined mappers associated with /// expressions used in the clause. /// \param UDMQualifierLoc C++ nested name specifier for the associated /// user-defined mapper. /// \param MapperId The identifier of associated user-defined mapper. - static OMPFromClause *Create(const ASTContext &C, const OMPVarListLocTy &Locs, - ArrayRef Vars, - ArrayRef Declarations, - MappableExprComponentListsRef ComponentLists, - ArrayRef UDMapperRefs, - NestedNameSpecifierLoc UDMQualifierLoc, - DeclarationNameInfo MapperId); + static OMPFromClause * + Create(const ASTContext &C, const OMPVarListLocTy &Locs, + ArrayRef Vars, ArrayRef Declarations, + MappableExprComponentListsRef ComponentLists, + ArrayRef UDMapperRefs, + ArrayRef MotionModifiers, + ArrayRef MotionModifiersLoc, + NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId); /// Creates an empty clause with the place for \a NumVars variables. /// @@ -6487,6 +6671,38 @@ public: static OMPFromClause *CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes); + /// Fetches the motion-modifier at 'Cnt' index of array of modifiers. + /// + /// \param Cnt index for motion-modifier. + OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY { + assert(Cnt < NumberOfOMPMotionModifiers && + "Requested modifier exceeds the total number of modifiers."); + return MotionModifiers[Cnt]; + } + + /// Fetches the motion-modifier location at 'Cnt' index of array of modifiers' + /// locations. + /// + /// \param Cnt index for motion-modifier location. + SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY { + assert(Cnt < NumberOfOMPMotionModifiers && + "Requested modifier location exceeds total number of modifiers."); + return MotionModifiersLoc[Cnt]; + } + + /// Fetches ArrayRef of motion-modifiers. + ArrayRef getMotionModifiers() const LLVM_READONLY { + return llvm::makeArrayRef(MotionModifiers); + } + + /// Fetches ArrayRef of location of motion-modifiers. + ArrayRef getMotionModifiersLoc() const LLVM_READONLY { + return llvm::makeArrayRef(MotionModifiersLoc); + } + + /// Get colon location. + SourceLocation getColonLoc() const { return ColonLoc; } + child_range children() { return child_range(reinterpret_cast(varlist_begin()), reinterpret_cast(varlist_end())); @@ -7542,22 +7758,22 @@ public: #define DISPATCH(CLASS) \ return static_cast(this)->Visit##CLASS(static_cast(S)) -#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ - RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } -#include "llvm/Frontend/OpenMP/OMPKinds.def" +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) \ + RetTy Visit##Class(PTR(Class) S) { DISPATCH(Class); } +#include "llvm/Frontend/OpenMP/OMP.inc" RetTy Visit(PTR(OMPClause) S) { // Top switch clause: visit each OMPClause. switch (S->getClauseKind()) { -#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) \ case llvm::omp::Clause::Enum: \ return Visit##Class(static_cast(S)); -#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ +#define CLAUSE_NO_CLASS(Enum, Str) \ case llvm::omp::Clause::Enum: \ break; -#include "llvm/Frontend/OpenMP/OMPKinds.def" - default: - break; +#include "llvm/Frontend/OpenMP/OMP.inc" } } // Base case, ignore it. :) @@ -7581,18 +7797,24 @@ class OMPClausePrinter final : public OMPClauseVisitor { /// Process clauses with list of variables. template void VisitOMPClauseList(T *Node, char StartSym); + /// Process motion clauses. + template void VisitOMPMotionClause(T *Node); public: OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy) : OS(OS), Policy(Policy) {} -#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ - void Visit##Class(Class *S); -#include "llvm/Frontend/OpenMP/OMPKinds.def" +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S); +#include "llvm/Frontend/OpenMP/OMP.inc" }; struct OMPTraitProperty { llvm::omp::TraitProperty Kind = llvm::omp::TraitProperty::invalid; + + /// The raw string as we parsed it. This is needed for the `isa` trait set + /// (which accepts anything) and (later) extensions. + StringRef RawString; }; struct OMPTraitSelector { Expr *ScoreOrCondition = nullptr; @@ -7644,12 +7866,190 @@ public: /// Return a string representation identifying this context selector. std::string getMangledName() const; + /// Check the extension trait \p TP is active. + bool isExtensionActive(llvm::omp::TraitProperty TP) { + for (const OMPTraitSet &Set : Sets) { + if (Set.Kind != llvm::omp::TraitSet::implementation) + continue; + for (const OMPTraitSelector &Selector : Set.Selectors) { + if (Selector.Kind != llvm::omp::TraitSelector::implementation_extension) + continue; + for (const OMPTraitProperty &Property : Selector.Properties) { + if (Property.Kind == TP) + return true; + } + } + } + return false; + } + /// Print a human readable representation into \p OS. void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const; }; llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo &TI); llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo *TI); +/// Clang specific specialization of the OMPContext to lookup target features. +struct TargetOMPContext final : public llvm::omp::OMPContext { + + TargetOMPContext(ASTContext &ASTCtx, + std::function &&DiagUnknownTrait, + const FunctionDecl *CurrentFunctionDecl); + virtual ~TargetOMPContext() = default; + + /// See llvm::omp::OMPContext::matchesISATrait + bool matchesISATrait(StringRef RawString) const override; + +private: + std::function FeatureValidityCheck; + std::function DiagUnknownTrait; + llvm::StringMap FeatureMap; +}; + +/// Contains data for OpenMP directives: clauses, children +/// expressions/statements (helpers for codegen) and associated statement, if +/// any. +class OMPChildren final + : private llvm::TrailingObjects { + friend TrailingObjects; + friend class OMPClauseReader; + friend class OMPExecutableDirective; + template friend class OMPDeclarativeDirective; + + /// Numbers of clauses. + unsigned NumClauses = 0; + /// Number of child expressions/stmts. + unsigned NumChildren = 0; + /// true if the directive has associated statement. + bool HasAssociatedStmt = false; + + /// Define the sizes of each trailing object array except the last one. This + /// is required for TrailingObjects to work properly. + size_t numTrailingObjects(OverloadToken) const { + return NumClauses; + } + + OMPChildren() = delete; + + OMPChildren(unsigned NumClauses, unsigned NumChildren, bool HasAssociatedStmt) + : NumClauses(NumClauses), NumChildren(NumChildren), + HasAssociatedStmt(HasAssociatedStmt) {} + + static size_t size(unsigned NumClauses, bool HasAssociatedStmt, + unsigned NumChildren); + + static OMPChildren *Create(void *Mem, ArrayRef Clauses); + static OMPChildren *Create(void *Mem, ArrayRef Clauses, Stmt *S, + unsigned NumChildren = 0); + static OMPChildren *CreateEmpty(void *Mem, unsigned NumClauses, + bool HasAssociatedStmt = false, + unsigned NumChildren = 0); + +public: + unsigned getNumClauses() const { return NumClauses; } + unsigned getNumChildren() const { return NumChildren; } + bool hasAssociatedStmt() const { return HasAssociatedStmt; } + + /// Set associated statement. + void setAssociatedStmt(Stmt *S) { + getTrailingObjects()[NumChildren] = S; + } + + void setChildren(ArrayRef Children); + + /// Sets the list of variables for this clause. + /// + /// \param Clauses The list of clauses for the directive. + /// + void setClauses(ArrayRef Clauses); + + /// Returns statement associated with the directive. + const Stmt *getAssociatedStmt() const { + return const_cast(this)->getAssociatedStmt(); + } + Stmt *getAssociatedStmt() { + assert(HasAssociatedStmt && + "Expected directive with the associated statement."); + return getTrailingObjects()[NumChildren]; + } + + /// Get the clauses storage. + MutableArrayRef getClauses() { + return llvm::makeMutableArrayRef(getTrailingObjects(), + NumClauses); + } + ArrayRef getClauses() const { + return const_cast(this)->getClauses(); + } + + /// Returns the captured statement associated with the + /// component region within the (combined) directive. + /// + /// \param RegionKind Component region kind. + const CapturedStmt * + getCapturedStmt(OpenMPDirectiveKind RegionKind, + ArrayRef CaptureRegions) const { + assert(llvm::any_of( + CaptureRegions, + [=](const OpenMPDirectiveKind K) { return K == RegionKind; }) && + "RegionKind not found in OpenMP CaptureRegions."); + auto *CS = cast(getAssociatedStmt()); + for (auto ThisCaptureRegion : CaptureRegions) { + if (ThisCaptureRegion == RegionKind) + return CS; + CS = cast(CS->getCapturedStmt()); + } + llvm_unreachable("Incorrect RegionKind specified for directive."); + } + + /// Get innermost captured statement for the construct. + CapturedStmt * + getInnermostCapturedStmt(ArrayRef CaptureRegions) { + assert(hasAssociatedStmt() && "Must have associated captured statement."); + assert(!CaptureRegions.empty() && + "At least one captured statement must be provided."); + auto *CS = cast(getAssociatedStmt()); + for (unsigned Level = CaptureRegions.size(); Level > 1; --Level) + CS = cast(CS->getCapturedStmt()); + return CS; + } + + const CapturedStmt * + getInnermostCapturedStmt(ArrayRef CaptureRegions) const { + return const_cast(this)->getInnermostCapturedStmt( + CaptureRegions); + } + + MutableArrayRef getChildren(); + ArrayRef getChildren() const { + return const_cast(this)->getChildren(); + } + + Stmt *getRawStmt() { + assert(HasAssociatedStmt && + "Expected directive with the associated statement."); + if (auto *CS = dyn_cast(getAssociatedStmt())) { + Stmt *S = nullptr; + do { + S = CS->getCapturedStmt(); + CS = dyn_cast(S); + } while (CS); + return S; + } + return getAssociatedStmt(); + } + const Stmt *getRawStmt() const { + return const_cast(this)->getRawStmt(); + } + + Stmt::child_range getAssociatedStmtAsRange() { + if (!HasAssociatedStmt) + return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator()); + return Stmt::child_range(&getTrailingObjects()[NumChildren], + &getTrailingObjects()[NumChildren + 1]); + } +}; + } // namespace clang #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H diff --git a/clang/include/clang/AST/OperationKinds.def b/clang/include/clang/AST/OperationKinds.def index f29664e8eb3..7c82ab6e57e 100644 --- a/clang/include/clang/AST/OperationKinds.def +++ b/clang/include/clang/AST/OperationKinds.def @@ -77,9 +77,10 @@ CAST_OPERATION(LValueToRValueBitCast) CAST_OPERATION(LValueToRValue) /// CK_NoOp - A conversion which does not affect the type other than -/// (possibly) adding qualifiers. +/// (possibly) adding qualifiers or removing noexcept. /// int -> int /// char** -> const char * const * +/// void () noexcept -> void () CAST_OPERATION(NoOp) /// CK_BaseToDerived - A conversion from a C++ class pointer/reference @@ -201,6 +202,14 @@ CAST_OPERATION(IntegralToBoolean) /// float f = i; CAST_OPERATION(IntegralToFloating) +/// CK_FloatingToFixedPoint - Floating to fixed point. +/// _Accum a = f; +CAST_OPERATION(FloatingToFixedPoint) + +/// CK_FixedPointToFloating - Fixed point to floating. +/// (float) 2.5k +CAST_OPERATION(FixedPointToFloating) + /// CK_FixedPointCast - Fixed point to fixed point. /// (_Accum) 0.5r CAST_OPERATION(FixedPointCast) diff --git a/clang/include/clang/AST/OptionalDiagnostic.h b/clang/include/clang/AST/OptionalDiagnostic.h index c57199f0fdf..c9a2d19f4eb 100644 --- a/clang/include/clang/AST/OptionalDiagnostic.h +++ b/clang/include/clang/AST/OptionalDiagnostic.h @@ -63,7 +63,7 @@ public: return *this; } - OptionalDiagnostic &operator<<(const APFixedPoint &FX) { + OptionalDiagnostic &operator<<(const llvm::APFixedPoint &FX) { if (Diag) { SmallVector Buffer; FX.toString(Buffer); diff --git a/clang/include/clang/AST/ParentMap.h b/clang/include/clang/AST/ParentMap.h index 1e65d7efd27..86e2f048a34 100644 --- a/clang/include/clang/AST/ParentMap.h +++ b/clang/include/clang/AST/ParentMap.h @@ -51,9 +51,7 @@ public: return getParentIgnoreParenCasts(const_cast(S)); } - bool hasParent(Stmt* S) const { - return getParent(S) != nullptr; - } + bool hasParent(const Stmt *S) const { return getParent(S) != nullptr; } bool isConsumedExpr(Expr *E) const; diff --git a/clang/include/clang/AST/ParentMapContext.h b/clang/include/clang/AST/ParentMapContext.h index be4d75df7b9..a0412380a86 100644 --- a/clang/include/clang/AST/ParentMapContext.h +++ b/clang/include/clang/AST/ParentMapContext.h @@ -94,25 +94,24 @@ class DynTypedNodeList { public: DynTypedNodeList(const DynTypedNode &N) : IsSingleNode(true) { - new (Storage.buffer) DynTypedNode(N); + new (&Storage) DynTypedNode(N); } DynTypedNodeList(ArrayRef A) : IsSingleNode(false) { - new (Storage.buffer) ArrayRef(A); + new (&Storage) ArrayRef(A); } const DynTypedNode *begin() const { if (!IsSingleNode) - return reinterpret_cast *>(Storage.buffer) + return reinterpret_cast *>(&Storage) ->begin(); - return reinterpret_cast(Storage.buffer); + return reinterpret_cast(&Storage); } const DynTypedNode *end() const { if (!IsSingleNode) - return reinterpret_cast *>(Storage.buffer) - ->end(); - return reinterpret_cast(Storage.buffer) + 1; + return reinterpret_cast *>(&Storage)->end(); + return reinterpret_cast(&Storage) + 1; } size_t size() const { return end() - begin(); } diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h index 616647f4443..3baf2b2ba94 100644 --- a/clang/include/clang/AST/PrettyPrinter.h +++ b/clang/include/clang/AST/PrettyPrinter.h @@ -18,6 +18,7 @@ namespace clang { +class DeclContext; class LangOptions; class SourceManager; class Stmt; @@ -39,6 +40,15 @@ public: virtual std::string remapPath(StringRef Path) const { return std::string(Path); } + + /// When printing type to be inserted into code in specific context, this + /// callback can be used to avoid printing the redundant part of the + /// qualifier. For example, when inserting code inside namespace foo, we + /// should print bar::SomeType instead of foo::bar::SomeType. + /// To do this, shouldPrintScope should return true on "foo" NamespaceDecl. + /// The printing stops at the first isScopeVisible() == true, so there will + /// be no calls with outer scopes. + virtual bool isScopeVisible(const DeclContext *DC) const { return false; } }; /// Describes how types, statements, expressions, and declarations should be @@ -52,12 +62,13 @@ struct PrintingPolicy { : Indentation(2), SuppressSpecifiers(false), SuppressTagKeyword(LO.CPlusPlus), IncludeTagDefinition(false), SuppressScope(false), SuppressUnwrittenScope(false), - SuppressInitializers(false), ConstantArraySizeAsWritten(false), - AnonymousTagLocations(true), SuppressStrongLifetime(false), - SuppressLifetimeQualifiers(false), - SuppressTemplateArgsInCXXConstructors(false), Bool(LO.Bool), - Restrict(LO.C99), Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11), - UseVoidForZeroParams(!LO.CPlusPlus), + SuppressInlineNamespace(true), SuppressInitializers(false), + ConstantArraySizeAsWritten(false), AnonymousTagLocations(true), + SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false), + SuppressTemplateArgsInCXXConstructors(false), + SuppressDefaultTemplateArgs(true), Bool(LO.Bool), + Nullptr(LO.CPlusPlus11), Restrict(LO.C99), Alignof(LO.CPlusPlus11), + UnderscoreAlignof(LO.C11), UseVoidForZeroParams(!LO.CPlusPlus), SplitTemplateClosers(!LO.CPlusPlus11), TerseOutput(false), PolishForDeclaration(false), Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true), @@ -117,10 +128,15 @@ struct PrintingPolicy { /// Suppresses printing of scope specifiers. unsigned SuppressScope : 1; - /// Suppress printing parts of scope specifiers that don't need - /// to be written, e.g., for inline or anonymous namespaces. + /// Suppress printing parts of scope specifiers that are never + /// written, e.g., for anonymous namespaces. unsigned SuppressUnwrittenScope : 1; + /// Suppress printing parts of scope specifiers that correspond + /// to inline namespaces, where the name is unambiguous with the specifier + /// removed. + unsigned SuppressInlineNamespace : 1; + /// Suppress printing of variable initializers. /// /// This flag is used when printing the loop variable in a for-range @@ -167,10 +183,18 @@ struct PrintingPolicy { /// constructors. unsigned SuppressTemplateArgsInCXXConstructors : 1; + /// When true, attempt to suppress template arguments that match the default + /// argument for the parameter. + unsigned SuppressDefaultTemplateArgs : 1; + /// Whether we can use 'bool' rather than '_Bool' (even if the language /// doesn't actually have 'bool', because, e.g., it is defined as a macro). unsigned Bool : 1; + /// Whether we should use 'nullptr' rather than '0' as a null pointer + /// constant. + unsigned Nullptr : 1; + /// Whether we can use 'restrict' rather than '__restrict'. unsigned Restrict : 1; diff --git a/clang/include/clang/AST/PropertiesBase.td b/clang/include/clang/AST/PropertiesBase.td index ba0f237a3bc..a087cb406b2 100644 --- a/clang/include/clang/AST/PropertiesBase.td +++ b/clang/include/clang/AST/PropertiesBase.td @@ -72,6 +72,8 @@ class CountPropertyType : PropertyType { def APInt : PropertyType<"llvm::APInt"> { let PassByReference = 1; } def APSInt : PropertyType<"llvm::APSInt"> { let PassByReference = 1; } +def APValue : PropertyType { let PassByReference = 1; } +def APValueKind : EnumPropertyType<"APValue::ValueKind">; def ArraySizeModifier : EnumPropertyType<"ArrayType::ArraySizeModifier">; def AttrKind : EnumPropertyType<"attr::Kind">; def AutoTypeKeyword : EnumPropertyType; @@ -109,7 +111,15 @@ def DeclRef : RefPropertyType<"Decl"> { let ConstWhenWriting = 1; } SubclassPropertyType<"ValueDecl", DeclRef>; def ElaboratedTypeKeyword : EnumPropertyType; def ExtParameterInfo : PropertyType<"FunctionProtoType::ExtParameterInfo">; +def FixedPointSemantics : PropertyType<"llvm::FixedPointSemantics"> { + let PassByReference = 1; +} def Identifier : RefPropertyType<"IdentifierInfo"> { let ConstWhenWriting = 1; } +def LValuePathEntry : PropertyType<"APValue::LValuePathEntry">; +def LValuePathSerializationHelper : + PropertyType<"APValue::LValuePathSerializationHelper"> { + let BufferElementTypes = [ LValuePathEntry ]; +} def NestedNameSpecifier : PropertyType<"NestedNameSpecifier *">; def NestedNameSpecifierKind : EnumPropertyType<"NestedNameSpecifier::SpecifierKind">; @@ -237,6 +247,304 @@ class PropertyTypeCase : HasProperties { string Name = name; } +// Type cases for APValue. +def : PropertyTypeKind; +let Class = PropertyTypeCase in { + def : Creator<[{ return APValue(); }]>; +} +let Class = PropertyTypeCase in { + def : Creator<[{ return APValue::IndeterminateValue(); }]>; +} +let Class = PropertyTypeCase in { + def : Property<"value", APSInt> { + let Read = [{ node.getInt() }]; + } + def : Creator<[{ return APValue(value); }]>; +} +let Class = PropertyTypeCase in { + def : Property<"semantics", UInt32> { + let Read = [{ + static_cast( + llvm::APFloatBase::SemanticsToEnum(node.getFloat().getSemantics())) + }]; + } + def : Property<"value", APInt> { + let Read = [{ node.getFloat().bitcastToAPInt() }]; + } + def : Creator<[{ + const llvm::fltSemantics &floatSema = llvm::APFloatBase::EnumToSemantics( + static_cast(semantics)); + return APValue(llvm::APFloat(floatSema, value)); + }]>; +} +let Class = PropertyTypeCase in { + def : Property<"semantics", FixedPointSemantics> { + let Read = [{ node.getFixedPoint().getSemantics() }]; + } + def : Property<"value", APSInt> { + let Read = [{ node.getFixedPoint().getValue() }]; + } + def : Creator<[{ + return APValue(llvm::APFixedPoint(std::move(value), semantics)); + }]>; +} +let Class = PropertyTypeCase in { + def : Property<"real", APSInt> { + let Read = [{ node.getComplexIntReal() }]; + } + def : Property<"imag", APSInt> { + let Read = [{ node.getComplexIntImag() }]; + } + def : Creator<[{ return APValue(real, imag); }]>; +} +let Class = PropertyTypeCase in { + def : ReadHelper<[{ + auto sema = llvm::APFloatBase::SemanticsToEnum( + node.getComplexFloatReal().getSemantics()); + assert(sema == llvm::APFloatBase::SemanticsToEnum( + node.getComplexFloatImag().getSemantics())); + }]>; + def : Property<"semantics", UInt32> { + let Read = [{ static_cast(sema) }]; + } + def : Property<"real", APInt> { + let Read = [{ node.getComplexFloatReal().bitcastToAPInt() }]; + } + def : Property<"imag", APInt> { + let Read = [{ node.getComplexFloatImag().bitcastToAPInt() }]; + } + def : Creator<[{ + const llvm::fltSemantics &sema = llvm::APFloatBase::EnumToSemantics( + static_cast(semantics)); + return APValue(llvm::APFloat(sema, real), + llvm::APFloat(sema, imag)); + }]>; +} +let Class = PropertyTypeCase in { + def : ReadHelper<[{ + SmallVector buffer; + unsigned len = node.getVectorLength(); + for (unsigned i = 0; i < len; ++i) + buffer.push_back(node.getVectorElt(i)); + }]>; + def : Property<"elements", Array> { + let Read = [{ buffer }]; + } + def : Creator<[{ + APValue result; + result.MakeVector(); + unsigned length = elements.size(); + (void)result.setVectorUninit(length); + for (unsigned i = 0; i < length; i++) + result.getVectorElt(i) = elements[i]; + return result; + }]>; +} +let Class = PropertyTypeCase in { + def : ReadHelper<[{ + SmallVector buffer{}; + unsigned initLength = node.getArrayInitializedElts(); + for (unsigned i = 0; i < initLength; ++i) + buffer.push_back(node.getArrayInitializedElt(i)); + if (node.hasArrayFiller()) + buffer.push_back(node.getArrayFiller()); + }]>; + def : Property<"totalLength", UInt32> { + let Read = [{ node.getArraySize() }]; + } + def : Property<"hasFiller", Bool> { + let Read = [{ node.hasArrayFiller() }]; + } + def : Property<"elements", Array> { + let Read = [{ buffer }]; + } + def : Creator<[{ + APValue result; + unsigned initLength = elements.size() - (hasFiller ? 1 : 0); + result.MakeArray(initLength, totalLength); + for (unsigned i = 0; i < initLength; ++i) + result.getArrayInitializedElt(i) = elements[i]; + if (hasFiller) + result.getArrayFiller() = elements.back(); + return result; + }]>; +} +let Class = PropertyTypeCase in { + def : ReadHelper<[{ + SmallVector structBases; + unsigned numBases = node.getStructNumBases(); + for (unsigned i = 0; i < numBases; ++i) + structBases.push_back(node.getStructBase(i)); + SmallVector structFields; + unsigned numFields = node.getStructNumFields(); + for (unsigned i = 0; i < numFields; ++i) + structFields.push_back(node.getStructField(i)); + }]>; + def : Property<"bases", Array> { + let Read = [{ structBases }]; + } + def : Property<"fields", Array> { + let Read = [{ structFields }]; + } + def : Creator<[{ + APValue result; + result.MakeStruct(bases.size(), fields.size()); + for (unsigned i = 0; i < bases.size(); ++i) + result.getStructBase(i) = bases[i]; + for (unsigned i = 0; i < fields.size(); ++i) + result.getStructField(i) = fields[i]; + return result; + }]>; +} +let Class = PropertyTypeCase in { + def : Property<"fieldDecl", DeclRef> { + let Read = [{ node.getUnionField() }]; + } + def : Property<"value", APValue> { + let Read = [{ node.getUnionValue() }]; + } + def : Creator<[{ + return APValue(cast(fieldDecl), std::move(value)); + }]>; +} +let Class = PropertyTypeCase in { + def : Property<"lhs", StmtRef> { + let Read = [{ const_cast(node.getAddrLabelDiffLHS()) }]; + } + def : Property<"rhs", StmtRef> { + let Read = [{ const_cast(node.getAddrLabelDiffRHS()) }]; + } + def : Creator<[{ + return APValue(cast(lhs), cast(rhs)); + }]>; +} +let Class = PropertyTypeCase in { + def : Property<"isDerived", Bool> { + let Read = [{ node.isMemberPointerToDerivedMember() }]; + } + def : Property<"member", ValueDeclRef> { + let Read = [{ node.getMemberPointerDecl() }]; + } + def : Property<"memberPath", Array> { + let Read = [{ node.getMemberPointerPath() }]; + } + def : Creator<[{ + APValue result; + unsigned pathSize = memberPath.size(); + const CXXRecordDecl **pathArray = + result.setMemberPointerUninit(member, isDerived, pathSize).data(); + for (unsigned i = 0; i < pathSize; ++i) + pathArray[i] = memberPath[i]->getCanonicalDecl(); + return result; + }]>; +} +let Class = PropertyTypeCase in { + def : ReadHelper<[{ + auto lvalueBase = node.getLValueBase(); + const Expr *expr = + lvalueBase ? lvalueBase.dyn_cast() : nullptr; + bool lvalueBaseIsExpr = (bool) expr; + bool lvalueBaseIsTypeInfo = lvalueBase.is(); + QualType elemTy; + if (lvalueBase) { + if (lvalueBaseIsTypeInfo) { + elemTy = lvalueBase.getTypeInfoType(); + } else if (lvalueBaseIsExpr) { + elemTy = expr->getType(); + } else { + elemTy = lvalueBase.get()->getType(); + } + } + }]>; + def : Property<"hasLValuePath", Bool> { + let Read = [{ node.hasLValuePath() }]; + } + def : Property<"isLValueOnePastTheEnd", Bool> { + let Read = [{ node.isLValueOnePastTheEnd() }]; + } + def : Property<"isExpr", Bool> { + let Read = [{ lvalueBaseIsExpr }]; + } + def : Property<"isTypeInfo", Bool> { + let Read = [{ lvalueBaseIsTypeInfo }]; + } + def : Property<"hasBase", Bool> { + let Read = [{ static_cast(lvalueBase) }]; + } + def : Property<"isNullPtr", Bool> { + let Read = [{ node.isNullPointer() }]; + } + def : Property<"typeInfo", QualType> { + let Conditional = [{ hasBase && isTypeInfo }]; + let Read = [{ + QualType(node.getLValueBase().get().getType(), 0) + }]; + } + def : Property<"type", QualType> { + let Conditional = [{ hasBase && isTypeInfo }]; + let Read = [{ node.getLValueBase().getTypeInfoType() }]; + } + def : Property<"callIndex", UInt32> { + let Conditional = [{ hasBase && !isTypeInfo }]; + let Read = [{ node.getLValueBase().getCallIndex() }]; + } + def : Property<"version", UInt32> { + let Conditional = [{ hasBase && !isTypeInfo }]; + let Read = [{ node.getLValueBase().getVersion() }]; + } + def : Property<"stmt", StmtRef> { + let Conditional = [{ hasBase && !isTypeInfo && isExpr }]; + let Read = [{ const_cast(expr) }]; + } + def : Property<"decl", DeclRef> { + let Conditional = [{ hasBase && !isTypeInfo && !isExpr }]; + let Read = [{ lvalueBase.get() }]; + } + def : Property<"offsetQuantity", UInt32> { + let Read = [{ node.getLValueOffset().getQuantity() }]; + } + def : Property<"lvaluePath", LValuePathSerializationHelper> { + let Conditional = [{ hasLValuePath }]; + let Read = [{ + APValue::LValuePathSerializationHelper(node.getLValuePath(), elemTy) + }]; + } + def : Creator<[{ + (void)ctx; + APValue::LValueBase base; + QualType elemTy; + if (hasBase) { + if (isTypeInfo) { + base = APValue::LValueBase::getTypeInfo( + TypeInfoLValue(typeInfo.getValue().getTypePtr()), type.getValue()); + elemTy = base.getTypeInfoType(); + } else if (isExpr) { + base = APValue::LValueBase(cast(stmt.getValue()), + callIndex.getValue(), version.getValue()); + elemTy = base.get()->getType(); + } else { + base = APValue::LValueBase(cast(decl.getValue()), + callIndex.getValue(), version.getValue()); + elemTy = base.get()->getType(); + } + } + CharUnits offset = CharUnits::fromQuantity(offsetQuantity); + APValue result; + result.MakeLValue(); + if (!hasLValuePath) { + result.setLValue(base, offset, APValue::NoLValuePath{}, isNullPtr); + return result; + } + auto pathLength = lvaluePath->Path.size(); + APValue::LValuePathEntry *path = result.setLValueUninit( + base, offset, pathLength, isLValueOnePastTheEnd, isNullPtr).data(); + assert(lvaluePath->getType() == elemTy && "Unexpected type reference!"); + llvm::copy(lvaluePath->Path, path); + return result; + }]>; +} + // Type cases for DeclarationName. def : PropertyTypeKind; diff --git a/clang/include/clang/AST/RecordLayout.h b/clang/include/clang/AST/RecordLayout.h index b259791af50..dd18f9c49f8 100644 --- a/clang/include/clang/AST/RecordLayout.h +++ b/clang/include/clang/AST/RecordLayout.h @@ -70,6 +70,11 @@ private: // Alignment - Alignment of record in characters. CharUnits Alignment; + // PreferredAlignment - Preferred alignment of record in characters. This + // can be different than Alignment in cases where it is beneficial for + // performance or backwards compatibility preserving (e.g. AIX-ABI). + CharUnits PreferredAlignment; + // UnadjustedAlignment - Maximum of the alignments of the record members in // characters. CharUnits UnadjustedAlignment; @@ -91,6 +96,11 @@ private: /// which is the alignment of the object without virtual bases. CharUnits NonVirtualAlignment; + /// PreferredNVAlignment - The preferred non-virtual alignment (in chars) of + /// an object, which is the preferred alignment of the object without + /// virtual bases. + CharUnits PreferredNVAlignment; + /// SizeOfLargestEmptySubobject - The size of the largest empty subobject /// (either a base or a member). Will be zero if the class doesn't contain /// any empty subobjects. @@ -139,30 +149,26 @@ private: CXXRecordLayoutInfo *CXXInfo = nullptr; ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment, - CharUnits unadjustedAlignment, + CharUnits preferredAlignment, CharUnits unadjustedAlignment, CharUnits requiredAlignment, CharUnits datasize, ArrayRef fieldoffsets); using BaseOffsetsMapTy = CXXRecordLayoutInfo::BaseOffsetsMapTy; // Constructor for C++ records. - ASTRecordLayout(const ASTContext &Ctx, - CharUnits size, CharUnits alignment, - CharUnits unadjustedAlignment, - CharUnits requiredAlignment, - bool hasOwnVFPtr, bool hasExtendableVFPtr, - CharUnits vbptroffset, - CharUnits datasize, - ArrayRef fieldoffsets, + ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment, + CharUnits preferredAlignment, CharUnits unadjustedAlignment, + CharUnits requiredAlignment, bool hasOwnVFPtr, + bool hasExtendableVFPtr, CharUnits vbptroffset, + CharUnits datasize, ArrayRef fieldoffsets, CharUnits nonvirtualsize, CharUnits nonvirtualalignment, + CharUnits preferrednvalignment, CharUnits SizeOfLargestEmptySubobject, - const CXXRecordDecl *PrimaryBase, - bool IsPrimaryBaseVirtual, + const CXXRecordDecl *PrimaryBase, bool IsPrimaryBaseVirtual, const CXXRecordDecl *BaseSharingVBPtr, - bool EndsWithZeroSizedObject, - bool LeadsWithZeroSizedBase, - const BaseOffsetsMapTy& BaseOffsets, - const VBaseOffsetsMapTy& VBaseOffsets); + bool EndsWithZeroSizedObject, bool LeadsWithZeroSizedBase, + const BaseOffsetsMapTy &BaseOffsets, + const VBaseOffsetsMapTy &VBaseOffsets); ~ASTRecordLayout() = default; @@ -175,6 +181,10 @@ public: /// getAlignment - Get the record alignment in characters. CharUnits getAlignment() const { return Alignment; } + /// getPreferredFieldAlignment - Get the record preferred alignment in + /// characters. + CharUnits getPreferredAlignment() const { return PreferredAlignment; } + /// getUnadjustedAlignment - Get the record alignment in characters, before /// alignment adjustement. CharUnits getUnadjustedAlignment() const { return UnadjustedAlignment; } @@ -193,9 +203,7 @@ public: /// getDataSize() - Get the record data size, which is the record size /// without tail padding, in characters. - CharUnits getDataSize() const { - return DataSize; - } + CharUnits getDataSize() const { return DataSize; } /// getNonVirtualSize - Get the non-virtual size (in chars) of an object, /// which is the size of the object without virtual bases. @@ -205,14 +213,23 @@ public: return CXXInfo->NonVirtualSize; } - /// getNonVirtualSize - Get the non-virtual alignment (in chars) of an object, - /// which is the alignment of the object without virtual bases. + /// getNonVirtualAlignment - Get the non-virtual alignment (in chars) of an + /// object, which is the alignment of the object without virtual bases. CharUnits getNonVirtualAlignment() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); return CXXInfo->NonVirtualAlignment; } + /// getPreferredNVAlignment - Get the preferred non-virtual alignment (in + /// chars) of an object, which is the preferred alignment of the object + /// without virtual bases. + CharUnits getPreferredNVAlignment() const { + assert(CXXInfo && "Record layout does not have C++ specific info!"); + + return CXXInfo->PreferredNVAlignment; + } + /// getPrimaryBase - Get the primary base for this record. const CXXRecordDecl *getPrimaryBase() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); @@ -231,6 +248,8 @@ public: /// getBaseClassOffset - Get the offset, in chars, for the given base class. CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const { assert(CXXInfo && "Record layout does not have C++ specific info!"); + + Base = Base->getDefinition(); assert(CXXInfo->BaseOffsets.count(Base) && "Did not find base!"); return CXXInfo->BaseOffsets[Base]; @@ -239,6 +258,8 @@ public: /// getVBaseClassOffset - Get the offset, in chars, for the given base class. CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const { assert(CXXInfo && "Record layout does not have C++ specific info!"); + + VBase = VBase->getDefinition(); assert(CXXInfo->VBaseOffsets.count(VBase) && "Did not find base!"); return CXXInfo->VBaseOffsets[VBase].VBaseOffset; @@ -287,9 +308,7 @@ public: return !CXXInfo->VBPtrOffset.isNegative(); } - CharUnits getRequiredAlignment() const { - return RequiredAlignment; - } + CharUnits getRequiredAlignment() const { return RequiredAlignment; } bool endsWithZeroSizedObject() const { return CXXInfo && CXXInfo->EndsWithZeroSizedObject; diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 3dcfc9fee62..505ea700fd0 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -461,6 +461,15 @@ public: bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child); +#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \ + bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D); + DEF_TRAVERSE_TMPL_INST(Class) + DEF_TRAVERSE_TMPL_INST(Var) + DEF_TRAVERSE_TMPL_INST(Function) +#undef DEF_TRAVERSE_TMPL_INST + + bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); + private: // These are helper methods used by more than one Traverse* method. bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL); @@ -469,12 +478,6 @@ private: template bool TraverseDeclTemplateParameterLists(T *D); -#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \ - bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D); - DEF_TRAVERSE_TMPL_INST(Class) - DEF_TRAVERSE_TMPL_INST(Var) - DEF_TRAVERSE_TMPL_INST(Function) -#undef DEF_TRAVERSE_TMPL_INST bool TraverseTemplateArgumentLocsHelper(const TemplateArgumentLoc *TAL, unsigned Count); bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL); @@ -487,15 +490,15 @@ private: bool TraverseOMPExecutableDirective(OMPExecutableDirective *S); bool TraverseOMPLoopDirective(OMPLoopDirective *S); bool TraverseOMPClause(OMPClause *C); -#define OMP_CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C); -#include "llvm/Frontend/OpenMP/OMPKinds.def" +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C); +#include "llvm/Frontend/OpenMP/OMP.inc" /// Process clauses with list of variables. template bool VisitOMPClauseList(T *Node); /// Process clauses with pre-initis. bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *Node); bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node); - bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue); bool PostVisitStmt(Stmt *S); }; @@ -1777,8 +1780,17 @@ DEF_TRAVERSE_DECL(TemplateTypeParmDecl, { // D is the "T" in something like "template class vector;" if (D->getTypeForDecl()) TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0))); - if (const auto *TC = D->getTypeConstraint()) - TRY_TO(TraverseConceptReference(*TC)); + if (const auto *TC = D->getTypeConstraint()) { + if (Expr *IDC = TC->getImmediatelyDeclaredConstraint()) { + TRY_TO(TraverseStmt(IDC)); + } else { + // Avoid traversing the ConceptReference in the TypeCosntraint + // if we have an immediately-declared-constraint, otherwise + // we'll end up visiting the concept and the arguments in + // the TC twice. + TRY_TO(TraverseConceptReference(*TC)); + } + } if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) TRY_TO(TraverseTypeLoc(D->getDefaultArgumentInfo()->getTypeLoc())); }) @@ -1961,6 +1973,8 @@ DEF_TRAVERSE_DECL(MSPropertyDecl, { TRY_TO(TraverseDeclaratorHelper(D)); }) DEF_TRAVERSE_DECL(MSGuidDecl, {}) +DEF_TRAVERSE_DECL(TemplateParamObjectDecl, {}) + DEF_TRAVERSE_DECL(FieldDecl, { TRY_TO(TraverseDeclaratorHelper(D)); if (D->isBitField()) @@ -2491,17 +2505,12 @@ DEF_TRAVERSE_STMT(LambdaExpr, { TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc(); FunctionProtoTypeLoc Proto = TL.getAsAdjusted(); - for (Decl *D : S->getExplicitTemplateParameters()) { - // Visit explicit template parameters. - TRY_TO(TraverseDecl(D)); - } + TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList())); if (S->hasExplicitParameters()) { // Visit parameters. for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) TRY_TO(TraverseDecl(Proto.getParam(I))); } - if (S->hasExplicitResultType()) - TRY_TO(TraverseTypeLoc(Proto.getReturnLoc())); auto *T = Proto.getTypePtr(); for (const auto &E : T->exceptions()) @@ -2510,6 +2519,10 @@ DEF_TRAVERSE_STMT(LambdaExpr, { if (Expr *NE = T->getNoexceptExpr()) TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(NE); + if (S->hasExplicitResultType()) + TRY_TO(TraverseTypeLoc(Proto.getReturnLoc())); + TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getTrailingRequiresClause()); + TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody()); } ShouldVisitChildren = false; @@ -2938,16 +2951,15 @@ bool RecursiveASTVisitor::TraverseOMPClause(OMPClause *C) { if (!C) return true; switch (C->getClauseKind()) { -#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ +#define GEN_CLANG_CLAUSE_CLASS +#define CLAUSE_CLASS(Enum, Str, Class) \ case llvm::omp::Clause::Enum: \ TRY_TO(Visit##Class(static_cast(C))); \ break; -#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ +#define CLAUSE_NO_CLASS(Enum, Str) \ case llvm::omp::Clause::Enum: \ break; -#include "llvm/Frontend/OpenMP/OMPKinds.def" - default: - break; +#include "llvm/Frontend/OpenMP/OMP.inc" } return true; } diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h index 0975773dd2c..87252337a0f 100644 --- a/clang/include/clang/AST/Redeclarable.h +++ b/clang/include/clang/AST/Redeclarable.h @@ -370,6 +370,7 @@ public: private: friend struct llvm::DenseMapInfo>; + friend struct llvm::PointerLikeTypeTraits>; decl_type *Ptr = nullptr; }; @@ -407,6 +408,20 @@ struct DenseMapInfo> { } }; +template +struct PointerLikeTypeTraits> { + static inline void *getAsVoidPointer(clang::CanonicalDeclPtr P) { + return P.Ptr; + } + static inline clang::CanonicalDeclPtr getFromVoidPointer(void *P) { + clang::CanonicalDeclPtr C; + C.Ptr = PointerLikeTypeTraits::getFromVoidPtr(P); + return C; + } + static constexpr int NumLowBitsAvailable = + PointerLikeTypeTraits::NumLowBitsAvailable; +}; + } // namespace llvm #endif // LLVM_CLANG_AST_REDECLARABLE_H diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index d3fad58fcf5..c2e69a91e55 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -464,8 +464,11 @@ protected: /// True if the callee of the call expression was found using ADL. unsigned UsesADL : 1; + /// True if the call expression has some floating-point features. + unsigned HasFPFeatures : 1; + /// Padding used to align OffsetToTrailingObjects to a byte multiple. - unsigned : 24 - 2 - NumExprBits; + unsigned : 24 - 3 - NumExprBits; /// The offset in bytes from the this pointer to the start of the /// trailing objects belonging to CallExpr. Intentionally byte sized @@ -518,6 +521,9 @@ protected: unsigned Kind : 6; unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr. + /// True if the call expression has some floating-point features. + unsigned HasFPFeatures : 1; + /// The number of CXXBaseSpecifiers in the cast. 14 bits would be enough /// here. ([implimits] Direct and indirect base classes [16384]). unsigned BasePathSize; @@ -1095,6 +1101,14 @@ public: /// de-serialization). struct EmptyShell {}; + /// The likelihood of a branch being taken. + enum Likelihood { + LH_Unlikely = -1, ///< Branch has the [[unlikely]] attribute. + LH_None, ///< No attribute set or branches of the IfStmt have + ///< the same attribute. + LH_Likely ///< Branch has the [[likely]] attribute. + }; + protected: /// Iterator for iterating over Stmt * arrays that contain only T *. /// @@ -1163,6 +1177,26 @@ public: static void EnableStatistics(); static void PrintStats(); + /// \returns the likelihood of a set of attributes. + static Likelihood getLikelihood(ArrayRef Attrs); + + /// \returns the likelihood of a statement. + static Likelihood getLikelihood(const Stmt *S); + + /// \returns the likelihood attribute of a statement. + static const Attr *getLikelihoodAttr(const Stmt *S); + + /// \returns the likelihood of the 'then' branch of an 'if' statement. The + /// 'else' branch is required to determine whether both branches specify the + /// same likelihood, which affects the result. + static Likelihood getLikelihood(const Stmt *Then, const Stmt *Else); + + /// \returns whether the likelihood of the branches of an if statement are + /// conflicting. When the first element is \c true there's a conflict and + /// the Attr's are the conflicting attributes of the Then and Else Stmt. + static std::tuple + determineLikelihoodConflict(const Stmt *Then, const Stmt *Else); + /// Dumps the specified AST fragment and all subtrees to /// \c llvm::errs(). void dump() const; @@ -1892,6 +1926,8 @@ class IfStmt final // Present if and only if hasElseStorage(). enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 }; enum { NumMandatoryStmtPtr = 2 }; + SourceLocation LParenLoc; + SourceLocation RParenLoc; unsigned numTrailingObjects(OverloadToken) const { return NumMandatoryStmtPtr + hasElseStorage() + hasVarStorage() + @@ -1912,7 +1948,8 @@ class IfStmt final /// Build an if/then/else statement. IfStmt(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt *Init, - VarDecl *Var, Expr *Cond, Stmt *Then, SourceLocation EL, Stmt *Else); + VarDecl *Var, Expr *Cond, SourceLocation LParenLoc, + SourceLocation RParenLoc, Stmt *Then, SourceLocation EL, Stmt *Else); /// Build an empty if/then/else statement. explicit IfStmt(EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit); @@ -1921,7 +1958,8 @@ public: /// Create an IfStmt. static IfStmt *Create(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt *Init, VarDecl *Var, Expr *Cond, - Stmt *Then, SourceLocation EL = SourceLocation(), + SourceLocation LPL, SourceLocation RPL, Stmt *Then, + SourceLocation EL = SourceLocation(), Stmt *Else = nullptr); /// Create an empty IfStmt optionally with storage for an else statement, @@ -2051,6 +2089,10 @@ public: return getElse()->getEndLoc(); return getThen()->getEndLoc(); } + SourceLocation getLParenLoc() const { return LParenLoc; } + void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } + SourceLocation getRParenLoc() const { return RParenLoc; } + void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; } // Iterators over subexpressions. The iterators will include iterating // over the initialization expression referenced by the condition variable. @@ -2098,6 +2140,8 @@ class SwitchStmt final : public Stmt, // Always present. enum { InitOffset = 0, BodyOffsetFromCond = 1 }; enum { NumMandatoryStmtPtr = 2 }; + SourceLocation LParenLoc; + SourceLocation RParenLoc; unsigned numTrailingObjects(OverloadToken) const { return NumMandatoryStmtPtr + hasInitStorage() + hasVarStorage(); @@ -2111,7 +2155,8 @@ class SwitchStmt final : public Stmt, unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; } /// Build a switch statement. - SwitchStmt(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond); + SwitchStmt(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond, + SourceLocation LParenLoc, SourceLocation RParenLoc); /// Build a empty switch statement. explicit SwitchStmt(EmptyShell Empty, bool HasInit, bool HasVar); @@ -2119,7 +2164,8 @@ class SwitchStmt final : public Stmt, public: /// Create a switch statement. static SwitchStmt *Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, - Expr *Cond); + Expr *Cond, SourceLocation LParenLoc, + SourceLocation RParenLoc); /// Create an empty switch statement optionally with storage for /// an init expression and a condition variable. @@ -2207,6 +2253,10 @@ public: SourceLocation getSwitchLoc() const { return SwitchStmtBits.SwitchLoc; } void setSwitchLoc(SourceLocation L) { SwitchStmtBits.SwitchLoc = L; } + SourceLocation getLParenLoc() const { return LParenLoc; } + void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } + SourceLocation getRParenLoc() const { return RParenLoc; } + void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; } void setBody(Stmt *S, SourceLocation SL) { setBody(S); diff --git a/clang/include/clang/AST/StmtIterator.h b/clang/include/clang/AST/StmtIterator.h index 911205347aa..bcdb0df829f 100644 --- a/clang/include/clang/AST/StmtIterator.h +++ b/clang/include/clang/AST/StmtIterator.h @@ -104,12 +104,13 @@ public: return tmp; } - bool operator==(const DERIVED& RHS) const { - return stmt == RHS.stmt && DGI == RHS.DGI && RawVAPtr == RHS.RawVAPtr; + friend bool operator==(const DERIVED &LHS, const DERIVED &RHS) { + return LHS.stmt == RHS.stmt && LHS.DGI == RHS.DGI && + LHS.RawVAPtr == RHS.RawVAPtr; } - bool operator!=(const DERIVED& RHS) const { - return stmt != RHS.stmt || DGI != RHS.DGI || RawVAPtr != RHS.RawVAPtr; + friend bool operator!=(const DERIVED &LHS, const DERIVED &RHS) { + return !(LHS == RHS); } REFERENCE operator*() const { diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index bd87eafc903..b7bbf15949a 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_AST_STMTOPENMP_H #define LLVM_CLANG_AST_STMTOPENMP_H +#include "clang/AST/ASTContext.h" #include "clang/AST/Expr.h" #include "clang/AST/OpenMPClause.h" #include "clang/AST/Stmt.h" @@ -32,30 +33,26 @@ namespace clang { /// class OMPExecutableDirective : public Stmt { friend class ASTStmtReader; + friend class ASTStmtWriter; + /// Kind of the directive. - OpenMPDirectiveKind Kind; + OpenMPDirectiveKind Kind = llvm::omp::OMPD_unknown; /// Starting location of the directive (directive keyword). SourceLocation StartLoc; /// Ending location of the directive. SourceLocation EndLoc; - /// Numbers of clauses. - const unsigned NumClauses; - /// Number of child expressions/stmts. - const unsigned NumChildren; - /// Offset from this to the start of clauses. - /// There are NumClauses pointers to clauses, they are followed by - /// NumChildren pointers to child stmts/exprs (if the directive type - /// requires an associated stmt, then it has to be the first of them). - const unsigned ClausesOffset; /// Get the clauses storage. MutableArrayRef getClauses() { - OMPClause **ClauseStorage = reinterpret_cast( - reinterpret_cast(this) + ClausesOffset); - return MutableArrayRef(ClauseStorage, NumClauses); + if (!Data) + return llvm::None; + return Data->getClauses(); } protected: + /// Data, associated with the directive. + OMPChildren *Data = nullptr; + /// Build instance of directive of class \a K. /// /// \param SC Statement class. @@ -63,28 +60,57 @@ protected: /// \param StartLoc Starting location of the directive (directive keyword). /// \param EndLoc Ending location of the directive. /// - template - OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K, - SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses, unsigned NumChildren) + OMPExecutableDirective(StmtClass SC, OpenMPDirectiveKind K, + SourceLocation StartLoc, SourceLocation EndLoc) : Stmt(SC), Kind(K), StartLoc(std::move(StartLoc)), - EndLoc(std::move(EndLoc)), NumClauses(NumClauses), - NumChildren(NumChildren), - ClausesOffset(llvm::alignTo(sizeof(T), alignof(OMPClause *))) {} + EndLoc(std::move(EndLoc)) {} - /// Sets the list of variables for this clause. - /// - /// \param Clauses The list of clauses for the directive. - /// - void setClauses(ArrayRef Clauses); + template + static T *createDirective(const ASTContext &C, ArrayRef Clauses, + Stmt *AssociatedStmt, unsigned NumChildren, + Params &&... P) { + void *Mem = + C.Allocate(sizeof(T) + OMPChildren::size(Clauses.size(), AssociatedStmt, + NumChildren), + alignof(T)); - /// Set the associated statement for the directive. - /// - /// /param S Associated statement. - /// - void setAssociatedStmt(Stmt *S) { - assert(hasAssociatedStmt() && "no associated statement."); - *child_begin() = S; + auto *Data = OMPChildren::Create(reinterpret_cast(Mem) + 1, Clauses, + AssociatedStmt, NumChildren); + auto *Inst = new (Mem) T(std::forward(P)...); + Inst->Data = Data; + return Inst; + } + + template + static T *createEmptyDirective(const ASTContext &C, unsigned NumClauses, + bool HasAssociatedStmt, unsigned NumChildren, + Params &&... P) { + void *Mem = + C.Allocate(sizeof(T) + OMPChildren::size(NumClauses, HasAssociatedStmt, + NumChildren), + alignof(T)); + auto *Data = + OMPChildren::CreateEmpty(reinterpret_cast(Mem) + 1, NumClauses, + HasAssociatedStmt, NumChildren); + auto *Inst = new (Mem) T(std::forward(P)...); + Inst->Data = Data; + return Inst; + } + + template + static T *createEmptyDirective(const ASTContext &C, unsigned NumClauses, + bool HasAssociatedStmt = false, + unsigned NumChildren = 0) { + void *Mem = + C.Allocate(sizeof(T) + OMPChildren::size(NumClauses, HasAssociatedStmt, + NumChildren), + alignof(T)); + auto *Data = + OMPChildren::CreateEmpty(reinterpret_cast(Mem) + 1, NumClauses, + HasAssociatedStmt, NumChildren); + auto *Inst = new (Mem) T; + Inst->Data = Data; + return Inst; } public: @@ -238,59 +264,50 @@ public: void setLocEnd(SourceLocation Loc) { EndLoc = Loc; } /// Get number of clauses. - unsigned getNumClauses() const { return NumClauses; } + unsigned getNumClauses() const { + if (!Data) + return 0; + return Data->getNumClauses(); + } /// Returns specified clause. /// - /// \param i Number of clause. + /// \param I Number of clause. /// - OMPClause *getClause(unsigned i) const { return clauses()[i]; } + OMPClause *getClause(unsigned I) const { return clauses()[I]; } /// Returns true if directive has associated statement. - bool hasAssociatedStmt() const { return NumChildren > 0; } + bool hasAssociatedStmt() const { return Data && Data->hasAssociatedStmt(); } /// Returns statement associated with the directive. const Stmt *getAssociatedStmt() const { - assert(hasAssociatedStmt() && "no associated statement."); - return *child_begin(); + return const_cast(this)->getAssociatedStmt(); } Stmt *getAssociatedStmt() { - assert(hasAssociatedStmt() && "no associated statement."); - return *child_begin(); + assert(hasAssociatedStmt() && + "Expected directive with the associated statement."); + return Data->getAssociatedStmt(); } /// Returns the captured statement associated with the /// component region within the (combined) directive. - // - // \param RegionKind Component region kind. + /// + /// \param RegionKind Component region kind. const CapturedStmt *getCapturedStmt(OpenMPDirectiveKind RegionKind) const { + assert(hasAssociatedStmt() && + "Expected directive with the associated statement."); SmallVector CaptureRegions; getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind()); - assert(std::any_of( - CaptureRegions.begin(), CaptureRegions.end(), - [=](const OpenMPDirectiveKind K) { return K == RegionKind; }) && - "RegionKind not found in OpenMP CaptureRegions."); - auto *CS = cast(getAssociatedStmt()); - for (auto ThisCaptureRegion : CaptureRegions) { - if (ThisCaptureRegion == RegionKind) - return CS; - CS = cast(CS->getCapturedStmt()); - } - llvm_unreachable("Incorrect RegionKind specified for directive."); + return Data->getCapturedStmt(RegionKind, CaptureRegions); } /// Get innermost captured statement for the construct. CapturedStmt *getInnermostCapturedStmt() { - assert(hasAssociatedStmt() && getAssociatedStmt() && - "Must have associated statement."); + assert(hasAssociatedStmt() && + "Expected directive with the associated statement."); SmallVector CaptureRegions; getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind()); - assert(!CaptureRegions.empty() && - "At least one captured statement must be provided."); - auto *CS = cast(getAssociatedStmt()); - for (unsigned Level = CaptureRegions.size(); Level > 1; --Level) - CS = cast(CS->getCapturedStmt()); - return CS; + return Data->getInnermostCapturedStmt(CaptureRegions); } const CapturedStmt *getInnermostCapturedStmt() const { @@ -306,26 +323,19 @@ public: } child_range children() { - if (!hasAssociatedStmt()) + if (!Data) return child_range(child_iterator(), child_iterator()); - Stmt **ChildStorage = reinterpret_cast(getClauses().end()); - /// Do not mark all the special expression/statements as children, except - /// for the associated statement. - return child_range(ChildStorage, ChildStorage + 1); + return Data->getAssociatedStmtAsRange(); } const_child_range children() const { - if (!hasAssociatedStmt()) - return const_child_range(const_child_iterator(), const_child_iterator()); - Stmt **ChildStorage = reinterpret_cast( - const_cast(this)->getClauses().end()); - return const_child_range(ChildStorage, ChildStorage + 1); + return const_cast(this)->children(); } - ArrayRef clauses() { return getClauses(); } - ArrayRef clauses() const { - return const_cast(this)->getClauses(); + if (!Data) + return llvm::None; + return Data->getClauses(); } /// Returns whether or not this is a Standalone directive. @@ -337,11 +347,18 @@ public: /// Returns the AST node representing OpenMP structured-block of this /// OpenMP executable directive, /// Prerequisite: Executable Directive must not be Standalone directive. - const Stmt *getStructuredBlock() const; + const Stmt *getStructuredBlock() const { + return const_cast(this)->getStructuredBlock(); + } + Stmt *getStructuredBlock(); - Stmt *getStructuredBlock() { - return const_cast( - const_cast(this)->getStructuredBlock()); + const Stmt *getRawStmt() const { + return const_cast(this)->getRawStmt(); + } + Stmt *getRawStmt() { + assert(hasAssociatedStmt() && + "Expected directive with the associated statement."); + return Data->getRawStmt(); } }; @@ -356,36 +373,28 @@ public: /// class OMPParallelDirective : public OMPExecutableDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive (directive keyword). /// \param EndLoc Ending Location of the directive. /// - OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelDirectiveClass, - llvm::omp::OMPD_parallel, StartLoc, EndLoc, - NumClauses, 1), - HasCancel(false) {} + OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPParallelDirectiveClass, + llvm::omp::OMPD_parallel, StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPParallelDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelDirectiveClass, + explicit OMPParallelDirective() + : OMPExecutableDirective(OMPParallelDirectiveClass, llvm::omp::OMPD_parallel, SourceLocation(), - SourceLocation(), NumClauses, 1), - HasCancel(false) {} + SourceLocation()) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { Data->getChildren()[0] = E; } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -416,8 +425,12 @@ public: unsigned NumClauses, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[0]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this)->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -433,7 +446,7 @@ public: class OMPLoopDirective : public OMPExecutableDirective { friend class ASTStmtReader; /// Number of collapsed loops as specified by 'collapse' clause. - unsigned CollapsedNum; + unsigned CollapsedNum = 0; /// Offsets to the stored exprs. /// This enumeration contains offsets to all the pointers to children @@ -452,110 +465,110 @@ class OMPLoopDirective : public OMPExecutableDirective { /// (e.g. 'distribute parallel for') /// enum { - AssociatedStmtOffset = 0, - IterationVariableOffset = 1, - LastIterationOffset = 2, - CalcLastIterationOffset = 3, - PreConditionOffset = 4, - CondOffset = 5, - InitOffset = 6, - IncOffset = 7, - PreInitsOffset = 8, + IterationVariableOffset = 0, + LastIterationOffset = 1, + CalcLastIterationOffset = 2, + PreConditionOffset = 3, + CondOffset = 4, + InitOffset = 5, + IncOffset = 6, + PreInitsOffset = 7, // The '...End' enumerators do not correspond to child expressions - they // specify the offset to the end (and start of the following counters/ // updates/finals/dependent_counters/dependent_inits/finals_conditions // arrays). - DefaultEnd = 9, + DefaultEnd = 8, // The following 8 exprs are used by worksharing and distribute loops only. - IsLastIterVariableOffset = 9, - LowerBoundVariableOffset = 10, - UpperBoundVariableOffset = 11, - StrideVariableOffset = 12, - EnsureUpperBoundOffset = 13, - NextLowerBoundOffset = 14, - NextUpperBoundOffset = 15, - NumIterationsOffset = 16, + IsLastIterVariableOffset = 8, + LowerBoundVariableOffset = 9, + UpperBoundVariableOffset = 10, + StrideVariableOffset = 11, + EnsureUpperBoundOffset = 12, + NextLowerBoundOffset = 13, + NextUpperBoundOffset = 14, + NumIterationsOffset = 15, // Offset to the end for worksharing loop directives. - WorksharingEnd = 17, - PrevLowerBoundVariableOffset = 17, - PrevUpperBoundVariableOffset = 18, - DistIncOffset = 19, - PrevEnsureUpperBoundOffset = 20, - CombinedLowerBoundVariableOffset = 21, - CombinedUpperBoundVariableOffset = 22, - CombinedEnsureUpperBoundOffset = 23, - CombinedInitOffset = 24, - CombinedConditionOffset = 25, - CombinedNextLowerBoundOffset = 26, - CombinedNextUpperBoundOffset = 27, - CombinedDistConditionOffset = 28, - CombinedParForInDistConditionOffset = 29, + WorksharingEnd = 16, + PrevLowerBoundVariableOffset = 16, + PrevUpperBoundVariableOffset = 17, + DistIncOffset = 18, + PrevEnsureUpperBoundOffset = 19, + CombinedLowerBoundVariableOffset = 20, + CombinedUpperBoundVariableOffset = 21, + CombinedEnsureUpperBoundOffset = 22, + CombinedInitOffset = 23, + CombinedConditionOffset = 24, + CombinedNextLowerBoundOffset = 25, + CombinedNextUpperBoundOffset = 26, + CombinedDistConditionOffset = 27, + CombinedParForInDistConditionOffset = 28, // Offset to the end (and start of the following // counters/updates/finals/dependent_counters/dependent_inits/finals_conditions // arrays) for combined distribute loop directives. - CombinedDistributeEnd = 30, + CombinedDistributeEnd = 29, }; /// Get the counters storage. MutableArrayRef getCounters() { - Expr **Storage = reinterpret_cast( - &(*(std::next(child_begin(), getArraysOffset(getDirectiveKind()))))); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind())]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the private counters storage. MutableArrayRef getPrivateCounters() { - Expr **Storage = reinterpret_cast(&*std::next( - child_begin(), getArraysOffset(getDirectiveKind()) + CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the updates storage. MutableArrayRef getInits() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 2 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the updates storage. MutableArrayRef getUpdates() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 3 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the final counter updates storage. MutableArrayRef getFinals() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 4 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 4 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the dependent counters storage. MutableArrayRef getDependentCounters() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 5 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 5 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the dependent inits storage. MutableArrayRef getDependentInits() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 6 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 6 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } /// Get the finals conditions storage. MutableArrayRef getFinalsConditions() { - Expr **Storage = reinterpret_cast( - &*std::next(child_begin(), - getArraysOffset(getDirectiveKind()) + 7 * CollapsedNum)); - return MutableArrayRef(Storage, CollapsedNum); + auto **Storage = reinterpret_cast( + &Data->getChildren()[getArraysOffset(getDirectiveKind()) + + 7 * CollapsedNum]); + return llvm::makeMutableArrayRef(Storage, CollapsedNum); } protected: @@ -566,17 +579,11 @@ protected: /// \param StartLoc Starting location of the directive (directive keyword). /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed loops from 'collapse' clause. - /// \param NumClauses Number of clauses. - /// \param NumSpecialChildren Number of additional directive-specific stmts. /// - template - OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind, + OMPLoopDirective(StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses, - unsigned NumSpecialChildren = 0) - : OMPExecutableDirective(That, SC, Kind, StartLoc, EndLoc, NumClauses, - numLoopChildren(CollapsedNum, Kind) + - NumSpecialChildren), + unsigned CollapsedNum) + : OMPExecutableDirective(SC, Kind, StartLoc, EndLoc), CollapsedNum(CollapsedNum) {} /// Offset to the start of children expression arrays. @@ -599,146 +606,142 @@ protected: } void setIterationVariable(Expr *IV) { - *std::next(child_begin(), IterationVariableOffset) = IV; + Data->getChildren()[IterationVariableOffset] = IV; } void setLastIteration(Expr *LI) { - *std::next(child_begin(), LastIterationOffset) = LI; + Data->getChildren()[LastIterationOffset] = LI; } void setCalcLastIteration(Expr *CLI) { - *std::next(child_begin(), CalcLastIterationOffset) = CLI; + Data->getChildren()[CalcLastIterationOffset] = CLI; } - void setPreCond(Expr *PC) { - *std::next(child_begin(), PreConditionOffset) = PC; - } - void setCond(Expr *Cond) { - *std::next(child_begin(), CondOffset) = Cond; - } - void setInit(Expr *Init) { *std::next(child_begin(), InitOffset) = Init; } - void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; } + void setPreCond(Expr *PC) { Data->getChildren()[PreConditionOffset] = PC; } + void setCond(Expr *Cond) { Data->getChildren()[CondOffset] = Cond; } + void setInit(Expr *Init) { Data->getChildren()[InitOffset] = Init; } + void setInc(Expr *Inc) { Data->getChildren()[IncOffset] = Inc; } void setPreInits(Stmt *PreInits) { - *std::next(child_begin(), PreInitsOffset) = PreInits; + Data->getChildren()[PreInitsOffset] = PreInits; } void setIsLastIterVariable(Expr *IL) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), IsLastIterVariableOffset) = IL; + Data->getChildren()[IsLastIterVariableOffset] = IL; } void setLowerBoundVariable(Expr *LB) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), LowerBoundVariableOffset) = LB; + Data->getChildren()[LowerBoundVariableOffset] = LB; } void setUpperBoundVariable(Expr *UB) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), UpperBoundVariableOffset) = UB; + Data->getChildren()[UpperBoundVariableOffset] = UB; } void setStrideVariable(Expr *ST) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), StrideVariableOffset) = ST; + Data->getChildren()[StrideVariableOffset] = ST; } void setEnsureUpperBound(Expr *EUB) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), EnsureUpperBoundOffset) = EUB; + Data->getChildren()[EnsureUpperBoundOffset] = EUB; } void setNextLowerBound(Expr *NLB) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), NextLowerBoundOffset) = NLB; + Data->getChildren()[NextLowerBoundOffset] = NLB; } void setNextUpperBound(Expr *NUB) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), NextUpperBoundOffset) = NUB; + Data->getChildren()[NextUpperBoundOffset] = NUB; } void setNumIterations(Expr *NI) { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - *std::next(child_begin(), NumIterationsOffset) = NI; + Data->getChildren()[NumIterationsOffset] = NI; } void setPrevLowerBoundVariable(Expr *PrevLB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), PrevLowerBoundVariableOffset) = PrevLB; + Data->getChildren()[PrevLowerBoundVariableOffset] = PrevLB; } void setPrevUpperBoundVariable(Expr *PrevUB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), PrevUpperBoundVariableOffset) = PrevUB; + Data->getChildren()[PrevUpperBoundVariableOffset] = PrevUB; } void setDistInc(Expr *DistInc) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), DistIncOffset) = DistInc; + Data->getChildren()[DistIncOffset] = DistInc; } void setPrevEnsureUpperBound(Expr *PrevEUB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB; + Data->getChildren()[PrevEnsureUpperBoundOffset] = PrevEUB; } void setCombinedLowerBoundVariable(Expr *CombLB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedLowerBoundVariableOffset) = CombLB; + Data->getChildren()[CombinedLowerBoundVariableOffset] = CombLB; } void setCombinedUpperBoundVariable(Expr *CombUB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedUpperBoundVariableOffset) = CombUB; + Data->getChildren()[CombinedUpperBoundVariableOffset] = CombUB; } void setCombinedEnsureUpperBound(Expr *CombEUB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB; + Data->getChildren()[CombinedEnsureUpperBoundOffset] = CombEUB; } void setCombinedInit(Expr *CombInit) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedInitOffset) = CombInit; + Data->getChildren()[CombinedInitOffset] = CombInit; } void setCombinedCond(Expr *CombCond) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedConditionOffset) = CombCond; + Data->getChildren()[CombinedConditionOffset] = CombCond; } void setCombinedNextLowerBound(Expr *CombNLB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedNextLowerBoundOffset) = CombNLB; + Data->getChildren()[CombinedNextLowerBoundOffset] = CombNLB; } void setCombinedNextUpperBound(Expr *CombNUB) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - *std::next(child_begin(), CombinedNextUpperBoundOffset) = CombNUB; + Data->getChildren()[CombinedNextUpperBoundOffset] = CombNUB; } void setCombinedDistCond(Expr *CombDistCond) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound distribute sharing directive"); - *std::next(child_begin(), CombinedDistConditionOffset) = CombDistCond; + Data->getChildren()[CombinedDistConditionOffset] = CombDistCond; } void setCombinedParForInDistCond(Expr *CombParForInDistCond) { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound distribute sharing directive"); - *std::next(child_begin(), - CombinedParForInDistConditionOffset) = CombParForInDistCond; + Data->getChildren()[CombinedParForInDistConditionOffset] = + CombParForInDistCond; } void setCounters(ArrayRef A); void setPrivateCounters(ArrayRef A); @@ -925,178 +928,144 @@ public: unsigned getCollapsedNumber() const { return CollapsedNum; } Expr *getIterationVariable() const { - return const_cast(reinterpret_cast( - *std::next(child_begin(), IterationVariableOffset))); + return cast(Data->getChildren()[IterationVariableOffset]); } Expr *getLastIteration() const { - return const_cast(reinterpret_cast( - *std::next(child_begin(), LastIterationOffset))); + return cast(Data->getChildren()[LastIterationOffset]); } Expr *getCalcLastIteration() const { - return const_cast(reinterpret_cast( - *std::next(child_begin(), CalcLastIterationOffset))); + return cast(Data->getChildren()[CalcLastIterationOffset]); } Expr *getPreCond() const { - return const_cast(reinterpret_cast( - *std::next(child_begin(), PreConditionOffset))); - } - Expr *getCond() const { - return const_cast( - reinterpret_cast(*std::next(child_begin(), CondOffset))); - } - Expr *getInit() const { - return const_cast( - reinterpret_cast(*std::next(child_begin(), InitOffset))); - } - Expr *getInc() const { - return const_cast( - reinterpret_cast(*std::next(child_begin(), IncOffset))); + return cast(Data->getChildren()[PreConditionOffset]); } + Expr *getCond() const { return cast(Data->getChildren()[CondOffset]); } + Expr *getInit() const { return cast(Data->getChildren()[InitOffset]); } + Expr *getInc() const { return cast(Data->getChildren()[IncOffset]); } const Stmt *getPreInits() const { - return *std::next(child_begin(), PreInitsOffset); + return Data->getChildren()[PreInitsOffset]; } - Stmt *getPreInits() { return *std::next(child_begin(), PreInitsOffset); } + Stmt *getPreInits() { return Data->getChildren()[PreInitsOffset]; } Expr *getIsLastIterVariable() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), IsLastIterVariableOffset))); + return cast(Data->getChildren()[IsLastIterVariableOffset]); } Expr *getLowerBoundVariable() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), LowerBoundVariableOffset))); + return cast(Data->getChildren()[LowerBoundVariableOffset]); } Expr *getUpperBoundVariable() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), UpperBoundVariableOffset))); + return cast(Data->getChildren()[UpperBoundVariableOffset]); } Expr *getStrideVariable() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), StrideVariableOffset))); + return cast(Data->getChildren()[StrideVariableOffset]); } Expr *getEnsureUpperBound() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), EnsureUpperBoundOffset))); + return cast(Data->getChildren()[EnsureUpperBoundOffset]); } Expr *getNextLowerBound() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), NextLowerBoundOffset))); + return cast(Data->getChildren()[NextLowerBoundOffset]); } Expr *getNextUpperBound() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), NextUpperBoundOffset))); + return cast(Data->getChildren()[NextUpperBoundOffset]); } Expr *getNumIterations() const { assert((isOpenMPWorksharingDirective(getDirectiveKind()) || isOpenMPTaskLoopDirective(getDirectiveKind()) || isOpenMPDistributeDirective(getDirectiveKind())) && "expected worksharing loop directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), NumIterationsOffset))); + return cast(Data->getChildren()[NumIterationsOffset]); } Expr *getPrevLowerBoundVariable() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), PrevLowerBoundVariableOffset))); + return cast(Data->getChildren()[PrevLowerBoundVariableOffset]); } Expr *getPrevUpperBoundVariable() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), PrevUpperBoundVariableOffset))); + return cast(Data->getChildren()[PrevUpperBoundVariableOffset]); } Expr *getDistInc() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), DistIncOffset))); + return cast(Data->getChildren()[DistIncOffset]); } Expr *getPrevEnsureUpperBound() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), PrevEnsureUpperBoundOffset))); + return cast(Data->getChildren()[PrevEnsureUpperBoundOffset]); } Expr *getCombinedLowerBoundVariable() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedLowerBoundVariableOffset))); + return cast(Data->getChildren()[CombinedLowerBoundVariableOffset]); } Expr *getCombinedUpperBoundVariable() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedUpperBoundVariableOffset))); + return cast(Data->getChildren()[CombinedUpperBoundVariableOffset]); } Expr *getCombinedEnsureUpperBound() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedEnsureUpperBoundOffset))); + return cast(Data->getChildren()[CombinedEnsureUpperBoundOffset]); } Expr *getCombinedInit() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedInitOffset))); + return cast(Data->getChildren()[CombinedInitOffset]); } Expr *getCombinedCond() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedConditionOffset))); + return cast(Data->getChildren()[CombinedConditionOffset]); } Expr *getCombinedNextLowerBound() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedNextLowerBoundOffset))); + return cast(Data->getChildren()[CombinedNextLowerBoundOffset]); } Expr *getCombinedNextUpperBound() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedNextUpperBoundOffset))); + return cast(Data->getChildren()[CombinedNextUpperBoundOffset]); } Expr *getCombinedDistCond() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound distribute sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedDistConditionOffset))); + return cast(Data->getChildren()[CombinedDistConditionOffset]); } Expr *getCombinedParForInDistCond() const { assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && "expected loop bound distribute sharing directive"); - return const_cast(reinterpret_cast( - *std::next(child_begin(), CombinedParForInDistConditionOffset))); + return cast(Data->getChildren()[CombinedParForInDistConditionOffset]); } /// Try to find the next loop sub-statement in the specified statement \p /// CurStmt. @@ -1206,27 +1175,25 @@ public: /// class OMPSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd, - StartLoc, EndLoc, CollapsedNum, NumClauses) {} + unsigned CollapsedNum) + : OMPLoopDirective(OMPSimdDirectiveClass, llvm::omp::OMPD_simd, StartLoc, + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + explicit OMPSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPSimdDirectiveClass, llvm::omp::OMPD_simd, + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -1271,38 +1238,34 @@ public: /// class OMPForDirective : public OMPLoopDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if current directive has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for, - StartLoc, EndLoc, CollapsedNum, NumClauses), - HasCancel(false) {} + unsigned CollapsedNum) + : OMPLoopDirective(OMPForDirectiveClass, llvm::omp::OMPD_for, StartLoc, + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses), - HasCancel(false) {} + explicit OMPForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPForDirectiveClass, llvm::omp::OMPD_for, + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren(getCollapsedNumber(), + llvm::omp::OMPD_for)] = E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -1338,8 +1301,13 @@ public: unsigned CollapsedNum, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this)->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -1360,28 +1328,25 @@ public: /// class OMPForSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPForSimdDirectiveClass, - llvm::omp::OMPD_for_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + unsigned CollapsedNum) + : OMPLoopDirective(OMPForSimdDirectiveClass, llvm::omp::OMPD_for_simd, + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPForSimdDirectiveClass, - llvm::omp::OMPD_for_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + explicit OMPForSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPForSimdDirectiveClass, llvm::omp::OMPD_for_simd, + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -1426,38 +1391,29 @@ public: /// class OMPSectionsDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; /// true if current directive has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPSectionsDirectiveClass, - llvm::omp::OMPD_sections, StartLoc, EndLoc, - NumClauses, 1), - HasCancel(false) {} + OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPSectionsDirectiveClass, + llvm::omp::OMPD_sections, StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPSectionsDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPSectionsDirectiveClass, + explicit OMPSectionsDirective() + : OMPExecutableDirective(OMPSectionsDirectiveClass, llvm::omp::OMPD_sections, SourceLocation(), - SourceLocation(), NumClauses, 1), - HasCancel(false) {} + SourceLocation()) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { Data->getChildren()[0] = E; } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -1489,8 +1445,12 @@ public: unsigned NumClauses, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[0]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this)->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -1508,9 +1468,10 @@ public: /// class OMPSectionDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// true if current directive has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// @@ -1518,17 +1479,15 @@ class OMPSectionDirective : public OMPExecutableDirective { /// \param EndLoc Ending location of the directive. /// OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPSectionDirectiveClass, - llvm::omp::OMPD_section, StartLoc, EndLoc, 0, 1), - HasCancel(false) {} + : OMPExecutableDirective(OMPSectionDirectiveClass, + llvm::omp::OMPD_section, StartLoc, EndLoc) {} /// Build an empty directive. /// explicit OMPSectionDirective() - : OMPExecutableDirective(this, OMPSectionDirectiveClass, + : OMPExecutableDirective(OMPSectionDirectiveClass, llvm::omp::OMPD_section, SourceLocation(), - SourceLocation(), 0, 1), - HasCancel(false) {} + SourceLocation()) {} public: /// Creates directive. @@ -1571,26 +1530,21 @@ public: /// class OMPSingleDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPSingleDirectiveClass, - llvm::omp::OMPD_single, StartLoc, EndLoc, - NumClauses, 1) {} + OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPSingleDirectiveClass, llvm::omp::OMPD_single, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPSingleDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPSingleDirectiveClass, - llvm::omp::OMPD_single, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + explicit OMPSingleDirective() + : OMPExecutableDirective(OMPSingleDirectiveClass, llvm::omp::OMPD_single, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -1627,22 +1581,21 @@ public: /// class OMPMasterDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPMasterDirectiveClass, - llvm::omp::OMPD_master, StartLoc, EndLoc, 0, 1) { - } + : OMPExecutableDirective(OMPMasterDirectiveClass, llvm::omp::OMPD_master, + StartLoc, EndLoc) {} /// Build an empty directive. /// explicit OMPMasterDirective() - : OMPExecutableDirective(this, OMPMasterDirectiveClass, - llvm::omp::OMPD_master, SourceLocation(), - SourceLocation(), 0, 1) {} + : OMPExecutableDirective(OMPMasterDirectiveClass, llvm::omp::OMPD_master, + SourceLocation(), SourceLocation()) {} public: /// Creates directive. @@ -1676,6 +1629,7 @@ public: /// class OMPCriticalDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Name of the directive. DeclarationNameInfo DirName; /// Build directive with the given start and end location. @@ -1683,24 +1637,19 @@ class OMPCriticalDirective : public OMPExecutableDirective { /// \param Name Name of the directive. /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// OMPCriticalDirective(const DeclarationNameInfo &Name, SourceLocation StartLoc, - SourceLocation EndLoc, unsigned NumClauses) - : OMPExecutableDirective(this, OMPCriticalDirectiveClass, - llvm::omp::OMPD_critical, StartLoc, EndLoc, - NumClauses, 1), + SourceLocation EndLoc) + : OMPExecutableDirective(OMPCriticalDirectiveClass, + llvm::omp::OMPD_critical, StartLoc, EndLoc), DirName(Name) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPCriticalDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPCriticalDirectiveClass, + explicit OMPCriticalDirective() + : OMPExecutableDirective(OMPCriticalDirectiveClass, llvm::omp::OMPD_critical, SourceLocation(), - SourceLocation(), NumClauses, 1), - DirName() {} + SourceLocation()) {} /// Set name of the directive. /// @@ -1751,40 +1700,37 @@ public: /// class OMPParallelForDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; /// true if current region has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelForDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelForDirectiveClass, llvm::omp::OMPD_parallel_for, StartLoc, EndLoc, - CollapsedNum, NumClauses), - HasCancel(false) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelForDirectiveClass, + explicit OMPParallelForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelForDirectiveClass, llvm::omp::OMPD_parallel_for, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses), - HasCancel(false) {} + SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren(getCollapsedNumber(), + llvm::omp::OMPD_parallel_for)] = E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -1822,8 +1768,14 @@ public: EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_parallel_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -1845,29 +1797,27 @@ public: /// class OMPParallelForSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelForSimdDirectiveClass, llvm::omp::OMPD_parallel_for_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPParallelForSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass, + explicit OMPParallelForSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelForSimdDirectiveClass, llvm::omp::OMPD_parallel_for_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -1912,25 +1862,20 @@ public: /// class OMPParallelMasterDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; - - OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, + OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPParallelMasterDirectiveClass, llvm::omp::OMPD_parallel_master, StartLoc, - EndLoc, NumClauses, 1) {} + EndLoc) {} - explicit OMPParallelMasterDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, + explicit OMPParallelMasterDirective() + : OMPExecutableDirective(OMPParallelMasterDirectiveClass, llvm::omp::OMPD_parallel_master, - SourceLocation(), SourceLocation(), NumClauses, - 1) {} + SourceLocation(), SourceLocation()) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { Data->getChildren()[0] = E; } public: /// Creates directive with a list of \a Clauses. @@ -1957,8 +1902,13 @@ public: CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[0]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } static bool classof(const Stmt *T) { return T->getStmtClass() == OMPParallelMasterDirectiveClass; @@ -1976,39 +1926,30 @@ public: /// class OMPParallelSectionsDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; /// true if current directive has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass, + OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPParallelSectionsDirectiveClass, llvm::omp::OMPD_parallel_sections, StartLoc, - EndLoc, NumClauses, 1), - HasCancel(false) {} + EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPParallelSectionsDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass, + explicit OMPParallelSectionsDirective() + : OMPExecutableDirective(OMPParallelSectionsDirectiveClass, llvm::omp::OMPD_parallel_sections, - SourceLocation(), SourceLocation(), NumClauses, - 1), - HasCancel(false) {} + SourceLocation(), SourceLocation()) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { Data->getChildren()[0] = E; } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -2040,8 +1981,13 @@ public: CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[0]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -2061,31 +2007,24 @@ public: /// class OMPTaskDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// true if this directive has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTaskDirectiveClass, - llvm::omp::OMPD_task, StartLoc, EndLoc, - NumClauses, 1), - HasCancel(false) {} + OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTaskDirectiveClass, llvm::omp::OMPD_task, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTaskDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTaskDirectiveClass, - llvm::omp::OMPD_task, SourceLocation(), - SourceLocation(), NumClauses, 1), - HasCancel(false) {} + explicit OMPTaskDirective() + : OMPExecutableDirective(OMPTaskDirectiveClass, llvm::omp::OMPD_task, + SourceLocation(), SourceLocation()) {} /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -2130,22 +2069,22 @@ public: /// class OMPTaskyieldDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, - llvm::omp::OMPD_taskyield, StartLoc, EndLoc, 0, - 0) {} + : OMPExecutableDirective(OMPTaskyieldDirectiveClass, + llvm::omp::OMPD_taskyield, StartLoc, EndLoc) {} /// Build an empty directive. /// explicit OMPTaskyieldDirective() - : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, + : OMPExecutableDirective(OMPTaskyieldDirectiveClass, llvm::omp::OMPD_taskyield, SourceLocation(), - SourceLocation(), 0, 0) {} + SourceLocation()) {} public: /// Creates directive. @@ -2176,22 +2115,22 @@ public: /// class OMPBarrierDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPBarrierDirectiveClass, - llvm::omp::OMPD_barrier, StartLoc, EndLoc, 0, - 0) {} + : OMPExecutableDirective(OMPBarrierDirectiveClass, + llvm::omp::OMPD_barrier, StartLoc, EndLoc) {} /// Build an empty directive. /// explicit OMPBarrierDirective() - : OMPExecutableDirective(this, OMPBarrierDirectiveClass, + : OMPExecutableDirective(OMPBarrierDirectiveClass, llvm::omp::OMPD_barrier, SourceLocation(), - SourceLocation(), 0, 0) {} + SourceLocation()) {} public: /// Creates directive. @@ -2222,22 +2161,22 @@ public: /// class OMPTaskwaitDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, - llvm::omp::OMPD_taskwait, StartLoc, EndLoc, 0, - 0) {} + : OMPExecutableDirective(OMPTaskwaitDirectiveClass, + llvm::omp::OMPD_taskwait, StartLoc, EndLoc) {} /// Build an empty directive. /// explicit OMPTaskwaitDirective() - : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, + : OMPExecutableDirective(OMPTaskwaitDirectiveClass, llvm::omp::OMPD_taskwait, SourceLocation(), - SourceLocation(), 0, 0) {} + SourceLocation()) {} public: /// Creates directive. @@ -2268,30 +2207,25 @@ public: /// class OMPTaskgroupDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, - llvm::omp::OMPD_taskgroup, StartLoc, EndLoc, - NumClauses, 2) {} + OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTaskgroupDirectiveClass, + llvm::omp::OMPD_taskgroup, StartLoc, EndLoc) {} /// Build an empty directive. - /// \param NumClauses Number of clauses. /// - explicit OMPTaskgroupDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, + explicit OMPTaskgroupDirective() + : OMPExecutableDirective(OMPTaskgroupDirectiveClass, llvm::omp::OMPD_taskgroup, SourceLocation(), - SourceLocation(), NumClauses, 2) {} + SourceLocation()) {} /// Sets the task_reduction return variable. - void setReductionRef(Expr *RR) { - *std::next(child_begin(), 1) = RR; - } + void setReductionRef(Expr *RR) { Data->getChildren()[0] = RR; } public: /// Creates directive. @@ -2319,11 +2253,9 @@ public: /// Returns reference to the task_reduction return variable. const Expr *getReductionRef() const { - return static_cast(*std::next(child_begin(), 1)); - } - Expr *getReductionRef() { - return static_cast(*std::next(child_begin(), 1)); + return const_cast(this)->getReductionRef(); } + Expr *getReductionRef() { return cast_or_null(Data->getChildren()[0]); } static bool classof(const Stmt *T) { return T->getStmtClass() == OMPTaskgroupDirectiveClass; @@ -2342,26 +2274,21 @@ public: /// FlushClause. class OMPFlushDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPFlushDirectiveClass, - llvm::omp::OMPD_flush, StartLoc, EndLoc, - NumClauses, 0) {} + OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPFlushDirectiveClass, llvm::omp::OMPD_flush, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPFlushDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPFlushDirectiveClass, - llvm::omp::OMPD_flush, SourceLocation(), - SourceLocation(), NumClauses, 0) {} + explicit OMPFlushDirective() + : OMPExecutableDirective(OMPFlushDirectiveClass, llvm::omp::OMPD_flush, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2399,27 +2326,22 @@ public: /// 'a' with dependence type 'in' and a list with 'x' and 'y' locators. class OMPDepobjDirective final : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPDepobjDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPDepobjDirectiveClass, - llvm::omp::OMPD_depobj, StartLoc, EndLoc, - NumClauses, 0) {} + OMPDepobjDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPDepobjDirectiveClass, llvm::omp::OMPD_depobj, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPDepobjDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPDepobjDirectiveClass, - llvm::omp::OMPD_depobj, SourceLocation(), - SourceLocation(), NumClauses, 0) {} + explicit OMPDepobjDirective() + : OMPExecutableDirective(OMPDepobjDirectiveClass, llvm::omp::OMPD_depobj, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2456,26 +2378,22 @@ public: /// class OMPOrderedDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPOrderedDirectiveClass, - llvm::omp::OMPD_ordered, StartLoc, EndLoc, - NumClauses, 1) {} + OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPOrderedDirectiveClass, + llvm::omp::OMPD_ordered, StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPOrderedDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPOrderedDirectiveClass, + explicit OMPOrderedDirective() + : OMPExecutableDirective(OMPOrderedDirectiveClass, llvm::omp::OMPD_ordered, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + SourceLocation()) {} public: /// Creates directive. @@ -2494,9 +2412,11 @@ public: /// /// \param C AST context. /// \param NumClauses Number of clauses. + /// \param IsStandalone true, if the the standalone directive is created. /// static OMPOrderedDirective *CreateEmpty(const ASTContext &C, - unsigned NumClauses, EmptyShell); + unsigned NumClauses, + bool IsStandalone, EmptyShell); static bool classof(const Stmt *T) { return T->getStmtClass() == OMPOrderedDirectiveClass; @@ -2512,6 +2432,7 @@ public: /// class OMPAtomicDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Used for 'atomic update' or 'atomic capture' constructs. They may /// have atomic expressions of forms /// \code @@ -2521,7 +2442,7 @@ class OMPAtomicDirective : public OMPExecutableDirective { /// This field is true for the first form of the expression and false for the /// second. Required for correct codegen of non-associative operations (like /// << or >>). - bool IsXLHSInRHSPart; + bool IsXLHSInRHSPart = false; /// Used for 'atomic update' or 'atomic capture' constructs. They may /// have atomic expressions of forms /// \code @@ -2530,41 +2451,33 @@ class OMPAtomicDirective : public OMPExecutableDirective { /// \endcode /// This field is true for the first(postfix) form of the expression and false /// otherwise. - bool IsPostfixUpdate; + bool IsPostfixUpdate = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPAtomicDirectiveClass, - llvm::omp::OMPD_atomic, StartLoc, EndLoc, - NumClauses, 5), - IsXLHSInRHSPart(false), IsPostfixUpdate(false) {} + OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPAtomicDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPAtomicDirectiveClass, - llvm::omp::OMPD_atomic, SourceLocation(), - SourceLocation(), NumClauses, 5), - IsXLHSInRHSPart(false), IsPostfixUpdate(false) {} + explicit OMPAtomicDirective() + : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic, + SourceLocation(), SourceLocation()) {} /// Set 'x' part of the associated expression/statement. - void setX(Expr *X) { *std::next(child_begin()) = X; } + void setX(Expr *X) { Data->getChildren()[0] = X; } /// Set helper expression of the form /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. - void setUpdateExpr(Expr *UE) { *std::next(child_begin(), 2) = UE; } + void setUpdateExpr(Expr *UE) { Data->getChildren()[1] = UE; } /// Set 'v' part of the associated expression/statement. - void setV(Expr *V) { *std::next(child_begin(), 3) = V; } + void setV(Expr *V) { Data->getChildren()[2] = V; } /// Set 'expr' part of the associated expression/statement. - void setExpr(Expr *E) { *std::next(child_begin(), 4) = E; } + void setExpr(Expr *E) { Data->getChildren()[3] = E; } public: /// Creates directive with a list of \a Clauses and 'x', 'v' and 'expr' @@ -2601,18 +2514,16 @@ public: unsigned NumClauses, EmptyShell); /// Get 'x' part of the associated expression/statement. - Expr *getX() { return cast_or_null(*std::next(child_begin())); } + Expr *getX() { return cast_or_null(Data->getChildren()[0]); } const Expr *getX() const { - return cast_or_null(*std::next(child_begin())); + return cast_or_null(Data->getChildren()[0]); } /// Get helper expression of the form /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. - Expr *getUpdateExpr() { - return cast_or_null(*std::next(child_begin(), 2)); - } + Expr *getUpdateExpr() { return cast_or_null(Data->getChildren()[1]); } const Expr *getUpdateExpr() const { - return cast_or_null(*std::next(child_begin(), 2)); + return cast_or_null(Data->getChildren()[1]); } /// Return true if helper update expression has form /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and false if it has form @@ -2622,14 +2533,14 @@ public: /// 'x', false if 'v' must be updated to the new value of 'x'. bool isPostfixUpdate() const { return IsPostfixUpdate; } /// Get 'v' part of the associated expression/statement. - Expr *getV() { return cast_or_null(*std::next(child_begin(), 3)); } + Expr *getV() { return cast_or_null(Data->getChildren()[2]); } const Expr *getV() const { - return cast_or_null(*std::next(child_begin(), 3)); + return cast_or_null(Data->getChildren()[2]); } /// Get 'expr' part of the associated expression/statement. - Expr *getExpr() { return cast_or_null(*std::next(child_begin(), 4)); } + Expr *getExpr() { return cast_or_null(Data->getChildren()[3]); } const Expr *getExpr() const { - return cast_or_null(*std::next(child_begin(), 4)); + return cast_or_null(Data->getChildren()[3]); } static bool classof(const Stmt *T) { @@ -2647,26 +2558,21 @@ public: /// class OMPTargetDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetDirectiveClass, - llvm::omp::OMPD_target, StartLoc, EndLoc, - NumClauses, 1) {} + OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetDirectiveClass, llvm::omp::OMPD_target, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetDirectiveClass, - llvm::omp::OMPD_target, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + explicit OMPTargetDirective() + : OMPExecutableDirective(OMPTargetDirectiveClass, llvm::omp::OMPD_target, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2706,26 +2612,22 @@ public: /// class OMPTargetDataDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending Location of the directive. - /// \param NumClauses The number of clauses. /// - OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetDataDirectiveClass, - llvm::omp::OMPD_target_data, StartLoc, EndLoc, - NumClauses, 1) {} + OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetDataDirectiveClass, + llvm::omp::OMPD_target_data, StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetDataDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetDataDirectiveClass, + explicit OMPTargetDataDirective() + : OMPExecutableDirective(OMPTargetDataDirectiveClass, llvm::omp::OMPD_target_data, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2764,27 +2666,23 @@ public: /// class OMPTargetEnterDataDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending Location of the directive. - /// \param NumClauses The number of clauses. /// - OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass, + OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetEnterDataDirectiveClass, llvm::omp::OMPD_target_enter_data, StartLoc, - EndLoc, NumClauses, /*NumChildren=*/1) {} + EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetEnterDataDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass, + explicit OMPTargetEnterDataDirective() + : OMPExecutableDirective(OMPTargetEnterDataDirectiveClass, llvm::omp::OMPD_target_enter_data, - SourceLocation(), SourceLocation(), NumClauses, - /*NumChildren=*/1) {} + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2823,27 +2721,23 @@ public: /// class OMPTargetExitDataDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending Location of the directive. - /// \param NumClauses The number of clauses. /// - OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass, + OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetExitDataDirectiveClass, llvm::omp::OMPD_target_exit_data, StartLoc, - EndLoc, NumClauses, /*NumChildren=*/1) {} + EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetExitDataDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass, + explicit OMPTargetExitDataDirective() + : OMPExecutableDirective(OMPTargetExitDataDirectiveClass, llvm::omp::OMPD_target_exit_data, - SourceLocation(), SourceLocation(), NumClauses, - /*NumChildren=*/1) {} + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -2881,9 +2775,7 @@ public: /// class OMPTargetParallelDirective : public OMPExecutableDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. bool HasCancel = false; @@ -2891,26 +2783,21 @@ class OMPTargetParallelDirective : public OMPExecutableDirective { /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass, + OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetParallelDirectiveClass, llvm::omp::OMPD_target_parallel, StartLoc, - EndLoc, NumClauses, /*NumChildren=*/1) {} + EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetParallelDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass, + explicit OMPTargetParallelDirective() + : OMPExecutableDirective(OMPTargetParallelDirectiveClass, llvm::omp::OMPD_target_parallel, - SourceLocation(), SourceLocation(), NumClauses, - /*NumChildren=*/1) {} + SourceLocation(), SourceLocation()) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { Data->getChildren()[0] = E; } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -2941,8 +2828,13 @@ public: CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[0]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -2963,41 +2855,37 @@ public: /// class OMPTargetParallelForDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; /// true if current region has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetParallelForDirectiveClass, llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc, - CollapsedNum, NumClauses), - HasCancel(false) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetParallelForDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass, + explicit OMPTargetParallelForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetParallelForDirectiveClass, llvm::omp::OMPD_target_parallel_for, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses), - HasCancel(false) {} + SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_target_parallel_for)] = E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -3035,8 +2923,14 @@ public: EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_target_parallel_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -3056,26 +2950,21 @@ public: /// class OMPTeamsDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTeamsDirectiveClass, - llvm::omp::OMPD_teams, StartLoc, EndLoc, - NumClauses, 1) {} + OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTeamsDirectiveClass, llvm::omp::OMPD_teams, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTeamsDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTeamsDirectiveClass, - llvm::omp::OMPD_teams, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + explicit OMPTeamsDirective() + : OMPExecutableDirective(OMPTeamsDirectiveClass, llvm::omp::OMPD_teams, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -3114,25 +3003,24 @@ public: /// In this example a cancellation point is created for innermost 'for' region. class OMPCancellationPointDirective : public OMPExecutableDirective { friend class ASTStmtReader; - OpenMPDirectiveKind CancelRegion; + friend class OMPExecutableDirective; + OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. + /// statements and child expressions. /// OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass, + : OMPExecutableDirective(OMPCancellationPointDirectiveClass, llvm::omp::OMPD_cancellation_point, StartLoc, - EndLoc, 0, 0), - CancelRegion(llvm::omp::OMPD_unknown) {} + EndLoc) {} /// Build an empty directive. - /// explicit OMPCancellationPointDirective() - : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass, + : OMPExecutableDirective(OMPCancellationPointDirectiveClass, llvm::omp::OMPD_cancellation_point, - SourceLocation(), SourceLocation(), 0, 0), - CancelRegion(llvm::omp::OMPD_unknown) {} + SourceLocation(), SourceLocation()) {} /// Set cancel region for current cancellation point. /// \param CR Cancellation region. @@ -3173,28 +3061,22 @@ public: /// In this example a cancel is created for innermost 'for' region. class OMPCancelDirective : public OMPExecutableDirective { friend class ASTStmtReader; - OpenMPDirectiveKind CancelRegion; + friend class OMPExecutableDirective; + OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPCancelDirectiveClass, - llvm::omp::OMPD_cancel, StartLoc, EndLoc, - NumClauses, 0), - CancelRegion(llvm::omp::OMPD_unknown) {} + OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPCancelDirectiveClass, llvm::omp::OMPD_cancel, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - explicit OMPCancelDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPCancelDirectiveClass, - llvm::omp::OMPD_cancel, SourceLocation(), - SourceLocation(), NumClauses, 0), - CancelRegion(llvm::omp::OMPD_unknown) {} + explicit OMPCancelDirective() + : OMPExecutableDirective(OMPCancelDirectiveClass, llvm::omp::OMPD_cancel, + SourceLocation(), SourceLocation()) {} /// Set cancel region for current cancellation point. /// \param CR Cancellation region. @@ -3239,33 +3121,28 @@ public: /// class OMPTaskLoopDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, - llvm::omp::OMPD_taskloop, StartLoc, EndLoc, - CollapsedNum, NumClauses), - HasCancel(false) {} + unsigned CollapsedNum) + : OMPLoopDirective(OMPTaskLoopDirectiveClass, llvm::omp::OMPD_taskloop, + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, - llvm::omp::OMPD_taskloop, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses), - HasCancel(false) {} + explicit OMPTaskLoopDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTaskLoopDirectiveClass, llvm::omp::OMPD_taskloop, + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -3317,28 +3194,27 @@ public: /// class OMPTaskLoopSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTaskLoopSimdDirectiveClass, llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass, + explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTaskLoopSimdDirectiveClass, llvm::omp::OMPD_taskloop_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -3384,34 +3260,30 @@ public: /// class OMPMasterTaskLoopDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPMasterTaskLoopDirectiveClass, llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc, - CollapsedNum, NumClauses), - HasCancel(false) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, + explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPMasterTaskLoopDirectiveClass, llvm::omp::OMPD_master_taskloop, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses), - HasCancel(false) {} + SourceLocation(), CollapsedNum) {} /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -3464,29 +3336,27 @@ public: /// class OMPMasterTaskLoopSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPMasterTaskLoopSimdDirectiveClass, llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPMasterTaskLoopSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass, + explicit OMPMasterTaskLoopSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPMasterTaskLoopSimdDirectiveClass, llvm::omp::OMPD_master_taskloop_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \p Clauses. @@ -3532,36 +3402,31 @@ public: /// class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. - bool HasCancel; + bool HasCancel = false; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPParallelMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelMasterTaskLoopDirectiveClass, llvm::omp::OMPD_parallel_master_taskloop, StartLoc, - EndLoc, CollapsedNum, NumClauses), - HasCancel(false) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass, + explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelMasterTaskLoopDirectiveClass, llvm::omp::OMPD_parallel_master_taskloop, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses), - HasCancel(false) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -3615,32 +3480,28 @@ public: /// class OMPParallelMasterTaskLoopSimdDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPParallelMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelMasterTaskLoopSimdDirectiveClass, llvm::omp::OMPD_parallel_master_taskloop_simd, - StartLoc, EndLoc, CollapsedNum, NumClauses) {} + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPParallelMasterTaskLoopSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass, + explicit OMPParallelMasterTaskLoopSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPParallelMasterTaskLoopSimdDirectiveClass, llvm::omp::OMPD_parallel_master_taskloop_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \p Clauses. @@ -3684,29 +3545,28 @@ public: /// class OMPDistributeDirective : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeDirectiveClass, llvm::omp::OMPD_distribute, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeDirectiveClass, + explicit OMPDistributeDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeDirectiveClass, llvm::omp::OMPD_distribute, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -3751,26 +3611,23 @@ public: /// class OMPTargetUpdateDirective : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending Location of the directive. - /// \param NumClauses The number of clauses. /// - OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, - llvm::omp::OMPD_target_update, StartLoc, EndLoc, - NumClauses, 1) {} + OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetUpdateDirectiveClass, + llvm::omp::OMPD_target_update, StartLoc, + EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetUpdateDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, + explicit OMPTargetUpdateDirective() + : OMPExecutableDirective(OMPTargetUpdateDirectiveClass, llvm::omp::OMPD_target_update, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -3810,9 +3667,7 @@ public: /// class OMPDistributeParallelForDirective : public OMPLoopDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. bool HasCancel = false; @@ -3821,31 +3676,28 @@ class OMPDistributeParallelForDirective : public OMPLoopDirective { /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPDistributeParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeParallelForDirectiveClass, llvm::omp::OMPD_distribute_parallel_for, StartLoc, - EndLoc, CollapsedNum, NumClauses), - HasCancel(false) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPDistributeParallelForDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass, + explicit OMPDistributeParallelForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeParallelForDirectiveClass, llvm::omp::OMPD_distribute_parallel_for, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses), - HasCancel(false) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_distribute_parallel_for)] = E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -3883,8 +3735,14 @@ public: EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_distribute_parallel_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -3905,33 +3763,29 @@ public: /// class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPDistributeParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass, + explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_distribute_parallel_for_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -3974,30 +3828,28 @@ public: /// class OMPDistributeSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeSimdDirectiveClass, llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPDistributeSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass, + explicit OMPDistributeSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPDistributeSimdDirectiveClass, llvm::omp::OMPD_distribute_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4042,32 +3894,29 @@ public: /// class OMPTargetParallelForSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetParallelForSimdDirectiveClass, llvm::omp::OMPD_target_parallel_for_simd, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass, + explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetParallelForSimdDirectiveClass, llvm::omp::OMPD_target_parallel_for_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4112,29 +3961,28 @@ public: /// class OMPTargetSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetSimdDirectiveClass, llvm::omp::OMPD_target_simd, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, + explicit OMPTargetSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetSimdDirectiveClass, llvm::omp::OMPD_target_simd, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4178,30 +4026,28 @@ public: /// class OMPTeamsDistributeDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeDirectiveClass, llvm::omp::OMPD_teams_distribute, StartLoc, EndLoc, - CollapsedNum, NumClauses) {} + CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTeamsDistributeDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass, + explicit OMPTeamsDistributeDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeDirectiveClass, llvm::omp::OMPD_teams_distribute, SourceLocation(), - SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4246,32 +4092,28 @@ public: /// class OMPTeamsDistributeSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTeamsDistributeSimdDirective(SourceLocation StartLoc, - SourceLocation EndLoc, unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass, + SourceLocation EndLoc, unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeSimdDirectiveClass, llvm::omp::OMPD_teams_distribute_simd, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass, + explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeSimdDirectiveClass, llvm::omp::OMPD_teams_distribute_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4318,33 +4160,29 @@ public: class OMPTeamsDistributeParallelForSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_teams_distribute_parallel_for_simd, - StartLoc, EndLoc, CollapsedNum, NumClauses) {} + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass, + explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_teams_distribute_parallel_for_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4388,9 +4226,7 @@ public: /// class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. bool HasCancel = false; @@ -4399,32 +4235,29 @@ class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective { /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTeamsDistributeParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeParallelForDirectiveClass, llvm::omp::OMPD_teams_distribute_parallel_for, - StartLoc, EndLoc, CollapsedNum, NumClauses), - HasCancel(false) {} + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass, + explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTeamsDistributeParallelForDirectiveClass, llvm::omp::OMPD_teams_distribute_parallel_for, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses), - HasCancel(false) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)] = + E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -4460,8 +4293,14 @@ public: EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -4481,26 +4320,23 @@ public: /// class OMPTargetTeamsDirective final : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass, - llvm::omp::OMPD_target_teams, StartLoc, EndLoc, - NumClauses, 1) {} + OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPTargetTeamsDirectiveClass, + llvm::omp::OMPD_target_teams, StartLoc, EndLoc) { + } /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPTargetTeamsDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass, + explicit OMPTargetTeamsDirective() + : OMPExecutableDirective(OMPTargetTeamsDirectiveClass, llvm::omp::OMPD_target_teams, SourceLocation(), - SourceLocation(), NumClauses, 1) {} + SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. @@ -4540,32 +4376,29 @@ public: /// class OMPTargetTeamsDistributeDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeDirectiveClass, llvm::omp::OMPD_target_teams_distribute, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass, + explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeDirectiveClass, llvm::omp::OMPD_target_teams_distribute, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4610,9 +4443,7 @@ public: class OMPTargetTeamsDistributeParallelForDirective final : public OMPLoopDirective { friend class ASTStmtReader; - /// Special reference expression for handling task reduction. Used to store - /// the taskgroup descriptor returned by the runtime functions. - Expr *TaskRedRef = nullptr; + friend class OMPExecutableDirective; /// true if the construct has inner cancel directive. bool HasCancel = false; @@ -4621,33 +4452,29 @@ class OMPTargetTeamsDistributeParallelForDirective final /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, - OMPTargetTeamsDistributeParallelForDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeParallelForDirectiveClass, llvm::omp::OMPD_target_teams_distribute_parallel_for, - StartLoc, EndLoc, CollapsedNum, NumClauses), - HasCancel(false) {} + StartLoc, EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective( - this, OMPTargetTeamsDistributeParallelForDirectiveClass, - llvm::omp::OMPD_target_teams_distribute_parallel_for, - SourceLocation(), SourceLocation(), CollapsedNum, NumClauses), - HasCancel(false) {} + explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeParallelForDirectiveClass, + llvm::omp::OMPD_target_teams_distribute_parallel_for, + SourceLocation(), SourceLocation(), CollapsedNum) {} /// Sets special task reduction descriptor. - void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; } + void setTaskReductionRefExpr(Expr *E) { + Data->getChildren()[numLoopChildren( + getCollapsedNumber(), + llvm::omp::OMPD_target_teams_distribute_parallel_for)] = E; + } /// Set cancel state. void setHasCancel(bool Has) { HasCancel = Has; } @@ -4683,8 +4510,15 @@ public: EmptyShell); /// Returns special task reduction reference expression. - Expr *getTaskReductionRefExpr() { return TaskRedRef; } - const Expr *getTaskReductionRefExpr() const { return TaskRedRef; } + Expr *getTaskReductionRefExpr() { + return cast_or_null(Data->getChildren()[numLoopChildren( + getCollapsedNumber(), + llvm::omp::OMPD_target_teams_distribute_parallel_for)]); + } + const Expr *getTaskReductionRefExpr() const { + return const_cast(this) + ->getTaskReductionRefExpr(); + } /// Return true if current directive has inner cancel directive. bool hasCancel() const { return HasCancel; } @@ -4707,34 +4541,32 @@ public: class OMPTargetTeamsDistributeParallelForSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) + unsigned CollapsedNum) : OMPLoopDirective( - this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass, + OMPTargetTeamsDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// explicit OMPTargetTeamsDistributeParallelForSimdDirective( - unsigned CollapsedNum, unsigned NumClauses) + unsigned CollapsedNum) : OMPLoopDirective( - this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass, + OMPTargetTeamsDistributeParallelForSimdDirectiveClass, llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, - SourceLocation(), SourceLocation(), CollapsedNum, NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4779,33 +4611,29 @@ public: /// class OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// OMPTargetTeamsDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass, + unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeSimdDirectiveClass, llvm::omp::OMPD_target_teams_distribute_simd, StartLoc, - EndLoc, CollapsedNum, NumClauses) {} + EndLoc, CollapsedNum) {} /// Build an empty directive. /// /// \param CollapsedNum Number of collapsed nested loops. - /// \param NumClauses Number of clauses. /// - explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum, - unsigned NumClauses) - : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass, + explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum) + : OMPLoopDirective(OMPTargetTeamsDistributeSimdDirectiveClass, llvm::omp::OMPD_target_teams_distribute_simd, - SourceLocation(), SourceLocation(), CollapsedNum, - NumClauses) {} + SourceLocation(), SourceLocation(), CollapsedNum) {} public: /// Creates directive with a list of \a Clauses. @@ -4847,26 +4675,21 @@ public: /// list item 'a'. class OMPScanDirective final : public OMPExecutableDirective { friend class ASTStmtReader; + friend class OMPExecutableDirective; /// Build directive with the given start and end location. /// /// \param StartLoc Starting location of the directive kind. /// \param EndLoc Ending location of the directive. - /// \param NumClauses Number of clauses. /// - OMPScanDirective(SourceLocation StartLoc, SourceLocation EndLoc, - unsigned NumClauses) - : OMPExecutableDirective(this, OMPScanDirectiveClass, - llvm::omp::OMPD_scan, StartLoc, EndLoc, - NumClauses, 0) {} + OMPScanDirective(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPExecutableDirective(OMPScanDirectiveClass, llvm::omp::OMPD_scan, + StartLoc, EndLoc) {} /// Build an empty directive. /// - /// \param NumClauses Number of clauses. - /// - explicit OMPScanDirective(unsigned NumClauses) - : OMPExecutableDirective(this, OMPScanDirectiveClass, - llvm::omp::OMPD_scan, SourceLocation(), - SourceLocation(), NumClauses, 0) {} + explicit OMPScanDirective() + : OMPExecutableDirective(OMPScanDirectiveClass, llvm::omp::OMPD_scan, + SourceLocation(), SourceLocation()) {} public: /// Creates directive with a list of \a Clauses. diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h index 51fd8ba5103..1671637521e 100644 --- a/clang/include/clang/AST/TemplateBase.h +++ b/clang/include/clang/AST/TemplateBase.h @@ -36,6 +36,17 @@ namespace llvm { class FoldingSetNodeID; +// Provide PointerLikeTypeTraits for clang::Expr*, this default one requires a +// full definition of Expr, but this file only sees a forward del because of +// the dependency. +template <> struct PointerLikeTypeTraits { + static inline void *getAsVoidPointer(clang::Expr *P) { return P; } + static inline clang::Expr *getFromVoidPointer(void *P) { + return static_cast(P); + } + static constexpr int NumLowBitsAvailable = 2; +}; + } // namespace llvm namespace clang { @@ -393,56 +404,51 @@ public: /// Location information for a TemplateArgument. struct TemplateArgumentLocInfo { private: - struct T { + struct TemplateTemplateArgLocInfo { // FIXME: We'd like to just use the qualifier in the TemplateName, // but template arguments get canonicalized too quickly. NestedNameSpecifier *Qualifier; void *QualifierLocData; - unsigned TemplateNameLoc; - unsigned EllipsisLoc; + SourceLocation TemplateNameLoc; + SourceLocation EllipsisLoc; }; - union { - struct T Template; - Expr *Expression; - TypeSourceInfo *Declarator; - }; + llvm::PointerUnion + Pointer; + + TemplateTemplateArgLocInfo *getTemplate() const { + return Pointer.get(); + } public: - constexpr TemplateArgumentLocInfo() : Template({nullptr, nullptr, 0, 0}) {} + TemplateArgumentLocInfo() {} + TemplateArgumentLocInfo(TypeSourceInfo *Declarator) { Pointer = Declarator; } - TemplateArgumentLocInfo(TypeSourceInfo *TInfo) : Declarator(TInfo) {} - - TemplateArgumentLocInfo(Expr *E) : Expression(E) {} - - TemplateArgumentLocInfo(NestedNameSpecifierLoc QualifierLoc, + TemplateArgumentLocInfo(Expr *E) { Pointer = E; } + // Ctx is used for allocation -- this case is unusually large and also rare, + // so we store the payload out-of-line. + TemplateArgumentLocInfo(ASTContext &Ctx, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateNameLoc, - SourceLocation EllipsisLoc) { - Template.Qualifier = QualifierLoc.getNestedNameSpecifier(); - Template.QualifierLocData = QualifierLoc.getOpaqueData(); - Template.TemplateNameLoc = TemplateNameLoc.getRawEncoding(); - Template.EllipsisLoc = EllipsisLoc.getRawEncoding(); - } + SourceLocation EllipsisLoc); TypeSourceInfo *getAsTypeSourceInfo() const { - return Declarator; + return Pointer.get(); } - Expr *getAsExpr() const { - return Expression; - } + Expr *getAsExpr() const { return Pointer.get(); } NestedNameSpecifierLoc getTemplateQualifierLoc() const { - return NestedNameSpecifierLoc(Template.Qualifier, - Template.QualifierLocData); + const auto *Template = getTemplate(); + return NestedNameSpecifierLoc(Template->Qualifier, + Template->QualifierLocData); } SourceLocation getTemplateNameLoc() const { - return SourceLocation::getFromRawEncoding(Template.TemplateNameLoc); + return getTemplate()->TemplateNameLoc; } SourceLocation getTemplateEllipsisLoc() const { - return SourceLocation::getFromRawEncoding(Template.EllipsisLoc); + return getTemplate()->EllipsisLoc; } }; @@ -453,7 +459,7 @@ class TemplateArgumentLoc { TemplateArgumentLocInfo LocInfo; public: - constexpr TemplateArgumentLoc() {} + TemplateArgumentLoc() {} TemplateArgumentLoc(const TemplateArgument &Argument, TemplateArgumentLocInfo Opaque) @@ -475,12 +481,12 @@ public: Argument.getKind() == TemplateArgument::Expression); } - TemplateArgumentLoc(const TemplateArgument &Argument, + TemplateArgumentLoc(ASTContext &Ctx, const TemplateArgument &Argument, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateNameLoc, SourceLocation EllipsisLoc = SourceLocation()) : Argument(Argument), - LocInfo(QualifierLoc, TemplateNameLoc, EllipsisLoc) { + LocInfo(Ctx, QualifierLoc, TemplateNameLoc, EllipsisLoc) { assert(Argument.getKind() == TemplateArgument::Template || Argument.getKind() == TemplateArgument::TemplateExpansion); } @@ -681,8 +687,8 @@ struct alignas(void *) ASTTemplateKWAndArgsInfo { TemplateArgumentListInfo &List) const; }; -const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const TemplateArgument &Arg); +const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const TemplateArgument &Arg); inline TemplateSpecializationType::iterator TemplateSpecializationType::end() const { diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h index 9bcf2838dcf..010b813dc52 100644 --- a/clang/include/clang/AST/TemplateName.h +++ b/clang/include/clang/AST/TemplateName.h @@ -342,10 +342,8 @@ public: /// Insertion operator for diagnostics. This allows sending TemplateName's /// into a diagnostic with <<. -const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - TemplateName N); -const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - TemplateName N); +const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + TemplateName N); /// A structure for storing the information associated with a /// substituted template template parameter. diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h index b4cfb5a380d..15ca348f476 100644 --- a/clang/include/clang/AST/TextNodeDumper.h +++ b/clang/include/clang/AST/TextNodeDumper.h @@ -155,6 +155,7 @@ class TextNodeDumper const comments::CommandTraits *Traits = nullptr; const char *getCommandName(unsigned CommandID); + void printFPOptions(FPOptionsOverride FPO); void dumpAPValueChildren(const APValue &Value, QualType Ty, const APValue &(*IdxToChildFun)(const APValue &, @@ -269,6 +270,7 @@ public: void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node); void VisitCXXThisExpr(const CXXThisExpr *Node); void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node); + void VisitCXXStaticCastExpr(const CXXStaticCastExpr *Node); void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *Node); void VisitCXXConstructExpr(const CXXConstructExpr *Node); void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node); @@ -294,6 +296,7 @@ public: void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node); void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node); void VisitOMPIteratorExpr(const OMPIteratorExpr *Node); + void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *Node); void VisitRValueReferenceType(const ReferenceType *T); void VisitArrayType(const ArrayType *T); diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 0fc50e0e799..319d3850346 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -61,6 +61,7 @@ class ExtQuals; class QualType; class ConceptDecl; class TagDecl; +class TemplateParameterList; class Type; enum { @@ -480,6 +481,11 @@ public: // Otherwise in OpenCLC v2.0 s6.5.5: every address space except // for __constant can be used as __generic. (A == LangAS::opencl_generic && B != LangAS::opencl_constant) || + // We also define global_device and global_host address spaces, + // to distinguish global pointers allocated on host from pointers + // allocated on device, which are a subset of __global. + (A == LangAS::opencl_global && (B == LangAS::opencl_global_device || + B == LangAS::opencl_global_host)) || // Consider pointer size address spaces to be equivalent to default. ((isPtrSizeAddressSpace(A) || A == LangAS::Default) && (isPtrSizeAddressSpace(B) || B == LangAS::Default)); @@ -1675,19 +1681,6 @@ protected: uint32_t NumElements; }; - class ConstantMatrixTypeBitfields { - friend class ConstantMatrixType; - - unsigned : NumTypeBits; - - /// Number of rows and columns. Using 20 bits allows supporting very large - /// matrixes, while keeping 24 bits to accommodate NumTypeBits. - unsigned NumRows : 20; - unsigned NumColumns : 20; - - static constexpr uint32_t MaxElementsPerDimension = (1 << 20) - 1; - }; - class AttributedTypeBitfields { friend class AttributedType; @@ -1797,46 +1790,11 @@ protected: TypeWithKeywordBitfields TypeWithKeywordBits; ElaboratedTypeBitfields ElaboratedTypeBits; VectorTypeBitfields VectorTypeBits; - ConstantMatrixTypeBitfields ConstantMatrixTypeBits; SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits; TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits; DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits; PackExpansionTypeBitfields PackExpansionTypeBits; - - static_assert(sizeof(TypeBitfields) <= 8, - "TypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ArrayTypeBitfields) <= 8, - "ArrayTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AttributedTypeBitfields) <= 8, - "AttributedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AutoTypeBitfields) <= 8, - "AutoTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(BuiltinTypeBitfields) <= 8, - "BuiltinTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionTypeBitfields) <= 8, - "FunctionTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, - "ObjCObjectTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ReferenceTypeBitfields) <= 8, - "ReferenceTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(TypeWithKeywordBitfields) <= 8, - "TypeWithKeywordBitfields is larger than 8 bytes!"); - static_assert(sizeof(ElaboratedTypeBitfields) <= 8, - "ElaboratedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(VectorTypeBitfields) <= 8, - "VectorTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, - "SubstTemplateTypeParmPackTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, - "TemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, - "DependentTemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(PackExpansionTypeBitfields) <= 8, - "PackExpansionTypeBitfields is larger than 8 bytes"); }; private: @@ -1853,6 +1811,10 @@ protected: Type(TypeClass tc, QualType canon, TypeDependence Dependence) : ExtQualsTypeCommonBase(this, canon.isNull() ? QualType(this_(), 0) : canon) { + static_assert(sizeof(*this) <= 8 + sizeof(ExtQualsTypeCommonBase), + "changing bitfields changed sizeof(Type)!"); + static_assert(alignof(decltype(*this)) % sizeof(void *) == 0, + "Insufficient alignment!"); TypeBits.TC = tc; TypeBits.Dependence = static_cast(Dependence); TypeBits.CacheValid = false; @@ -1925,6 +1887,16 @@ public: bool isSizelessType() const; bool isSizelessBuiltinType() const; + /// Determines if this is a sizeless type supported by the + /// 'arm_sve_vector_bits' type attribute, which can be applied to a single + /// SVE vector or predicate, excluding tuple types such as svint32x4_t. + bool isVLSTBuiltinType() const; + + /// Returns the representative type for the element of an SVE builtin type. + /// This is used to represent fixed-length SVE vectors created with the + /// 'arm_sve_vector_bits' type attribute as VectorType. + QualType getSveEltType(const ASTContext &Ctx) const; + /// Types are partitioned into 3 broad categories (C99 6.2.5p1): /// object types, function types, and incomplete types. @@ -1956,6 +1928,9 @@ public: /// (C++11 [basic.types]p10) bool isLiteralType(const ASTContext &Ctx) const; + /// Determine if this type is a structural type, per C++20 [temp.param]p7. + bool isStructuralType() const; + /// Test if this type is a standard-layout type. /// (C++0x [basic.type]p9) bool isStandardLayoutType() const; @@ -2118,6 +2093,7 @@ public: bool isAtomicType() const; // C11 _Atomic() bool isUndeducedAutoType() const; // C++11 auto or // C++14 decltype(auto) + bool isTypedefNameType() const; // typedef or alias template #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ bool is##Id##Type() const; @@ -2513,6 +2489,9 @@ public: // SVE Types #define SVE_TYPE(Name, Id, SingletonId) Id, #include "clang/Basic/AArch64SVEACLETypes.def" +// PPC MMA Types +#define PPC_VECTOR_TYPE(Name, Id, Size) Id, +#include "clang/Basic/PPCTypes.def" // All other builtin types #define BUILTIN_TYPE(Id, SingletonId) Id, #define LAST_BUILTIN_TYPE(Id) LastKind = Id @@ -3250,7 +3229,13 @@ public: NeonVector, /// is ARM Neon polynomial vector - NeonPolyVector + NeonPolyVector, + + /// is AArch64 SVE fixed-length data vector + SveFixedLengthDataVector, + + /// is AArch64 SVE fixed-length predicate vector + SveFixedLengthPredicateVector }; protected: @@ -3456,8 +3441,15 @@ protected: friend class ASTContext; /// The element type of the matrix. + // FIXME: Appears to be unused? There is also MatrixType::ElementType... QualType ElementType; + /// Number of rows and columns. + unsigned NumRows; + unsigned NumColumns; + + static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1; + ConstantMatrixType(QualType MatrixElementType, unsigned NRows, unsigned NColumns, QualType CanonElementType); @@ -3466,25 +3458,24 @@ protected: public: /// Returns the number of rows in the matrix. - unsigned getNumRows() const { return ConstantMatrixTypeBits.NumRows; } + unsigned getNumRows() const { return NumRows; } /// Returns the number of columns in the matrix. - unsigned getNumColumns() const { return ConstantMatrixTypeBits.NumColumns; } + unsigned getNumColumns() const { return NumColumns; } /// Returns the number of elements required to embed the matrix into a vector. unsigned getNumElementsFlattened() const { - return ConstantMatrixTypeBits.NumRows * ConstantMatrixTypeBits.NumColumns; + return getNumRows() * getNumColumns(); } /// Returns true if \p NumElements is a valid matrix dimension. - static bool isDimensionValid(uint64_t NumElements) { - return NumElements > 0 && - NumElements <= ConstantMatrixTypeBitfields::MaxElementsPerDimension; + static constexpr bool isDimensionValid(size_t NumElements) { + return NumElements > 0 && NumElements <= MaxElementsPerDimension; } /// Returns the maximum number of elements per dimension. - static unsigned getMaxElementsPerDimension() { - return ConstantMatrixTypeBitfields::MaxElementsPerDimension; + static constexpr unsigned getMaxElementsPerDimension() { + return MaxElementsPerDimension; } void Profile(llvm::FoldingSetNodeID &ID) { @@ -4372,14 +4363,11 @@ public: class TypedefType : public Type { TypedefNameDecl *Decl; -protected: +private: friend class ASTContext; // ASTContext creates these. - TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType can) - : Type(tc, can, can->getDependence() & ~TypeDependence::UnexpandedPack), - Decl(const_cast(D)) { - assert(!isa(can) && "Invalid canonical type"); - } + TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType underlying, + QualType can); public: TypedefNameDecl *getDecl() const { return Decl; } @@ -4730,6 +4718,9 @@ public: case NullabilityKind::Nullable: return attr::TypeNullable; + case NullabilityKind::NullableResult: + return attr::TypeNullableResult; + case NullabilityKind::Unspecified: return attr::TypeNullUnspecified; } @@ -5122,11 +5113,24 @@ class alignas(8) TemplateSpecializationType public: /// Determine whether any of the given template arguments are dependent. - static bool anyDependentTemplateArguments(ArrayRef Args, - bool &InstantiationDependent); - - static bool anyDependentTemplateArguments(const TemplateArgumentListInfo &, - bool &InstantiationDependent); + /// + /// The converted arguments should be supplied when known; whether an + /// argument is dependent can depend on the conversions performed on it + /// (for example, a 'const int' passed as a template argument might be + /// dependent if the parameter is a reference but non-dependent if the + /// parameter is an int). + /// + /// Note that the \p Args parameter is unused: this is intentional, to remind + /// the caller that they need to pass in the converted arguments, not the + /// specified arguments. + static bool + anyDependentTemplateArguments(ArrayRef Args, + ArrayRef Converted); + static bool + anyDependentTemplateArguments(const TemplateArgumentListInfo &, + ArrayRef Converted); + static bool anyInstantiationDependentTemplateArguments( + ArrayRef Args); /// True if this template specialization type matches a current /// instantiation in the context in which it is found. @@ -5211,15 +5215,18 @@ public: /// enclosing the template arguments. void printTemplateArgumentList(raw_ostream &OS, ArrayRef Args, - const PrintingPolicy &Policy); + const PrintingPolicy &Policy, + const TemplateParameterList *TPL = nullptr); void printTemplateArgumentList(raw_ostream &OS, ArrayRef Args, - const PrintingPolicy &Policy); + const PrintingPolicy &Policy, + const TemplateParameterList *TPL = nullptr); void printTemplateArgumentList(raw_ostream &OS, const TemplateArgumentListInfo &Args, - const PrintingPolicy &Policy); + const PrintingPolicy &Policy, + const TemplateParameterList *TPL = nullptr); /// The injected class name of a C++ class template or class /// template partial specialization. Used to record that a type was @@ -5405,7 +5412,9 @@ class ElaboratedType final ElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, QualType CanonType, TagDecl *OwnedTagDecl) : TypeWithKeyword(Keyword, Elaborated, CanonType, - NamedType->getDependence()), + NamedType->getDependence() | + (NNS ? toTypeDependence(NNS->getDependence()) + : TypeDependence::None)), NNS(NNS), NamedType(NamedType) { ElaboratedTypeBits.HasOwnedTagDecl = false; if (OwnedTagDecl) { @@ -5616,7 +5625,8 @@ class PackExpansionType : public Type, public llvm::FoldingSetNode { PackExpansionType(QualType Pattern, QualType Canon, Optional NumExpansions) : Type(PackExpansion, Canon, - (Pattern->getDependence() | TypeDependence::Instantiation) & + (Pattern->getDependence() | TypeDependence::Dependent | + TypeDependence::Instantiation) & ~TypeDependence::UnexpandedPack), Pattern(Pattern) { PackExpansionTypeBits.NumExpansions = @@ -5637,8 +5647,8 @@ public: return None; } - bool isSugared() const { return !Pattern->isDependentType(); } - QualType desugar() const { return isSugared() ? Pattern : QualType(this, 0); } + bool isSugared() const { return false; } + QualType desugar() const { return QualType(this, 0); } void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, getPattern(), getNumExpansions()); @@ -7059,6 +7069,15 @@ inline bool Type::isOverloadableType() const { return isDependentType() || isRecordType() || isEnumeralType(); } +/// Determines whether this type is written as a typedef-name. +inline bool Type::isTypedefNameType() const { + if (getAs()) + return true; + if (auto *TST = getAs()) + return TST->isTypeAlias(); + return false; +} + /// Determines whether this type can decay to a pointer type. inline bool Type::canDecayToPointerType() const { return isFunctionType() || isArrayType(); @@ -7088,55 +7107,28 @@ inline const Type *Type::getPointeeOrArrayElementType() const { return type->getBaseElementTypeUnsafe(); return type; } -/// Insertion operator for diagnostics. This allows sending address spaces into -/// a diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - LangAS AS) { - DB.AddTaggedVal(static_cast>(AS), - DiagnosticsEngine::ArgumentKind::ak_addrspace); - return DB; -} - /// Insertion operator for partial diagnostics. This allows sending adress /// spaces into a diagnostic with <<. -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - LangAS AS) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, + LangAS AS) { PD.AddTaggedVal(static_cast>(AS), DiagnosticsEngine::ArgumentKind::ak_addrspace); return PD; } -/// Insertion operator for diagnostics. This allows sending Qualifiers into a -/// diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - Qualifiers Q) { - DB.AddTaggedVal(Q.getAsOpaqueValue(), - DiagnosticsEngine::ArgumentKind::ak_qual); - return DB; -} - /// Insertion operator for partial diagnostics. This allows sending Qualifiers /// into a diagnostic with <<. -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - Qualifiers Q) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, + Qualifiers Q) { PD.AddTaggedVal(Q.getAsOpaqueValue(), DiagnosticsEngine::ArgumentKind::ak_qual); return PD; } -/// Insertion operator for diagnostics. This allows sending QualType's into a -/// diagnostic with <<. -inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - QualType T) { - DB.AddTaggedVal(reinterpret_cast(T.getAsOpaquePtr()), - DiagnosticsEngine::ak_qualtype); - return DB; -} - /// Insertion operator for partial diagnostics. This allows sending QualType's /// into a diagnostic with <<. -inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, - QualType T) { +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD, + QualType T) { PD.AddTaggedVal(reinterpret_cast(T.getAsOpaquePtr()), DiagnosticsEngine::ak_qualtype); return PD; diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index 72cc8ef098e..65e95d52c30 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/include/clang/AST/TypeLoc.h @@ -603,32 +603,32 @@ public: if (needsExtraLocalData()) return static_cast(getWrittenBuiltinSpecs().Sign); else - return TSS_unspecified; + return TypeSpecifierSign::Unspecified; } bool hasWrittenSignSpec() const { - return getWrittenSignSpec() != TSS_unspecified; + return getWrittenSignSpec() != TypeSpecifierSign::Unspecified; } void setWrittenSignSpec(TypeSpecifierSign written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Sign = written; + getWrittenBuiltinSpecs().Sign = static_cast(written); } TypeSpecifierWidth getWrittenWidthSpec() const { if (needsExtraLocalData()) return static_cast(getWrittenBuiltinSpecs().Width); else - return TSW_unspecified; + return TypeSpecifierWidth::Unspecified; } bool hasWrittenWidthSpec() const { - return getWrittenWidthSpec() != TSW_unspecified; + return getWrittenWidthSpec() != TypeSpecifierWidth::Unspecified; } void setWrittenWidthSpec(TypeSpecifierWidth written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Width = written; + getWrittenBuiltinSpecs().Width = static_cast(written); } TypeSpecifierType getWrittenTypeSpec() const; @@ -658,8 +658,8 @@ public: setBuiltinLoc(Loc); if (needsExtraLocalData()) { WrittenBuiltinSpecs &wbs = getWrittenBuiltinSpecs(); - wbs.Sign = TSS_unspecified; - wbs.Width = TSW_unspecified; + wbs.Sign = static_cast(TypeSpecifierSign::Unspecified); + wbs.Width = static_cast(TypeSpecifierWidth::Unspecified); wbs.Type = TST_unspecified; wbs.ModeAttr = false; } @@ -1749,30 +1749,79 @@ public: // FIXME: size expression and attribute locations (or keyword if we // ever fully support altivec syntax). -class VectorTypeLoc : public InheritingConcreteTypeLoc { +struct VectorTypeLocInfo { + SourceLocation NameLoc; +}; + +class VectorTypeLoc : public ConcreteTypeLoc { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } + + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } }; // FIXME: size expression and attribute locations (or keyword if we // ever fully support altivec syntax). class DependentVectorTypeLoc - : public InheritingConcreteTypeLoc {}; + : public ConcreteTypeLoc { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } + + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } +}; // FIXME: size expression and attribute locations. -class ExtVectorTypeLoc : public InheritingConcreteTypeLoc { -}; +class ExtVectorTypeLoc + : public InheritingConcreteTypeLoc {}; // FIXME: attribute locations. // For some reason, this isn't a subtype of VectorType. -class DependentSizedExtVectorTypeLoc : - public InheritingConcreteTypeLoc { +class DependentSizedExtVectorTypeLoc + : public ConcreteTypeLoc { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } + + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } }; struct MatrixTypeLocInfo { diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index 4540ea0e195..ffcc8290938 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -484,8 +484,12 @@ let Class = TagType in { let Read = [{ node->isDependentType() }]; } def : Property<"declaration", DeclRef> { - // Serializing a reference to the canonical declaration is apparently - // necessary to make module-merging work. + // We don't know which declaration was originally referenced here, and we + // cannot reference a declaration that follows the use (because that can + // introduce deserialization cycles), so conservatively generate a + // reference to the first declaration. + // FIXME: If this is a reference to a class template specialization, that + // can still introduce a deserialization cycle. let Read = [{ node->getDecl()->getCanonicalDecl() }]; } } @@ -722,7 +726,8 @@ let Class = PackExpansionType in { } def : Creator<[{ - return ctx.getPackExpansionType(pattern, numExpansions); + return ctx.getPackExpansionType(pattern, numExpansions, + /*ExpectPackInType*/false); }]>; } @@ -760,6 +765,10 @@ let Class = BuiltinType in { case BuiltinType::ID: return ctx.SINGLETON_ID; #include "clang/Basic/AArch64SVEACLETypes.def" +#define PPC_VECTOR_TYPE(NAME, ID, SIZE) \ + case BuiltinType::ID: return ctx.ID##Ty; +#include "clang/Basic/PPCTypes.def" + #define BUILTIN_TYPE(ID, SINGLETON_ID) \ case BuiltinType::ID: return ctx.SINGLETON_ID; #include "clang/AST/BuiltinTypes.def" diff --git a/clang/include/clang/ASTMatchers/ASTMatchFinder.h b/clang/include/clang/ASTMatchers/ASTMatchFinder.h index 0af98438ab5..81125ad8d96 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchFinder.h +++ b/clang/include/clang/ASTMatchers/ASTMatchFinder.h @@ -159,6 +159,8 @@ public: MatchCallback *Action); void addMatcher(const CXXCtorInitializerMatcher &NodeMatch, MatchCallback *Action); + void addMatcher(const TemplateArgumentLocMatcher &NodeMatch, + MatchCallback *Action); /// @} /// Adds a matcher to execute when running over the AST. @@ -209,6 +211,8 @@ public: NestedNameSpecifierLoc; std::vector> TypeLoc; std::vector> CtorInit; + std::vector> + TemplateArgumentLoc; /// All the callbacks in one container to simplify iteration. llvm::SmallPtrSet AllCallbacks; }; diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 643419743a1..6f6dfab59a3 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -145,6 +145,8 @@ using TypeLocMatcher = internal::Matcher; using NestedNameSpecifierMatcher = internal::Matcher; using NestedNameSpecifierLocMatcher = internal::Matcher; using CXXCtorInitializerMatcher = internal::Matcher; +using TemplateArgumentMatcher = internal::Matcher; +using TemplateArgumentLocMatcher = internal::Matcher; /// @} /// Matches any node. @@ -306,10 +308,9 @@ AST_POLYMORPHIC_MATCHER_REGEX(isExpansionInFileMatching, /// Does not match if only part of the statement is expanded from that macro or /// if different parts of the the statement are expanded from different /// appearances of the macro. -/// -/// FIXME: Change to be a polymorphic matcher that works on any syntactic -/// node. There's nothing `Stmt`-specific about it. -AST_MATCHER_P(Stmt, isExpandedFromMacro, llvm::StringRef, MacroName) { +AST_POLYMORPHIC_MATCHER_P(isExpandedFromMacro, + AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), + std::string, MacroName) { // Verifies that the statement' beginning and ending are both expanded from // the same instance of the given macro. auto& Context = Finder->getASTContext(); @@ -333,6 +334,19 @@ AST_MATCHER_P(Stmt, isExpandedFromMacro, llvm::StringRef, MacroName) { /// \endcode extern const internal::VariadicAllOfMatcher decl; +/// Matches decomposition-declarations. +/// +/// Examples matches the declaration node with \c foo and \c bar, but not +/// \c number. +/// (matcher = declStmt(has(decompositionDecl()))) +/// +/// \code +/// int number = 42; +/// auto [foo, bar] = std::make_pair{42, 42}; +/// \endcode +extern const internal::VariadicAllOfMatcher + decompositionDecl; + /// Matches a declaration of a linkage specification. /// /// Given @@ -515,6 +529,18 @@ extern const internal::VariadicAllOfMatcher /// matches 'int' in C. extern const internal::VariadicAllOfMatcher templateArgument; +/// Matches template arguments (with location info). +/// +/// Given +/// \code +/// template struct C {}; +/// C c; +/// \endcode +/// templateArgumentLoc() +/// matches 'int' in C. +extern const internal::VariadicAllOfMatcher + templateArgumentLoc; + /// Matches template name. /// /// Given @@ -549,6 +575,18 @@ extern const internal::VariadicDynCastAllOfMatcher templateTypeParmDecl; +/// Matches template template parameter declarations. +/// +/// Given +/// \code +/// template