aboutsummaryrefslogtreecommitdiffstats
path: root/include/clang
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:06:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:06:01 +0000
commit486754660bb926339aefcf012a3f848592babb8b (patch)
treeecdbc446c9876f4f120f701c243373cd3cb43db3 /include/clang
parent55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff)
downloadsrc-486754660bb926339aefcf012a3f848592babb8b.tar.gz
src-486754660bb926339aefcf012a3f848592babb8b.zip
Vendor import of clang trunk r338150:vendor/clang/clang-trunk-r338150
Notes
Notes: svn path=/vendor/clang/dist/; revision=336815 svn path=/vendor/clang/clang-trunk-r338150/; revision=336816; tag=vendor/clang/clang-trunk-r338150
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/ARCMigrate/ARCMT.h10
-rw-r--r--include/clang/ARCMigrate/ARCMTActions.h2
-rw-r--r--include/clang/AST/APValue.h80
-rw-r--r--include/clang/AST/ASTConsumer.h22
-rw-r--r--include/clang/AST/ASTContext.h623
-rw-r--r--include/clang/AST/ASTDiagnostic.h2
-rw-r--r--include/clang/AST/ASTFwd.h2
-rw-r--r--include/clang/AST/ASTImporter.h165
-rw-r--r--include/clang/AST/ASTLambda.h2
-rw-r--r--include/clang/AST/ASTMutationListener.h44
-rw-r--r--include/clang/AST/ASTStructuralEquivalence.h34
-rw-r--r--include/clang/AST/ASTTypeTraits.h70
-rw-r--r--include/clang/AST/ASTUnresolvedSet.h4
-rw-r--r--include/clang/AST/Attr.h163
-rw-r--r--include/clang/AST/Availability.h4
-rw-r--r--include/clang/AST/BuiltinTypes.def77
-rw-r--r--include/clang/AST/CXXInheritance.h89
-rw-r--r--include/clang/AST/CanonicalType.h68
-rw-r--r--include/clang/AST/Comment.h2
-rw-r--r--include/clang/AST/CommentBriefParser.h2
-rw-r--r--include/clang/AST/CommentCommandTraits.h22
-rw-r--r--include/clang/AST/CommentLexer.h27
-rw-r--r--include/clang/AST/CommentSema.h4
-rw-r--r--include/clang/AST/ComparisonCategories.h243
-rw-r--r--include/clang/AST/DataCollection.h4
-rw-r--r--include/clang/AST/Decl.h964
-rw-r--r--include/clang/AST/DeclBase.h241
-rw-r--r--include/clang/AST/DeclCXX.h876
-rw-r--r--include/clang/AST/DeclContextInternals.h10
-rw-r--r--include/clang/AST/DeclFriend.h8
-rw-r--r--include/clang/AST/DeclLookups.h23
-rw-r--r--include/clang/AST/DeclObjC.h166
-rw-r--r--include/clang/AST/DeclOpenMP.h33
-rw-r--r--include/clang/AST/DeclTemplate.h537
-rw-r--r--include/clang/AST/DeclVisitor.h6
-rw-r--r--include/clang/AST/DeclarationName.h8
-rw-r--r--include/clang/AST/EvaluatedExprVisitor.h4
-rw-r--r--include/clang/AST/Expr.h526
-rw-r--r--include/clang/AST/ExprCXX.h651
-rw-r--r--include/clang/AST/ExprObjC.h136
-rw-r--r--include/clang/AST/ExprOpenMP.h18
-rw-r--r--include/clang/AST/ExternalASTMerger.h2
-rw-r--r--include/clang/AST/ExternalASTSource.h89
-rw-r--r--include/clang/AST/LambdaCapture.h32
-rw-r--r--include/clang/AST/LocInfoType.h2
-rw-r--r--include/clang/AST/Mangle.h8
-rw-r--r--include/clang/AST/MangleNumberingContext.h10
-rw-r--r--include/clang/AST/NSAPI.h66
-rw-r--r--include/clang/AST/NestedNameSpecifier.h142
-rw-r--r--include/clang/AST/NonTrivialTypeVisitor.h113
-rw-r--r--include/clang/AST/ODRHash.h15
-rw-r--r--include/clang/AST/OpenMPClause.h987
-rw-r--r--include/clang/AST/OperationKinds.def36
-rw-r--r--include/clang/AST/OperationKinds.h8
-rw-r--r--include/clang/AST/ParentMap.h2
-rw-r--r--include/clang/AST/PrettyDeclStackTrace.h (renamed from include/clang/Sema/PrettyDeclStackTrace.h)12
-rw-r--r--include/clang/AST/PrettyPrinter.h2
-rw-r--r--include/clang/AST/QualTypeNames.h5
-rw-r--r--include/clang/AST/RawCommentList.h54
-rw-r--r--include/clang/AST/RecordLayout.h2
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h65
-rw-r--r--include/clang/AST/Redeclarable.h102
-rw-r--r--include/clang/AST/SelectorLocationsKind.h16
-rw-r--r--include/clang/AST/Stmt.h198
-rw-r--r--include/clang/AST/StmtCXX.h43
-rw-r--r--include/clang/AST/StmtObjC.h32
-rw-r--r--include/clang/AST/StmtOpenMP.h580
-rw-r--r--include/clang/AST/StmtVisitor.h2
-rw-r--r--include/clang/AST/TemplateBase.h108
-rw-r--r--include/clang/AST/TemplateName.h102
-rw-r--r--include/clang/AST/Type.h639
-rw-r--r--include/clang/AST/TypeLoc.h113
-rw-r--r--include/clang/AST/TypeNodes.def1
-rw-r--r--include/clang/AST/TypeOrdering.h6
-rw-r--r--include/clang/AST/TypeVisitor.h6
-rw-r--r--include/clang/AST/UnresolvedSet.h4
-rw-r--r--include/clang/AST/VTTBuilder.h36
-rw-r--r--include/clang/AST/VTableBuilder.h102
-rw-r--r--include/clang/ASTMatchers/ASTMatchFinder.h48
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h1138
-rw-r--r--include/clang/ASTMatchers/ASTMatchersInternal.h256
-rw-r--r--include/clang/ASTMatchers/ASTMatchersMacros.h27
-rw-r--r--include/clang/ASTMatchers/Dynamic/Diagnostics.h34
-rw-r--r--include/clang/ASTMatchers/Dynamic/Parser.h22
-rw-r--r--include/clang/ASTMatchers/Dynamic/Registry.h18
-rw-r--r--include/clang/ASTMatchers/Dynamic/VariantValue.h72
-rw-r--r--include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h12
-rw-r--r--include/clang/Analysis/Analyses/Consumed.h109
-rw-r--r--include/clang/Analysis/Analyses/Dominators.h91
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h39
-rw-r--r--include/clang/Analysis/Analyses/LiveVariables.h9
-rw-r--r--include/clang/Analysis/Analyses/PostOrderCFGView.h54
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafety.h63
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyCommon.h185
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyLogical.h4
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyTIL.h543
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyTraverse.h173
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyUtil.h107
-rw-r--r--include/clang/Analysis/Analyses/UninitializedValues.h26
-rw-r--r--include/clang/Analysis/AnalysisDeclContext.h104
-rw-r--r--include/clang/Analysis/CFG.h187
-rw-r--r--include/clang/Analysis/CallGraph.h20
-rw-r--r--include/clang/Analysis/CloneDetection.h6
-rw-r--r--include/clang/Analysis/CodeInjector.h4
-rw-r--r--include/clang/Analysis/ConstructionContext.h474
-rw-r--r--include/clang/Analysis/ProgramPoint.h89
-rw-r--r--include/clang/Basic/ABI.h40
-rw-r--r--include/clang/Basic/AddressSpaces.h18
-rw-r--r--include/clang/Basic/AlignedAllocation.h12
-rw-r--r--include/clang/Basic/AllDiagnostics.h2
-rw-r--r--include/clang/Basic/Attr.td416
-rw-r--r--include/clang/Basic/AttrDocs.td307
-rw-r--r--include/clang/Basic/AttrKinds.h4
-rw-r--r--include/clang/Basic/AttrSubjectMatchRules.h2
-rw-r--r--include/clang/Basic/Attributes.h2
-rw-r--r--include/clang/Basic/BitmaskEnum.h25
-rw-r--r--include/clang/Basic/Builtins.def73
-rw-r--r--include/clang/Basic/Builtins.h75
-rw-r--r--include/clang/Basic/BuiltinsAArch64.def35
-rw-r--r--include/clang/Basic/BuiltinsAMDGPU.def21
-rw-r--r--include/clang/Basic/BuiltinsHexagon.def45
-rw-r--r--include/clang/Basic/BuiltinsNEON.def1
-rw-r--r--include/clang/Basic/BuiltinsNVPTX.def318
-rw-r--r--include/clang/Basic/BuiltinsPPC.def9
-rw-r--r--include/clang/Basic/BuiltinsWebAssembly.def15
-rw-r--r--include/clang/Basic/BuiltinsX86.def3474
-rw-r--r--include/clang/Basic/BuiltinsX86_64.def104
-rw-r--r--include/clang/Basic/CMakeLists.txt4
-rw-r--r--include/clang/Basic/CapturedStmt.h3
-rw-r--r--include/clang/Basic/CharInfo.h13
-rw-r--r--include/clang/Basic/CommentOptions.h24
-rw-r--r--include/clang/Basic/Cuda.h21
-rw-r--r--include/clang/Basic/DebugInfoOptions.h2
-rw-r--r--include/clang/Basic/Diagnostic.h500
-rw-r--r--include/clang/Basic/Diagnostic.td9
-rw-r--r--include/clang/Basic/DiagnosticASTKinds.td2
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td16
-rw-r--r--include/clang/Basic/DiagnosticDriverKinds.td63
-rw-r--r--include/clang/Basic/DiagnosticError.h2
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td7
-rw-r--r--include/clang/Basic/DiagnosticGroups.td63
-rw-r--r--include/clang/Basic/DiagnosticIDs.h62
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td26
-rw-r--r--include/clang/Basic/DiagnosticOptions.h25
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td43
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td876
-rw-r--r--include/clang/Basic/DiagnosticSerializationKinds.td83
-rw-r--r--include/clang/Basic/ExceptionSpecificationType.h17
-rw-r--r--include/clang/Basic/ExpressionTraits.h2
-rw-r--r--include/clang/Basic/Features.def238
-rw-r--r--include/clang/Basic/FileManager.h62
-rw-r--r--include/clang/Basic/FileSystemOptions.h6
-rw-r--r--include/clang/Basic/FileSystemStatCache.h69
-rw-r--r--include/clang/Basic/IdentifierTable.h136
-rw-r--r--include/clang/Basic/LLVM.h14
-rw-r--r--include/clang/Basic/Lambda.h6
-rw-r--r--include/clang/Basic/LangOptions.def35
-rw-r--r--include/clang/Basic/LangOptions.h139
-rw-r--r--include/clang/Basic/Linkage.h35
-rw-r--r--include/clang/Basic/MacroBuilder.h2
-rw-r--r--include/clang/Basic/Module.h238
-rw-r--r--include/clang/Basic/ObjCRuntime.h66
-rw-r--r--include/clang/Basic/OpenCLExtensions.def3
-rw-r--r--include/clang/Basic/OpenCLOptions.h6
-rw-r--r--include/clang/Basic/OpenMPKinds.def2
-rw-r--r--include/clang/Basic/OpenMPKinds.h46
-rw-r--r--include/clang/Basic/OperatorKinds.h6
-rw-r--r--include/clang/Basic/OperatorPrecedence.h4
-rw-r--r--include/clang/Basic/PartialDiagnostic.h96
-rw-r--r--include/clang/Basic/PlistSupport.h19
-rw-r--r--include/clang/Basic/PrettyStackTrace.h2
-rw-r--r--include/clang/Basic/Sanitizers.def12
-rw-r--r--include/clang/Basic/Sanitizers.h28
-rw-r--r--include/clang/Basic/SourceLocation.h127
-rw-r--r--include/clang/Basic/SourceManager.h454
-rw-r--r--include/clang/Basic/SourceManagerInternals.h22
-rw-r--r--include/clang/Basic/Specifiers.h55
-rw-r--r--include/clang/Basic/Stack.h27
-rw-r--r--include/clang/Basic/StmtNodes.td1
-rw-r--r--include/clang/Basic/SyncScope.h20
-rw-r--r--include/clang/Basic/TargetBuiltins.h30
-rw-r--r--include/clang/Basic/TargetCXXABI.h27
-rw-r--r--include/clang/Basic/TargetInfo.h412
-rw-r--r--include/clang/Basic/TargetOptions.h15
-rw-r--r--include/clang/Basic/TemplateKinds.h4
-rw-r--r--include/clang/Basic/TokenKinds.def62
-rw-r--r--include/clang/Basic/TokenKinds.h24
-rw-r--r--include/clang/Basic/TypeTraits.h11
-rw-r--r--include/clang/Basic/Version.h18
-rw-r--r--include/clang/Basic/VersionTuple.h168
-rw-r--r--include/clang/Basic/VirtualFileSystem.h125
-rw-r--r--include/clang/Basic/Visibility.h6
-rw-r--r--include/clang/Basic/X86Target.def147
-rw-r--r--include/clang/Basic/XRayInstr.h70
-rw-r--r--include/clang/Basic/XRayLists.h3
-rw-r--r--include/clang/Basic/arm_fp16.td131
-rw-r--r--include/clang/Basic/arm_neon.td524
-rw-r--r--include/clang/Basic/arm_neon_incl.td316
-rw-r--r--include/clang/CodeGen/BackendUtil.h2
-rw-r--r--include/clang/CodeGen/CGFunctionInfo.h73
-rw-r--r--include/clang/CodeGen/ConstantInitBuilder.h4
-rw-r--r--include/clang/CodeGen/SwiftCallingConv.h22
-rw-r--r--include/clang/Config/config.h.cmake13
-rw-r--r--include/clang/CrossTU/CrossTranslationUnit.h14
-rw-r--r--include/clang/Driver/Action.h113
-rw-r--r--include/clang/Driver/CC1Options.td31
-rw-r--r--include/clang/Driver/CLCompatOptions.td17
-rw-r--r--include/clang/Driver/Compilation.h61
-rw-r--r--include/clang/Driver/Distro.h3
-rw-r--r--include/clang/Driver/Driver.h93
-rw-r--r--include/clang/Driver/Job.h35
-rw-r--r--include/clang/Driver/Multilib.h54
-rw-r--r--include/clang/Driver/Options.td488
-rw-r--r--include/clang/Driver/SanitizerArgs.h2
-rw-r--r--include/clang/Driver/Tool.h8
-rw-r--r--include/clang/Driver/ToolChain.h136
-rw-r--r--include/clang/Driver/Types.def3
-rw-r--r--include/clang/Driver/Types.h3
-rw-r--r--include/clang/Driver/XRayArgs.h10
-rw-r--r--include/clang/Edit/Commit.h36
-rw-r--r--include/clang/Edit/EditedSource.h36
-rw-r--r--include/clang/Edit/EditsReceiver.h19
-rw-r--r--include/clang/Edit/FileOffset.h23
-rw-r--r--include/clang/Format/Format.h709
-rw-r--r--include/clang/Frontend/ASTConsumers.h7
-rw-r--r--include/clang/Frontend/ASTUnit.h286
-rw-r--r--include/clang/Frontend/ChainedDiagnosticConsumer.h2
-rw-r--r--include/clang/Frontend/CodeGenOptions.def54
-rw-r--r--include/clang/Frontend/CodeGenOptions.h34
-rw-r--r--include/clang/Frontend/CommandLineSourceLoc.h4
-rw-r--r--include/clang/Frontend/CompilerInstance.h53
-rw-r--r--include/clang/Frontend/CompilerInvocation.h78
-rw-r--r--include/clang/Frontend/DependencyOutputOptions.h25
-rw-r--r--include/clang/Frontend/DiagnosticRenderer.h32
-rw-r--r--include/clang/Frontend/FrontendAction.h48
-rw-r--r--include/clang/Frontend/FrontendActions.h32
-rw-r--r--include/clang/Frontend/FrontendOptions.h357
-rw-r--r--include/clang/Frontend/FrontendPluginRegistry.h12
-rw-r--r--include/clang/Frontend/LangStandards.def7
-rw-r--r--include/clang/Frontend/LayoutOverrideSource.h20
-rw-r--r--include/clang/Frontend/MultiplexConsumer.h23
-rw-r--r--include/clang/Frontend/PrecompiledPreamble.h27
-rw-r--r--include/clang/Frontend/SerializedDiagnosticPrinter.h6
-rw-r--r--include/clang/Frontend/SerializedDiagnosticReader.h83
-rw-r--r--include/clang/Frontend/SerializedDiagnostics.h8
-rw-r--r--include/clang/Frontend/TextDiagnostic.h6
-rw-r--r--include/clang/Frontend/TextDiagnosticBuffer.h32
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h2
-rw-r--r--include/clang/Frontend/Utils.h73
-rw-r--r--include/clang/Frontend/VerifyDiagnosticConsumer.h62
-rw-r--r--include/clang/FrontendTool/Utils.h9
-rw-r--r--include/clang/Index/IndexDataConsumer.h13
-rw-r--r--include/clang/Index/IndexSymbol.h48
-rw-r--r--include/clang/Index/IndexingAction.h25
-rw-r--r--include/clang/Index/USRGeneration.h18
-rw-r--r--include/clang/Lex/CodeCompletionHandler.h14
-rw-r--r--include/clang/Lex/DirectoryLookup.h12
-rw-r--r--include/clang/Lex/ExternalPreprocessorSource.h10
-rw-r--r--include/clang/Lex/HeaderSearch.h191
-rw-r--r--include/clang/Lex/HeaderSearchOptions.h28
-rw-r--r--include/clang/Lex/Lexer.h52
-rw-r--r--include/clang/Lex/LiteralSupport.h21
-rw-r--r--include/clang/Lex/MacroInfo.h118
-rw-r--r--include/clang/Lex/ModuleLoader.h20
-rw-r--r--include/clang/Lex/ModuleMap.h208
-rw-r--r--include/clang/Lex/MultipleIncludeOpt.h16
-rw-r--r--include/clang/Lex/PPCallbacks.h104
-rw-r--r--include/clang/Lex/PPConditionalDirectiveRecord.h10
-rw-r--r--include/clang/Lex/Pragma.h8
-rw-r--r--include/clang/Lex/PreprocessingRecord.h170
-rw-r--r--include/clang/Lex/Preprocessor.h392
-rw-r--r--include/clang/Lex/PreprocessorLexer.h30
-rw-r--r--include/clang/Lex/PreprocessorOptions.h52
-rw-r--r--include/clang/Lex/Token.h46
-rw-r--r--include/clang/Lex/TokenLexer.h14
-rw-r--r--include/clang/Lex/VariadicMacroSupport.h6
-rw-r--r--include/clang/Parse/ParseAST.h4
-rw-r--r--include/clang/Parse/Parser.h580
-rw-r--r--include/clang/Parse/RAIIObjectsForParser.h17
-rw-r--r--include/clang/Rewrite/Core/DeltaTree.h13
-rw-r--r--include/clang/Rewrite/Core/HTMLRewrite.h3
-rw-r--r--include/clang/Rewrite/Core/RewriteBuffer.h19
-rw-r--r--include/clang/Rewrite/Core/RewriteRope.h55
-rw-r--r--include/clang/Rewrite/Core/Rewriter.h56
-rw-r--r--include/clang/Rewrite/Core/TokenRewriter.h28
-rw-r--r--include/clang/Rewrite/Frontend/FixItRewriter.h69
-rw-r--r--include/clang/Rewrite/Frontend/FrontendActions.h2
-rw-r--r--include/clang/Sema/AnalysisBasedWarnings.h18
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h768
-rw-r--r--include/clang/Sema/CodeCompleteOptions.h11
-rw-r--r--include/clang/Sema/DeclSpec.h771
-rw-r--r--include/clang/Sema/DelayedDiagnostic.h87
-rw-r--r--include/clang/Sema/ExternalSemaSource.h38
-rw-r--r--include/clang/Sema/IdentifierResolver.h61
-rw-r--r--include/clang/Sema/Initialization.h767
-rw-r--r--include/clang/Sema/Lookup.h212
-rw-r--r--include/clang/Sema/LoopHint.h4
-rw-r--r--include/clang/Sema/MultiplexExternalSemaSource.h86
-rw-r--r--include/clang/Sema/ObjCMethodList.h6
-rw-r--r--include/clang/Sema/Overload.h298
-rw-r--r--include/clang/Sema/Ownership.h101
-rw-r--r--include/clang/Sema/ParsedAttr.h (renamed from include/clang/Sema/AttributeList.h)733
-rw-r--r--include/clang/Sema/ParsedTemplate.h53
-rw-r--r--include/clang/Sema/Scope.h100
-rw-r--r--include/clang/Sema/ScopeInfo.h521
-rw-r--r--include/clang/Sema/Sema.h1884
-rw-r--r--include/clang/Sema/SemaConsumer.h6
-rw-r--r--include/clang/Sema/SemaFixItUtils.h2
-rw-r--r--include/clang/Sema/SemaInternal.h55
-rw-r--r--include/clang/Sema/SemaLambda.h10
-rw-r--r--include/clang/Sema/Template.h197
-rw-r--r--include/clang/Sema/TemplateDeduction.h148
-rw-r--r--include/clang/Sema/TemplateInstCallback.h83
-rw-r--r--include/clang/Sema/TypoCorrection.h137
-rw-r--r--include/clang/Sema/Weak.h2
-rw-r--r--include/clang/Serialization/ASTBitCodes.h1104
-rw-r--r--include/clang/Serialization/ASTDeserializationListener.h18
-rw-r--r--include/clang/Serialization/ASTReader.h791
-rw-r--r--include/clang/Serialization/ASTWriter.h267
-rw-r--r--include/clang/Serialization/ContinuousRangeMap.h7
-rw-r--r--include/clang/Serialization/GlobalModuleIndex.h60
-rw-r--r--include/clang/Serialization/Module.h231
-rw-r--r--include/clang/Serialization/ModuleManager.h92
-rw-r--r--include/clang/StaticAnalyzer/Checkers/CMakeLists.txt1
-rw-r--r--include/clang/StaticAnalyzer/Checkers/Checkers.td50
-rw-r--r--include/clang/StaticAnalyzer/Core/AnalyzerOptions.h236
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h246
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h181
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugType.h40
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h296
-rw-r--r--include/clang/StaticAnalyzer/Core/Checker.h24
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerManager.h294
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerRegistry.h22
-rw-r--r--include/clang/StaticAnalyzer/Core/IssueHash.h4
-rw-r--r--include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h30
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h79
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h296
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h42
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h21
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h41
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h174
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h8
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h28
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h39
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h125
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h264
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h29
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h274
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h185
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h142
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h216
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h77
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h31
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SMTExpr.h62
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SMTSolver.h996
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SMTSort.h91
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h64
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h232
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h5
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Store.h73
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h25
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h39
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h140
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h31
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/TaintTag.h11
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h18
-rw-r--r--include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h15
-rw-r--r--include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h10
-rw-r--r--include/clang/StaticAnalyzer/Frontend/FrontendActions.h2
-rw-r--r--include/clang/StaticAnalyzer/Frontend/ModelConsumer.h4
-rw-r--r--include/clang/Tooling/AllTUsExecution.h76
-rw-r--r--include/clang/Tooling/ArgumentsAdjusters.h27
-rw-r--r--include/clang/Tooling/CommonOptionsParser.h10
-rw-r--r--include/clang/Tooling/CompilationDatabase.h67
-rw-r--r--include/clang/Tooling/CompilationDatabasePluginRegistry.h14
-rw-r--r--include/clang/Tooling/Core/Diagnostic.h22
-rw-r--r--include/clang/Tooling/Core/Replacement.h88
-rw-r--r--include/clang/Tooling/DiagnosticsYaml.h6
-rw-r--r--include/clang/Tooling/Execution.h44
-rw-r--r--include/clang/Tooling/FileMatchTrie.h31
-rw-r--r--include/clang/Tooling/FixIt.h14
-rw-r--r--include/clang/Tooling/Inclusions/HeaderIncludes.h137
-rw-r--r--include/clang/Tooling/Inclusions/IncludeStyle.h139
-rw-r--r--include/clang/Tooling/JSONCompilationDatabase.h37
-rw-r--r--include/clang/Tooling/Refactoring.h12
-rw-r--r--include/clang/Tooling/Refactoring/AtomicChange.h34
-rw-r--r--include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h2
-rw-r--r--include/clang/Tooling/Refactoring/RefactoringActionRule.h2
-rw-r--r--include/clang/Tooling/Refactoring/RefactoringResultConsumer.h4
-rw-r--r--include/clang/Tooling/Refactoring/Rename/RenamingAction.h4
-rw-r--r--include/clang/Tooling/Refactoring/Rename/SymbolName.h2
-rw-r--r--include/clang/Tooling/Refactoring/Rename/USRFinder.h2
-rw-r--r--include/clang/Tooling/Refactoring/Rename/USRFindingAction.h2
-rw-r--r--include/clang/Tooling/Refactoring/Rename/USRLocFinder.h2
-rw-r--r--include/clang/Tooling/RefactoringCallbacks.h12
-rw-r--r--include/clang/Tooling/ReplacementsYaml.h8
-rw-r--r--include/clang/Tooling/StandaloneExecution.h11
-rw-r--r--include/clang/Tooling/ToolExecutorPluginRegistry.h8
-rw-r--r--include/clang/Tooling/Tooling.h163
-rw-r--r--include/clang/module.modulemap6
405 files changed, 27903 insertions, 18567 deletions
diff --git a/include/clang/ARCMigrate/ARCMT.h b/include/clang/ARCMigrate/ARCMT.h
index 74081867eebc..30c24f1cdb10 100644
--- a/include/clang/ARCMigrate/ARCMT.h
+++ b/include/clang/ARCMigrate/ARCMT.h
@@ -22,7 +22,7 @@ namespace clang {
namespace arcmt {
class MigrationPass;
-/// \brief Creates an AST with the provided CompilerInvocation but with these
+/// Creates an AST with the provided CompilerInvocation but with these
/// changes:
/// -if a PCH/PTH is set, the original header is used instead
/// -Automatic Reference Counting mode is enabled
@@ -45,7 +45,7 @@ checkForManualIssues(CompilerInvocation &CI, const FrontendInputFile &Input,
bool emitPremigrationARCErrors = false,
StringRef plistOut = StringRef());
-/// \brief Works similar to checkForManualIssues but instead of checking, it
+/// Works similar to checkForManualIssues but instead of checking, it
/// applies automatic modifications to source files to conform to ARC.
///
/// \returns false if no error is produced, true otherwise.
@@ -55,7 +55,7 @@ applyTransformations(CompilerInvocation &origCI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
DiagnosticConsumer *DiagClient);
-/// \brief Applies automatic modifications and produces temporary files
+/// Applies automatic modifications and produces temporary files
/// and metadata into the \p outputDir path.
///
/// \param emitPremigrationARCErrors if true all ARC errors will get emitted
@@ -72,7 +72,7 @@ bool migrateWithTemporaryFiles(
DiagnosticConsumer *DiagClient, StringRef outputDir,
bool emitPremigrationARCErrors, StringRef plistOut);
-/// \brief Get the set of file remappings from the \p outputDir path that
+/// Get the set of file remappings from the \p outputDir path that
/// migrateWithTemporaryFiles produced.
///
/// \returns false if no error is produced, true otherwise.
@@ -80,7 +80,7 @@ bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap,
StringRef outputDir,
DiagnosticConsumer *DiagClient);
-/// \brief Get the set of file remappings from a list of files with remapping
+/// Get the set of file remappings from a list of files with remapping
/// info.
///
/// \returns false if no error is produced, true otherwise.
diff --git a/include/clang/ARCMigrate/ARCMTActions.h b/include/clang/ARCMigrate/ARCMTActions.h
index 554e0c0c6d02..2571ca75be51 100644
--- a/include/clang/ARCMigrate/ARCMTActions.h
+++ b/include/clang/ARCMigrate/ARCMTActions.h
@@ -55,7 +55,7 @@ public:
bool emitPremigrationARCErrors);
};
-/// \brief Migrates to modern ObjC syntax.
+/// Migrates to modern ObjC syntax.
class ObjCMigrateAction : public WrapperFrontendAction {
std::string MigrateDir;
unsigned ObjCMigAction;
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h
index 7c431f3be8c4..d4057c9da5f3 100644
--- a/include/clang/AST/APValue.h
+++ b/include/clang/AST/APValue.h
@@ -53,7 +53,58 @@ public:
MemberPointer,
AddrLabelDiff
};
- typedef llvm::PointerUnion<const ValueDecl *, const Expr *> LValueBase;
+
+ class LValueBase {
+ public:
+ typedef llvm::PointerUnion<const ValueDecl *, const Expr *> PtrTy;
+
+ LValueBase() : CallIndex(0), Version(0) {}
+
+ template <class T>
+ LValueBase(T P, unsigned I = 0, unsigned V = 0)
+ : Ptr(P), CallIndex(I), Version(V) {}
+
+ template <class T>
+ bool is() const { return Ptr.is<T>(); }
+
+ template <class T>
+ T get() const { return Ptr.get<T>(); }
+
+ template <class T>
+ T dyn_cast() const { return Ptr.dyn_cast<T>(); }
+
+ void *getOpaqueValue() const;
+
+ bool isNull() const;
+
+ explicit operator bool () const;
+
+ PtrTy getPointer() const {
+ return Ptr;
+ }
+
+ unsigned getCallIndex() const {
+ return CallIndex;
+ }
+
+ void setCallIndex(unsigned Index) {
+ CallIndex = Index;
+ }
+
+ unsigned getVersion() const {
+ return Version;
+ }
+
+ bool operator==(const LValueBase &Other) const {
+ return Ptr == Other.Ptr && CallIndex == Other.CallIndex &&
+ Version == Other.Version;
+ }
+
+ private:
+ PtrTy Ptr;
+ unsigned CallIndex, Version;
+ };
+
typedef llvm::PointerIntPair<const Decl *, 1, bool> BaseOrMemberType;
union LValuePathEntry {
/// BaseOrMember - The FieldDecl or CXXRecordDecl indicating the next item
@@ -135,15 +186,15 @@ public:
}
APValue(const APValue &RHS);
APValue(APValue &&RHS) : Kind(Uninitialized) { swap(RHS); }
- APValue(LValueBase B, const CharUnits &O, NoLValuePath N, unsigned CallIndex,
+ APValue(LValueBase B, const CharUnits &O, NoLValuePath N,
bool IsNullPtr = false)
: Kind(Uninitialized) {
- MakeLValue(); setLValue(B, O, N, CallIndex, IsNullPtr);
+ MakeLValue(); setLValue(B, O, N, IsNullPtr);
}
APValue(LValueBase B, const CharUnits &O, ArrayRef<LValuePathEntry> Path,
- bool OnePastTheEnd, unsigned CallIndex, bool IsNullPtr = false)
+ bool OnePastTheEnd, bool IsNullPtr = false)
: Kind(Uninitialized) {
- MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, CallIndex, IsNullPtr);
+ MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, IsNullPtr);
}
APValue(UninitArray, unsigned InitElts, unsigned Size) : Kind(Uninitialized) {
MakeArray(InitElts, Size);
@@ -168,14 +219,14 @@ public:
MakeUninit();
}
- /// \brief Returns whether the object performed allocations.
+ /// Returns whether the object performed allocations.
///
/// If APValues are constructed via placement new, \c needsCleanup()
/// indicates whether the destructor must be called in order to correctly
/// free all allocated memory.
bool needsCleanup() const;
- /// \brief Swaps the contents of this and the given APValue.
+ /// Swaps the contents of this and the given APValue.
void swap(APValue &RHS);
ValueKind getKind() const { return Kind; }
@@ -255,6 +306,7 @@ public:
bool hasLValuePath() const;
ArrayRef<LValuePathEntry> getLValuePath() const;
unsigned getLValueCallIndex() const;
+ unsigned getLValueVersion() const;
bool isNullPointer() const;
APValue &getVectorElt(unsigned I) {
@@ -376,10 +428,10 @@ public:
((ComplexAPFloat *)(char *)Data.buffer)->Imag = std::move(I);
}
void setLValue(LValueBase B, const CharUnits &O, NoLValuePath,
- unsigned CallIndex, bool IsNullPtr);
+ bool IsNullPtr);
void setLValue(LValueBase B, const CharUnits &O,
ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
- unsigned CallIndex, bool IsNullPtr);
+ bool IsNullPtr);
void setUnion(const FieldDecl *Field, const APValue &Value) {
assert(isUnion() && "Invalid accessor");
((UnionData*)(char*)Data.buffer)->Field = Field;
@@ -451,4 +503,14 @@ private:
} // end namespace clang.
+namespace llvm {
+template<> struct DenseMapInfo<clang::APValue::LValueBase> {
+ static clang::APValue::LValueBase getEmptyKey();
+ static clang::APValue::LValueBase getTombstoneKey();
+ static unsigned getHashValue(const clang::APValue::LValueBase &Base);
+ static bool isEqual(const clang::APValue::LValueBase &LHS,
+ const clang::APValue::LValueBase &RHS);
+};
+}
+
#endif
diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h
index ad368c86c79c..1167c566a35f 100644
--- a/include/clang/AST/ASTConsumer.h
+++ b/include/clang/AST/ASTConsumer.h
@@ -32,7 +32,7 @@ namespace clang {
/// clients that read ASTs. This abstraction layer allows the client to be
/// independent of the AST producer (e.g. parser vs AST dump file reader, etc).
class ASTConsumer {
- /// \brief Whether this AST consumer also requires information about
+ /// Whether this AST consumer also requires information about
/// semantic analysis.
bool SemaConsumer;
@@ -53,7 +53,7 @@ public:
/// \returns true to continue parsing, or false to abort parsing.
virtual bool HandleTopLevelDecl(DeclGroupRef D);
- /// \brief This callback is invoked each time an inline (method or friend)
+ /// This callback is invoked each time an inline (method or friend)
/// function definition in a class is completed.
virtual void HandleInlineFunctionDefinition(FunctionDecl *D) {}
@@ -72,22 +72,22 @@ public:
/// can be defined in declspecs).
virtual void HandleTagDeclDefinition(TagDecl *D) {}
- /// \brief This callback is invoked the first time each TagDecl is required to
+ /// This callback is invoked the first time each TagDecl is required to
/// be complete.
virtual void HandleTagDeclRequiredDefinition(const TagDecl *D) {}
- /// \brief Invoked when a function is implicitly instantiated.
+ /// Invoked when a function is implicitly instantiated.
/// Note that at this point point it does not have a body, its body is
/// instantiated at the end of the translation unit and passed to
/// HandleTopLevelDecl.
virtual void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) {}
- /// \brief Handle the specified top-level declaration that occurred inside
+ /// Handle the specified top-level declaration that occurred inside
/// and ObjC container.
/// The default implementation ignored them.
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D);
- /// \brief Handle an ImportDecl that was implicitly created due to an
+ /// Handle an ImportDecl that was implicitly created due to an
/// inclusion directive.
/// The default implementation passes it to HandleTopLevelDecl.
virtual void HandleImplicitImportDecl(ImportDecl *D);
@@ -103,7 +103,7 @@ public:
/// modified by the introduction of an implicit zero initializer.
virtual void CompleteTentativeDefinition(VarDecl *D) {}
- /// \brief Callback invoked when an MSInheritanceAttr has been attached to a
+ /// Callback invoked when an MSInheritanceAttr has been attached to a
/// CXXRecordDecl.
virtual void AssignInheritanceModel(CXXRecordDecl *RD) {}
@@ -111,19 +111,19 @@ public:
// variable has been instantiated.
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D) {}
- /// \brief Callback involved at the end of a translation unit to
+ /// Callback involved at the end of a translation unit to
/// notify the consumer that a vtable for the given C++ class is
/// required.
///
/// \param RD The class whose vtable was used.
virtual void HandleVTable(CXXRecordDecl *RD) {}
- /// \brief If the consumer is interested in entities getting modified after
+ /// If the consumer is interested in entities getting modified after
/// their initial creation, it should return a pointer to
/// an ASTMutationListener here.
virtual ASTMutationListener *GetASTMutationListener() { return nullptr; }
- /// \brief If the consumer is interested in entities being deserialized from
+ /// If the consumer is interested in entities being deserialized from
/// AST files, it should return a pointer to a ASTDeserializationListener here
virtual ASTDeserializationListener *GetASTDeserializationListener() {
return nullptr;
@@ -132,7 +132,7 @@ public:
/// PrintStats - If desired, print any statistics.
virtual void PrintStats() {}
- /// \brief This callback is called for each function if the Parser was
+ /// This callback is called for each function if the Parser was
/// initialized with \c SkipFunctionBodies set to \c true.
///
/// \return \c true if the function's body should be skipped. The function
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index a5d080035df0..c6f8e2973e8e 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
/// \file
-/// \brief Defines the clang::ASTContext interface.
+/// Defines the clang::ASTContext interface.
//
//===----------------------------------------------------------------------===//
@@ -18,6 +18,7 @@
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/CanonicalType.h"
#include "clang/AST/CommentCommandTraits.h"
+#include "clang/AST/ComparisonCategories.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
@@ -144,7 +145,7 @@ struct TypeInfo {
: Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {}
};
-/// \brief Holds long-lived AST nodes (such as types and decls) that can be
+/// 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<ASTContext> {
friend class NestedNameSpecifier;
@@ -167,6 +168,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
mutable llvm::FoldingSet<DependentAddressSpaceType>
DependentAddressSpaceTypes;
mutable llvm::FoldingSet<VectorType> VectorTypes;
+ mutable llvm::FoldingSet<DependentVectorType> DependentVectorTypes;
mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
FunctionProtoTypes;
@@ -206,13 +208,13 @@ class ASTContext : public RefCountedBase<ASTContext> {
ASTContext&>
SubstTemplateTemplateParmPacks;
- /// \brief The set of nested name specifiers.
+ /// The set of nested name specifiers.
///
/// This set is managed by the NestedNameSpecifier class.
mutable llvm::FoldingSet<NestedNameSpecifier> NestedNameSpecifiers;
mutable NestedNameSpecifier *GlobalNestedNameSpecifier = nullptr;
- /// \brief A cache mapping from RecordDecls to ASTRecordLayouts.
+ /// A cache mapping from RecordDecls to ASTRecordLayouts.
///
/// This is lazily created. This is intentionally not serialized.
mutable llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>
@@ -220,35 +222,35 @@ class ASTContext : public RefCountedBase<ASTContext> {
mutable llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*>
ObjCLayouts;
- /// \brief A cache from types to size and alignment information.
+ /// A cache from types to size and alignment information.
using TypeInfoMap = llvm::DenseMap<const Type *, struct TypeInfo>;
mutable TypeInfoMap MemoizedTypeInfo;
- /// \brief A cache mapping from CXXRecordDecls to key functions.
+ /// A cache mapping from CXXRecordDecls to key functions.
llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions;
- /// \brief Mapping from ObjCContainers to their ObjCImplementations.
+ /// Mapping from ObjCContainers to their ObjCImplementations.
llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
- /// \brief Mapping from ObjCMethod to its duplicate declaration in the same
+ /// Mapping from ObjCMethod to its duplicate declaration in the same
/// interface.
llvm::DenseMap<const ObjCMethodDecl*,const ObjCMethodDecl*> ObjCMethodRedecls;
- /// \brief Mapping from __block VarDecls to their copy initialization expr.
+ /// Mapping from __block VarDecls to their copy initialization expr.
llvm::DenseMap<const VarDecl*, Expr*> BlockVarCopyInits;
- /// \brief Mapping from class scope functions specialization to their
+ /// Mapping from class scope functions specialization to their
/// template patterns.
llvm::DenseMap<const FunctionDecl*, FunctionDecl*>
ClassScopeSpecializationPattern;
- /// \brief Mapping from materialized temporaries with static storage duration
+ /// Mapping from materialized temporaries with static storage duration
/// that appear in constant initializers to their evaluated values. These are
/// allocated in a std::map because their address must be stable.
llvm::DenseMap<const MaterializeTemporaryExpr *, APValue *>
MaterializedTemporaryValues;
- /// \brief Representation of a "canonical" template template parameter that
+ /// Representation of a "canonical" template template parameter that
/// is used in canonical template names.
class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
TemplateTemplateParmDecl *Parm;
@@ -270,32 +272,32 @@ class ASTContext : public RefCountedBase<ASTContext> {
TemplateTemplateParmDecl *
getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const;
- /// \brief The typedef for the __int128_t type.
+ /// The typedef for the __int128_t type.
mutable TypedefDecl *Int128Decl = nullptr;
- /// \brief The typedef for the __uint128_t type.
+ /// The typedef for the __uint128_t type.
mutable TypedefDecl *UInt128Decl = nullptr;
- /// \brief The typedef for the target specific predefined
+ /// The typedef for the target specific predefined
/// __builtin_va_list type.
mutable TypedefDecl *BuiltinVaListDecl = nullptr;
/// The typedef for the predefined \c __builtin_ms_va_list type.
mutable TypedefDecl *BuiltinMSVaListDecl = nullptr;
- /// \brief The typedef for the predefined \c id type.
+ /// The typedef for the predefined \c id type.
mutable TypedefDecl *ObjCIdDecl = nullptr;
- /// \brief The typedef for the predefined \c SEL type.
+ /// The typedef for the predefined \c SEL type.
mutable TypedefDecl *ObjCSelDecl = nullptr;
- /// \brief The typedef for the predefined \c Class type.
+ /// The typedef for the predefined \c Class type.
mutable TypedefDecl *ObjCClassDecl = nullptr;
- /// \brief The typedef for the predefined \c Protocol class in Objective-C.
+ /// The typedef for the predefined \c Protocol class in Objective-C.
mutable ObjCInterfaceDecl *ObjCProtocolClassDecl = nullptr;
- /// \brief The typedef for the predefined 'BOOL' type.
+ /// The typedef for the predefined 'BOOL' type.
mutable TypedefDecl *BOOLDecl = nullptr;
// Typedefs which may be provided defining the structure of Objective-C
@@ -327,53 +329,53 @@ class ASTContext : public RefCountedBase<ASTContext> {
QualType ObjCNSStringType;
- /// \brief The typedef declaration for the Objective-C "instancetype" type.
+ /// The typedef declaration for the Objective-C "instancetype" type.
TypedefDecl *ObjCInstanceTypeDecl = nullptr;
- /// \brief The type for the C FILE type.
+ /// The type for the C FILE type.
TypeDecl *FILEDecl = nullptr;
- /// \brief The type for the C jmp_buf type.
+ /// The type for the C jmp_buf type.
TypeDecl *jmp_bufDecl = nullptr;
- /// \brief The type for the C sigjmp_buf type.
+ /// The type for the C sigjmp_buf type.
TypeDecl *sigjmp_bufDecl = nullptr;
- /// \brief The type for the C ucontext_t type.
+ /// The type for the C ucontext_t type.
TypeDecl *ucontext_tDecl = nullptr;
- /// \brief Type for the Block descriptor for Blocks CodeGen.
+ /// Type for the Block descriptor for Blocks CodeGen.
///
/// Since this is only used for generation of debug info, it is not
/// serialized.
mutable RecordDecl *BlockDescriptorType = nullptr;
- /// \brief Type for the Block descriptor for Blocks CodeGen.
+ /// Type for the Block descriptor for Blocks CodeGen.
///
/// Since this is only used for generation of debug info, it is not
/// serialized.
mutable RecordDecl *BlockDescriptorExtendedType = nullptr;
- /// \brief Declaration for the CUDA cudaConfigureCall function.
+ /// Declaration for the CUDA cudaConfigureCall function.
FunctionDecl *cudaConfigureCallDecl = nullptr;
- /// \brief Keeps track of all declaration attributes.
+ /// Keeps track of all declaration attributes.
///
/// Since so few decls have attrs, we keep them in a hash map instead of
/// wasting space in the Decl class.
llvm::DenseMap<const Decl*, AttrVec*> DeclAttrs;
- /// \brief A mapping from non-redeclarable declarations in modules that were
+ /// A mapping from non-redeclarable declarations in modules that were
/// merged with other declarations to the canonical declaration that they were
/// merged into.
llvm::DenseMap<Decl*, Decl*> MergedDecls;
- /// \brief A mapping from a defining declaration to a list of modules (other
+ /// A mapping from a defining declaration to a list of modules (other
/// than the owning module of the declaration) that contain merged
/// definitions of that entity.
llvm::DenseMap<NamedDecl*, llvm::TinyPtrVector<Module*>> MergedDefModules;
- /// \brief Initializers for a module, in order. Each Decl will be either
+ /// Initializers for a module, in order. Each Decl will be either
/// something that has a semantic effect on startup (such as a variable with
/// a non-constant initializer), or an ImportDecl (which recursively triggers
/// initialization of another module).
@@ -388,7 +390,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
ASTContext &this_() { return *this; }
public:
- /// \brief A type synonym for the TemplateOrInstantiation mapping.
+ /// A type synonym for the TemplateOrInstantiation mapping.
using TemplateOrSpecializationInfo =
llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>;
@@ -398,7 +400,7 @@ private:
friend class ASTWriter;
friend class CXXRecordDecl;
- /// \brief A mapping to contain the template or declaration that
+ /// A mapping to contain the template or declaration that
/// a variable declaration describes or was instantiated from,
/// respectively.
///
@@ -431,7 +433,7 @@ private:
llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>
TemplateOrInstantiation;
- /// \brief Keeps track of the declaration from which a using declaration was
+ /// Keeps track of the declaration from which a using declaration was
/// created during instantiation.
///
/// The source and target declarations are always a UsingDecl, an
@@ -461,7 +463,7 @@ private:
llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl;
- /// \brief Mapping that stores the methods overridden by a given C++
+ /// Mapping that stores the methods overridden by a given C++
/// member function.
///
/// Since most C++ member functions aren't virtual and therefore
@@ -470,18 +472,18 @@ private:
using CXXMethodVector = llvm::TinyPtrVector<const CXXMethodDecl *>;
llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods;
- /// \brief Mapping from each declaration context to its corresponding
+ /// Mapping from each declaration context to its corresponding
/// mangling numbering context (used for constructs like lambdas which
/// need to be consistently numbered for the mangler).
llvm::DenseMap<const DeclContext *, std::unique_ptr<MangleNumberingContext>>
MangleNumberingContexts;
- /// \brief Side-table of mangling numbers for declarations which rarely
+ /// Side-table of mangling numbers for declarations which rarely
/// need them (like static local vars).
llvm::MapVector<const NamedDecl *, unsigned> MangleNumbers;
llvm::MapVector<const VarDecl *, unsigned> StaticLocalNumbers;
- /// \brief Mapping that stores parameterIndex values for ParmVarDecls when
+ /// Mapping that stores parameterIndex values for ParmVarDecls when
/// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex.
using ParameterIndexTable = llvm::DenseMap<const VarDecl *, unsigned>;
ParameterIndexTable ParamIndices;
@@ -494,38 +496,38 @@ private:
mutable BuiltinTemplateDecl *MakeIntegerSeqDecl = nullptr;
mutable BuiltinTemplateDecl *TypePackElementDecl = nullptr;
- /// \brief The associated SourceManager object.
+ /// The associated SourceManager object.
SourceManager &SourceMgr;
- /// \brief The language options used to create the AST associated with
+ /// The language options used to create the AST associated with
/// this ASTContext object.
LangOptions &LangOpts;
- /// \brief Blacklist object that is used by sanitizers to decide which
+ /// Blacklist object that is used by sanitizers to decide which
/// entities should not be instrumented.
std::unique_ptr<SanitizerBlacklist> SanitizerBL;
- /// \brief Function filtering mechanism to determine whether a given function
+ /// Function filtering mechanism to determine whether a given function
/// should be imbued with the XRay "always" or "never" attributes.
std::unique_ptr<XRayFunctionFilter> XRayFilter;
- /// \brief The allocator used to create AST objects.
+ /// The allocator used to create AST objects.
///
/// AST objects are never destructed; rather, all memory associated with the
/// AST objects will be released when the ASTContext itself is destroyed.
mutable llvm::BumpPtrAllocator BumpAlloc;
- /// \brief Allocator for partial diagnostics.
+ /// Allocator for partial diagnostics.
PartialDiagnostic::StorageAllocator DiagAllocator;
- /// \brief The current C++ ABI.
+ /// The current C++ ABI.
std::unique_ptr<CXXABI> ABI;
CXXABI *createCXXABI(const TargetInfo &T);
- /// \brief The logical -> physical address space map.
+ /// The logical -> physical address space map.
const LangASMap *AddrSpaceMap = nullptr;
- /// \brief Address space map mangling must be used with language specific
+ /// Address space map mangling must be used with language specific
/// address spaces (e.g. OpenCL/CUDA)
bool AddrSpaceMapMangling;
@@ -541,10 +543,10 @@ public:
IntrusiveRefCntPtr<ExternalASTSource> ExternalSource;
ASTMutationListener *Listener = nullptr;
- /// \brief Contains parents of a node.
+ /// Contains parents of a node.
using ParentVector = llvm::SmallVector<ast_type_traits::DynTypedNode, 2>;
- /// \brief Maps from a node to its parents. This is used for nodes that have
+ /// Maps from a node to its parents. This is used for nodes that have
/// pointer identity only, which are more common and we can save space by
/// only storing a unique pointer to them.
using ParentMapPointers =
@@ -602,7 +604,7 @@ public:
}
};
- /// \brief Returns the parents of the given node.
+ /// Returns the parents of the given node.
///
/// Note that this will lazily compute the parents of all nodes
/// and store them for later retrieval. Thus, the first call is O(n)
@@ -701,10 +703,10 @@ public:
return FullSourceLoc(Loc,SourceMgr);
}
- /// \brief All comments in this translation unit.
+ /// All comments in this translation unit.
RawCommentList Comments;
- /// \brief True if comments are already loaded from ExternalASTSource.
+ /// True if comments are already loaded from ExternalASTSource.
mutable bool CommentsLoaded = false;
class RawCommentAndCacheFlags {
@@ -761,18 +763,18 @@ public:
const Decl *OriginalDecl;
};
- /// \brief Mapping from declarations to comments attached to any
+ /// Mapping from declarations to comments attached to any
/// redeclaration.
///
/// Raw comments are owned by Comments list. This mapping is populated
/// lazily.
mutable llvm::DenseMap<const Decl *, RawCommentAndCacheFlags> RedeclComments;
- /// \brief Mapping from declarations to parsed comments attached to any
+ /// Mapping from declarations to parsed comments attached to any
/// redeclaration.
mutable llvm::DenseMap<const Decl *, comments::FullComment *> ParsedComments;
- /// \brief Return the documentation comment attached to a given declaration,
+ /// Return the documentation comment attached to a given declaration,
/// without looking into cache.
RawComment *getRawCommentForDeclNoCache(const Decl *D) const;
@@ -784,10 +786,10 @@ public:
void addComment(const RawComment &RC) {
assert(LangOpts.RetainCommentsFromSystemHeaders ||
!SourceMgr.isInSystemHeader(RC.getSourceRange().getBegin()));
- Comments.addComment(RC, BumpAlloc);
+ Comments.addComment(RC, LangOpts.CommentOpts, BumpAlloc);
}
- /// \brief Return the documentation comment attached to a given declaration.
+ /// Return the documentation comment attached to a given declaration.
/// Returns nullptr if no comment is attached.
///
/// \param OriginalDecl if not nullptr, is set to declaration AST node that
@@ -815,7 +817,7 @@ public:
private:
mutable comments::CommandTraits CommentCommandTraits;
- /// \brief Iterator that visits import declarations.
+ /// Iterator that visits import declarations.
class import_iterator {
ImportDecl *Import = nullptr;
@@ -857,13 +859,13 @@ public:
return CommentCommandTraits;
}
- /// \brief Retrieve the attributes for the given declaration.
+ /// Retrieve the attributes for the given declaration.
AttrVec& getDeclAttrs(const Decl *D);
- /// \brief Erase the attributes corresponding to the given declaration.
+ /// Erase the attributes corresponding to the given declaration.
void eraseDeclAttrs(const Decl *D);
- /// \brief If this variable is an instantiated static data member of a
+ /// If this variable is an instantiated static data member of a
/// class template specialization, returns the templated static data member
/// from which it was instantiated.
// FIXME: Remove ?
@@ -878,7 +880,7 @@ public:
void setClassScopeSpecializationPattern(FunctionDecl *FD,
FunctionDecl *Pattern);
- /// \brief Note that the static data member \p Inst is an instantiation of
+ /// Note that the static data member \p Inst is an instantiation of
/// the static data member template \p Tmpl of a class template.
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl,
TemplateSpecializationKind TSK,
@@ -887,12 +889,12 @@ public:
void setTemplateOrSpecializationInfo(VarDecl *Inst,
TemplateOrSpecializationInfo TSI);
- /// \brief If the given using decl \p Inst is an instantiation of a
+ /// If the given using decl \p Inst is an instantiation of a
/// (possibly unresolved) using decl from a template instantiation,
/// return it.
NamedDecl *getInstantiatedFromUsingDecl(NamedDecl *Inst);
- /// \brief Remember that the using decl \p Inst is an instantiation
+ /// Remember that the using decl \p Inst is an instantiation
/// of the using decl \p Pattern of a class template.
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern);
@@ -919,12 +921,12 @@ public:
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const;
- /// \brief Note that the given C++ \p Method overrides the given \p
+ /// Note that the given C++ \p Method overrides the given \p
/// Overridden method.
void addOverriddenMethod(const CXXMethodDecl *Method,
const CXXMethodDecl *Overridden);
- /// \brief Return C++ or ObjC overridden methods for the given \p Method.
+ /// Return C++ or ObjC overridden methods for the given \p Method.
///
/// An ObjC method is considered to override any method in the class's
/// base classes, its protocols, or its categories' protocols, that has
@@ -935,7 +937,7 @@ public:
const NamedDecl *Method,
SmallVectorImpl<const NamedDecl *> &Overridden) const;
- /// \brief Notify the AST context that a new import declaration has been
+ /// Notify the AST context that a new import declaration has been
/// parsed or implicitly created within this translation unit.
void addedLocalImportDecl(ImportDecl *Import);
@@ -957,16 +959,16 @@ public:
MergedDecls[D] = Primary;
}
- /// \brief Note that the definition \p ND has been merged into module \p M,
+ /// Note that the definition \p ND has been merged into module \p M,
/// and should be visible whenever \p M is visible.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
bool NotifyListeners = true);
- /// \brief Clean up the merged definition list. Call this if you might have
+ /// Clean up the merged definition list. Call this if you might have
/// added duplicates into the list.
void deduplicateMergedDefinitonsFor(NamedDecl *ND);
- /// \brief Get the additional modules in which the definition \p Def has
+ /// Get the additional modules in which the definition \p Def has
/// been merged.
ArrayRef<Module*> getModulesWithMergedDefinition(const NamedDecl *Def) {
auto MergedIt = MergedDefModules.find(Def);
@@ -999,12 +1001,24 @@ public:
CanQualType WCharTy; // [C++ 3.9.1p5].
CanQualType WideCharTy; // Same as WCharTy in C++, integer type in C99.
CanQualType WIntTy; // [C99 7.24.1], integer type unchanged by default promotions.
+ CanQualType Char8Ty; // [C++20 proposal]
CanQualType Char16Ty; // [C++0x 3.9.1p5], integer type in C99.
CanQualType Char32Ty; // [C++0x 3.9.1p5], integer type in C99.
CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty;
CanQualType UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy;
CanQualType UnsignedLongLongTy, UnsignedInt128Ty;
CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty;
+ CanQualType ShortAccumTy, AccumTy,
+ LongAccumTy; // ISO/IEC JTC1 SC22 WG14 N1169 Extension
+ CanQualType UnsignedShortAccumTy, UnsignedAccumTy, UnsignedLongAccumTy;
+ CanQualType ShortFractTy, FractTy, LongFractTy;
+ CanQualType UnsignedShortFractTy, UnsignedFractTy, UnsignedLongFractTy;
+ CanQualType SatShortAccumTy, SatAccumTy, SatLongAccumTy;
+ CanQualType SatUnsignedShortAccumTy, SatUnsignedAccumTy,
+ SatUnsignedLongAccumTy;
+ CanQualType SatShortFractTy, SatFractTy, SatLongFractTy;
+ CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy,
+ SatUnsignedLongFractTy;
CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
@@ -1036,20 +1050,20 @@ public:
ASTContext &operator=(const ASTContext &) = delete;
~ASTContext();
- /// \brief Attach an external AST source to the AST context.
+ /// Attach an external AST source to the AST context.
///
/// The external AST source provides the ability to load parts of
/// the abstract syntax tree as needed from some external storage,
/// e.g., a precompiled header.
void setExternalSource(IntrusiveRefCntPtr<ExternalASTSource> Source);
- /// \brief Retrieve a pointer to the external AST source associated
+ /// Retrieve a pointer to the external AST source associated
/// with this AST context, if any.
ExternalASTSource *getExternalSource() const {
return ExternalSource.get();
}
- /// \brief Attach an AST mutation listener to the AST context.
+ /// Attach an AST mutation listener to the AST context.
///
/// The AST mutation listener provides the ability to track modifications to
/// the abstract syntax tree entities committed after they were initially
@@ -1058,7 +1072,7 @@ public:
this->Listener = Listener;
}
- /// \brief Retrieve a pointer to the AST mutation listener associated
+ /// Retrieve a pointer to the AST mutation listener associated
/// with this AST context, if any.
ASTMutationListener *getASTMutationListener() const { return Listener; }
@@ -1068,18 +1082,18 @@ public:
BuiltinTemplateDecl *buildBuiltinTemplateDecl(BuiltinTemplateKind BTK,
const IdentifierInfo *II) const;
- /// \brief Create a new implicit TU-level CXXRecordDecl or RecordDecl
+ /// Create a new implicit TU-level CXXRecordDecl or RecordDecl
/// declaration.
RecordDecl *buildImplicitRecord(StringRef Name,
RecordDecl::TagKind TK = TTK_Struct) const;
- /// \brief Create a new implicit TU-level typedef declaration.
+ /// Create a new implicit TU-level typedef declaration.
TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;
- /// \brief Retrieve the declaration for the 128-bit signed integer type.
+ /// Retrieve the declaration for the 128-bit signed integer type.
TypedefDecl *getInt128Decl() const;
- /// \brief Retrieve the declaration for the 128-bit unsigned integer type.
+ /// Retrieve the declaration for the 128-bit unsigned integer type.
TypedefDecl *getUInt128Decl() const;
//===--------------------------------------------------------------------===//
@@ -1087,7 +1101,7 @@ public:
//===--------------------------------------------------------------------===//
private:
- /// \brief Return a type with extended qualifiers.
+ /// Return a type with extended qualifiers.
QualType getExtQualType(const Type *Base, Qualifiers Quals) const;
QualType getTypeDeclTypeSlow(const TypeDecl *Decl) const;
@@ -1095,7 +1109,7 @@ private:
QualType getPipeType(QualType T, bool ReadOnly) const;
public:
- /// \brief Return the uniqued reference to the type for an address space
+ /// Return the uniqued reference to the type for an address space
/// qualified type with the specified type and address space.
///
/// The resulting type has a union of the qualifiers from T and the address
@@ -1103,29 +1117,29 @@ public:
/// replaced.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const;
- /// \brief Remove any existing address space on the type and returns the type
+ /// Remove any existing address space on the type and returns the type
/// with qualifiers intact (or that's the idea anyway)
///
/// The return type should be T with all prior qualifiers minus the address
/// space.
QualType removeAddrSpaceQualType(QualType T) const;
- /// \brief Apply Objective-C protocol qualifiers to the given type.
+ /// Apply Objective-C protocol qualifiers to the given type.
/// \param allowOnPointerType specifies if we can apply protocol
/// qualifiers on ObjCObjectPointerType. It can be set to true when
- /// contructing the canonical type of a Objective-C type parameter.
+ /// constructing the canonical type of a Objective-C type parameter.
QualType applyObjCProtocolQualifiers(QualType type,
ArrayRef<ObjCProtocolDecl *> protocols, bool &hasError,
bool allowOnPointerType = false) const;
- /// \brief Return the uniqued reference to the type for an Objective-C
+ /// Return the uniqued reference to the type for an Objective-C
/// gc-qualified type.
///
- /// The retulting type has a union of the qualifiers from T and the gc
+ /// The resulting type has a union of the qualifiers from T and the gc
/// attribute.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const;
- /// \brief Return the uniqued reference to the type for a \c restrict
+ /// Return the uniqued reference to the type for a \c restrict
/// qualified type.
///
/// The resulting type has a union of the qualifiers from \p T and
@@ -1134,7 +1148,7 @@ public:
return T.withFastQualifiers(Qualifiers::Restrict);
}
- /// \brief Return the uniqued reference to the type for a \c volatile
+ /// Return the uniqued reference to the type for a \c volatile
/// qualified type.
///
/// The resulting type has a union of the qualifiers from \p T and
@@ -1143,7 +1157,7 @@ public:
return T.withFastQualifiers(Qualifiers::Volatile);
}
- /// \brief Return the uniqued reference to the type for a \c const
+ /// Return the uniqued reference to the type for a \c const
/// qualified type.
///
/// The resulting type has a union of the qualifiers from \p T and \c const.
@@ -1152,41 +1166,48 @@ public:
/// calling T.withConst().
QualType getConstType(QualType T) const { return T.withConst(); }
- /// \brief Change the ExtInfo on a function type.
+ /// Change the ExtInfo on a function type.
const FunctionType *adjustFunctionType(const FunctionType *Fn,
FunctionType::ExtInfo EInfo);
/// Adjust the given function result type.
CanQualType getCanonicalFunctionResultType(QualType ResultType) const;
- /// \brief Change the result type of a function type once it is deduced.
+ /// Change the result type of a function type once it is deduced.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType);
- /// \brief Determine whether two function types are the same, ignoring
+ /// Get a function type and produce the equivalent function type with the
+ /// specified exception specification. Type sugar that can be present on a
+ /// declaration of a function with an exception specification is permitted
+ /// and preserved. Other type sugar (for instance, typedefs) is not.
+ QualType getFunctionTypeWithExceptionSpec(
+ QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI);
+
+ /// Determine whether two function types are the same, ignoring
/// exception specifications in cases where they're part of the type.
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U);
- /// \brief Change the exception specification on a function once it is
+ /// Change the exception specification on a function once it is
/// delay-parsed, instantiated, or computed.
void adjustExceptionSpec(FunctionDecl *FD,
const FunctionProtoType::ExceptionSpecInfo &ESI,
bool AsWritten = false);
- /// \brief Return the uniqued reference to the type for a complex
+ /// Return the uniqued reference to the type for a complex
/// number with the specified element type.
QualType getComplexType(QualType T) const;
CanQualType getComplexType(CanQualType T) const {
return CanQualType::CreateUnsafe(getComplexType((QualType) T));
}
- /// \brief Return the uniqued reference to the type for a pointer to
+ /// Return the uniqued reference to the type for a pointer to
/// the specified type.
QualType getPointerType(QualType T) const;
CanQualType getPointerType(CanQualType T) const {
return CanQualType::CreateUnsafe(getPointerType((QualType) T));
}
- /// \brief Return the uniqued reference to a type adjusted from the original
+ /// Return the uniqued reference to a type adjusted from the original
/// type to a new type.
QualType getAdjustedType(QualType Orig, QualType New) const;
CanQualType getAdjustedType(CanQualType Orig, CanQualType New) const {
@@ -1194,7 +1215,7 @@ public:
getAdjustedType((QualType)Orig, (QualType)New));
}
- /// \brief Return the uniqued reference to the decayed version of the given
+ /// Return the uniqued reference to the decayed version of the given
/// type. Can only be called on array and function types which decay to
/// pointer types.
QualType getDecayedType(QualType T) const;
@@ -1202,11 +1223,11 @@ public:
return CanQualType::CreateUnsafe(getDecayedType((QualType) T));
}
- /// \brief Return the uniqued reference to the atomic type for the specified
+ /// Return the uniqued reference to the atomic type for the specified
/// type.
QualType getAtomicType(QualType T) const;
- /// \brief Return the uniqued reference to the type for a block of the
+ /// Return the uniqued reference to the type for a block of the
/// specified type.
QualType getBlockPointerType(QualType T) const;
@@ -1214,10 +1235,10 @@ public:
/// blocks.
QualType getBlockDescriptorType() const;
- /// \brief Return a read_only pipe type for the specified type.
+ /// Return a read_only pipe type for the specified type.
QualType getReadPipeType(QualType T) const;
- /// \brief Return a write_only pipe type for the specified type.
+ /// Return a write_only pipe type for the specified type.
QualType getWritePipeType(QualType T) const;
/// Gets the struct used to keep track of the extended descriptor for
@@ -1241,36 +1262,36 @@ public:
/// Returns true iff we need copy/dispose helpers for the given type.
bool BlockRequiresCopying(QualType Ty, const VarDecl *D);
- /// Returns true, if given type has a known lifetime. HasByrefExtendedLayout is set
- /// to false in this case. If HasByrefExtendedLayout returns true, byref variable
- /// has extended lifetime.
+ /// Returns true, if given type has a known lifetime. HasByrefExtendedLayout
+ /// is set to false in this case. If HasByrefExtendedLayout returns true,
+ /// byref variable has extended lifetime.
bool getByrefLifetime(QualType Ty,
Qualifiers::ObjCLifetime &Lifetime,
bool &HasByrefExtendedLayout) const;
- /// \brief Return the uniqued reference to the type for an lvalue reference
+ /// Return the uniqued reference to the type for an lvalue reference
/// to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue = true)
const;
- /// \brief Return the uniqued reference to the type for an rvalue reference
+ /// Return the uniqued reference to the type for an rvalue reference
/// to the specified type.
QualType getRValueReferenceType(QualType T) const;
- /// \brief Return the uniqued reference to the type for a member pointer to
+ /// Return the uniqued reference to the type for a member pointer to
/// the specified type in the specified class.
///
/// The class \p Cls is a \c Type because it could be a dependent name.
QualType getMemberPointerType(QualType T, const Type *Cls) const;
- /// \brief Return a non-unique reference to the type for a variable array of
+ /// Return a non-unique reference to the type for a variable array of
/// the specified element type.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts,
ArrayType::ArraySizeModifier ASM,
unsigned IndexTypeQuals,
SourceRange Brackets) const;
- /// \brief Return a non-unique reference to the type for a dependently-sized
+ /// Return a non-unique reference to the type for a dependently-sized
/// array of the specified element type.
///
/// FIXME: We will need these to be uniqued, or at least comparable, at some
@@ -1280,29 +1301,34 @@ public:
unsigned IndexTypeQuals,
SourceRange Brackets) const;
- /// \brief Return a unique reference to the type for an incomplete array of
+ /// Return a unique reference to the type for an incomplete array of
/// the specified element type.
QualType getIncompleteArrayType(QualType EltTy,
ArrayType::ArraySizeModifier ASM,
unsigned IndexTypeQuals) const;
- /// \brief Return the unique reference to the type for a constant array of
+ /// Return the unique reference to the type for a constant array of
/// the specified element type.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize,
ArrayType::ArraySizeModifier ASM,
unsigned IndexTypeQuals) const;
- /// \brief Returns a vla type where known sizes are replaced with [*].
+ /// Returns a vla type where known sizes are replaced with [*].
QualType getVariableArrayDecayedType(QualType Ty) const;
- /// \brief Return the unique reference to a vector type of the specified
+ /// Return the unique reference to a vector type of the specified
/// element type and size.
///
/// \pre \p VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts,
VectorType::VectorKind VecKind) const;
+ /// Return the unique reference to the type for a dependently sized vector of
+ /// the specified element type.
+ QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr,
+ SourceLocation AttrLoc,
+ VectorType::VectorKind VecKind) const;
- /// \brief Return the unique reference to an extended vector type
+ /// Return the unique reference to an extended vector type
/// of the specified element type and size.
///
/// \pre \p VectorType must be a built-in type.
@@ -1321,7 +1347,7 @@ public:
Expr *AddrSpaceExpr,
SourceLocation AttrLoc) const;
- /// \brief Return a K&R style C function type like 'int()'.
+ /// Return a K&R style C function type like 'int()'.
QualType getFunctionNoProtoType(QualType ResultTy,
const FunctionType::ExtInfo &Info) const;
@@ -1329,20 +1355,22 @@ public:
return getFunctionNoProtoType(ResultTy, FunctionType::ExtInfo());
}
- /// \brief Return a normal function type with a typed argument list.
+ /// Return a normal function type with a typed argument list.
QualType getFunctionType(QualType ResultTy, ArrayRef<QualType> Args,
const FunctionProtoType::ExtProtoInfo &EPI) const {
return getFunctionTypeInternal(ResultTy, Args, EPI, false);
}
+ QualType adjustStringLiteralBaseType(QualType StrLTy) const;
+
private:
- /// \brief Return a normal function type with a typed argument list.
+ /// Return a normal function type with a typed argument list.
QualType getFunctionTypeInternal(QualType ResultTy, ArrayRef<QualType> Args,
const FunctionProtoType::ExtProtoInfo &EPI,
bool OnlyWantCanonical) const;
public:
- /// \brief Return the unique reference to the type for the specified type
+ /// Return the unique reference to the type for the specified type
/// declaration.
QualType getTypeDeclType(const TypeDecl *Decl,
const TypeDecl *PrevDecl = nullptr) const {
@@ -1358,7 +1386,7 @@ public:
return getTypeDeclTypeSlow(Decl);
}
- /// \brief Return the unique reference to the type for the specified
+ /// Return the unique reference to the type for the specified
/// typedef-name decl.
QualType getTypedefType(const TypedefNameDecl *Decl,
QualType Canon = QualType()) const;
@@ -1404,8 +1432,8 @@ public:
QualType getParenType(QualType NamedType) const;
QualType getElaboratedType(ElaboratedTypeKeyword Keyword,
- NestedNameSpecifier *NNS,
- QualType NamedType) const;
+ NestedNameSpecifier *NNS, QualType NamedType,
+ TagDecl *OwnedTagDecl = nullptr) const;
QualType getDependentNameType(ElaboratedTypeKeyword Keyword,
NestedNameSpecifier *NNS,
const IdentifierInfo *Name,
@@ -1455,105 +1483,105 @@ public:
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT,
ObjCInterfaceDecl *IDecl);
- /// \brief Return a ObjCObjectPointerType type for the given ObjCObjectType.
+ /// Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectPointerType(QualType OIT) const;
- /// \brief GCC extension.
+ /// GCC extension.
QualType getTypeOfExprType(Expr *e) const;
QualType getTypeOfType(QualType t) const;
- /// \brief C++11 decltype.
+ /// C++11 decltype.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const;
- /// \brief Unary type transforms
+ /// Unary type transforms
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType,
UnaryTransformType::UTTKind UKind) const;
- /// \brief C++11 deduced auto type.
+ /// C++11 deduced auto type.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword,
bool IsDependent) const;
- /// \brief C++11 deduction pattern for 'auto' type.
+ /// C++11 deduction pattern for 'auto' type.
QualType getAutoDeductType() const;
- /// \brief C++11 deduction pattern for 'auto &&' type.
+ /// C++11 deduction pattern for 'auto &&' type.
QualType getAutoRRefDeductType() const;
- /// \brief C++17 deduced class template specialization type.
+ /// C++17 deduced class template specialization type.
QualType getDeducedTemplateSpecializationType(TemplateName Template,
QualType DeducedType,
bool IsDependent) const;
- /// \brief Return the unique reference to the type for the specified TagDecl
+ /// Return the unique reference to the type for the specified TagDecl
/// (struct/union/class/enum) decl.
QualType getTagDeclType(const TagDecl *Decl) const;
- /// \brief Return the unique type for "size_t" (C99 7.17), defined in
+ /// Return the unique type for "size_t" (C99 7.17), defined in
/// <stddef.h>.
///
/// The sizeof operator requires this (C99 6.5.3.4p4).
CanQualType getSizeType() const;
- /// \brief Return the unique signed counterpart of
+ /// Return the unique signed counterpart of
/// the integer type corresponding to size_t.
CanQualType getSignedSizeType() const;
- /// \brief Return the unique type for "intmax_t" (C99 7.18.1.5), defined in
+ /// Return the unique type for "intmax_t" (C99 7.18.1.5), defined in
/// <stdint.h>.
CanQualType getIntMaxType() const;
- /// \brief Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in
+ /// Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in
/// <stdint.h>.
CanQualType getUIntMaxType() const;
- /// \brief Return the unique wchar_t type available in C++ (and available as
+ /// Return the unique wchar_t type available in C++ (and available as
/// __wchar_t as a Microsoft extension).
QualType getWCharType() const { return WCharTy; }
- /// \brief Return the type of wide characters. In C++, this returns the
+ /// Return the type of wide characters. In C++, this returns the
/// unique wchar_t type. In C99, this returns a type compatible with the type
/// defined in <stddef.h> as defined by the target.
QualType getWideCharType() const { return WideCharTy; }
- /// \brief Return the type of "signed wchar_t".
+ /// Return the type of "signed wchar_t".
///
/// Used when in C++, as a GCC extension.
QualType getSignedWCharType() const;
- /// \brief Return the type of "unsigned wchar_t".
+ /// Return the type of "unsigned wchar_t".
///
/// Used when in C++, as a GCC extension.
QualType getUnsignedWCharType() const;
- /// \brief In C99, this returns a type compatible with the type
+ /// In C99, this returns a type compatible with the type
/// defined in <stddef.h> as defined by the target.
QualType getWIntType() const { return WIntTy; }
- /// \brief Return a type compatible with "intptr_t" (C99 7.18.1.4),
+ /// Return a type compatible with "intptr_t" (C99 7.18.1.4),
/// as defined by the target.
QualType getIntPtrType() const;
- /// \brief Return a type compatible with "uintptr_t" (C99 7.18.1.4),
+ /// Return a type compatible with "uintptr_t" (C99 7.18.1.4),
/// as defined by the target.
QualType getUIntPtrType() const;
- /// \brief Return the unique type for "ptrdiff_t" (C99 7.17) defined in
+ /// Return the unique type for "ptrdiff_t" (C99 7.17) defined in
/// <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
QualType getPointerDiffType() const;
- /// \brief Return the unique unsigned counterpart of "ptrdiff_t"
+ /// Return the unique unsigned counterpart of "ptrdiff_t"
/// integer type. The standard (C11 7.21.6.1p7) refers to this type
/// in the definition of %tu format specifier.
QualType getUnsignedPointerDiffType() const;
- /// \brief Return the unique type for "pid_t" defined in
+ /// Return the unique type for "pid_t" defined in
/// <sys/types.h>. We need this to compute the correct type for vfork().
QualType getProcessIDType() const;
- /// \brief Return the C structure type used to represent constant CFStrings.
+ /// Return the C structure type used to represent constant CFStrings.
QualType getCFConstantStringType() const;
- /// \brief Returns the C struct type for objc_super
+ /// Returns the C struct type for objc_super
QualType getObjCSuperType() const;
void setObjCSuperType(QualType ST) { ObjCSuperType = ST; }
@@ -1582,7 +1610,7 @@ public:
ObjCNSStringType = T;
}
- /// \brief Retrieve the type that \c id has been defined to, which may be
+ /// Retrieve the type that \c id has been defined to, which may be
/// different from the built-in \c id if \c id has been typedef'd.
QualType getObjCIdRedefinitionType() const {
if (ObjCIdRedefinitionType.isNull())
@@ -1590,12 +1618,12 @@ public:
return ObjCIdRedefinitionType;
}
- /// \brief Set the user-written type that redefines \c id.
+ /// Set the user-written type that redefines \c id.
void setObjCIdRedefinitionType(QualType RedefType) {
ObjCIdRedefinitionType = RedefType;
}
- /// \brief Retrieve the type that \c Class has been defined to, which may be
+ /// Retrieve the type that \c Class has been defined to, which may be
/// different from the built-in \c Class if \c Class has been typedef'd.
QualType getObjCClassRedefinitionType() const {
if (ObjCClassRedefinitionType.isNull())
@@ -1603,12 +1631,12 @@ public:
return ObjCClassRedefinitionType;
}
- /// \brief Set the user-written type that redefines 'SEL'.
+ /// Set the user-written type that redefines 'SEL'.
void setObjCClassRedefinitionType(QualType RedefType) {
ObjCClassRedefinitionType = RedefType;
}
- /// \brief Retrieve the type that 'SEL' has been defined to, which may be
+ /// Retrieve the type that 'SEL' has been defined to, which may be
/// different from the built-in 'SEL' if 'SEL' has been typedef'd.
QualType getObjCSelRedefinitionType() const {
if (ObjCSelRedefinitionType.isNull())
@@ -1616,7 +1644,7 @@ public:
return ObjCSelRedefinitionType;
}
- /// \brief Set the user-written type that redefines 'SEL'.
+ /// Set the user-written type that redefines 'SEL'.
void setObjCSelRedefinitionType(QualType RedefType) {
ObjCSelRedefinitionType = RedefType;
}
@@ -1676,68 +1704,68 @@ public:
return TypePackElementName;
}
- /// \brief Retrieve the Objective-C "instancetype" type, if already known;
+ /// Retrieve the Objective-C "instancetype" type, if already known;
/// otherwise, returns a NULL type;
QualType getObjCInstanceType() {
return getTypeDeclType(getObjCInstanceTypeDecl());
}
- /// \brief Retrieve the typedef declaration corresponding to the Objective-C
+ /// Retrieve the typedef declaration corresponding to the Objective-C
/// "instancetype" type.
TypedefDecl *getObjCInstanceTypeDecl();
- /// \brief Set the type for the C FILE type.
+ /// Set the type for the C FILE type.
void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; }
- /// \brief Retrieve the C FILE type.
+ /// Retrieve the C FILE type.
QualType getFILEType() const {
if (FILEDecl)
return getTypeDeclType(FILEDecl);
return QualType();
}
- /// \brief Set the type for the C jmp_buf type.
+ /// Set the type for the C jmp_buf type.
void setjmp_bufDecl(TypeDecl *jmp_bufDecl) {
this->jmp_bufDecl = jmp_bufDecl;
}
- /// \brief Retrieve the C jmp_buf type.
+ /// Retrieve the C jmp_buf type.
QualType getjmp_bufType() const {
if (jmp_bufDecl)
return getTypeDeclType(jmp_bufDecl);
return QualType();
}
- /// \brief Set the type for the C sigjmp_buf type.
+ /// Set the type for the C sigjmp_buf type.
void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) {
this->sigjmp_bufDecl = sigjmp_bufDecl;
}
- /// \brief Retrieve the C sigjmp_buf type.
+ /// Retrieve the C sigjmp_buf type.
QualType getsigjmp_bufType() const {
if (sigjmp_bufDecl)
return getTypeDeclType(sigjmp_bufDecl);
return QualType();
}
- /// \brief Set the type for the C ucontext_t type.
+ /// Set the type for the C ucontext_t type.
void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
this->ucontext_tDecl = ucontext_tDecl;
}
- /// \brief Retrieve the C ucontext_t type.
+ /// Retrieve the C ucontext_t type.
QualType getucontext_tType() const {
if (ucontext_tDecl)
return getTypeDeclType(ucontext_tDecl);
return QualType();
}
- /// \brief The result type of logical operations, '<', '>', '!=', etc.
+ /// The result type of logical operations, '<', '>', '!=', etc.
QualType getLogicalOperationType() const {
return getLangOpts().CPlusPlus ? BoolTy : IntTy;
}
- /// \brief Emit the Objective-CC type encoding for the given type \p T into
+ /// Emit the Objective-CC type encoding for the given type \p T into
/// \p S.
///
/// If \p Field is specified then record field names are also encoded.
@@ -1745,17 +1773,17 @@ public:
const FieldDecl *Field=nullptr,
QualType *NotEncodedT=nullptr) const;
- /// \brief Emit the Objective-C property type encoding for the given
+ /// Emit the Objective-C property type encoding for the given
/// type \p T into \p S.
void getObjCEncodingForPropertyType(QualType T, std::string &S) const;
void getLegacyIntegralTypeEncoding(QualType &t) const;
- /// \brief Put the string version of the type qualifiers \p QT into \p S.
+ /// Put the string version of the type qualifiers \p QT into \p S.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
std::string &S) const;
- /// \brief Emit the encoded type for the function \p Decl into \p S.
+ /// Emit the encoded type for the function \p Decl into \p S.
///
/// This is in the same format as Objective-C method encodings.
///
@@ -1763,12 +1791,12 @@ public:
/// types is incomplete), false otherwise.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const;
- /// \brief Emit the encoded type for the method declaration \p Decl into
+ /// Emit the encoded type for the method declaration \p Decl into
/// \p S.
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
bool Extended = false) const;
- /// \brief Return the encoded type for this block declaration.
+ /// Return the encoded type for this block declaration.
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const;
/// getObjCEncodingForPropertyDecl - Return the encoded type for
@@ -1785,15 +1813,15 @@ public:
const ObjCPropertyDecl *PD,
const Decl *Container) const;
- /// \brief Return the size of type \p T for Objective-C encoding purpose,
+ /// Return the size of type \p T for Objective-C encoding purpose,
/// in characters.
CharUnits getObjCEncodingTypeSize(QualType T) const;
- /// \brief Retrieve the typedef corresponding to the predefined \c id type
+ /// Retrieve the typedef corresponding to the predefined \c id type
/// in Objective-C.
TypedefDecl *getObjCIdDecl() const;
- /// \brief Represents the Objective-CC \c id type.
+ /// Represents the Objective-CC \c id type.
///
/// This is set up lazily, by Sema. \c id is always a (typedef for a)
/// pointer type, a pointer to a struct.
@@ -1801,21 +1829,21 @@ public:
return getTypeDeclType(getObjCIdDecl());
}
- /// \brief Retrieve the typedef corresponding to the predefined 'SEL' type
+ /// Retrieve the typedef corresponding to the predefined 'SEL' type
/// in Objective-C.
TypedefDecl *getObjCSelDecl() const;
- /// \brief Retrieve the type that corresponds to the predefined Objective-C
+ /// Retrieve the type that corresponds to the predefined Objective-C
/// 'SEL' type.
QualType getObjCSelType() const {
return getTypeDeclType(getObjCSelDecl());
}
- /// \brief Retrieve the typedef declaration corresponding to the predefined
+ /// Retrieve the typedef declaration corresponding to the predefined
/// Objective-C 'Class' type.
TypedefDecl *getObjCClassDecl() const;
- /// \brief Represents the Objective-C \c Class type.
+ /// Represents the Objective-C \c Class type.
///
/// This is set up lazily, by Sema. \c Class is always a (typedef for a)
/// pointer type, a pointer to a struct.
@@ -1823,40 +1851,40 @@ public:
return getTypeDeclType(getObjCClassDecl());
}
- /// \brief Retrieve the Objective-C class declaration corresponding to
+ /// Retrieve the Objective-C class declaration corresponding to
/// the predefined \c Protocol class.
ObjCInterfaceDecl *getObjCProtocolDecl() const;
- /// \brief Retrieve declaration of 'BOOL' typedef
+ /// Retrieve declaration of 'BOOL' typedef
TypedefDecl *getBOOLDecl() const {
return BOOLDecl;
}
- /// \brief Save declaration of 'BOOL' typedef
+ /// Save declaration of 'BOOL' typedef
void setBOOLDecl(TypedefDecl *TD) {
BOOLDecl = TD;
}
- /// \brief type of 'BOOL' type.
+ /// type of 'BOOL' type.
QualType getBOOLType() const {
return getTypeDeclType(getBOOLDecl());
}
- /// \brief Retrieve the type of the Objective-C \c Protocol class.
+ /// Retrieve the type of the Objective-C \c Protocol class.
QualType getObjCProtoType() const {
return getObjCInterfaceType(getObjCProtocolDecl());
}
- /// \brief Retrieve the C type declaration corresponding to the predefined
+ /// Retrieve the C type declaration corresponding to the predefined
/// \c __builtin_va_list type.
TypedefDecl *getBuiltinVaListDecl() const;
- /// \brief Retrieve the type of the \c __builtin_va_list type.
+ /// Retrieve the type of the \c __builtin_va_list type.
QualType getBuiltinVaListType() const {
return getTypeDeclType(getBuiltinVaListDecl());
}
- /// \brief Retrieve the C type declaration corresponding to the predefined
+ /// Retrieve the C type declaration corresponding to the predefined
/// \c __va_list_tag type used to help define the \c __builtin_va_list type
/// for some targets.
Decl *getVaListTagDecl() const;
@@ -1870,18 +1898,22 @@ public:
return getTypeDeclType(getBuiltinMSVaListDecl());
}
- /// \brief Return a type with additional \c const, \c volatile, or
+ /// Return whether a declaration to a builtin is allowed to be
+ /// overloaded/redeclared.
+ bool canBuiltinBeRedeclared(const FunctionDecl *) const;
+
+ /// Return a type with additional \c const, \c volatile, or
/// \c restrict qualifiers.
QualType getCVRQualifiedType(QualType T, unsigned CVR) const {
return getQualifiedType(T, Qualifiers::fromCVRMask(CVR));
}
- /// \brief Un-split a SplitQualType.
+ /// Un-split a SplitQualType.
QualType getQualifiedType(SplitQualType split) const {
return getQualifiedType(split.Ty, split.Quals);
}
- /// \brief Return a type with additional qualifiers.
+ /// Return a type with additional qualifiers.
QualType getQualifiedType(QualType T, Qualifiers Qs) const {
if (!Qs.hasNonFastQualifiers())
return T.withFastQualifiers(Qs.getFastQualifiers());
@@ -1890,14 +1922,14 @@ public:
return getExtQualType(Ptr, Qc);
}
- /// \brief Return a type with additional qualifiers.
+ /// Return a type with additional qualifiers.
QualType getQualifiedType(const Type *T, Qualifiers Qs) const {
if (!Qs.hasNonFastQualifiers())
return QualType(T, Qs.getFastQualifiers());
return getExtQualType(T, Qs);
}
- /// \brief Return a type with the given lifetime qualifier.
+ /// Return a type with the given lifetime qualifier.
///
/// \pre Neither type.ObjCLifetime() nor \p lifetime may be \c OCL_None.
QualType getLifetimeQualifiedType(QualType type,
@@ -1921,6 +1953,9 @@ public:
return getQualifiedType(type.getUnqualifiedType(), Qs);
}
+ unsigned char getFixedPointScale(QualType Ty) const;
+ unsigned char getFixedPointIBits(QualType Ty) const;
+
DeclarationNameInfo getNameForTemplate(TemplateName Name,
SourceLocation NameLoc) const;
@@ -1954,7 +1989,7 @@ public:
GE_Missing_ucontext
};
- /// \brief Return the type for the specified builtin.
+ /// Return the type for the specified builtin.
///
/// If \p IntegerConstantArgs is non-null, it is filled in with a bitmask of
/// arguments to the builtin that are required to be integer constant
@@ -1962,6 +1997,10 @@ public:
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error,
unsigned *IntegerConstantArgs = nullptr) const;
+ /// Types and expressions required to build C++2a three-way comparisons
+ /// using operator<=>, including the values return by builtin <=> operators.
+ ComparisonCategories CompCategories;
+
private:
CanQualType getFromTargetType(unsigned Type) const;
TypeInfo getTypeInfoImpl(const Type *T) const;
@@ -1971,18 +2010,18 @@ private:
//===--------------------------------------------------------------------===//
public:
- /// \brief Return one of the GCNone, Weak or Strong Objective-C garbage
+ /// Return one of the GCNone, Weak or Strong Objective-C garbage
/// collection attributes.
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const;
- /// \brief Return true if the given vector types are of the same unqualified
+ /// Return true if the given vector types are of the same unqualified
/// type or if they are equivalent to the same GCC vector type.
///
/// \note This ignores whether they are target-specific (AltiVec or Neon)
/// types.
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec);
- /// \brief Return true if this is an \c NSObject object with its \c NSObject
+ /// Return true if this is an \c NSObject object with its \c NSObject
/// attribute set.
static bool isObjCNSObjectType(QualType Ty) {
return Ty->isObjCNSObjectType();
@@ -1992,48 +2031,48 @@ public:
// Type Sizing and Analysis
//===--------------------------------------------------------------------===//
- /// \brief Return the APFloat 'semantics' for the specified scalar floating
+ /// Return the APFloat 'semantics' for the specified scalar floating
/// point type.
const llvm::fltSemantics &getFloatTypeSemantics(QualType T) const;
- /// \brief Get the size and alignment of the specified complete type in bits.
+ /// Get the size and alignment of the specified complete type in bits.
TypeInfo getTypeInfo(const Type *T) const;
TypeInfo getTypeInfo(QualType T) const { return getTypeInfo(T.getTypePtr()); }
- /// \brief Get default simd alignment of the specified complete type in bits.
+ /// Get default simd alignment of the specified complete type in bits.
unsigned getOpenMPDefaultSimdAlign(QualType T) const;
- /// \brief Return the size of the specified (complete) type \p T, in bits.
+ /// Return the size of the specified (complete) type \p T, in bits.
uint64_t getTypeSize(QualType T) const { return getTypeInfo(T).Width; }
uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; }
- /// \brief Return the size of the character type, in bits.
+ /// Return the size of the character type, in bits.
uint64_t getCharWidth() const {
return getTypeSize(CharTy);
}
- /// \brief Convert a size in bits to a size in characters.
+ /// Convert a size in bits to a size in characters.
CharUnits toCharUnitsFromBits(int64_t BitSize) const;
- /// \brief Convert a size in characters to a size in bits.
+ /// Convert a size in characters to a size in bits.
int64_t toBits(CharUnits CharSize) const;
- /// \brief Return the size of the specified (complete) type \p T, in
+ /// Return the size of the specified (complete) type \p T, in
/// characters.
CharUnits getTypeSizeInChars(QualType T) const;
CharUnits getTypeSizeInChars(const Type *T) const;
- /// \brief Return the ABI-specified alignment of a (complete) type \p T, in
+ /// Return the ABI-specified alignment of a (complete) type \p T, in
/// bits.
unsigned getTypeAlign(QualType T) const { return getTypeInfo(T).Align; }
unsigned getTypeAlign(const Type *T) const { return getTypeInfo(T).Align; }
- /// \brief Return the ABI-specified alignment of a type, in bits, or 0 if
+ /// Return the ABI-specified 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;
- /// \brief Return the ABI-specified alignment of a (complete) type \p T, in
+ /// Return the ABI-specified alignment of a (complete) type \p T, in
/// characters.
CharUnits getTypeAlignInChars(QualType T) const;
CharUnits getTypeAlignInChars(const Type *T) const;
@@ -2045,31 +2084,31 @@ public:
std::pair<CharUnits, CharUnits> getTypeInfoInChars(const Type *T) const;
std::pair<CharUnits, CharUnits> getTypeInfoInChars(QualType T) const;
- /// \brief Determine if the alignment the type has was required using an
+ /// Determine if the alignment the type has was required using an
/// alignment attribute.
bool isAlignmentRequired(const Type *T) const;
bool isAlignmentRequired(QualType T) const;
- /// \brief Return the "preferred" alignment of the specified type \p T for
+ /// Return the "preferred" alignment of the specified type \p T for
/// 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.
unsigned getPreferredTypeAlign(const Type *T) const;
- /// \brief Return the default alignment for __attribute__((aligned)) on
+ /// Return the default alignment for __attribute__((aligned)) on
/// this target, to be used if no alignment value is specified.
unsigned getTargetDefaultAlignForAttributeAligned() const;
- /// \brief Return the alignment in bits that should be given to a
+ /// Return the alignment in bits that should be given to a
/// global variable with type \p T.
unsigned getAlignOfGlobalVar(QualType T) const;
- /// \brief Return the alignment in characters that should be given to a
+ /// Return the alignment in characters that should be given to a
/// global variable with type \p T.
CharUnits getAlignOfGlobalVarInChars(QualType T) const;
- /// \brief Return a conservative estimate of the alignment of the specified
+ /// Return a conservative estimate of the alignment of the specified
/// decl \p D.
///
/// \pre \p D must not be a bitfield type, as bitfields do not have a valid
@@ -2081,12 +2120,12 @@ public:
/// pointers and large arrays get extra alignment.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof = false) const;
- /// \brief Get or compute information about the layout of the specified
+ /// Get or compute information about the layout of the specified
/// record (struct/union/class) \p D, which indicates its size and field
/// position information.
const ASTRecordLayout &getASTRecordLayout(const RecordDecl *D) const;
- /// \brief Get or compute information about the layout of the specified
+ /// Get or compute information about the layout of the specified
/// Objective-C interface.
const ASTRecordLayout &getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D)
const;
@@ -2094,14 +2133,14 @@ public:
void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS,
bool Simple = false) const;
- /// \brief Get or compute information about the layout of the specified
+ /// Get or compute information about the layout of the specified
/// Objective-C implementation.
///
/// This may differ from the interface if synthesized ivars are present.
const ASTRecordLayout &
getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const;
- /// \brief Get our current best idea for the key function of the
+ /// Get our current best idea for the key function of the
/// given record decl, or nullptr if there isn't one.
///
/// The key function is, according to the Itanium C++ ABI section 5.2.3:
@@ -2113,7 +2152,7 @@ public:
/// the result of this computation can change.
const CXXMethodDecl *getCurrentKeyFunction(const CXXRecordDecl *RD);
- /// \brief Observe that the given method cannot be a key function.
+ /// Observe that the given method cannot be a key function.
/// Checks the key-function cache for the method's class and clears it
/// if matches the given declaration.
///
@@ -2155,7 +2194,7 @@ public:
void CollectInheritedProtocols(const Decl *CDecl,
llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols);
- /// \brief Return true if the specified type has unique object representations
+ /// Return true if the specified type has unique object representations
/// according to (C++17 [meta.unary.prop]p9)
bool hasUniqueObjectRepresentations(QualType Ty) const;
@@ -2163,7 +2202,7 @@ public:
// Type Operators
//===--------------------------------------------------------------------===//
- /// \brief Return the canonical (structural) type corresponding to the
+ /// Return the canonical (structural) type corresponding to the
/// specified potentially non-canonical type \p T.
///
/// The non-canonical version of a type may have many "decorated" versions of
@@ -2179,14 +2218,14 @@ public:
return T->getCanonicalTypeInternal().getTypePtr();
}
- /// \brief Return the canonical parameter type corresponding to the specific
+ /// Return the canonical parameter type corresponding to the specific
/// potentially non-canonical one.
///
/// Qualifiers are stripped off, functions are turned into function
/// pointers, and arrays decay one level into pointers.
CanQualType getCanonicalParamType(QualType T) const;
- /// \brief Determine whether the given types \p T1 and \p T2 are equivalent.
+ /// Determine whether the given types \p T1 and \p T2 are equivalent.
bool hasSameType(QualType T1, QualType T2) const {
return getCanonicalType(T1) == getCanonicalType(T2);
}
@@ -2194,7 +2233,7 @@ public:
return getCanonicalType(T1) == getCanonicalType(T2);
}
- /// \brief Return this type as a completely-unqualified array type,
+ /// Return this type as a completely-unqualified array type,
/// capturing the qualifiers in \p Quals.
///
/// This will remove the minimal amount of sugaring from the types, similar
@@ -2209,7 +2248,7 @@ public:
/// that corresponds to it. Otherwise, returns T.getUnqualifiedType().
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals);
- /// \brief Determine whether the given types are equivalent after
+ /// Determine whether the given types are equivalent after
/// cvr-qualifiers have been removed.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const {
return getCanonicalType(T1).getTypePtr() ==
@@ -2249,9 +2288,22 @@ public:
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl,
const ObjCMethodDecl *MethodImp);
- bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2);
+ bool UnwrapSimilarTypes(QualType &T1, QualType &T2);
+ bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2);
+
+ /// Determine if two types are similar, according to the C++ rules. That is,
+ /// determine if they are the same other than qualifiers on the initial
+ /// sequence of pointer / pointer-to-member / array (and in Clang, object
+ /// pointer) types and their element types.
+ ///
+ /// Clang offers a number of qualifiers in addition to the C++ qualifiers;
+ /// those qualifiers are also ignored in the 'similarity' check.
+ bool hasSimilarType(QualType T1, QualType T2);
+
+ /// Determine if two types are similar, ignoring only CVR qualifiers.
+ bool hasCvrSimilarType(QualType T1, QualType T2);
- /// \brief Retrieves the "canonical" nested name specifier for a
+ /// Retrieves the "canonical" nested name specifier for a
/// given nested name specifier.
///
/// The canonical nested name specifier is a nested name specifier
@@ -2277,11 +2329,11 @@ public:
NestedNameSpecifier *
getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const;
- /// \brief Retrieves the default calling convention for the current target.
+ /// Retrieves the default calling convention for the current target.
CallingConv getDefaultCallingConvention(bool IsVariadic,
bool IsCXXMethod) const;
- /// \brief Retrieves the "canonical" template name that refers to a
+ /// Retrieves the "canonical" template name that refers to a
/// given template.
///
/// The canonical template name is the simplest expression that can
@@ -2301,11 +2353,11 @@ public:
/// types, values, and templates.
TemplateName getCanonicalTemplateName(TemplateName Name) const;
- /// \brief Determine whether the given template names refer to the same
+ /// Determine whether the given template names refer to the same
/// template.
bool hasSameTemplateName(TemplateName X, TemplateName Y);
- /// \brief Retrieve the "canonical" template argument.
+ /// Retrieve the "canonical" template argument.
///
/// The canonical template argument is the simplest template argument
/// (which may be a type, value, expression, or declaration) that
@@ -2332,33 +2384,33 @@ public:
return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T));
}
- /// \brief Return the innermost element type of an array type.
+ /// Return the innermost element type of an array type.
///
/// For example, will return "int" for int[m][n]
QualType getBaseElementType(const ArrayType *VAT) const;
- /// \brief Return the innermost element type of a type (which needn't
+ /// Return the innermost element type of a type (which needn't
/// actually be an array type).
QualType getBaseElementType(QualType QT) const;
- /// \brief Return number of constant array elements.
+ /// Return number of constant array elements.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const;
- /// \brief Perform adjustment on the parameter type of a function.
+ /// Perform adjustment on the parameter type of a function.
///
/// This routine adjusts the given parameter type @p T to the actual
/// parameter type used by semantic analysis (C99 6.7.5.3p[7,8],
/// C++ [dcl.fct]p3). The adjusted parameter type is returned.
QualType getAdjustedParameterType(QualType T) const;
- /// \brief Retrieve the parameter type as adjusted for use in the signature
+ /// Retrieve the parameter type as adjusted for use in the signature
/// of a function, decaying array and function types and removing top-level
/// cv-qualifiers.
QualType getSignatureParameterType(QualType T) const;
QualType getExceptionObjectType(QualType T) const;
- /// \brief Return the properly qualified result of decaying the specified
+ /// Return the properly qualified result of decaying the specified
/// array type to a pointer.
///
/// This operation is non-trivial when handling typedefs etc. The canonical
@@ -2368,35 +2420,35 @@ public:
/// See C99 6.7.5.3p7 and C99 6.3.2.1p3.
QualType getArrayDecayedType(QualType T) const;
- /// \brief Return the type that \p PromotableType will promote to: C99
+ /// Return the type that \p PromotableType will promote to: C99
/// 6.3.1.1p2, assuming that \p PromotableType is a promotable integer type.
QualType getPromotedIntegerType(QualType PromotableType) const;
- /// \brief Recurses in pointer/array types until it finds an Objective-C
+ /// Recurses in pointer/array types until it finds an Objective-C
/// retainable type and returns its ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const;
- /// \brief Whether this is a promotable bitfield reference according
+ /// Whether this is a promotable bitfield reference according
/// to C99 6.3.1.1p2, bullet 2 (and GCC extensions).
///
/// \returns the type this bit-field will promote to, or NULL if no
/// promotion occurs.
QualType isPromotableBitField(Expr *E) const;
- /// \brief Return the highest ranked integer type, see C99 6.3.1.8p1.
+ /// Return the highest ranked integer type, see C99 6.3.1.8p1.
///
/// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
/// \p LHS < \p RHS, return -1.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const;
- /// \brief Compare the rank of the two specified floating point types,
+ /// Compare the rank of the two specified floating point types,
/// ignoring the domain of the type (i.e. 'double' == '_Complex double').
///
/// If \p LHS > \p RHS, returns 1. If \p LHS == \p RHS, returns 0. If
/// \p LHS < \p RHS, return -1.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const;
- /// \brief Return a real floating point or a complex type (based on
+ /// Return a real floating point or a complex type (based on
/// \p typeDomain/\p typeSize).
///
/// \param typeDomain a real floating point or complex type.
@@ -2521,13 +2573,20 @@ public:
// Per C99 6.2.5p6, for every signed integer type, there is a corresponding
// unsigned integer type. This method takes a signed type, and returns the
// corresponding unsigned integer type.
+ // With the introduction of fixed point types in ISO N1169, this method also
+ // accepts fixed point types and returns the corresponding unsigned type for
+ // a given fixed point type.
QualType getCorrespondingUnsignedType(QualType T) const;
+ // Per ISO N1169, this method accepts fixed point types and returns the
+ // corresponding saturated type for a given fixed point type.
+ QualType getCorrespondingSaturatedType(QualType Ty) const;
+
//===--------------------------------------------------------------------===//
// Integer Values
//===--------------------------------------------------------------------===//
- /// \brief Make an APSInt of the appropriate width and signedness for the
+ /// Make an APSInt of the appropriate width and signedness for the
/// given \p Value and integer \p Type.
llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const {
// If Type is a signed integer type larger than 64 bits, we need to be sure
@@ -2542,28 +2601,28 @@ public:
bool isSentinelNullExpr(const Expr *E);
- /// \brief Get the implementation of the ObjCInterfaceDecl \p D, or nullptr if
+ /// Get the implementation of the ObjCInterfaceDecl \p D, or nullptr if
/// none exists.
ObjCImplementationDecl *getObjCImplementation(ObjCInterfaceDecl *D);
- /// \brief Get the implementation of the ObjCCategoryDecl \p D, or nullptr if
+ /// Get the implementation of the ObjCCategoryDecl \p D, or nullptr if
/// none exists.
ObjCCategoryImplDecl *getObjCImplementation(ObjCCategoryDecl *D);
- /// \brief Return true if there is at least one \@implementation in the TU.
+ /// Return true if there is at least one \@implementation in the TU.
bool AnyObjCImplementation() {
return !ObjCImpls.empty();
}
- /// \brief Set the implementation of ObjCInterfaceDecl.
+ /// Set the implementation of ObjCInterfaceDecl.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD,
ObjCImplementationDecl *ImplD);
- /// \brief Set the implementation of ObjCCategoryDecl.
+ /// Set the implementation of ObjCCategoryDecl.
void setObjCImplementation(ObjCCategoryDecl *CatD,
ObjCCategoryImplDecl *ImplD);
- /// \brief Get the duplicate declaration of a ObjCMethod in the same
+ /// Get the duplicate declaration of a ObjCMethod in the same
/// interface, or null if none exists.
const ObjCMethodDecl *
getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const;
@@ -2571,19 +2630,19 @@ public:
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD,
const ObjCMethodDecl *Redecl);
- /// \brief Returns the Objective-C interface that \p ND belongs to if it is
+ /// Returns the Objective-C interface that \p ND belongs to if it is
/// an Objective-C method/property/ivar etc. that is part of an interface,
/// otherwise returns null.
const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const;
- /// \brief Set the copy inialization expression of a block var decl.
+ /// Set the copy inialization expression of a block var decl.
void setBlockVarCopyInits(VarDecl*VD, Expr* Init);
- /// \brief Get the copy initialization expression of the VarDecl \p VD, or
+ /// Get the copy initialization expression of the VarDecl \p VD, or
/// nullptr if none exists.
Expr *getBlockVarCopyInits(const VarDecl* VD);
- /// \brief Allocate an uninitialized TypeSourceInfo.
+ /// Allocate an uninitialized TypeSourceInfo.
///
/// The caller should initialize the memory held by TypeSourceInfo using
/// the TypeLoc wrappers.
@@ -2596,14 +2655,14 @@ public:
/// should be calculated based on the type.
TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const;
- /// \brief Allocate a TypeSourceInfo where all locations have been
+ /// Allocate a TypeSourceInfo where all locations have been
/// initialized to a given location, which defaults to the empty
/// location.
TypeSourceInfo *
getTrivialTypeSourceInfo(QualType T,
SourceLocation Loc = SourceLocation()) const;
- /// \brief Add a deallocation callback that will be invoked when the
+ /// Add a deallocation callback that will be invoked when the
/// ASTContext is destroyed.
///
/// \param Callback A callback function that will be invoked on destruction.
@@ -2625,7 +2684,7 @@ public:
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const;
GVALinkage GetGVALinkageForVariable(const VarDecl *VD);
- /// \brief Determines if the decl can be CodeGen'ed or deserialized from PCH
+ /// Determines if the decl can be CodeGen'ed or deserialized from PCH
/// lazily, only when used; this is only relevant for function or file scoped
/// var definitions.
///
@@ -2633,6 +2692,12 @@ public:
/// it is not used.
bool DeclMustBeEmitted(const Decl *D);
+ /// Visits all versions of a multiversioned function with the passed
+ /// predicate.
+ void forEachMultiversionedFunctionVersion(
+ const FunctionDecl *FD,
+ llvm::function_ref<void(const FunctionDecl *)> Pred) const;
+
const CXXConstructorDecl *
getCopyConstructorForExceptionObject(CXXRecordDecl *RD);
@@ -2653,21 +2718,21 @@ public:
void setStaticLocalNumber(const VarDecl *VD, unsigned Number);
unsigned getStaticLocalNumber(const VarDecl *VD) const;
- /// \brief Retrieve the context for computing mangling numbers in the given
+ /// Retrieve the context for computing mangling numbers in the given
/// DeclContext.
MangleNumberingContext &getManglingNumberContext(const DeclContext *DC);
std::unique_ptr<MangleNumberingContext> createMangleNumberingContext() const;
- /// \brief Used by ParmVarDecl to store on the side the
+ /// Used by ParmVarDecl to store on the side the
/// index of the parameter when it exceeds the size of the normal bitfield.
void setParameterIndex(const ParmVarDecl *D, unsigned index);
- /// \brief Used by ParmVarDecl to retrieve on the side the
+ /// Used by ParmVarDecl to retrieve on the side the
/// index of the parameter when it exceeds the size of the normal bitfield.
unsigned getParameterIndex(const ParmVarDecl *D) const;
- /// \brief Get the storage for the constant value of a materialized temporary
+ /// Get the storage for the constant value of a materialized temporary
/// of static storage duration.
APValue *getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E,
bool MayCreate);
@@ -2676,50 +2741,50 @@ public:
// Statistics
//===--------------------------------------------------------------------===//
- /// \brief The number of implicitly-declared default constructors.
+ /// The number of implicitly-declared default constructors.
static unsigned NumImplicitDefaultConstructors;
- /// \brief The number of implicitly-declared default constructors for
+ /// The number of implicitly-declared default constructors for
/// which declarations were built.
static unsigned NumImplicitDefaultConstructorsDeclared;
- /// \brief The number of implicitly-declared copy constructors.
+ /// The number of implicitly-declared copy constructors.
static unsigned NumImplicitCopyConstructors;
- /// \brief The number of implicitly-declared copy constructors for
+ /// The number of implicitly-declared copy constructors for
/// which declarations were built.
static unsigned NumImplicitCopyConstructorsDeclared;
- /// \brief The number of implicitly-declared move constructors.
+ /// The number of implicitly-declared move constructors.
static unsigned NumImplicitMoveConstructors;
- /// \brief The number of implicitly-declared move constructors for
+ /// The number of implicitly-declared move constructors for
/// which declarations were built.
static unsigned NumImplicitMoveConstructorsDeclared;
- /// \brief The number of implicitly-declared copy assignment operators.
+ /// The number of implicitly-declared copy assignment operators.
static unsigned NumImplicitCopyAssignmentOperators;
- /// \brief The number of implicitly-declared copy assignment operators for
+ /// The number of implicitly-declared copy assignment operators for
/// which declarations were built.
static unsigned NumImplicitCopyAssignmentOperatorsDeclared;
- /// \brief The number of implicitly-declared move assignment operators.
+ /// The number of implicitly-declared move assignment operators.
static unsigned NumImplicitMoveAssignmentOperators;
- /// \brief The number of implicitly-declared move assignment operators for
+ /// The number of implicitly-declared move assignment operators for
/// which declarations were built.
static unsigned NumImplicitMoveAssignmentOperatorsDeclared;
- /// \brief The number of implicitly-declared destructors.
+ /// The number of implicitly-declared destructors.
static unsigned NumImplicitDestructors;
- /// \brief The number of implicitly-declared destructors for which
+ /// The number of implicitly-declared destructors for which
/// declarations were built.
static unsigned NumImplicitDestructorsDeclared;
public:
- /// \brief Initialize built-in types.
+ /// Initialize built-in types.
///
/// This routine may only be invoked once for a given ASTContext object.
/// It is normally invoked after ASTContext construction.
@@ -2756,7 +2821,7 @@ public:
QualType T, std::string& S,
bool Extended) const;
- /// \brief Returns true if this is an inline-initialized static data member
+ /// Returns true if this is an inline-initialized static data member
/// which is treated as a definition for MSVC compatibility.
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const;
@@ -2774,7 +2839,7 @@ public:
Strong
};
- /// \brief Determine whether a definition of this inline variable should
+ /// Determine whether a definition of this inline variable should
/// be treated as a weak or strong definition. For compatibility with
/// C++14 and before, for a constexpr static data member, if there is an
/// out-of-line declaration of the member, we may promote it from weak to
@@ -2790,7 +2855,7 @@ private:
getObjCLayout(const ObjCInterfaceDecl *D,
const ObjCImplementationDecl *Impl) const;
- /// \brief A set of deallocations that should be performed when the
+ /// A set of deallocations that should be performed when the
/// ASTContext is destroyed.
// FIXME: We really should have a better mechanism in the ASTContext to
// manage running destructors for types which do variable sized allocation
@@ -2841,13 +2906,13 @@ public:
llvm::StringMap<SectionInfo> SectionInfos;
};
-/// \brief Utility function for constructing a nullary selector.
+/// Utility function for constructing a nullary selector.
inline Selector GetNullarySelector(StringRef name, ASTContext &Ctx) {
IdentifierInfo* II = &Ctx.Idents.get(name);
return Ctx.Selectors.getSelector(0, &II);
}
-/// \brief Utility function for constructing an unary selector.
+/// Utility function for constructing an unary selector.
inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) {
IdentifierInfo* II = &Ctx.Idents.get(name);
return Ctx.Selectors.getSelector(1, &II);
@@ -2857,7 +2922,7 @@ inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) {
// operator new and delete aren't allowed inside namespaces.
-/// @brief Placement new for using the ASTContext's allocator.
+/// Placement new for using the ASTContext's allocator.
///
/// This placement form of operator new uses the ASTContext's allocator for
/// obtaining memory.
@@ -2890,7 +2955,7 @@ inline void *operator new(size_t Bytes, const clang::ASTContext &C,
return C.Allocate(Bytes, Alignment);
}
-/// @brief Placement delete companion to the new above.
+/// Placement delete companion to the new above.
///
/// This operator is just a companion to the new above. There is no way of
/// invoking it directly; see the new operator for more details. This operator
@@ -2928,7 +2993,7 @@ inline void *operator new[](size_t Bytes, const clang::ASTContext& C,
return C.Allocate(Bytes, Alignment);
}
-/// @brief Placement delete[] companion to the new[] above.
+/// Placement delete[] companion to the new[] above.
///
/// This operator is just a companion to the new[] above. There is no way of
/// invoking it directly; see the new[] operator for more details. This operator
@@ -2938,7 +3003,7 @@ inline void operator delete[](void *Ptr, const clang::ASTContext &C, size_t) {
C.Deallocate(Ptr);
}
-/// \brief Create the representation of a LazyGenerationalUpdatePtr.
+/// Create the representation of a LazyGenerationalUpdatePtr.
template <typename Owner, typename T,
void (clang::ExternalASTSource::*Update)(Owner)>
typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
diff --git a/include/clang/AST/ASTDiagnostic.h b/include/clang/AST/ASTDiagnostic.h
index 27c85e65f2c1..b08865dde3c1 100644
--- a/include/clang/AST/ASTDiagnostic.h
+++ b/include/clang/AST/ASTDiagnostic.h
@@ -24,7 +24,7 @@ namespace clang {
};
} // end namespace diag
- /// \brief DiagnosticsEngine argument formatting function for diagnostics that
+ /// DiagnosticsEngine argument formatting function for diagnostics that
/// involve AST nodes.
///
/// This function formats diagnostic arguments for various AST nodes,
diff --git a/include/clang/AST/ASTFwd.h b/include/clang/AST/ASTFwd.h
index 003d489c1ca4..038d5c3d3611 100644
--- a/include/clang/AST/ASTFwd.h
+++ b/include/clang/AST/ASTFwd.h
@@ -8,7 +8,7 @@
//===--------------------------------------------------------------===//
///
/// \file
-/// \brief Forward declaration of all AST node types.
+/// Forward declaration of all AST node types.
///
//===-------------------------------------------------------------===//
diff --git a/include/clang/AST/ASTImporter.h b/include/clang/AST/ASTImporter.h
index 66b9cd394b9d..6e6a1926254b 100644
--- a/include/clang/AST/ASTImporter.h
+++ b/include/clang/AST/ASTImporter.h
@@ -1,4 +1,4 @@
-//===--- ASTImporter.h - Importing ASTs from other Contexts -----*- C++ -*-===//
+//===- ASTImporter.h - Importing ASTs from other Contexts -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,82 +11,95 @@
// context into another context.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_CLANG_AST_ASTIMPORTER_H
#define LLVM_CLANG_AST_ASTIMPORTER_H
#include "clang/AST/DeclarationName.h"
+#include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
+#include <utility>
namespace clang {
- class ASTContext;
- class CXXCtorInitializer;
- class CXXBaseSpecifier;
- class Decl;
- class DeclContext;
- class DiagnosticsEngine;
- class Expr;
- class FileManager;
- class IdentifierInfo;
- class NestedNameSpecifier;
- class Stmt;
- class TypeSourceInfo;
-
- /// \brief Imports selected nodes from one AST context into another context,
+
+class ASTContext;
+class CXXBaseSpecifier;
+class CXXCtorInitializer;
+class Decl;
+class DeclContext;
+class Expr;
+class FileManager;
+class NamedDecl;
+class Stmt;
+class TagDecl;
+class TypeSourceInfo;
+class Attr;
+
+ // \brief Returns with a list of declarations started from the canonical decl
+ // then followed by subsequent decls in the translation unit.
+ // This gives a canonical list for each entry in the redecl chain.
+ // `Decl::redecls()` gives a list of decls which always start from the
+ // previous decl and the next item is actually the previous item in the order
+ // of source locations. Thus, `Decl::redecls()` gives different lists for
+ // the different entries in a given redecl chain.
+ llvm::SmallVector<Decl*, 2> getCanonicalForwardRedeclChain(Decl* D);
+
+ /// Imports selected nodes from one AST context into another context,
/// merging AST nodes where appropriate.
class ASTImporter {
public:
- typedef llvm::DenseSet<std::pair<Decl *, Decl *> > NonEquivalentDeclSet;
- typedef llvm::DenseMap<const CXXBaseSpecifier *, CXXBaseSpecifier *>
- ImportedCXXBaseSpecifierMap;
+ using NonEquivalentDeclSet = llvm::DenseSet<std::pair<Decl *, Decl *>>;
+ using ImportedCXXBaseSpecifierMap =
+ llvm::DenseMap<const CXXBaseSpecifier *, CXXBaseSpecifier *>;
private:
- /// \brief The contexts we're importing to and from.
+ /// The contexts we're importing to and from.
ASTContext &ToContext, &FromContext;
- /// \brief The file managers we're importing to and from.
+ /// The file managers we're importing to and from.
FileManager &ToFileManager, &FromFileManager;
- /// \brief Whether to perform a minimal import.
+ /// Whether to perform a minimal import.
bool Minimal;
- /// \brief Whether the last diagnostic came from the "from" context.
- bool LastDiagFromFrom;
+ /// Whether the last diagnostic came from the "from" context.
+ bool LastDiagFromFrom = false;
- /// \brief Mapping from the already-imported types in the "from" context
+ /// Mapping from the already-imported types in the "from" context
/// to the corresponding types in the "to" context.
llvm::DenseMap<const Type *, const Type *> ImportedTypes;
- /// \brief Mapping from the already-imported declarations in the "from"
+ /// Mapping from the already-imported declarations in the "from"
/// context to the corresponding declarations in the "to" context.
llvm::DenseMap<Decl *, Decl *> ImportedDecls;
- /// \brief Mapping from the already-imported statements in the "from"
+ /// Mapping from the already-imported statements in the "from"
/// context to the corresponding statements in the "to" context.
llvm::DenseMap<Stmt *, Stmt *> ImportedStmts;
- /// \brief Mapping from the already-imported FileIDs in the "from" source
+ /// Mapping from the already-imported FileIDs in the "from" source
/// manager to the corresponding FileIDs in the "to" source manager.
llvm::DenseMap<FileID, FileID> ImportedFileIDs;
- /// \brief Mapping from the already-imported CXXBasesSpecifier in
+ /// Mapping from the already-imported CXXBasesSpecifier in
/// the "from" source manager to the corresponding CXXBasesSpecifier
/// in the "to" source manager.
ImportedCXXBaseSpecifierMap ImportedCXXBaseSpecifiers;
-
- /// \brief Imported, anonymous tag declarations that are missing their
- /// corresponding typedefs.
- SmallVector<TagDecl *, 4> AnonTagsWithPendingTypedefs;
- /// \brief Declaration (from, to) pairs that are known not to be equivalent
+ /// Declaration (from, to) pairs that are known not to be equivalent
/// (which we have already complained about).
NonEquivalentDeclSet NonEquivalentDecls;
public:
- /// \brief Create a new AST importer.
+ /// Create a new AST importer.
///
/// \param ToContext The context we'll be importing into.
///
@@ -105,135 +118,144 @@ namespace clang {
virtual ~ASTImporter();
- /// \brief Whether the importer will perform a minimal import, creating
+ /// Whether the importer will perform a minimal import, creating
/// to-be-completed forward declarations when possible.
bool isMinimalImport() const { return Minimal; }
- /// \brief Import the given type from the "from" context into the "to"
+ /// Import the given type from the "from" context into the "to"
/// context.
///
/// \returns the equivalent type in the "to" context, or a NULL type if
/// an error occurred.
QualType Import(QualType FromT);
- /// \brief Import the given type source information from the
+ /// Import the given type source information from the
/// "from" context into the "to" context.
///
/// \returns the equivalent type source information in the "to"
/// context, or NULL if an error occurred.
TypeSourceInfo *Import(TypeSourceInfo *FromTSI);
- /// \brief Import the given declaration from the "from" context into the
+ /// Import the given attribute from the "from" context into the
+ /// "to" context.
+ ///
+ /// \returns the equivalent attribute in the "to" context.
+ Attr *Import(const Attr *FromAttr);
+
+ /// Import the given declaration from the "from" context into the
/// "to" context.
///
/// \returns the equivalent declaration in the "to" context, or a NULL type
/// if an error occurred.
Decl *Import(Decl *FromD);
+ Decl *Import(const Decl *FromD) {
+ return Import(const_cast<Decl *>(FromD));
+ }
- /// \brief Return the copy of the given declaration in the "to" context if
+ /// Return the copy of the given declaration in the "to" context if
/// it has already been imported from the "from" context. Otherwise return
/// NULL.
Decl *GetAlreadyImportedOrNull(Decl *FromD);
- /// \brief Import the given declaration context from the "from"
+ /// Import the given declaration context from the "from"
/// AST context into the "to" AST context.
///
/// \returns the equivalent declaration context in the "to"
/// context, or a NULL type if an error occurred.
DeclContext *ImportContext(DeclContext *FromDC);
- /// \brief Import the given expression from the "from" context into the
+ /// Import the given expression from the "from" context into the
/// "to" context.
///
/// \returns the equivalent expression in the "to" context, or NULL if
/// an error occurred.
Expr *Import(Expr *FromE);
- /// \brief Import the given statement from the "from" context into the
+ /// Import the given statement from the "from" context into the
/// "to" context.
///
/// \returns the equivalent statement in the "to" context, or NULL if
/// an error occurred.
Stmt *Import(Stmt *FromS);
- /// \brief Import the given nested-name-specifier from the "from"
+ /// Import the given nested-name-specifier from the "from"
/// context into the "to" context.
///
/// \returns the equivalent nested-name-specifier in the "to"
/// context, or NULL if an error occurred.
NestedNameSpecifier *Import(NestedNameSpecifier *FromNNS);
- /// \brief Import the given nested-name-specifier from the "from"
+ /// Import the given nested-name-specifier from the "from"
/// context into the "to" context.
///
/// \returns the equivalent nested-name-specifier in the "to"
/// context.
NestedNameSpecifierLoc Import(NestedNameSpecifierLoc FromNNS);
- /// \brief Import the goven template name from the "from" context into the
+ /// Import the goven template name from the "from" context into the
/// "to" context.
TemplateName Import(TemplateName From);
- /// \brief Import the given source location from the "from" context into
+ /// Import the given source location from the "from" context into
/// the "to" context.
///
/// \returns the equivalent source location in the "to" context, or an
/// invalid source location if an error occurred.
SourceLocation Import(SourceLocation FromLoc);
- /// \brief Import the given source range from the "from" context into
+ /// Import the given source range from the "from" context into
/// the "to" context.
///
/// \returns the equivalent source range in the "to" context, or an
/// invalid source location if an error occurred.
SourceRange Import(SourceRange FromRange);
- /// \brief Import the given declaration name from the "from"
+ /// Import the given declaration name from the "from"
/// context into the "to" context.
///
/// \returns the equivalent declaration name in the "to" context,
/// or an empty declaration name if an error occurred.
DeclarationName Import(DeclarationName FromName);
- /// \brief Import the given identifier from the "from" context
+ /// Import the given identifier from the "from" context
/// into the "to" context.
///
/// \returns the equivalent identifier in the "to" context.
IdentifierInfo *Import(const IdentifierInfo *FromId);
- /// \brief Import the given Objective-C selector from the "from"
+ /// Import the given Objective-C selector from the "from"
/// context into the "to" context.
///
/// \returns the equivalent selector in the "to" context.
Selector Import(Selector FromSel);
- /// \brief Import the given file ID from the "from" context into the
+ /// Import the given file ID from the "from" context into the
/// "to" context.
///
/// \returns the equivalent file ID in the source manager of the "to"
/// context.
FileID Import(FileID);
- /// \brief Import the given C++ constructor initializer from the "from"
+ /// Import the given C++ constructor initializer from the "from"
/// context into the "to" context.
///
/// \returns the equivalent initializer in the "to" context.
CXXCtorInitializer *Import(CXXCtorInitializer *FromInit);
- /// \brief Import the given CXXBaseSpecifier from the "from" context into
+ /// Import the given CXXBaseSpecifier from the "from" context into
/// the "to" context.
///
/// \returns the equivalent CXXBaseSpecifier in the source manager of the
/// "to" context.
CXXBaseSpecifier *Import(const CXXBaseSpecifier *FromSpec);
- /// \brief Import the definition of the given declaration, including all of
+ /// Import the definition of the given declaration, including all of
/// the declarations it contains.
///
/// This routine is intended to be used
void ImportDefinition(Decl *From);
- /// \brief Cope with a name conflict when importing a declaration into the
+ /// Cope with a name conflict when importing a declaration into the
/// given context.
///
/// This routine is invoked whenever there is a name conflict while
@@ -265,41 +287,41 @@ namespace clang {
NamedDecl **Decls,
unsigned NumDecls);
- /// \brief Retrieve the context that AST nodes are being imported into.
+ /// Retrieve the context that AST nodes are being imported into.
ASTContext &getToContext() const { return ToContext; }
- /// \brief Retrieve the context that AST nodes are being imported from.
+ /// Retrieve the context that AST nodes are being imported from.
ASTContext &getFromContext() const { return FromContext; }
- /// \brief Retrieve the file manager that AST nodes are being imported into.
+ /// Retrieve the file manager that AST nodes are being imported into.
FileManager &getToFileManager() const { return ToFileManager; }
- /// \brief Retrieve the file manager that AST nodes are being imported from.
+ /// Retrieve the file manager that AST nodes are being imported from.
FileManager &getFromFileManager() const { return FromFileManager; }
- /// \brief Report a diagnostic in the "to" context.
+ /// Report a diagnostic in the "to" context.
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID);
- /// \brief Report a diagnostic in the "from" context.
+ /// Report a diagnostic in the "from" context.
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID);
- /// \brief Return the set of declarations that we know are not equivalent.
+ /// Return the set of declarations that we know are not equivalent.
NonEquivalentDeclSet &getNonEquivalentDecls() { return NonEquivalentDecls; }
- /// \brief Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
+ /// Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
/// Mark the Decl as complete, filling it in as much as possible.
///
/// \param D A declaration in the "to" context.
virtual void CompleteDecl(Decl* D);
- /// \brief Note that we have imported the "from" declaration by mapping it
- /// to the (potentially-newly-created) "to" declaration.
- ///
/// Subclasses can override this function to observe all of the \c From ->
/// \c To declaration mappings as they are imported.
- virtual Decl *Imported(Decl *From, Decl *To);
-
- /// \brief Called by StructuralEquivalenceContext. If a RecordDecl is
+ virtual Decl *Imported(Decl *From, Decl *To) { return To; }
+
+ /// Store and assign the imported declaration to its counterpart.
+ Decl *MapImported(Decl *From, Decl *To);
+
+ /// Called by StructuralEquivalenceContext. If a RecordDecl is
/// being compared to another RecordDecl as part of import, completing the
/// other RecordDecl may trigger importation of the first RecordDecl. This
/// happens especially for anonymous structs. If the original of the second
@@ -307,11 +329,12 @@ namespace clang {
/// importation, eliminating this loop.
virtual Decl *GetOriginalDecl(Decl *To) { return nullptr; }
- /// \brief Determine whether the given types are structurally
+ /// Determine whether the given types are structurally
/// equivalent.
bool IsStructurallyEquivalent(QualType From, QualType To,
bool Complain = true);
};
-}
+
+} // namespace clang
#endif // LLVM_CLANG_AST_ASTIMPORTER_H
diff --git a/include/clang/AST/ASTLambda.h b/include/clang/AST/ASTLambda.h
index 69df2d8c0113..2fe4e2563b36 100644
--- a/include/clang/AST/ASTLambda.h
+++ b/include/clang/AST/ASTLambda.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief This file provides some common utility functions for processing
+/// This file provides some common utility functions for processing
/// Lambda related AST Constructs.
///
//===----------------------------------------------------------------------===//
diff --git a/include/clang/AST/ASTMutationListener.h b/include/clang/AST/ASTMutationListener.h
index 9395d36d87e5..31ae2b111e01 100644
--- a/include/clang/AST/ASTMutationListener.h
+++ b/include/clang/AST/ASTMutationListener.h
@@ -41,86 +41,86 @@ namespace clang {
class VarTemplateDecl;
class VarTemplateSpecializationDecl;
-/// \brief An abstract interface that should be implemented by listeners
+/// An abstract interface that should be implemented by listeners
/// that want to be notified when an AST entity gets modified after its
/// initial creation.
class ASTMutationListener {
public:
virtual ~ASTMutationListener();
- /// \brief A new TagDecl definition was completed.
+ /// A new TagDecl definition was completed.
virtual void CompletedTagDefinition(const TagDecl *D) { }
- /// \brief A new declaration with name has been added to a DeclContext.
+ /// A new declaration with name has been added to a DeclContext.
virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}
- /// \brief An implicit member was added after the definition was completed.
+ /// An implicit member was added after the definition was completed.
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {}
- /// \brief A template specialization (or partial one) was added to the
+ /// A template specialization (or partial one) was added to the
/// template declaration.
virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
const ClassTemplateSpecializationDecl *D) {}
- /// \brief A template specialization (or partial one) was added to the
+ /// A template specialization (or partial one) was added to the
/// template declaration.
virtual void
AddedCXXTemplateSpecialization(const VarTemplateDecl *TD,
const VarTemplateSpecializationDecl *D) {}
- /// \brief A template specialization (or partial one) was added to the
+ /// A template specialization (or partial one) was added to the
/// template declaration.
virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
const FunctionDecl *D) {}
- /// \brief A function's exception specification has been evaluated or
+ /// A function's exception specification has been evaluated or
/// instantiated.
virtual void ResolvedExceptionSpec(const FunctionDecl *FD) {}
- /// \brief A function's return type has been deduced.
+ /// A function's return type has been deduced.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType);
- /// \brief A virtual destructor's operator delete has been resolved.
+ /// A virtual destructor's operator delete has been resolved.
virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
const FunctionDecl *Delete,
Expr *ThisArg) {}
- /// \brief An implicit member got a definition.
+ /// An implicit member got a definition.
virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}
- /// \brief The instantiation of a templated function or variable was
+ /// The instantiation of a templated function or variable was
/// requested. In particular, the point of instantiation and template
/// specialization kind of \p D may have changed.
virtual void InstantiationRequested(const ValueDecl *D) {}
- /// \brief A templated variable's definition was implicitly instantiated.
+ /// A templated variable's definition was implicitly instantiated.
virtual void VariableDefinitionInstantiated(const VarDecl *D) {}
- /// \brief A function template's definition was instantiated.
+ /// A function template's definition was instantiated.
virtual void FunctionDefinitionInstantiated(const FunctionDecl *D) {}
- /// \brief A default argument was instantiated.
+ /// A default argument was instantiated.
virtual void DefaultArgumentInstantiated(const ParmVarDecl *D) {}
- /// \brief A default member initializer was instantiated.
+ /// A default member initializer was instantiated.
virtual void DefaultMemberInitializerInstantiated(const FieldDecl *D) {}
- /// \brief A new objc category class was added for an interface.
+ /// A new objc category class was added for an interface.
virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
const ObjCInterfaceDecl *IFD) {}
- /// \brief A declaration is marked used which was not previously marked used.
+ /// A declaration is marked used which was not previously marked used.
///
/// \param D the declaration marked used
virtual void DeclarationMarkedUsed(const Decl *D) {}
- /// \brief A declaration is marked as OpenMP threadprivate which was not
+ /// A declaration is marked as OpenMP threadprivate which was not
/// previously marked as threadprivate.
///
/// \param D the declaration marked OpenMP threadprivate.
virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
- /// \brief A declaration is marked as OpenMP declaretarget which was not
+ /// A declaration is marked as OpenMP declaretarget which was not
/// previously marked as declaretarget.
///
/// \param D the declaration marked OpenMP declaretarget.
@@ -128,14 +128,14 @@ public:
virtual void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
const Attr *Attr) {}
- /// \brief A definition has been made visible by being redefined locally.
+ /// A definition has been made visible by being redefined locally.
///
/// \param D The definition that was previously not visible.
/// \param M The containing module in which the definition was made visible,
/// if any.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
- /// \brief An attribute was added to a RecordDecl
+ /// An attribute was added to a RecordDecl
///
/// \param Attr The attribute that was added to the Record
///
diff --git a/include/clang/AST/ASTStructuralEquivalence.h b/include/clang/AST/ASTStructuralEquivalence.h
index 23674c65f332..d32f87d43e04 100644
--- a/include/clang/AST/ASTStructuralEquivalence.h
+++ b/include/clang/AST/ASTStructuralEquivalence.h
@@ -1,4 +1,4 @@
-//===--- ASTStructuralEquivalence.h - ---------------------------*- C++ -*-===//
+//===- ASTStructuralEquivalence.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -19,6 +19,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
#include <deque>
+#include <utility>
namespace clang {
@@ -29,6 +30,14 @@ class QualType;
class RecordDecl;
class SourceLocation;
+/// \brief Whether to perform a normal or minimal equivalence check.
+/// In case of `Minimal`, we do not perform a recursive check of decls with
+/// external storage.
+enum class StructuralEquivalenceKind {
+ Default,
+ Minimal,
+};
+
struct StructuralEquivalenceContext {
/// AST contexts for which we are checking structural equivalence.
ASTContext &FromCtx, &ToCtx;
@@ -46,6 +55,8 @@ struct StructuralEquivalenceContext {
/// (which we have already complained about).
llvm::DenseSet<std::pair<Decl *, Decl *>> &NonEquivalentDecls;
+ StructuralEquivalenceKind EqKind;
+
/// Whether we're being strict about the spelling of types when
/// unifying two types.
bool StrictTypeSpelling;
@@ -57,27 +68,35 @@ struct StructuralEquivalenceContext {
bool Complain;
/// \c true if the last diagnostic came from ToCtx.
- bool LastDiagFromC2;
+ bool LastDiagFromC2 = false;
StructuralEquivalenceContext(
ASTContext &FromCtx, ASTContext &ToCtx,
llvm::DenseSet<std::pair<Decl *, Decl *>> &NonEquivalentDecls,
+ StructuralEquivalenceKind EqKind,
bool StrictTypeSpelling = false, bool Complain = true,
bool ErrorOnTagTypeMismatch = false)
: FromCtx(FromCtx), ToCtx(ToCtx), NonEquivalentDecls(NonEquivalentDecls),
- StrictTypeSpelling(StrictTypeSpelling),
- ErrorOnTagTypeMismatch(ErrorOnTagTypeMismatch), Complain(Complain),
- LastDiagFromC2(false) {}
+ EqKind(EqKind), StrictTypeSpelling(StrictTypeSpelling),
+ ErrorOnTagTypeMismatch(ErrorOnTagTypeMismatch), Complain(Complain) {}
DiagnosticBuilder Diag1(SourceLocation Loc, unsigned DiagID);
DiagnosticBuilder Diag2(SourceLocation Loc, unsigned DiagID);
/// Determine whether the two declarations are structurally
/// equivalent.
- bool IsStructurallyEquivalent(Decl *D1, Decl *D2);
+ /// 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 TentativeEquivalences members) and can cause faulty equivalent results.
+ bool IsEquivalent(Decl *D1, Decl *D2);
/// Determine whether the two types are structurally equivalent.
- bool IsStructurallyEquivalent(QualType T1, QualType T2);
+ /// 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 TentativeEquivalences members) and can cause faulty equivalent results.
+ bool IsEquivalent(QualType T1, QualType T2);
/// Find the index of the given anonymous struct/union within its
/// context.
@@ -98,6 +117,7 @@ private:
/// \returns true if an error occurred, false otherwise.
bool Finish();
};
+
} // namespace clang
#endif // LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H
diff --git a/include/clang/AST/ASTTypeTraits.h b/include/clang/AST/ASTTypeTraits.h
index 51d60a90a146..9df9793370c4 100644
--- a/include/clang/AST/ASTTypeTraits.h
+++ b/include/clang/AST/ASTTypeTraits.h
@@ -38,62 +38,62 @@ struct PrintingPolicy;
namespace ast_type_traits {
-/// \brief Kind identifier.
+/// Kind identifier.
///
/// It can be constructed from any node kind and allows for runtime type
/// hierarchy checks.
/// Use getFromNodeKind<T>() to construct them.
class ASTNodeKind {
public:
- /// \brief Empty identifier. It matches nothing.
+ /// Empty identifier. It matches nothing.
ASTNodeKind() : KindId(NKI_None) {}
- /// \brief Construct an identifier for T.
+ /// Construct an identifier for T.
template <class T>
static ASTNodeKind getFromNodeKind() {
return ASTNodeKind(KindToKindId<T>::Id);
}
/// \{
- /// \brief Construct an identifier for the dynamic type of the node
+ /// Construct an identifier for the dynamic type of the node
static ASTNodeKind getFromNode(const Decl &D);
static ASTNodeKind getFromNode(const Stmt &S);
static ASTNodeKind getFromNode(const Type &T);
/// \}
- /// \brief Returns \c true if \c this and \c Other represent the same kind.
+ /// Returns \c true if \c this and \c Other represent the same kind.
bool isSame(ASTNodeKind Other) const {
return KindId != NKI_None && KindId == Other.KindId;
}
- /// \brief Returns \c true only for the default \c ASTNodeKind()
+ /// Returns \c true only for the default \c ASTNodeKind()
bool isNone() const { return KindId == NKI_None; }
- /// \brief Returns \c true if \c this is a base kind of (or same as) \c Other.
+ /// Returns \c true if \c this is a base kind of (or same as) \c Other.
/// \param Distance If non-null, used to return the distance between \c this
/// and \c Other in the class hierarchy.
bool isBaseOf(ASTNodeKind Other, unsigned *Distance = nullptr) const;
- /// \brief String representation of the kind.
+ /// String representation of the kind.
StringRef asStringRef() const;
- /// \brief Strict weak ordering for ASTNodeKind.
+ /// Strict weak ordering for ASTNodeKind.
bool operator<(const ASTNodeKind &Other) const {
return KindId < Other.KindId;
}
- /// \brief Return the most derived type between \p Kind1 and \p Kind2.
+ /// Return the most derived type between \p Kind1 and \p Kind2.
///
/// Return ASTNodeKind() if they are not related.
static ASTNodeKind getMostDerivedType(ASTNodeKind Kind1, ASTNodeKind Kind2);
- /// \brief Return the most derived common ancestor between Kind1 and Kind2.
+ /// Return the most derived common ancestor between Kind1 and Kind2.
///
/// Return ASTNodeKind() if they are not related.
static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1,
ASTNodeKind Kind2);
- /// \brief Hooks for using ASTNodeKind as a key in a DenseMap.
+ /// 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.
static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); }
@@ -115,7 +115,7 @@ public:
}
private:
- /// \brief Kind ids.
+ /// Kind ids.
///
/// Includes all possible base and derived kinds.
enum NodeKindId {
@@ -140,16 +140,16 @@ private:
NKI_NumberOfKinds
};
- /// \brief Use getFromNodeKind<T>() to construct the kind.
+ /// Use getFromNodeKind<T>() to construct the kind.
ASTNodeKind(NodeKindId KindId) : KindId(KindId) {}
- /// \brief Returns \c true if \c Base is a base kind of (or same as) \c
+ /// Returns \c true if \c Base is a base kind of (or same as) \c
/// Derived.
/// \param Distance If non-null, used to return the distance between \c Base
/// and \c Derived in the class hierarchy.
static bool isBaseOf(NodeKindId Base, NodeKindId Derived, unsigned *Distance);
- /// \brief Helper meta-function to convert a kind T to its enum value.
+ /// Helper meta-function to convert a kind T to its enum value.
///
/// This struct is specialized below for all known kinds.
template <class T> struct KindToKindId {
@@ -158,11 +158,11 @@ private:
template <class T>
struct KindToKindId<const T> : KindToKindId<T> {};
- /// \brief Per kind info.
+ /// Per kind info.
struct KindInfo {
- /// \brief The id of the parent kind, or None if it has no parent.
+ /// The id of the parent kind, or None if it has no parent.
NodeKindId ParentId;
- /// \brief Name of the kind.
+ /// Name of the kind.
const char *Name;
};
static const KindInfo AllKindInfo[NKI_NumberOfKinds];
@@ -197,7 +197,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {
return OS;
}
-/// \brief A dynamically typed AST node container.
+/// A dynamically typed AST node container.
///
/// Stores an AST node in a type safe way. This allows writing code that
/// works with different kinds of AST nodes, despite the fact that they don't
@@ -211,13 +211,13 @@ inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {
/// the supported base types.
class DynTypedNode {
public:
- /// \brief Creates a \c DynTypedNode from \c Node.
+ /// Creates a \c DynTypedNode from \c Node.
template <typename T>
static DynTypedNode create(const T &Node) {
return BaseConverter<T>::create(Node);
}
- /// \brief Retrieve the stored node as type \c T.
+ /// Retrieve the stored node as type \c T.
///
/// Returns NULL if the stored node does not have a type that is
/// convertible to \c T.
@@ -234,7 +234,7 @@ public:
return BaseConverter<T>::get(NodeKind, Storage.buffer);
}
- /// \brief Retrieve the stored node as type \c T.
+ /// Retrieve the stored node as type \c T.
///
/// Similar to \c get(), but asserts that the type is what we are expecting.
template <typename T>
@@ -244,7 +244,7 @@ public:
ASTNodeKind getNodeKind() const { return NodeKind; }
- /// \brief Returns a pointer that identifies the stored AST node.
+ /// Returns a pointer that identifies the stored AST node.
///
/// Note that this is not supported by all AST nodes. For AST nodes
/// that don't have a pointer-defined identity inside the AST, this
@@ -255,21 +255,21 @@ public:
: nullptr;
}
- /// \brief Prints the node to the given output stream.
+ /// Prints the node to the given output stream.
void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const;
- /// \brief Dumps the node to the given output stream.
+ /// Dumps the node to the given output stream.
void dump(llvm::raw_ostream &OS, SourceManager &SM) const;
- /// \brief For nodes which represent textual entities in the source code,
+ /// For nodes which represent textual entities in the source code,
/// return their SourceRange. For all other nodes, return SourceRange().
SourceRange getSourceRange() const;
/// @{
- /// \brief Imposes an order on \c DynTypedNode.
+ /// Imposes an order on \c DynTypedNode.
///
/// Supports comparison of nodes that support memoization.
- /// FIXME: Implement comparsion for other node types (currently
+ /// FIXME: Implement comparison for other node types (currently
/// only Stmt, Decl, Type and NestedNameSpecifier return memoization data).
bool operator<(const DynTypedNode &Other) const {
if (!NodeKind.isSame(Other.NodeKind))
@@ -326,7 +326,7 @@ public:
}
/// @}
- /// \brief Hooks for using DynTypedNode as a key in a DenseMap.
+ /// Hooks for using DynTypedNode as a key in a DenseMap.
struct DenseMapInfo {
static inline DynTypedNode getEmptyKey() {
DynTypedNode Node;
@@ -368,10 +368,10 @@ public:
};
private:
- /// \brief Takes care of converting from and to \c T.
+ /// Takes care of converting from and to \c T.
template <typename T, typename EnablerT = void> struct BaseConverter;
- /// \brief Converter that uses dyn_cast<T> from a stored BaseT*.
+ /// Converter that uses dyn_cast<T> from a stored BaseT*.
template <typename T, typename BaseT> struct DynCastPtrConverter {
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
@@ -391,7 +391,7 @@ private:
}
};
- /// \brief Converter that stores T* (by pointer).
+ /// Converter that stores T* (by pointer).
template <typename T> struct PtrConverter {
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
@@ -411,7 +411,7 @@ private:
}
};
- /// \brief Converter that stores T (by value).
+ /// Converter that stores T (by value).
template <typename T> struct ValueConverter {
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
@@ -432,7 +432,7 @@ private:
ASTNodeKind NodeKind;
- /// \brief Stores the data of the node.
+ /// Stores the data of the node.
///
/// Note that we can store \c Decls, \c Stmts, \c Types,
/// \c NestedNameSpecifiers and \c CXXCtorInitializer by pointer as they are
diff --git a/include/clang/AST/ASTUnresolvedSet.h b/include/clang/AST/ASTUnresolvedSet.h
index 3693aeccfe14..9bf63bb6e2d7 100644
--- a/include/clang/AST/ASTUnresolvedSet.h
+++ b/include/clang/AST/ASTUnresolvedSet.h
@@ -26,7 +26,7 @@ namespace clang {
class NamedDecl;
-/// \brief An UnresolvedSet-like class which uses the ASTContext's allocator.
+/// An UnresolvedSet-like class which uses the ASTContext's allocator.
class ASTUnresolvedSet {
friend class LazyASTUnresolvedSet;
@@ -89,7 +89,7 @@ public:
const DeclAccessPair &operator[](unsigned I) const { return Decls[I]; }
};
-/// \brief An UnresolvedSet-like class that might not have been loaded from the
+/// An UnresolvedSet-like class that might not have been loaded from the
/// external AST source yet.
class LazyASTUnresolvedSet {
mutable ASTUnresolvedSet Impl;
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index bbe320c28a3b..32a61c59d236 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -23,9 +23,9 @@
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/VersionTuple.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -52,8 +52,10 @@ protected:
unsigned Inherited : 1;
unsigned IsPackExpansion : 1;
unsigned Implicit : 1;
+ // FIXME: These are properties of the attribute kind, not state for this
+ // instance of the attribute.
unsigned IsLateParsed : 1;
- unsigned DuplicatesAllowed : 1;
+ unsigned InheritEvenIfAlreadyPresent : 1;
void *operator new(size_t bytes) noexcept {
llvm_unreachable("Attrs cannot be allocated with regular 'new'.");
@@ -74,10 +76,10 @@ public:
protected:
Attr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex,
- bool IsLateParsed, bool DuplicatesAllowed)
+ bool IsLateParsed)
: Range(R), AttrKind(AK), SpellingListIndex(SpellingListIndex),
Inherited(false), IsPackExpansion(false), Implicit(false),
- IsLateParsed(IsLateParsed), DuplicatesAllowed(DuplicatesAllowed) {}
+ IsLateParsed(IsLateParsed), InheritEvenIfAlreadyPresent(false) {}
public:
@@ -94,7 +96,7 @@ public:
bool isInherited() const { return Inherited; }
- /// \brief Returns true if the attribute has been implicitly created instead
+ /// Returns true if the attribute has been implicitly created instead
/// of explicitly written by the user.
bool isImplicit() const { return Implicit; }
void setImplicit(bool I) { Implicit = I; }
@@ -109,18 +111,13 @@ public:
// Pretty print this attribute.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const;
-
- /// \brief By default, attributes cannot be duplicated when being merged;
- /// however, an attribute can override this. Returns true if the attribute
- /// can be duplicated when merging.
- bool duplicatesAllowed() const { return DuplicatesAllowed; }
};
class StmtAttr : public Attr {
protected:
StmtAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex,
- bool IsLateParsed, bool DuplicatesAllowed)
- : Attr(AK, R, SpellingListIndex, IsLateParsed, DuplicatesAllowed) {}
+ bool IsLateParsed)
+ : Attr(AK, R, SpellingListIndex, IsLateParsed) {}
public:
static bool classof(const Attr *A) {
@@ -132,12 +129,20 @@ public:
class InheritableAttr : public Attr {
protected:
InheritableAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex,
- bool IsLateParsed, bool DuplicatesAllowed)
- : Attr(AK, R, SpellingListIndex, IsLateParsed, DuplicatesAllowed) {}
+ bool IsLateParsed, bool InheritEvenIfAlreadyPresent)
+ : Attr(AK, R, SpellingListIndex, IsLateParsed) {
+ this->InheritEvenIfAlreadyPresent = InheritEvenIfAlreadyPresent;
+ }
public:
void setInherited(bool I) { Inherited = I; }
+ /// Should this attribute be inherited from a prior declaration even if it's
+ /// explicitly provided in the current declaration?
+ bool shouldInheritEvenIfAlreadyPresent() const {
+ return InheritEvenIfAlreadyPresent;
+ }
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) {
return A->getKind() >= attr::FirstInheritableAttr &&
@@ -148,9 +153,9 @@ public:
class InheritableParamAttr : public InheritableAttr {
protected:
InheritableParamAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex,
- bool IsLateParsed, bool DuplicatesAllowed)
+ bool IsLateParsed, bool InheritEvenIfAlreadyPresent)
: InheritableAttr(AK, R, SpellingListIndex, IsLateParsed,
- DuplicatesAllowed) {}
+ InheritEvenIfAlreadyPresent) {}
public:
// Implement isa/cast/dyncast/etc.
@@ -166,9 +171,9 @@ class ParameterABIAttr : public InheritableParamAttr {
protected:
ParameterABIAttr(attr::Kind AK, SourceRange R,
unsigned SpellingListIndex, bool IsLateParsed,
- bool DuplicatesAllowed)
+ bool InheritEvenIfAlreadyPresent)
: InheritableParamAttr(AK, R, SpellingListIndex, IsLateParsed,
- DuplicatesAllowed) {}
+ InheritEvenIfAlreadyPresent) {}
public:
ParameterABI getABI() const {
@@ -190,6 +195,128 @@ public:
}
};
+/// A single parameter index whose accessors require each use to make explicit
+/// the parameter index encoding needed.
+class ParamIdx {
+ // Idx is exposed only via accessors that specify specific encodings.
+ unsigned Idx : 30;
+ unsigned HasThis : 1;
+ unsigned IsValid : 1;
+
+ void assertComparable(const ParamIdx &I) const {
+ assert(isValid() && I.isValid() &&
+ "ParamIdx must be valid to be compared");
+ // It's possible to compare indices from separate functions, but so far
+ // it's not proven useful. Moreover, it might be confusing because a
+ // comparison on the results of getASTIndex might be inconsistent with a
+ // comparison on the ParamIdx objects themselves.
+ assert(HasThis == I.HasThis &&
+ "ParamIdx must be for the same function to be compared");
+ }
+
+public:
+ /// Construct an invalid parameter index (\c isValid returns false and
+ /// accessors fail an assert).
+ ParamIdx() : Idx(0), HasThis(false), IsValid(false) {}
+
+ /// \param Idx is the parameter index as it is normally specified in
+ /// attributes in the source: one-origin including any C++ implicit this
+ /// parameter.
+ ///
+ /// \param D is the declaration containing the parameters. It is used to
+ /// determine if there is a C++ implicit this parameter.
+ ParamIdx(unsigned Idx, const Decl *D)
+ : Idx(Idx), HasThis(false), IsValid(true) {
+ assert(Idx >= 1 && "Idx must be one-origin");
+ if (const auto *FD = dyn_cast<FunctionDecl>(D))
+ HasThis = FD->isCXXInstanceMember();
+ }
+
+ /// A type into which \c ParamIdx can be serialized.
+ ///
+ /// A static assertion that it's of the correct size follows the \c ParamIdx
+ /// class definition.
+ typedef uint32_t SerialType;
+
+ /// Produce a representation that can later be passed to \c deserialize to
+ /// construct an equivalent \c ParamIdx.
+ SerialType serialize() const {
+ return *reinterpret_cast<const SerialType *>(this);
+ }
+
+ /// Construct from a result from \c serialize.
+ static ParamIdx deserialize(SerialType S) {
+ ParamIdx P(*reinterpret_cast<ParamIdx *>(&S));
+ assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
+ return P;
+ }
+
+ /// Is this parameter index valid?
+ bool isValid() const { return IsValid; }
+
+ /// Get the parameter index as it would normally be encoded for attributes at
+ /// the source level of representation: one-origin including any C++ implicit
+ /// this parameter.
+ ///
+ /// This encoding thus makes sense for diagnostics, pretty printing, and
+ /// constructing new attributes from a source-like specification.
+ unsigned getSourceIndex() const {
+ assert(isValid() && "ParamIdx must be valid");
+ return Idx;
+ }
+
+ /// Get the parameter index as it would normally be encoded at the AST level
+ /// of representation: zero-origin not including any C++ implicit this
+ /// parameter.
+ ///
+ /// This is the encoding primarily used in Sema. However, in diagnostics,
+ /// Sema uses \c getSourceIndex instead.
+ unsigned getASTIndex() const {
+ assert(isValid() && "ParamIdx must be valid");
+ assert(Idx >= 1 + HasThis &&
+ "stored index must be base-1 and not specify C++ implicit this");
+ return Idx - 1 - HasThis;
+ }
+
+ /// Get the parameter index as it would normally be encoded at the LLVM level
+ /// of representation: zero-origin including any C++ implicit this parameter.
+ ///
+ /// This is the encoding primarily used in CodeGen.
+ unsigned getLLVMIndex() const {
+ assert(isValid() && "ParamIdx must be valid");
+ assert(Idx >= 1 && "stored index must be base-1");
+ return Idx - 1;
+ }
+
+ bool operator==(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx == I.Idx;
+ }
+ bool operator!=(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx != I.Idx;
+ }
+ bool operator<(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx < I.Idx;
+ }
+ bool operator>(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx > I.Idx;
+ }
+ bool operator<=(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx <= I.Idx;
+ }
+ bool operator>=(const ParamIdx &I) const {
+ assertComparable(I);
+ return Idx >= I.Idx;
+ }
+};
+
+static_assert(sizeof(ParamIdx) == sizeof(ParamIdx::SerialType),
+ "ParamIdx does not fit its serialization type");
+
#include "clang/AST/Attrs.inc"
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
diff --git a/include/clang/AST/Availability.h b/include/clang/AST/Availability.h
index 5ed831378456..28f3c3c01d20 100644
--- a/include/clang/AST/Availability.h
+++ b/include/clang/AST/Availability.h
@@ -15,12 +15,12 @@
#define LLVM_CLANG_AST_AVAILABILITY_H
#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/VersionTuple.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
namespace clang {
-/// \brief One specifier in an @available expression.
+/// One specifier in an @available expression.
///
/// \code
/// @available(macos 10.10, *)
diff --git a/include/clang/AST/BuiltinTypes.def b/include/clang/AST/BuiltinTypes.def
index e4f5f7db2f73..400efcb1981f 100644
--- a/include/clang/AST/BuiltinTypes.def
+++ b/include/clang/AST/BuiltinTypes.def
@@ -72,6 +72,9 @@ UNSIGNED_TYPE(UChar, UnsignedCharTy)
// 'wchar_t' for targets where it's unsigned
SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
+// 'char8_t' in C++20 (proposed)
+UNSIGNED_TYPE(Char8, Char8Ty)
+
// 'char16_t' in C++
UNSIGNED_TYPE(Char16, Char16Ty)
@@ -119,6 +122,80 @@ SIGNED_TYPE(LongLong, LongLongTy)
// '__int128_t'
SIGNED_TYPE(Int128, Int128Ty)
+//===- Fixed point types --------------------------------------------------===//
+
+// 'short _Accum'
+SIGNED_TYPE(ShortAccum, ShortAccumTy)
+
+// '_Accum'
+SIGNED_TYPE(Accum, AccumTy)
+
+// 'long _Accum'
+SIGNED_TYPE(LongAccum, LongAccumTy)
+
+// 'unsigned short _Accum'
+UNSIGNED_TYPE(UShortAccum, UnsignedShortAccumTy)
+
+// 'unsigned _Accum'
+UNSIGNED_TYPE(UAccum, UnsignedAccumTy)
+
+// 'unsigned long _Accum'
+UNSIGNED_TYPE(ULongAccum, UnsignedLongAccumTy)
+
+// 'short _Fract'
+SIGNED_TYPE(ShortFract, ShortFractTy)
+
+// '_Fract'
+SIGNED_TYPE(Fract, FractTy)
+
+// 'long _Fract'
+SIGNED_TYPE(LongFract, LongFractTy)
+
+// 'unsigned short _Fract'
+UNSIGNED_TYPE(UShortFract, UnsignedShortFractTy)
+
+// 'unsigned _Fract'
+UNSIGNED_TYPE(UFract, UnsignedFractTy)
+
+// 'unsigned long _Fract'
+UNSIGNED_TYPE(ULongFract, UnsignedLongFractTy)
+
+// '_Sat short _Accum'
+SIGNED_TYPE(SatShortAccum, SatShortAccumTy)
+
+// '_Sat _Accum'
+SIGNED_TYPE(SatAccum, SatAccumTy)
+
+// '_Sat long _Accum'
+SIGNED_TYPE(SatLongAccum, SatLongAccumTy)
+
+// '_Sat unsigned short _Accum'
+UNSIGNED_TYPE(SatUShortAccum, SatUnsignedShortAccumTy)
+
+// '_Sat unsigned _Accum'
+UNSIGNED_TYPE(SatUAccum, SatUnsignedAccumTy)
+
+// '_Sat unsigned long _Accum'
+UNSIGNED_TYPE(SatULongAccum, SatUnsignedLongAccumTy)
+
+// '_Sat short _Fract'
+SIGNED_TYPE(SatShortFract, SatShortFractTy)
+
+// '_Sat _Fract'
+SIGNED_TYPE(SatFract, SatFractTy)
+
+// '_Sat long _Fract'
+SIGNED_TYPE(SatLongFract, SatLongFractTy)
+
+// '_Sat unsigned short _Fract'
+UNSIGNED_TYPE(SatUShortFract, SatUnsignedShortFractTy)
+
+// '_Sat unsigned _Fract'
+UNSIGNED_TYPE(SatUFract, SatUnsignedFractTy)
+
+// '_Sat unsigned long _Fract'
+UNSIGNED_TYPE(SatULongFract, SatUnsignedLongFractTy)
+
//===- Floating point types -----------------------------------------------===//
// 'half' in OpenCL, '__fp16' in ARM NEON.
diff --git a/include/clang/AST/CXXInheritance.h b/include/clang/AST/CXXInheritance.h
index 11fb229f0c09..2ae1d8b25823 100644
--- a/include/clang/AST/CXXInheritance.h
+++ b/include/clang/AST/CXXInheritance.h
@@ -35,7 +35,7 @@ namespace clang {
class ASTContext;
class NamedDecl;
-/// \brief Represents an element in a path from a derived class to a
+/// Represents an element in a path from a derived class to a
/// base class.
///
/// Each step in the path references the link from a
@@ -43,15 +43,15 @@ class NamedDecl;
/// base "number" that identifies which base subobject of the
/// original derived class we are referencing.
struct CXXBasePathElement {
- /// \brief The base specifier that states the link from a derived
+ /// The base specifier that states the link from a derived
/// class to a base class, which will be followed by this base
/// path element.
const CXXBaseSpecifier *Base;
- /// \brief The record decl of the class that the base is a base of.
+ /// The record decl of the class that the base is a base of.
const CXXRecordDecl *Class;
- /// \brief Identifies which base class subobject (of type
+ /// Identifies which base class subobject (of type
/// \c Base->getType()) this base path element refers to.
///
/// This value is only valid if \c !Base->isVirtual(), because there
@@ -60,7 +60,7 @@ struct CXXBasePathElement {
int SubobjectNumber;
};
-/// \brief Represents a path from a specific derived class
+/// Represents a path from a specific derived class
/// (which is not represented as part of the path) to a particular
/// (direct or indirect) base class subobject.
///
@@ -70,14 +70,14 @@ struct CXXBasePathElement {
/// subobject is being used.
class CXXBasePath : public SmallVector<CXXBasePathElement, 4> {
public:
- /// \brief The access along this inheritance path. This is only
+ /// The access along this inheritance path. This is only
/// calculated when recording paths. AS_none is a special value
/// used to indicate a path which permits no legal access.
AccessSpecifier Access = AS_public;
CXXBasePath() = default;
- /// \brief The set of declarations found inside this base class
+ /// The set of declarations found inside this base class
/// subobject.
DeclContext::lookup_result Decls;
@@ -119,24 +119,42 @@ public:
class CXXBasePaths {
friend class CXXRecordDecl;
- /// \brief The type from which this search originated.
+ /// The type from which this search originated.
CXXRecordDecl *Origin = nullptr;
/// Paths - The actual set of paths that can be taken from the
/// derived class to the same base class.
std::list<CXXBasePath> Paths;
-
+
/// ClassSubobjects - Records the class subobjects for each class
- /// type that we've seen. The first element in the pair says
+ /// type that we've seen. The first element IsVirtBase says
/// whether we found a path to a virtual base for that class type,
- /// while the element contains the number of non-virtual base
+ /// while NumberOfNonVirtBases contains the number of non-virtual base
/// class subobjects for that class type. The key of the map is
/// the cv-unqualified canonical type of the base class subobject.
- llvm::SmallDenseMap<QualType, std::pair<bool, unsigned>, 8> ClassSubobjects;
+ struct IsVirtBaseAndNumberNonVirtBases {
+ unsigned IsVirtBase : 1;
+ unsigned NumberOfNonVirtBases : 31;
+ };
+ llvm::SmallDenseMap<QualType, IsVirtBaseAndNumberNonVirtBases, 8>
+ ClassSubobjects;
/// VisitedDependentRecords - Records the dependent records that have been
/// already visited.
- llvm::SmallDenseSet<const CXXRecordDecl *, 4> VisitedDependentRecords;
+ llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedDependentRecords;
+
+ /// DetectedVirtual - The base class that is virtual.
+ const RecordType *DetectedVirtual = nullptr;
+
+ /// ScratchPath - A BasePath that is used by Sema::lookupInBases
+ /// 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<NamedDecl *[]> DeclsFound;
+ unsigned NumDeclsFound = 0;
/// FindAmbiguities - Whether Sema::IsDerivedFrom should try find
/// ambiguous paths while it is looking for a path from a derived
@@ -152,20 +170,7 @@ class CXXBasePaths {
/// if it finds a path that goes across a virtual base. The virtual class
/// is also recorded.
bool DetectVirtual;
-
- /// ScratchPath - A BasePath that is used by Sema::lookupInBases
- /// to help build the set of paths.
- CXXBasePath ScratchPath;
- /// DetectedVirtual - The base class that is virtual.
- const RecordType *DetectedVirtual = nullptr;
-
- /// \brief 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<NamedDecl *[]> DeclsFound;
- unsigned NumDeclsFound = 0;
-
void ComputeDeclsFound();
bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
@@ -196,53 +201,53 @@ public:
decl_range found_decls();
- /// \brief Determine whether the path from the most-derived type to the
+ /// 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).
bool isAmbiguous(CanQualType BaseType);
- /// \brief Whether we are finding multiple paths to detect ambiguities.
+ /// Whether we are finding multiple paths to detect ambiguities.
bool isFindingAmbiguities() const { return FindAmbiguities; }
- /// \brief Whether we are recording paths.
+ /// Whether we are recording paths.
bool isRecordingPaths() const { return RecordPaths; }
- /// \brief Specify whether we should be recording paths or not.
+ /// Specify whether we should be recording paths or not.
void setRecordingPaths(bool RP) { RecordPaths = RP; }
- /// \brief Whether we are detecting virtual bases.
+ /// Whether we are detecting virtual bases.
bool isDetectingVirtual() const { return DetectVirtual; }
- /// \brief The virtual base discovered on the path (if we are merely
+ /// The virtual base discovered on the path (if we are merely
/// detecting virtuals).
const RecordType* getDetectedVirtual() const {
return DetectedVirtual;
}
- /// \brief Retrieve the type from which this base-paths search
+ /// Retrieve the type from which this base-paths search
/// began
CXXRecordDecl *getOrigin() const { return Origin; }
void setOrigin(CXXRecordDecl *Rec) { Origin = Rec; }
- /// \brief Clear the base-paths results.
+ /// Clear the base-paths results.
void clear();
- /// \brief Swap this data structure's contents with another CXXBasePaths
+ /// Swap this data structure's contents with another CXXBasePaths
/// object.
void swap(CXXBasePaths &Other);
};
-/// \brief Uniquely identifies a virtual method within a class
+/// Uniquely identifies a virtual method within a class
/// hierarchy by the method itself and a class subobject number.
struct UniqueVirtualMethod {
- /// \brief The overriding virtual method.
+ /// The overriding virtual method.
CXXMethodDecl *Method = nullptr;
- /// \brief The subobject in which the overriding virtual method
+ /// The subobject in which the overriding virtual method
/// resides.
unsigned Subobject = 0;
- /// \brief The virtual base class subobject of which this overridden
+ /// The virtual base class subobject of which this overridden
/// virtual method is a part. Note that this records the closest
/// derived virtual base class subobject.
const CXXRecordDecl *InVirtualSubobject = nullptr;
@@ -266,7 +271,7 @@ struct UniqueVirtualMethod {
}
};
-/// \brief The set of methods that override a given virtual method in
+/// The set of methods that override a given virtual method in
/// each subobject where it occurs.
///
/// The first part of the pair is the subobject in which the
@@ -310,7 +315,7 @@ public:
void replaceAll(UniqueVirtualMethod Overriding);
};
-/// \brief A mapping from each virtual member function to its set of
+/// A mapping from each virtual member function to its set of
/// final overriders.
///
/// Within a class hierarchy for a given derived class, each virtual
@@ -364,7 +369,7 @@ public:
class CXXFinalOverriderMap
: public llvm::MapVector<const CXXMethodDecl *, OverridingMethods> {};
-/// \brief A set of all the primary bases for a class.
+/// A set of all the primary bases for a class.
class CXXIndirectPrimaryBaseSet
: public llvm::SmallSet<const CXXRecordDecl*, 32> {};
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index 6487613200de..63a0af66eec3 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -44,7 +44,7 @@ class TemplateTypeParmDecl;
// Canonical, qualified type template
//----------------------------------------------------------------------------//
-/// \brief Represents a canonical, potentially-qualified type.
+/// Represents a canonical, potentially-qualified type.
///
/// The CanQual template is a lightweight smart pointer that provides access
/// to the canonical representation of a type, where all typedefs and other
@@ -64,35 +64,35 @@ class TemplateTypeParmDecl;
/// a call to ASTContext::getCanonicalType().
template<typename T = Type>
class CanQual {
- /// \brief The actual, canonical type.
+ /// The actual, canonical type.
QualType Stored;
public:
- /// \brief Constructs a NULL canonical type.
+ /// Constructs a NULL canonical type.
CanQual() = default;
- /// \brief Converting constructor that permits implicit upcasting of
+ /// Converting constructor that permits implicit upcasting of
/// canonical type pointers.
template <typename U>
CanQual(const CanQual<U> &Other,
typename std::enable_if<std::is_base_of<T, U>::value, int>::type = 0);
- /// \brief Retrieve the underlying type pointer, which refers to a
+ /// Retrieve the underlying type pointer, which refers to a
/// canonical type.
///
/// The underlying pointer must not be nullptr.
const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
- /// \brief Retrieve the underlying type pointer, which refers to a
+ /// Retrieve the underlying type pointer, which refers to a
/// canonical type, or nullptr.
const T *getTypePtrOrNull() const {
return cast_or_null<T>(Stored.getTypePtrOrNull());
}
- /// \brief Implicit conversion to a qualified type.
+ /// Implicit conversion to a qualified type.
operator QualType() const { return Stored; }
- /// \brief Implicit conversion to bool.
+ /// Implicit conversion to bool.
explicit operator bool() const { return !isNull(); }
bool isNull() const {
@@ -101,7 +101,7 @@ public:
SplitQualType split() const { return Stored.split(); }
- /// \brief Retrieve a canonical type pointer with a different static type,
+ /// Retrieve a canonical type pointer with a different static type,
/// upcasting or downcasting as needed.
///
/// The getAs() function is typically used to try to downcast to a
@@ -122,17 +122,17 @@ public:
template<typename U> CanProxy<U> castAs() const;
- /// \brief Overloaded arrow operator that produces a canonical type
+ /// Overloaded arrow operator that produces a canonical type
/// proxy.
CanProxy<T> operator->() const;
- /// \brief Retrieve all qualifiers.
+ /// Retrieve all qualifiers.
Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); }
- /// \brief Retrieve the const/volatile/restrict qualifiers.
+ /// Retrieve the const/volatile/restrict qualifiers.
unsigned getCVRQualifiers() const { return Stored.getLocalCVRQualifiers(); }
- /// \brief Determines whether this type has any qualifiers
+ /// Determines whether this type has any qualifiers
bool hasQualifiers() const { return Stored.hasLocalQualifiers(); }
bool isConstQualified() const {
@@ -147,45 +147,45 @@ public:
return Stored.isLocalRestrictQualified();
}
- /// \brief Determines if this canonical type is furthermore
+ /// Determines if this canonical type is furthermore
/// canonical as a parameter. The parameter-canonicalization
/// process decays arrays to pointers and drops top-level qualifiers.
bool isCanonicalAsParam() const {
return Stored.isCanonicalAsParam();
}
- /// \brief Retrieve the unqualified form of this type.
+ /// Retrieve the unqualified form of this type.
CanQual<T> getUnqualifiedType() const;
- /// \brief Retrieves a version of this type with const applied.
+ /// Retrieves a version of this type with const applied.
/// Note that this does not always yield a canonical type.
QualType withConst() const {
return Stored.withConst();
}
- /// \brief Determines whether this canonical type is more qualified than
+ /// Determines whether this canonical type is more qualified than
/// the @p Other canonical type.
bool isMoreQualifiedThan(CanQual<T> Other) const {
return Stored.isMoreQualifiedThan(Other.Stored);
}
- /// \brief Determines whether this canonical type is at least as qualified as
+ /// Determines whether this canonical type is at least as qualified as
/// the @p Other canonical type.
bool isAtLeastAsQualifiedAs(CanQual<T> Other) const {
return Stored.isAtLeastAsQualifiedAs(Other.Stored);
}
- /// \brief If the canonical type is a reference type, returns the type that
+ /// If the canonical type is a reference type, returns the type that
/// it refers to; otherwise, returns the type itself.
CanQual<Type> getNonReferenceType() const;
- /// \brief Retrieve the internal representation of this canonical type.
+ /// Retrieve the internal representation of this canonical type.
void *getAsOpaquePtr() const { return Stored.getAsOpaquePtr(); }
- /// \brief Construct a canonical type from its internal representation.
+ /// Construct a canonical type from its internal representation.
static CanQual<T> getFromOpaquePtr(void *Ptr);
- /// \brief Builds a canonical type from a QualType.
+ /// Builds a canonical type from a QualType.
///
/// This routine is inherently unsafe, because it requires the user to
/// ensure that the given type is a canonical type with the correct
@@ -209,7 +209,7 @@ inline bool operator!=(CanQual<T> x, CanQual<U> y) {
return x.getAsOpaquePtr() != y.getAsOpaquePtr();
}
-/// \brief Represents a canonical, potentially-qualified type.
+/// Represents a canonical, potentially-qualified type.
using CanQualType = CanQual<Type>;
inline CanQualType Type::getCanonicalTypeUnqualified() const {
@@ -234,7 +234,7 @@ return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \
#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \
Type Accessor() const { return this->getTypePtr()->Accessor(); }
-/// \brief Base class of all canonical proxy types, which is responsible for
+/// Base class of all canonical proxy types, which is responsible for
/// storing the underlying canonical type and providing basic conversions.
template<typename T>
class CanProxyBase {
@@ -242,10 +242,10 @@ protected:
CanQual<T> Stored;
public:
- /// \brief Retrieve the pointer to the underlying Type
+ /// Retrieve the pointer to the underlying Type
const T *getTypePtr() const { return Stored.getTypePtr(); }
- /// \brief Implicit conversion to the underlying pointer.
+ /// Implicit conversion to the underlying pointer.
///
/// Also provides the ability to use canonical type proxies in a Boolean
// context,e.g.,
@@ -254,7 +254,7 @@ public:
/// @endcode
operator const T*() const { return this->Stored.getTypePtrOrNull(); }
- /// \brief Try to convert the given canonical type to a specific structural
+ /// Try to convert the given canonical type to a specific structural
/// type.
template<typename U> CanProxy<U> getAs() const {
return this->Stored.template getAs<U>();
@@ -313,7 +313,7 @@ public:
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSpecifierType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(CXXRecordDecl*, getAsCXXRecordDecl)
- /// \brief Retrieve the proxy-adaptor type.
+ /// Retrieve the proxy-adaptor type.
///
/// This arrow operator is used when CanProxyAdaptor has been specialized
/// for the given type T. In that case, we reference members of the
@@ -324,7 +324,7 @@ public:
}
};
-/// \brief Replacable canonical proxy adaptor class that provides the link
+/// Replaceable canonical proxy adaptor class that provides the link
/// between a canonical type and the accessors of the type.
///
/// The CanProxyAdaptor is a replaceable class template that is instantiated
@@ -337,7 +337,7 @@ public:
template<typename T>
struct CanProxyAdaptor : CanProxyBase<T> {};
-/// \brief Canonical proxy type returned when retrieving the members of a
+/// Canonical proxy type returned when retrieving the members of a
/// canonical type or as the result of the @c CanQual<T>::getAs member
/// function.
///
@@ -347,13 +347,13 @@ struct CanProxyAdaptor : CanProxyBase<T> {};
template<typename T>
class CanProxy : public CanProxyAdaptor<T> {
public:
- /// \brief Build a NULL proxy.
+ /// Build a NULL proxy.
CanProxy() = default;
- /// \brief Build a proxy to the given canonical type.
+ /// Build a proxy to the given canonical type.
CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
- /// \brief Implicit conversion to the stored canonical type.
+ /// Implicit conversion to the stored canonical type.
operator CanQual<T>() const { return this->Stored; }
};
@@ -396,7 +396,7 @@ namespace clang {
// Canonical proxy adaptors for canonical type nodes.
//----------------------------------------------------------------------------//
-/// \brief Iterator adaptor that turns an iterator over canonical QualTypes
+/// Iterator adaptor that turns an iterator over canonical QualTypes
/// into an iterator over CanQualTypes.
template <typename InputIterator>
struct CanTypeIterator
diff --git a/include/clang/AST/Comment.h b/include/clang/AST/Comment.h
index 94470cbf305f..e3a427d8aa0d 100644
--- a/include/clang/AST/Comment.h
+++ b/include/clang/AST/Comment.h
@@ -990,7 +990,7 @@ struct DeclInfo {
/// CurrentDecl is the declaration with which the FullComment is associated.
///
- /// It can be different from \c CommentDecl. It happens when we we decide
+ /// It can be different from \c CommentDecl. It happens when we decide
/// that the comment originally attached to \c CommentDecl is fine for
/// \c CurrentDecl too (for example, for a redeclaration or an overrider of
/// \c CommentDecl).
diff --git a/include/clang/AST/CommentBriefParser.h b/include/clang/AST/CommentBriefParser.h
index be5b8eeb80c3..baa22930539e 100644
--- a/include/clang/AST/CommentBriefParser.h
+++ b/include/clang/AST/CommentBriefParser.h
@@ -24,7 +24,7 @@ namespace comments {
///
/// Due to a variety of comment styles, it considers the following as "a brief
/// description", in order of priority:
-/// \li a \\brief or \\short command,
+/// \li a \or \\short command,
/// \li the first paragraph,
/// \li a \\result or \\return or \\returns paragraph.
class BriefParser {
diff --git a/include/clang/AST/CommentCommandTraits.h b/include/clang/AST/CommentCommandTraits.h
index 289f2fd345af..bac4e99dc7a4 100644
--- a/include/clang/AST/CommentCommandTraits.h
+++ b/include/clang/AST/CommentCommandTraits.h
@@ -26,7 +26,7 @@
namespace clang {
namespace comments {
-/// \brief Information about a single command.
+/// Information about a single command.
///
/// When reordering, adding or removing members please update the corresponding
/// TableGen backend.
@@ -57,7 +57,7 @@ struct CommandInfo {
unsigned IsBlockCommand : 1;
/// True if this command is introducing a brief documentation
- /// paragraph (\\brief or an alias).
+ /// paragraph (\or an alias).
unsigned IsBriefCommand : 1;
/// True if this command is \\returns or an alias.
@@ -77,29 +77,29 @@ struct CommandInfo {
/// True if this command is \\deprecated or an alias.
unsigned IsDeprecatedCommand : 1;
- /// \brief True if this is a \\headerfile-like command.
+ /// True if this is a \\headerfile-like command.
unsigned IsHeaderfileCommand : 1;
/// True if we don't want to warn about this command being passed an empty
/// paragraph. Meaningful only for block commands.
unsigned IsEmptyParagraphAllowed : 1;
- /// \brief True if this command is a verbatim-like block command.
+ /// True if this command is a verbatim-like block command.
///
/// A verbatim-like block command eats every character (except line starting
/// decorations) until matching end command is seen or comment end is hit.
unsigned IsVerbatimBlockCommand : 1;
- /// \brief True if this command is an end command for a verbatim-like block.
+ /// True if this command is an end command for a verbatim-like block.
unsigned IsVerbatimBlockEndCommand : 1;
- /// \brief True if this command is a verbatim line command.
+ /// True if this command is a verbatim line command.
///
/// A verbatim-like line command eats everything until a newline is seen or
/// comment end is hit.
unsigned IsVerbatimLineCommand : 1;
- /// \brief True if this command contains a declaration for the entity being
+ /// True if this command contains a declaration for the entity being
/// documented.
///
/// For example:
@@ -108,17 +108,17 @@ struct CommandInfo {
/// \endcode
unsigned IsDeclarationCommand : 1;
- /// \brief True if verbatim-like line command is a function declaration.
+ /// True if verbatim-like line command is a function declaration.
unsigned IsFunctionDeclarationCommand : 1;
- /// \brief True if block command is further describing a container API; such
+ /// True if block command is further describing a container API; such
/// as \@coclass, \@classdesign, etc.
unsigned IsRecordLikeDetailCommand : 1;
- /// \brief True if block command is a container API; such as \@interface.
+ /// True if block command is a container API; such as \@interface.
unsigned IsRecordLikeDeclarationCommand : 1;
- /// \brief True if this command is unknown. This \c CommandInfo object was
+ /// True if this command is unknown. This \c CommandInfo object was
/// created during parsing.
unsigned IsUnknownCommand : 1;
};
diff --git a/include/clang/AST/CommentLexer.h b/include/clang/AST/CommentLexer.h
index 5bb075807be5..52c4eb9e309a 100644
--- a/include/clang/AST/CommentLexer.h
+++ b/include/clang/AST/CommentLexer.h
@@ -52,7 +52,7 @@ enum TokenKind {
};
} // end namespace tok
-/// \brief Comment token.
+/// Comment token.
class Token {
friend class Lexer;
friend class TextTokenRetokenizer;
@@ -72,7 +72,7 @@ class Token {
/// Integer value associated with a token.
///
- /// If the token is a konwn command, contains command ID and TextPtr is
+ /// If the token is a known command, contains command ID and TextPtr is
/// unused (command spelling can be found with CommandTraits). Otherwise,
/// contains the length of the string that starts at TextPtr.
unsigned IntVal;
@@ -217,7 +217,7 @@ public:
void dump(const Lexer &L, const SourceManager &SM) const;
};
-/// \brief Comment lexer.
+/// Comment lexer.
class Lexer {
private:
Lexer(const Lexer &) = delete;
@@ -281,6 +281,11 @@ 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;
@@ -315,12 +320,11 @@ private:
/// Eat string matching regexp \code \s*\* \endcode.
void skipLineStartingDecorations();
- /// Lex stuff inside comments. CommentEnd should be set correctly.
+ /// Lex comment text, including commands if ParseCommands is set to true.
void lexCommentText(Token &T);
- void setupAndLexVerbatimBlock(Token &T,
- const char *TextBegin,
- char Marker, const CommandInfo *Info);
+ void setupAndLexVerbatimBlock(Token &T, const char *TextBegin, char Marker,
+ const CommandInfo *Info);
void lexVerbatimBlockFirstLine(Token &T);
@@ -343,14 +347,13 @@ private:
public:
Lexer(llvm::BumpPtrAllocator &Allocator, DiagnosticsEngine &Diags,
- const CommandTraits &Traits,
- SourceLocation FileLoc,
- const char *BufferStart, const char *BufferEnd);
+ const CommandTraits &Traits, SourceLocation FileLoc,
+ const char *BufferStart, const char *BufferEnd,
+ bool ParseCommands = true);
void lex(Token &T);
- StringRef getSpelling(const Token &Tok,
- const SourceManager &SourceMgr,
+ StringRef getSpelling(const Token &Tok, const SourceManager &SourceMgr,
bool *Invalid = nullptr) const;
};
diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h
index 230e52739f24..0e94c33970ca 100644
--- a/include/clang/AST/CommentSema.h
+++ b/include/clang/AST/CommentSema.h
@@ -55,7 +55,7 @@ class Sema {
/// Contains a valid value if \c DeclInfo->IsFilled is true.
llvm::StringMap<TParamCommandComment *> TemplateParameterDocs;
- /// AST node for the \\brief command and its aliases.
+ /// AST node for the \command and its aliases.
const BlockCommandComment *BriefCommand;
/// AST node for the \\headerfile command.
@@ -187,7 +187,7 @@ public:
void checkReturnsCommand(const BlockCommandComment *Command);
/// Emit diagnostics about duplicate block commands that should be
- /// used only once per comment, e.g., \\brief and \\returns.
+ /// used only once per comment, e.g., \and \\returns.
void checkBlockCommandDuplicate(const BlockCommandComment *Command);
void checkDeprecatedCommand(const BlockCommandComment *Comment);
diff --git a/include/clang/AST/ComparisonCategories.h b/include/clang/AST/ComparisonCategories.h
new file mode 100644
index 000000000000..23bfd708e7eb
--- /dev/null
+++ b/include/clang/AST/ComparisonCategories.h
@@ -0,0 +1,243 @@
+//===- ComparisonCategories.h - Three Way Comparison Data -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the Comparison Category enum and data types, which
+// store the types and expressions needed to support operator<=>
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_COMPARISONCATEGORIES_H
+#define LLVM_CLANG_AST_COMPARISONCATEGORIES_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/DenseMap.h"
+#include <array>
+#include <cassert>
+
+namespace llvm {
+ class StringRef;
+ class APSInt;
+}
+
+namespace clang {
+
+class ASTContext;
+class VarDecl;
+class CXXRecordDecl;
+class Sema;
+class QualType;
+class NamespaceDecl;
+
+/// An enumeration representing the different comparison categories
+/// types.
+///
+/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
+/// partial_ordering, weak_ordering, and strong_ordering are collectively
+/// termed the comparison category types.
+enum class ComparisonCategoryType : unsigned char {
+ WeakEquality,
+ StrongEquality,
+ PartialOrdering,
+ WeakOrdering,
+ StrongOrdering,
+ First = WeakEquality,
+ Last = StrongOrdering
+};
+
+/// An enumeration representing the possible results of a three-way
+/// comparison. These values map onto instances of comparison category types
+/// defined in the standard library. e.g. 'std::strong_ordering::less'.
+enum class ComparisonCategoryResult : unsigned char {
+ Equal,
+ Equivalent,
+ Nonequivalent,
+ Nonequal,
+ Less,
+ Greater,
+ Unordered,
+ Last = Unordered
+};
+
+class ComparisonCategoryInfo {
+ friend class ComparisonCategories;
+ friend class Sema;
+
+public:
+ ComparisonCategoryInfo(const ASTContext &Ctx, CXXRecordDecl *RD,
+ ComparisonCategoryType Kind)
+ : Ctx(Ctx), Record(RD), Kind(Kind) {}
+
+ struct ValueInfo {
+ ComparisonCategoryResult Kind;
+ VarDecl *VD;
+
+ ValueInfo(ComparisonCategoryResult Kind, VarDecl *VD)
+ : Kind(Kind), VD(VD) {}
+
+ /// True iff we've successfully evaluated the variable as a constant
+ /// expression and extracted its integer value.
+ bool hasValidIntValue() const;
+
+ /// Get the constant integer value used by this variable to represent
+ /// the comparison category result type.
+ llvm::APSInt getIntValue() const;
+ };
+private:
+ const ASTContext &Ctx;
+
+ /// A map containing the comparison category result decls from the
+ /// standard library. The key is a value of ComparisonCategoryResult.
+ mutable llvm::SmallVector<
+ ValueInfo, static_cast<unsigned>(ComparisonCategoryResult::Last) + 1>
+ Objects;
+
+ /// Lookup the ValueInfo struct for the specified ValueKind. If the
+ /// VarDecl for the value cannot be found, nullptr is returned.
+ ///
+ /// If the ValueInfo does not have a valid integer value the variable
+ /// is evaluated as a constant expression to determine that value.
+ ValueInfo *lookupValueInfo(ComparisonCategoryResult ValueKind) const;
+
+public:
+ /// The declaration for the comparison category type from the
+ /// standard library.
+ // FIXME: Make this const
+ CXXRecordDecl *Record = nullptr;
+
+ /// The Kind of the comparison category type
+ ComparisonCategoryType Kind;
+
+public:
+ QualType getType() const;
+
+ const ValueInfo *getValueInfo(ComparisonCategoryResult ValueKind) const {
+ ValueInfo *Info = lookupValueInfo(ValueKind);
+ assert(Info &&
+ "comparison category does not contain the specified result kind");
+ assert(Info->hasValidIntValue() &&
+ "couldn't determine the integer constant for this value");
+ return Info;
+ }
+
+ /// True iff the comparison category is an equality comparison.
+ bool isEquality() const { return !isOrdered(); }
+
+ /// True iff the comparison category is a relational comparison.
+ bool isOrdered() const {
+ using CCK = ComparisonCategoryType;
+ return Kind == CCK::PartialOrdering || Kind == CCK::WeakOrdering ||
+ Kind == CCK::StrongOrdering;
+ }
+
+ /// True iff the comparison is "strong". i.e. it checks equality and
+ /// not equivalence.
+ bool isStrong() const {
+ using CCK = ComparisonCategoryType;
+ return Kind == CCK::StrongEquality || Kind == CCK::StrongOrdering;
+ }
+
+ /// True iff the comparison is not totally ordered.
+ bool isPartial() const {
+ using CCK = ComparisonCategoryType;
+ return Kind == CCK::PartialOrdering;
+ }
+
+ /// Converts the specified result kind into the the correct result kind
+ /// for this category. Specifically it lowers strong equality results to
+ /// weak equivalence if needed.
+ ComparisonCategoryResult makeWeakResult(ComparisonCategoryResult Res) const {
+ using CCR = ComparisonCategoryResult;
+ if (!isStrong()) {
+ if (Res == CCR::Equal)
+ return CCR::Equivalent;
+ if (Res == CCR::Nonequal)
+ return CCR::Nonequivalent;
+ }
+ return Res;
+ }
+
+ const ValueInfo *getEqualOrEquiv() const {
+ return getValueInfo(makeWeakResult(ComparisonCategoryResult::Equal));
+ }
+ const ValueInfo *getNonequalOrNonequiv() const {
+ assert(isEquality());
+ return getValueInfo(makeWeakResult(ComparisonCategoryResult::Nonequal));
+ }
+ const ValueInfo *getLess() const {
+ assert(isOrdered());
+ return getValueInfo(ComparisonCategoryResult::Less);
+ }
+ const ValueInfo *getGreater() const {
+ assert(isOrdered());
+ return getValueInfo(ComparisonCategoryResult::Greater);
+ }
+ const ValueInfo *getUnordered() const {
+ assert(isPartial());
+ return getValueInfo(ComparisonCategoryResult::Unordered);
+ }
+};
+
+class ComparisonCategories {
+public:
+ static StringRef getCategoryString(ComparisonCategoryType Kind);
+ static StringRef getResultString(ComparisonCategoryResult Kind);
+
+ /// Return the list of results which are valid for the specified
+ /// comparison category type.
+ static std::vector<ComparisonCategoryResult>
+ getPossibleResultsForType(ComparisonCategoryType Type);
+
+ /// Return the comparison category information for the category
+ /// specified by 'Kind'.
+ const ComparisonCategoryInfo &getInfo(ComparisonCategoryType Kind) const {
+ const ComparisonCategoryInfo *Result = lookupInfo(Kind);
+ assert(Result != nullptr &&
+ "information for specified comparison category has not been built");
+ return *Result;
+ }
+
+ /// Return the comparison category information as specified by
+ /// `getCategoryForType(Ty)`. If the information is not already cached,
+ /// the declaration is looked up and a cache entry is created.
+ /// NOTE: Lookup is expected to succeed. Use lookupInfo if failure is
+ /// possible.
+ const ComparisonCategoryInfo &getInfoForType(QualType Ty) const;
+
+public:
+ /// Return the cached comparison category information for the
+ /// specified 'Kind'. If no cache entry is present the comparison category
+ /// type is looked up. If lookup fails nullptr is returned. Otherwise, a
+ /// new cache entry is created and returned
+ const ComparisonCategoryInfo *lookupInfo(ComparisonCategoryType Kind) const;
+
+ ComparisonCategoryInfo *lookupInfo(ComparisonCategoryType Kind) {
+ const auto &This = *this;
+ return const_cast<ComparisonCategoryInfo *>(This.lookupInfo(Kind));
+ }
+
+private:
+ const ComparisonCategoryInfo *lookupInfoForType(QualType Ty) const;
+
+private:
+ friend class ASTContext;
+
+ explicit ComparisonCategories(const ASTContext &Ctx) : Ctx(Ctx) {}
+
+ const ASTContext &Ctx;
+
+ /// A map from the ComparisonCategoryType (represented as 'char') to the
+ /// cached information for the specified category.
+ mutable llvm::DenseMap<char, ComparisonCategoryInfo> Data;
+ mutable NamespaceDecl *StdNS = nullptr;
+};
+
+} // namespace clang
+
+#endif
diff --git a/include/clang/AST/DataCollection.h b/include/clang/AST/DataCollection.h
index 229ac2bd0f22..8b2a8345d941 100644
--- a/include/clang/AST/DataCollection.h
+++ b/include/clang/AST/DataCollection.h
@@ -7,12 +7,12 @@
//
//===----------------------------------------------------------------------===//
/// \file
-/// \brief This file declares helper methods for collecting data from AST nodes.
+/// This file declares helper methods for collecting data from AST nodes.
///
/// To collect data from Stmt nodes, subclass ConstStmtVisitor and include
/// StmtDataCollectors.inc after defining the macros that you need. This
/// provides data collection implementations for most Stmt kinds. Note
-/// that that code requires some conditions to be met:
+/// that the code requires some conditions to be met:
///
/// - There must be a method addData(const T &Data) that accepts strings,
/// integral types as well as QualType. All data is forwarded using
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 04a832e552a4..dde94599636f 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -76,14 +76,14 @@ class TypeLoc;
class UnresolvedSetImpl;
class VarTemplateDecl;
-/// \brief A container of type source information.
+/// A container of type source information.
///
/// A client can read the relevant info using TypeLoc wrappers, e.g:
/// @code
/// TypeLoc TL = TypeSourceInfo->getTypeLoc();
/// TL.getStartLoc().print(OS, SrcMgr);
/// @endcode
-class TypeSourceInfo {
+class alignas(8) TypeSourceInfo {
// Contains a memory block after the class, used for type source information,
// allocated by ASTContext.
friend class ASTContext;
@@ -93,17 +93,17 @@ class TypeSourceInfo {
TypeSourceInfo(QualType ty) : Ty(ty) {}
public:
- /// \brief Return the type wrapped by this type source info.
+ /// Return the type wrapped by this type source info.
QualType getType() const { return Ty; }
- /// \brief Return the TypeLoc wrapper for the type source info.
+ /// Return the TypeLoc wrapper for the type source info.
TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
- /// \brief Override the type stored in this TypeSourceInfo. Use with caution!
+ /// Override the type stored in this TypeSourceInfo. Use with caution!
void overrideType(QualType T) { Ty = T; }
};
-/// TranslationUnitDecl - The top declaration context.
+/// The top declaration context.
class TranslationUnitDecl : public Decl, public DeclContext {
ASTContext &Ctx;
@@ -134,7 +134,7 @@ public:
}
};
-/// \brief Represents a `#pragma comment` line. Always a child of
+/// Represents a `#pragma comment` line. Always a child of
/// TranslationUnitDecl.
class PragmaCommentDecl final
: public Decl,
@@ -168,7 +168,7 @@ public:
static bool classofKind(Kind K) { return K == PragmaComment; }
};
-/// \brief Represents a `#pragma detect_mismatch` line. Always a child of
+/// Represents a `#pragma detect_mismatch` line. Always a child of
/// TranslationUnitDecl.
class PragmaDetectMismatchDecl final
: public Decl,
@@ -201,7 +201,7 @@ public:
static bool classofKind(Kind K) { return K == PragmaDetectMismatch; }
};
-/// \brief Declaration context for names declared as extern "C" in C++. This
+/// Declaration context for names declared as extern "C" in C++. This
/// is neither the semantic nor lexical context for such declarations, but is
/// used to check for conflicts with other extern "C" declarations. Example:
///
@@ -240,10 +240,13 @@ public:
}
};
-/// NamedDecl - This represents a decl with a name. Many decls have names such
+/// This represents a decl that may have a name. Many decls have names such
/// as ObjCMethodDecl, but not \@class, etc.
+///
+/// Note that not every NamedDecl is actually named (e.g., a struct might
+/// be anonymous), and not every name is an identifier.
class NamedDecl : public Decl {
- /// Name - The name of this declaration, which is typically a normal
+ /// The name of this declaration, which is typically a normal
/// identifier but may also be a special kind of name (C++
/// constructor, Objective-C selector, etc.)
DeclarationName Name;
@@ -258,13 +261,15 @@ protected:
: Decl(DK, DC, L), Name(N) {}
public:
- /// getIdentifier - Get the identifier that names this declaration,
- /// if there is one. This will return NULL if this declaration has
- /// no name (e.g., for an unnamed class) or if the name is a special
- /// name (C++ constructor, Objective-C selector, etc.).
+ /// Get the identifier that names this declaration, if there is one.
+ ///
+ /// This will return NULL if this declaration has no name (e.g., for
+ /// an unnamed class) or if the name is a special name (C++ constructor,
+ /// Objective-C selector, etc.).
IdentifierInfo *getIdentifier() const { return Name.getAsIdentifierInfo(); }
- /// getName - Get the name of identifier for this declaration as a StringRef.
+ /// Get the name of identifier for this declaration as a StringRef.
+ ///
/// This requires that the declaration have a name and that it be a simple
/// identifier.
StringRef getName() const {
@@ -272,11 +277,12 @@ public:
return getIdentifier() ? getIdentifier()->getName() : "";
}
- /// getNameAsString - Get a human-readable name for the declaration, even if
- /// it is one of the special kinds of names (C++ constructor, Objective-C
- /// selector, etc). Creating this name requires expensive string
- /// manipulation, so it should be called only when performance doesn't matter.
- /// For simple declarations, getNameAsCString() should suffice.
+ /// Get a human-readable name for the declaration, even if it is one of the
+ /// special kinds of names (C++ constructor, Objective-C selector, etc).
+ ///
+ /// Creating this name requires expensive string manipulation, so it should
+ /// be called only when performance doesn't matter. For simple declarations,
+ /// getNameAsCString() should suffice.
//
// FIXME: This function should be renamed to indicate that it is not just an
// alternate form of getName(), and clients should move as appropriate.
@@ -286,17 +292,19 @@ public:
virtual void printName(raw_ostream &os) const;
- /// getDeclName - Get the actual, stored name of the declaration,
- /// which may be a special name.
+ /// Get the actual, stored name of the declaration, which may be a special
+ /// name.
DeclarationName getDeclName() const { return Name; }
- /// \brief Set the name of this declaration.
+ /// Set the name of this declaration.
void setDeclName(DeclarationName N) { Name = N; }
- /// printQualifiedName - Returns human-readable qualified name for
- /// declaration, like A::B::i, for i being member of namespace A::B.
- /// If declaration is not member of context which can be named (record,
- /// namespace), it will return same result as printName().
+ /// Returns a human-readable qualified name for this declaration, like
+ /// A::B::i, for i being member of namespace A::B.
+ ///
+ /// If the declaration is not a member of context which can be named (record,
+ /// namespace), it will return the same result as printName().
+ ///
/// Creating this name is expensive, so it should be called only when
/// performance doesn't matter.
void printQualifiedName(raw_ostream &OS) const;
@@ -315,25 +323,25 @@ public:
const PrintingPolicy &Policy,
bool Qualified) const;
- /// \brief Determine whether this declaration, if
- /// known to be well-formed within its context, will replace the
- /// declaration OldD if introduced into scope. A declaration will
- /// replace another declaration if, for example, it is a
- /// redeclaration of the same variable or function, but not if it is
- /// a declaration of a different kind (function vs. class) or an
- /// overloaded function.
+ /// Determine whether this declaration, if known to be well-formed within
+ /// its context, will replace the declaration OldD if introduced into scope.
+ ///
+ /// A declaration will replace another declaration if, for example, it is
+ /// a redeclaration of the same variable or function, but not if it is a
+ /// declaration of a different kind (function vs. class) or an overloaded
+ /// function.
///
/// \param IsKnownNewer \c true if this declaration is known to be newer
/// than \p OldD (for instance, if this declaration is newly-created).
bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer = true) const;
- /// \brief Determine whether this declaration has linkage.
+ /// Determine whether this declaration has linkage.
bool hasLinkage() const;
using Decl::isModulePrivate;
using Decl::setModulePrivate;
- /// \brief Determine whether this declaration is a C++ class member.
+ /// Determine whether this declaration is a C++ class member.
bool isCXXClassMember() const {
const DeclContext *DC = getDeclContext();
@@ -346,23 +354,24 @@ public:
return DC->isRecord();
}
- /// \brief Determine whether the given declaration is an instance member of
+ /// Determine whether the given declaration is an instance member of
/// a C++ class.
bool isCXXInstanceMember() const;
- /// \brief Determine what kind of linkage this entity has.
+ /// Determine what kind of linkage this entity has.
+ ///
/// This is not the linkage as defined by the standard or the codegen notion
/// of linkage. It is just an implementation detail that is used to compute
/// those.
Linkage getLinkageInternal() const;
- /// \brief Get the linkage from a semantic point of view. Entities in
+ /// Get the linkage from a semantic point of view. Entities in
/// anonymous namespaces are external (in c++98).
Linkage getFormalLinkage() const {
return clang::getFormalLinkage(getLinkageInternal());
}
- /// \brief True if this decl has external linkage.
+ /// True if this decl has external linkage.
bool hasExternalFormalLinkage() const {
return isExternalFormalLinkage(getLinkageInternal());
}
@@ -377,12 +386,12 @@ public:
return isExternallyVisible() && !getOwningModuleForLinkage();
}
- /// \brief Determines the visibility of this entity.
+ /// Determines the visibility of this entity.
Visibility getVisibility() const {
return getLinkageAndVisibility().getVisibility();
}
- /// \brief Determines the linkage and visibility of this entity.
+ /// Determines the linkage and visibility of this entity.
LinkageInfo getLinkageAndVisibility() const;
/// Kinds of explicit visibility.
@@ -398,16 +407,16 @@ public:
VisibilityForValue
};
- /// \brief If visibility was explicitly specified for this
+ /// If visibility was explicitly specified for this
/// declaration, return that visibility.
Optional<Visibility>
getExplicitVisibility(ExplicitVisibilityKind kind) const;
- /// \brief True if the computed linkage is valid. Used for consistency
+ /// True if the computed linkage is valid. Used for consistency
/// checking. Should always return true.
bool isLinkageValid() const;
- /// \brief True if something has required us to compute the linkage
+ /// True if something has required us to compute the linkage
/// of this declaration.
///
/// Language features which can retroactively change linkage (like a
@@ -417,7 +426,7 @@ public:
return hasCachedLinkage();
}
- /// \brief Looks through UsingDecls and ObjCCompatibleAliasDecls for
+ /// Looks through UsingDecls and ObjCCompatibleAliasDecls for
/// the underlying named decl.
NamedDecl *getUnderlyingDecl() {
// Fast-path the common case.
@@ -451,7 +460,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const NamedDecl &ND) {
return OS;
}
-/// LabelDecl - Represents the declaration of a label. Labels also have a
+/// Represents the declaration of a label. Labels also have a
/// corresponding LabelStmt, which indicates the position that the label was
/// defined at. For normal labels, the location of the decl is the same as the
/// location of the statement. For GNU local labels (__label__), the decl
@@ -461,7 +470,7 @@ class LabelDecl : public NamedDecl {
StringRef MSAsmName;
bool MSAsmNameResolved = false;
- /// LocStart - For normal labels, this is the same as the main declaration
+ /// For normal labels, this is the same as the main declaration
/// label, i.e., the location of the identifier; for GNU local labels,
/// this is the location of the __label__ keyword.
SourceLocation LocStart;
@@ -501,18 +510,18 @@ public:
static bool classofKind(Kind K) { return K == Label; }
};
-/// NamespaceDecl - Represent a C++ namespace.
+/// Represent a C++ namespace.
class NamespaceDecl : public NamedDecl, public DeclContext,
public Redeclarable<NamespaceDecl>
{
- /// LocStart - The starting location of the source range, pointing
+ /// The starting location of the source range, pointing
/// to either the namespace or the inline keyword.
SourceLocation LocStart;
- /// RBraceLoc - The ending location of the source range.
+ /// The ending location of the source range.
SourceLocation RBraceLoc;
- /// \brief A pointer to either the anonymous namespace that lives just inside
+ /// A pointer to either the anonymous namespace that lives just inside
/// this namespace or to the first namespace in the chain (the latter case
/// only when this is not the first in the chain), along with a
/// boolean value indicating whether this is an inline namespace.
@@ -549,7 +558,7 @@ public:
using redeclarable_base::getMostRecentDecl;
using redeclarable_base::isFirstDecl;
- /// \brief Returns true if this is an anonymous namespace declaration.
+ /// Returns true if this is an anonymous namespace declaration.
///
/// For example:
/// \code
@@ -562,28 +571,28 @@ public:
return !getIdentifier();
}
- /// \brief Returns true if this is an inline namespace declaration.
+ /// Returns true if this is an inline namespace declaration.
bool isInline() const {
return AnonOrFirstNamespaceAndInline.getInt();
}
- /// \brief Set whether this is an inline namespace declaration.
+ /// Set whether this is an inline namespace declaration.
void setInline(bool Inline) {
AnonOrFirstNamespaceAndInline.setInt(Inline);
}
- /// \brief Get the original (first) namespace declaration.
+ /// Get the original (first) namespace declaration.
NamespaceDecl *getOriginalNamespace();
- /// \brief Get the original (first) namespace declaration.
+ /// Get the original (first) namespace declaration.
const NamespaceDecl *getOriginalNamespace() const;
- /// \brief Return true if this declaration is an original (first) declaration
+ /// Return true if this declaration is an original (first) declaration
/// of the namespace. This is false for non-original (subsequent) namespace
/// declarations and anonymous namespaces.
bool isOriginalNamespace() const;
- /// \brief Retrieve the anonymous namespace nested inside this namespace,
+ /// Retrieve the anonymous namespace nested inside this namespace,
/// if any.
NamespaceDecl *getAnonymousNamespace() const {
return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
@@ -621,7 +630,7 @@ public:
}
};
-/// ValueDecl - Represent the declaration of a variable (in which case it is
+/// Represent the declaration of a variable (in which case it is
/// an lvalue) a function (in which case it is a function designator) or
/// an enum constant.
class ValueDecl : public NamedDecl {
@@ -638,7 +647,7 @@ public:
QualType getType() const { return DeclType; }
void setType(QualType newType) { DeclType = newType; }
- /// \brief Determine whether this symbol is weakly-imported,
+ /// Determine whether this symbol is weakly-imported,
/// or declared with the weak or weak-ref attr.
bool isWeak() const;
@@ -647,18 +656,18 @@ public:
static bool classofKind(Kind K) { return K >= firstValue && K <= lastValue; }
};
-/// QualifierInfo - A struct with extended info about a syntactic
+/// A struct with extended info about a syntactic
/// name qualifier, to be used for the case of out-of-line declarations.
struct QualifierInfo {
NestedNameSpecifierLoc QualifierLoc;
- /// NumTemplParamLists - The number of "outer" template parameter lists.
+ /// The number of "outer" template parameter lists.
/// The count includes all of the template parameter lists that were matched
/// against the template-ids occurring into the NNS and possibly (in the
/// case of an explicit specialization) a final "template <>".
unsigned NumTemplParamLists = 0;
- /// TemplParamLists - A new-allocated array of size NumTemplParamLists,
+ /// A new-allocated array of size NumTemplParamLists,
/// containing pointers to the "outer" template parameter lists.
/// It includes all of the template parameter lists that were matched
/// against the template-ids occurring into the NNS and possibly (in the
@@ -669,13 +678,12 @@ struct QualifierInfo {
QualifierInfo(const QualifierInfo &) = delete;
QualifierInfo& operator=(const QualifierInfo &) = delete;
- /// setTemplateParameterListsInfo - Sets info about "outer" template
- /// parameter lists.
+ /// Sets info about "outer" template parameter lists.
void setTemplateParameterListsInfo(ASTContext &Context,
ArrayRef<TemplateParameterList *> TPLists);
};
-/// \brief Represents a ValueDecl that came out of a declarator.
+/// Represents a ValueDecl that came out of a declarator.
/// Contains type source information through TypeSourceInfo.
class DeclaratorDecl : public ValueDecl {
// A struct representing both a TInfo and a syntactic qualifier,
@@ -686,7 +694,7 @@ class DeclaratorDecl : public ValueDecl {
llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
- /// InnerLocStart - The start of the source range for this declaration,
+ /// The start of the source range for this declaration,
/// ignoring outer template declarations.
SourceLocation InnerLocStart;
@@ -717,13 +725,12 @@ public:
DeclInfo = TI;
}
- /// getInnerLocStart - Return SourceLocation representing start of source
- /// range ignoring outer template declarations.
+ /// Return start of source range ignoring outer template declarations.
SourceLocation getInnerLocStart() const { return InnerLocStart; }
void setInnerLocStart(SourceLocation L) { InnerLocStart = L; }
- /// getOuterLocStart - Return SourceLocation representing start of source
- /// range taking into account any outer template declarations.
+ /// Return start of source range taking into account any outer template
+ /// declarations.
SourceLocation getOuterLocStart() const;
SourceRange getSourceRange() const override LLVM_READONLY;
@@ -732,14 +739,14 @@ public:
return getOuterLocStart();
}
- /// \brief Retrieve the nested-name-specifier that qualifies the name of this
+ /// Retrieve the nested-name-specifier that qualifies the name of this
/// declaration, if it was present in the source.
NestedNameSpecifier *getQualifier() const {
return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
: nullptr;
}
- /// \brief Retrieve the nested-name-specifier (with source-location
+ /// Retrieve the nested-name-specifier (with source-location
/// information) that qualifies the name of this declaration, if it was
/// present in the source.
NestedNameSpecifierLoc getQualifierLoc() const {
@@ -770,25 +777,25 @@ public:
}
};
-/// \brief Structure used to store a statement, the constant value to
+/// Structure used to store a statement, the constant value to
/// which it was evaluated (if any), and whether or not the statement
/// is an integral constant expression (if known).
struct EvaluatedStmt {
- /// \brief Whether this statement was already evaluated.
+ /// Whether this statement was already evaluated.
bool WasEvaluated : 1;
- /// \brief Whether this statement is being evaluated.
+ /// Whether this statement is being evaluated.
bool IsEvaluating : 1;
- /// \brief Whether we already checked whether this statement was an
+ /// Whether we already checked whether this statement was an
/// integral constant expression.
bool CheckedICE : 1;
- /// \brief Whether we are checking whether this statement is an
+ /// Whether we are checking whether this statement is an
/// integral constant expression.
bool CheckingICE : 1;
- /// \brief Whether this statement is an integral constant expression,
+ /// 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;
@@ -801,11 +808,10 @@ struct EvaluatedStmt {
};
-/// VarDecl - An instance of this class is created to represent a variable
-/// declaration or definition.
+/// Represents a variable declaration or definition.
class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
public:
- /// \brief Initialization styles.
+ /// Initialization styles.
enum InitializationStyle {
/// C-style initialization with assignment
CInit,
@@ -817,7 +823,7 @@ public:
ListInit
};
- /// \brief Kinds of thread-local storage.
+ /// Kinds of thread-local storage.
enum TLSKind {
/// Not a TLS variable.
TLS_None,
@@ -829,8 +835,7 @@ public:
TLS_Dynamic
};
- /// getStorageClassSpecifierString - Return the string used to
- /// specify the storage class \p SC.
+ /// Return the string used to specify the storage class \p SC.
///
/// It is illegal to call this function with SC == None.
static const char *getStorageClassSpecifierString(StorageClass SC);
@@ -845,7 +850,7 @@ protected:
// allocated in trailing space when necessary.
using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
- /// \brief The initializer for this variable or, for a ParmVarDecl, the
+ /// The initializer for this variable or, for a ParmVarDecl, the
/// C++ default argument.
mutable InitType Init;
@@ -915,41 +920,44 @@ protected:
unsigned : NumVarDeclBits;
// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
- /// \brief Whether this variable is a definition which was demoted due to
+ /// Whether this variable is a definition which was demoted due to
/// module merge.
unsigned IsThisDeclarationADemotedDefinition : 1;
- /// \brief Whether this variable is the exception variable in a C++ catch
+ /// Whether this variable is the exception variable in a C++ catch
/// or an Objective-C @catch statement.
unsigned ExceptionVar : 1;
- /// \brief Whether this local variable could be allocated in the return
+ /// Whether this local variable could be allocated in the return
/// slot of its function, enabling the named return value optimization
/// (NRVO).
unsigned NRVOVariable : 1;
- /// \brief Whether this variable is the for-range-declaration in a C++0x
+ /// Whether this variable is the for-range-declaration in a C++0x
/// for-range statement.
unsigned CXXForRangeDecl : 1;
- /// \brief Whether this variable is an ARC pseudo-__strong
+ /// Whether this variable is the for-in loop declaration in Objective-C.
+ unsigned ObjCForDecl : 1;
+
+ /// Whether this variable is an ARC pseudo-__strong
/// variable; see isARCPseudoStrong() for details.
unsigned ARCPseudoStrong : 1;
- /// \brief Whether this variable is (C++1z) inline.
+ /// Whether this variable is (C++1z) inline.
unsigned IsInline : 1;
- /// \brief Whether this variable has (C++1z) inline explicitly specified.
+ /// Whether this variable has (C++1z) inline explicitly specified.
unsigned IsInlineSpecified : 1;
- /// \brief Whether this variable is (C++0x) constexpr.
+ /// Whether this variable is (C++0x) constexpr.
unsigned IsConstexpr : 1;
- /// \brief Whether this variable is the implicit variable for a lambda
+ /// Whether this variable is the implicit variable for a lambda
/// init-capture.
unsigned IsInitCapture : 1;
- /// \brief Whether this local extern variable's previous declaration was
+ /// Whether this local extern variable's previous declaration was
/// declared in the same block scope. This controls whether we should merge
/// the type of this declaration with its previous declaration.
unsigned PreviousDeclInSameBlockScope : 1;
@@ -1004,7 +1012,7 @@ public:
SourceRange getSourceRange() const override LLVM_READONLY;
- /// \brief Returns the storage class as written in the source. For the
+ /// Returns the storage class as written in the source. For the
/// computed linkage of symbol, see getLinkage.
StorageClass getStorageClass() const {
return (StorageClass) VarDeclBits.SClass;
@@ -1020,8 +1028,8 @@ public:
}
TLSKind getTLSKind() const;
- /// hasLocalStorage - Returns true if a variable with function scope
- /// is a non-static local variable.
+ /// Returns true if a variable with function scope is a non-static local
+ /// variable.
bool hasLocalStorage() const {
if (getStorageClass() == SC_None) {
// OpenCL v1.2 s6.5.3: The __constant or constant address space name is
@@ -1044,8 +1052,8 @@ public:
return getStorageClass() >= SC_Auto;
}
- /// isStaticLocal - Returns true if a variable with function scope is a
- /// static local variable.
+ /// Returns true if a variable with function scope is a static local
+ /// variable.
bool isStaticLocal() const {
return (getStorageClass() == SC_Static ||
// C++11 [dcl.stc]p4
@@ -1053,43 +1061,42 @@ public:
&& !isFileVarDecl();
}
- /// \brief Returns true if a variable has extern or __private_extern__
+ /// Returns true if a variable has extern or __private_extern__
/// storage.
bool hasExternalStorage() const {
return getStorageClass() == SC_Extern ||
getStorageClass() == SC_PrivateExtern;
}
- /// \brief Returns true for all variables that do not have local storage.
+ /// Returns true for all variables that do not have local storage.
///
/// This includes all global variables as well as static variables declared
/// within a function.
bool hasGlobalStorage() const { return !hasLocalStorage(); }
- /// \brief Get the storage duration of this variable, per C++ [basic.stc].
+ /// Get the storage duration of this variable, per C++ [basic.stc].
StorageDuration getStorageDuration() const {
return hasLocalStorage() ? SD_Automatic :
getTSCSpec() ? SD_Thread : SD_Static;
}
- /// \brief Compute the language linkage.
+ /// Compute the language linkage.
LanguageLinkage getLanguageLinkage() const;
- /// \brief Determines whether this variable is a variable with
- /// external, C linkage.
+ /// Determines whether this variable is a variable with external, C linkage.
bool isExternC() const;
- /// \brief Determines whether this variable's context is, or is nested within,
+ /// Determines whether this variable's context is, or is nested within,
/// a C++ extern "C" linkage spec.
bool isInExternCContext() const;
- /// \brief Determines whether this variable's context is, or is nested within,
+ /// Determines whether this variable's context is, or is nested within,
/// a C++ extern "C++" linkage spec.
bool isInExternCXXContext() const;
- /// isLocalVarDecl - Returns true for local variable declarations
- /// other than parameters. Note that this includes static variables
- /// inside of functions. It also includes variables inside blocks.
+ /// Returns true for local variable declarations other than parameters.
+ /// Note that this includes static variables inside of functions. It also
+ /// includes variables inside blocks.
///
/// void foo() { int x; static int y; extern int z; }
bool isLocalVarDecl() const {
@@ -1100,13 +1107,12 @@ public:
return false;
}
- /// \brief Similar to isLocalVarDecl but also includes parameters.
+ /// Similar to isLocalVarDecl but also includes parameters.
bool isLocalVarDeclOrParm() const {
return isLocalVarDecl() || getKind() == Decl::ParmVar;
}
- /// isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but
- /// excludes variables declared in blocks.
+ /// Similar to isLocalVarDecl, but excludes variables declared in blocks.
bool isFunctionOrMethodVarDecl() const {
if (getKind() != Decl::Var && getKind() != Decl::Decomposition)
return false;
@@ -1114,7 +1120,7 @@ public:
return DC->isFunctionOrMethod() && DC->getDeclKind() != Decl::Block;
}
- /// \brief Determines whether this is a static data member.
+ /// Determines whether this is a static data member.
///
/// This will only be true in C++, and applies to, e.g., the
/// variable 'x' in:
@@ -1144,7 +1150,7 @@ public:
Definition
};
- /// \brief Check whether this declaration is a definition. If this could be
+ /// Check whether this declaration is a definition. If this could be
/// a tentative definition (in C), don't check whether there's an overriding
/// definition.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const;
@@ -1152,21 +1158,20 @@ public:
return isThisDeclarationADefinition(getASTContext());
}
- /// \brief Check whether this variable is defined in this
- /// translation unit.
+ /// Check whether this variable is defined in this translation unit.
DefinitionKind hasDefinition(ASTContext &) const;
DefinitionKind hasDefinition() const {
return hasDefinition(getASTContext());
}
- /// \brief Get the tentative definition that acts as the real definition in
- /// a TU. Returns null if there is a proper definition available.
+ /// Get the tentative definition that acts as the real definition in a TU.
+ /// Returns null if there is a proper definition available.
VarDecl *getActingDefinition();
const VarDecl *getActingDefinition() const {
return const_cast<VarDecl*>(this)->getActingDefinition();
}
- /// \brief Get the real (not just tentative) definition for this declaration.
+ /// Get the real (not just tentative) definition for this declaration.
VarDecl *getDefinition(ASTContext &);
const VarDecl *getDefinition(ASTContext &C) const {
return const_cast<VarDecl*>(this)->getDefinition(C);
@@ -1178,11 +1183,11 @@ public:
return const_cast<VarDecl*>(this)->getDefinition();
}
- /// \brief Determine whether this is or was instantiated from an out-of-line
+ /// Determine whether this is or was instantiated from an out-of-line
/// definition of a static data member.
bool isOutOfLine() const override;
- /// isFileVarDecl - Returns true for file scoped variable declaration.
+ /// Returns true for file scoped variable declaration.
bool isFileVarDecl() const {
Kind K = getKind();
if (K == ParmVar || K == ImplicitParam)
@@ -1197,14 +1202,14 @@ public:
return false;
}
- /// getAnyInitializer - Get the initializer for this variable, no matter which
+ /// Get the initializer for this variable, no matter which
/// declaration it is attached to.
const Expr *getAnyInitializer() const {
const VarDecl *D;
return getAnyInitializer(D);
}
- /// getAnyInitializer - Get the initializer for this variable, no matter which
+ /// Get the initializer for this variable, no matter which
/// declaration it is attached to. Also get that declaration.
const Expr *getAnyInitializer(const VarDecl *&D) const;
@@ -1214,12 +1219,12 @@ public:
}
Expr *getInit();
- /// \brief Retrieve the address of the initializer expression.
+ /// Retrieve the address of the initializer expression.
Stmt **getInitAddress();
void setInit(Expr *I);
- /// \brief Determine whether this variable's value can be used in a
+ /// Determine whether this variable's value can be used in a
/// 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.
@@ -1227,30 +1232,30 @@ public:
EvaluatedStmt *ensureEvaluatedStmt() const;
- /// \brief Attempt to evaluate the value of the initializer attached to this
+ /// 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.
APValue *evaluateValue() const;
APValue *evaluateValue(SmallVectorImpl<PartialDiagnosticAt> &Notes) const;
- /// \brief Return the already-evaluated value of this variable's
+ /// 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.
APValue *getEvaluatedValue() const;
- /// \brief Determines whether it is already known whether the
+ /// Determines whether it is already known whether the
/// initializer is an integral constant expression or not.
bool isInitKnownICE() const;
- /// \brief Determines whether the initializer is an integral constant
+ /// Determines whether the initializer is an integral constant
/// expression, or in C++11, whether the initializer is a constant
/// expression.
///
/// \pre isInitKnownICE()
bool isInitICE() const;
- /// \brief Determine whether the value of the initializer attached to this
+ /// Determine whether the value of the initializer attached to this
/// declaration is an integral constant expression.
bool checkInitIsICE() const;
@@ -1258,7 +1263,7 @@ public:
VarDeclBits.InitStyle = Style;
}
- /// \brief The style of initialization for this declaration.
+ /// The style of initialization for this declaration.
///
/// C-style initialization is "int x = 1;". Call-style initialization is
/// a C++98 direct-initializer, e.g. "int x(1);". The Init expression will be
@@ -1272,18 +1277,18 @@ public:
return static_cast<InitializationStyle>(VarDeclBits.InitStyle);
}
- /// \brief Whether the initializer is a direct-initializer (list or call).
+ /// Whether the initializer is a direct-initializer (list or call).
bool isDirectInit() const {
return getInitStyle() != CInit;
}
- /// \brief If this definition should pretend to be a declaration.
+ /// If this definition should pretend to be a declaration.
bool isThisDeclarationADemotedDefinition() const {
return isa<ParmVarDecl>(this) ? false :
NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
}
- /// \brief This is a definition which should be demoted to a declaration.
+ /// This is a definition which should be demoted to a declaration.
///
/// In some cases (mostly module merging) we can end up with two visible
/// definitions one of which needs to be demoted to a declaration to keep
@@ -1294,7 +1299,7 @@ public:
NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
}
- /// \brief Determine whether this variable is the exception variable in a
+ /// Determine whether this variable is the exception variable in a
/// C++ catch statememt or an Objective-C \@catch statement.
bool isExceptionVariable() const {
return isa<ParmVarDecl>(this) ? false : NonParmVarDeclBits.ExceptionVar;
@@ -1304,7 +1309,7 @@ public:
NonParmVarDeclBits.ExceptionVar = EV;
}
- /// \brief Determine whether this local variable can be used with the named
+ /// Determine whether this local variable can be used with the named
/// return value optimization (NRVO).
///
/// The named return value optimization (NRVO) works by marking certain
@@ -1322,7 +1327,7 @@ public:
NonParmVarDeclBits.NRVOVariable = NRVO;
}
- /// \brief Determine whether this variable is the for-range-declaration in
+ /// Determine whether this variable is the for-range-declaration in
/// a C++0x for-range statement.
bool isCXXForRangeDecl() const {
return isa<ParmVarDecl>(this) ? false : NonParmVarDeclBits.CXXForRangeDecl;
@@ -1332,7 +1337,17 @@ public:
NonParmVarDeclBits.CXXForRangeDecl = FRD;
}
- /// \brief Determine whether this variable is an ARC pseudo-__strong
+ /// Determine whether this variable is a for-loop declaration for a
+ /// for-in statement in Objective-C.
+ bool isObjCForDecl() const {
+ return NonParmVarDeclBits.ObjCForDecl;
+ }
+
+ void setObjCForDecl(bool FRD) {
+ NonParmVarDeclBits.ObjCForDecl = FRD;
+ }
+
+ /// Determine whether this variable is an ARC pseudo-__strong
/// variable. A pseudo-__strong variable has a __strong-qualified
/// type but does not actually retain the object written into it.
/// Generally such variables are also 'const' for safety.
@@ -1392,41 +1407,41 @@ public:
NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
}
- /// \brief Retrieve the variable declaration from which this variable could
+ /// Retrieve the variable declaration from which this variable could
/// be instantiated, if it is an instantiation (rather than a non-template).
VarDecl *getTemplateInstantiationPattern() const;
- /// \brief If this variable is an instantiated static data member of a
+ /// If this variable is an instantiated static data member of a
/// class template specialization, returns the templated static data member
/// from which it was instantiated.
VarDecl *getInstantiatedFromStaticDataMember() const;
- /// \brief If this variable is an instantiation of a variable template or a
+ /// If this variable is an instantiation of a variable template or a
/// static data member of a class template, determine what kind of
/// template specialization or instantiation this is.
TemplateSpecializationKind getTemplateSpecializationKind() const;
- /// \brief If this variable is an instantiation of a variable template or a
+ /// If this variable is an instantiation of a variable template or a
/// static data member of a class template, determine its point of
/// instantiation.
SourceLocation getPointOfInstantiation() const;
- /// \brief If this variable is an instantiation of a static data member of a
+ /// If this variable is an instantiation of a static data member of a
/// class template specialization, retrieves the member specialization
/// information.
MemberSpecializationInfo *getMemberSpecializationInfo() const;
- /// \brief For a static data member that was instantiated from a static
+ /// For a static data member that was instantiated from a static
/// data member of a class template, set the template specialiation kind.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
SourceLocation PointOfInstantiation = SourceLocation());
- /// \brief Specify that this variable is an instantiation of the
+ /// Specify that this variable is an instantiation of the
/// static data member VD.
void setInstantiationOfStaticDataMember(VarDecl *VD,
TemplateSpecializationKind TSK);
- /// \brief Retrieves the variable template that is described by this
+ /// Retrieves the variable template that is described by this
/// variable declaration.
///
/// Every variable template is represented as a VarTemplateDecl and a
@@ -1441,6 +1456,11 @@ public:
void setDescribedVarTemplate(VarTemplateDecl *Template);
+ // Is this variable known to have a definition somewhere in the complete
+ // program? This may be true even if the declaration has internal linkage and
+ // has no definition within this source file.
+ bool isKnownToBeDefined() const;
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) { return K >= firstVar && K <= lastVar; }
@@ -1509,7 +1529,7 @@ public:
static bool classofKind(Kind K) { return K == ImplicitParam; }
};
-/// ParmVarDecl - Represents a parameter to a function.
+/// Represents a parameter to a function.
class ParmVarDecl : public VarDecl {
public:
enum { MaxFunctionScopeDepth = 255 };
@@ -1598,7 +1618,7 @@ public:
void setDefaultArg(Expr *defarg);
- /// \brief Retrieve the source range that covers the entire default
+ /// Retrieve the source range that covers the entire default
/// argument.
SourceRange getDefaultArgRange() const;
void setUninstantiatedDefaultArg(Expr *arg);
@@ -1607,14 +1627,13 @@ public:
return const_cast<ParmVarDecl *>(this)->getUninstantiatedDefaultArg();
}
- /// hasDefaultArg - Determines whether this parameter has a default argument,
+ /// Determines whether this parameter has a default argument,
/// either parsed or not.
bool hasDefaultArg() const;
- /// hasUnparsedDefaultArg - Determines whether this parameter has a
- /// default argument that has not yet been parsed. This will occur
- /// during the processing of a C++ class whose member functions have
- /// default arguments, e.g.,
+ /// Determines whether this parameter has a default argument that has not
+ /// yet been parsed. This will occur during the processing of a C++ class
+ /// whose member functions have default arguments, e.g.,
/// @code
/// class X {
/// public:
@@ -1629,11 +1648,10 @@ public:
return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
}
- /// setUnparsedDefaultArg - Specify that this parameter has an
- /// unparsed default argument. The argument will be replaced with a
- /// real default argument via setDefaultArg when the class
- /// definition enclosing the function declaration that owns this
- /// default argument is completed.
+ /// Specify that this parameter has an unparsed default argument.
+ /// The argument will be replaced with a real default argument via
+ /// setDefaultArg when the class definition enclosing the function
+ /// declaration that owns this default argument is completed.
void setUnparsedDefaultArg() {
ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
}
@@ -1648,11 +1666,11 @@ public:
QualType getOriginalType() const;
- /// \brief Determine whether this parameter is actually a function
+ /// Determine whether this parameter is actually a function
/// parameter pack.
bool isParameterPack() const;
- /// setOwningFunction - Sets the function declaration that owns this
+ /// Sets the function declaration that owns this
/// ParmVarDecl. Since ParmVarDecls are often created before the
/// FunctionDecls that own them, this routine is required to update
/// the DeclContext appropriately.
@@ -1683,8 +1701,7 @@ private:
unsigned getParameterIndexLarge() const;
};
-/// An instance of this class is created to represent a function declaration or
-/// definition.
+/// Represents a function declaration or definition.
///
/// Since a given function can be declared several times in a program,
/// there may be several FunctionDecls that correspond to that
@@ -1697,7 +1714,7 @@ private:
class FunctionDecl : public DeclaratorDecl, public DeclContext,
public Redeclarable<FunctionDecl> {
public:
- /// \brief The kind of templated function a FunctionDecl can be.
+ /// The kind of templated function a FunctionDecl can be.
enum TemplatedKind {
TK_NonTemplate,
TK_FunctionTemplate,
@@ -1707,7 +1724,7 @@ public:
};
private:
- /// ParamInfo - new[]'d array of pointers to VarDecls for the formal
+ /// A new[]'d array of pointers to VarDecls for the formal
/// parameters of this function. This is null if a prototype or if there are
/// no formals.
ParmVarDecl **ParamInfo = nullptr;
@@ -1732,6 +1749,12 @@ private:
unsigned HasWrittenPrototype : 1;
unsigned IsDeleted : 1;
unsigned IsTrivial : 1; // sunk from CXXMethodDecl
+
+ /// This flag indicates whether this function is trivial for the purpose of
+ /// calls. This is meaningful only when this function is a copy/move
+ /// constructor or a destructor.
+ unsigned IsTrivialForCall : 1;
+
unsigned IsDefaulted : 1; // sunk from CXXMethoDecl
unsigned IsExplicitlyDefaulted : 1; //sunk from CXXMethodDecl
unsigned HasImplicitReturnZero : 1;
@@ -1739,10 +1762,10 @@ private:
unsigned IsConstexpr : 1;
unsigned InstantiationIsPending : 1;
- /// \brief Indicates if the function uses __try.
+ /// Indicates if the function uses __try.
unsigned UsesSEHTry : 1;
- /// \brief Indicates if the function was a definition but its body was
+ /// Indicates if the function was a definition but its body was
/// skipped.
unsigned HasSkippedBody : 1;
@@ -1750,6 +1773,10 @@ private:
/// parsing it.
unsigned WillHaveBody : 1;
+ /// Indicates that this function is a multiversioned function using attribute
+ /// 'target'.
+ unsigned IsMultiVersion : 1;
+
protected:
/// [C++17] Only used by CXXDeductionGuideDecl. Declared here to avoid
/// increasing the size of CXXDeductionGuideDecl by the size of an unsigned
@@ -1764,7 +1791,7 @@ private:
unsigned HasODRHash : 1;
unsigned ODRHash;
- /// \brief End part of this FunctionDecl's source range.
+ /// End part of this FunctionDecl's source range.
///
/// We could compute the full range in getSourceRange(). However, when we're
/// dealing with a function definition deserialized from a PCH/AST file,
@@ -1773,7 +1800,7 @@ private:
/// EndRangeLoc.
SourceLocation EndRangeLoc;
- /// \brief The template or declaration that this declaration
+ /// The template or declaration that this declaration
/// describes or was instantiated from, respectively.
///
/// For non-templates, this value will be NULL. For function
@@ -1795,7 +1822,7 @@ private:
/// the DeclaratorDecl base class.
DeclarationNameLoc DNLoc;
- /// \brief Specify that this function declaration is actually a function
+ /// Specify that this function declaration is actually a function
/// template specialization.
///
/// \param C the ASTContext.
@@ -1824,7 +1851,7 @@ private:
const TemplateArgumentListInfo *TemplateArgsAsWritten,
SourceLocation PointOfInstantiation);
- /// \brief Specify that this record is an instantiation of the
+ /// Specify that this record is an instantiation of the
/// member function FD.
void setInstantiationOfMemberFunction(ASTContext &C, FunctionDecl *FD,
TemplateSpecializationKind TSK);
@@ -1842,13 +1869,14 @@ protected:
IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
IsExplicitSpecified(false), IsVirtualAsWritten(false), IsPure(false),
HasInheritedPrototype(false), HasWrittenPrototype(true),
- IsDeleted(false), IsTrivial(false), IsDefaulted(false),
+ IsDeleted(false), IsTrivial(false), IsTrivialForCall(false),
+ IsDefaulted(false),
IsExplicitlyDefaulted(false), HasImplicitReturnZero(false),
IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified),
InstantiationIsPending(false), UsesSEHTry(false), HasSkippedBody(false),
- WillHaveBody(false), IsCopyDeductionCandidate(false), HasODRHash(false),
- ODRHash(0), EndRangeLoc(NameInfo.getEndLoc()),
- DNLoc(NameInfo.getInfo()) {}
+ WillHaveBody(false), IsMultiVersion(false),
+ IsCopyDeductionCandidate(false), HasODRHash(false), ODRHash(0),
+ EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) {}
using redeclarable_base = Redeclarable<FunctionDecl>;
@@ -1915,11 +1943,25 @@ public:
SourceRange getSourceRange() const override LLVM_READONLY;
- /// \brief Returns true if the function has a body (definition). The
- /// function body might be in any of the (re-)declarations of this
- /// function. The variant that accepts a FunctionDecl pointer will
- /// set that function declaration to the actual declaration
- /// containing the body (if there is one).
+ // Function definitions.
+ //
+ // A function declaration may be:
+ // - a non defining declaration,
+ // - a definition. A function may be defined because:
+ // - it has a body, or will have it in the case of late parsing.
+ // - it has an uninstantiated body. The body does not exist because the
+ // function is not used yet, but the declaration is considered a
+ // definition and does not allow other definition of this function.
+ // - it does not have a user specified body, but it does not allow
+ // redefinition, because it is deleted/defaulted or is defined through
+ // some other mechanism (alias, ifunc).
+
+ /// Returns true if the function has a body.
+ ///
+ /// The function body might be in any of the (re-)declarations of this
+ /// function. The variant that accepts a FunctionDecl pointer will set that
+ /// function declaration to the actual declaration containing the body (if
+ /// there is one).
bool hasBody(const FunctionDecl *&Definition) const;
bool hasBody() const override {
@@ -1931,9 +1973,11 @@ public:
/// specific codegen.
bool hasTrivialBody() const;
- /// Returns true if the function is defined at all, including a deleted
- /// definition. Except for the behavior when the function is deleted, behaves
- /// like hasBody.
+ /// Returns true if the function has a definition that does not need to be
+ /// instantiated.
+ ///
+ /// 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;
virtual bool isDefined() const {
@@ -1941,7 +1985,7 @@ public:
return isDefined(Definition);
}
- /// \brief Get the definition for this declaration.
+ /// Get the definition for this declaration.
FunctionDecl *getDefinition() {
const FunctionDecl *Definition;
if (isDefined(Definition))
@@ -1975,8 +2019,7 @@ public:
IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
}
- /// Returns whether this specific declaration of the function has a body -
- /// that is, if it is a non-deleted definition.
+ /// Returns whether this specific declaration of the function has a body.
bool doesThisDeclarationHaveABody() const {
return Body || IsLateTemplateParsed;
}
@@ -2007,6 +2050,9 @@ public:
bool isTrivial() const { return IsTrivial; }
void setTrivial(bool IT) { IsTrivial = IT; }
+ bool isTrivialForCall() const { return IsTrivialForCall; }
+ void setTrivialForCall(bool IT) { IsTrivialForCall = IT; }
+
/// Whether this function is defaulted per C++0x. Only valid for
/// special member functions.
bool isDefaulted() const { return IsDefaulted; }
@@ -2023,7 +2069,7 @@ public:
bool hasImplicitReturnZero() const { return HasImplicitReturnZero; }
void setHasImplicitReturnZero(bool IRZ) { HasImplicitReturnZero = IRZ; }
- /// \brief Whether this function has a prototype, either because one
+ /// Whether this function has a prototype, either because one
/// was explicitly written or because it was "inherited" by merging
/// a declaration without a prototype with a declaration that has a
/// prototype.
@@ -2033,7 +2079,7 @@ public:
bool hasWrittenPrototype() const { return HasWrittenPrototype; }
- /// \brief Whether this function inherited its prototype from a
+ /// Whether this function inherited its prototype from a
/// previous declaration.
bool hasInheritedPrototype() const { return HasInheritedPrototype; }
void setHasInheritedPrototype(bool P = true) { HasInheritedPrototype = P; }
@@ -2042,7 +2088,7 @@ public:
bool isConstexpr() const { return IsConstexpr; }
void setConstexpr(bool IC) { IsConstexpr = IC; }
- /// \brief Whether the instantiation of this function is pending.
+ /// Whether the instantiation of this function is pending.
/// This bit is set when the decision to instantiate this function is made
/// and unset if and when the function body is created. That leaves out
/// cases where instantiation did not happen because the template definition
@@ -2051,11 +2097,11 @@ public:
bool instantiationIsPending() const { return InstantiationIsPending; }
void setInstantiationIsPending(bool IC) { InstantiationIsPending = IC; }
- /// \brief Indicates the function uses __try.
+ /// Indicates the function uses __try.
bool usesSEHTry() const { return UsesSEHTry; }
void setUsesSEHTry(bool UST) { UsesSEHTry = UST; }
- /// \brief Whether this function has been deleted.
+ /// Whether this function has been deleted.
///
/// A function that is "deleted" (via the C++0x "= delete" syntax)
/// acts like a normal function, except that it cannot actually be
@@ -2078,15 +2124,15 @@ public:
bool isDeletedAsWritten() const { return IsDeleted && !IsDefaulted; }
void setDeletedAsWritten(bool D = true) { IsDeleted = D; }
- /// \brief Determines whether this function is "main", which is the
+ /// Determines whether this function is "main", which is the
/// entry point into an executable program.
bool isMain() const;
- /// \brief Determines whether this function is a MSVCRT user defined entry
+ /// Determines whether this function is a MSVCRT user defined entry
/// point.
bool isMSVCRTEntryPoint() const;
- /// \brief Determines whether this operator new or delete is one
+ /// Determines whether this operator new or delete is one
/// of the reserved global placement operators:
/// void *operator new(size_t, void *);
/// void *operator new[](size_t, void *);
@@ -2101,7 +2147,7 @@ public:
/// This function must be an allocation or deallocation function.
bool isReservedGlobalPlacementOperator() const;
- /// \brief Determines whether this function is one of the replaceable
+ /// Determines whether this function is one of the replaceable
/// global allocation functions:
/// void *operator new(size_t);
/// void *operator new(size_t, const std::nothrow_t &) noexcept;
@@ -2121,32 +2167,32 @@ public:
/// true through IsAligned.
bool isReplaceableGlobalAllocationFunction(bool *IsAligned = nullptr) const;
- /// \brief Determine whether this is a destroying operator delete.
+ /// Determine whether this is a destroying operator delete.
bool isDestroyingOperatorDelete() const;
/// Compute the language linkage.
LanguageLinkage getLanguageLinkage() const;
- /// \brief Determines whether this function is a function with
+ /// Determines whether this function is a function with
/// external, C linkage.
bool isExternC() const;
- /// \brief Determines whether this function's context is, or is nested within,
+ /// Determines whether this function's context is, or is nested within,
/// a C++ extern "C" linkage spec.
bool isInExternCContext() const;
- /// \brief Determines whether this function's context is, or is nested within,
+ /// Determines whether this function's context is, or is nested within,
/// a C++ extern "C++" linkage spec.
bool isInExternCXXContext() const;
- /// \brief Determines whether this is a global function.
+ /// Determines whether this is a global function.
bool isGlobal() const;
- /// \brief Determines whether this function is known to be 'noreturn', through
+ /// Determines whether this function is known to be 'noreturn', through
/// an attribute on its declaration or its type.
bool isNoReturn() const;
- /// \brief True if the function was a definition but its body was skipped.
+ /// True if the function was a definition but its body was skipped.
bool hasSkippedBody() const { return HasSkippedBody; }
void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
@@ -2154,6 +2200,22 @@ public:
bool willHaveBody() const { return WillHaveBody; }
void setWillHaveBody(bool V = true) { WillHaveBody = V; }
+ /// True if this function is considered a multiversioned function.
+ bool isMultiVersion() const { return getCanonicalDecl()->IsMultiVersion; }
+
+ /// Sets the multiversion state for this declaration and all of its
+ /// redeclarations.
+ void setIsMultiVersion(bool V = true) {
+ getCanonicalDecl()->IsMultiVersion = V;
+ }
+
+ /// True if this function is a multiversioned dispatch function as a part of
+ /// the cpu_specific/cpu_dispatch functionality.
+ bool isCPUDispatchMultiVersion() const;
+ /// True if this function is a multiversioned processor specific function as a
+ /// part of the cpu_specific/cpu_dispatch functionality.
+ bool isCPUSpecificMultiVersion() const;
+
void setPreviousDeclaration(FunctionDecl * PrevDecl);
FunctionDecl *getCanonicalDecl() override;
@@ -2209,34 +2271,34 @@ public:
return getType()->getAs<FunctionType>()->getReturnType();
}
- /// \brief Attempt to compute an informative source range covering the
+ /// Attempt to compute an informative source range covering the
/// function return type. This may omit qualifiers and other information with
/// limited representation in the AST.
SourceRange getReturnTypeSourceRange() const;
- /// \brief Attempt to compute an informative source range covering the
+ /// Attempt to compute an informative source range covering the
/// function exception specification, if any.
SourceRange getExceptionSpecSourceRange() const;
- /// \brief Determine the type of an expression that calls this function.
+ /// Determine the type of an expression that calls this function.
QualType getCallResultType() const {
assert(getType()->getAs<FunctionType>() && "Expected a FunctionType!");
return getType()->getAs<FunctionType>()->getCallResultType(getASTContext());
}
- /// \brief Returns the WarnUnusedResultAttr that is either declared on this
+ /// Returns the WarnUnusedResultAttr that is either declared on this
/// function, or its return type declaration.
const Attr *getUnusedResultAttr() const;
- /// \brief Returns true if this function or its return type has the
+ /// Returns true if this function or its return type has the
/// warn_unused_result attribute.
bool hasUnusedResultAttr() const { return getUnusedResultAttr() != nullptr; }
- /// \brief Returns the storage class as written in the source. For the
+ /// Returns the storage class as written in the source. For the
/// computed linkage of symbol, see getLinkage.
StorageClass getStorageClass() const { return StorageClass(SClass); }
- /// \brief Determine whether the "inline" keyword was specified for this
+ /// Determine whether the "inline" keyword was specified for this
/// function.
bool isInlineSpecified() const { return IsInlineSpecified; }
@@ -2251,7 +2313,7 @@ public:
IsInline = true;
}
- /// \brief Determine whether this function should be inlined, because it is
+ /// Determine whether this function should be inlined, because it is
/// either marked "inline" or "constexpr" or is a member function of a class
/// that was defined in the class body.
bool isInlined() const { return IsInline; }
@@ -2262,8 +2324,8 @@ public:
bool doesDeclarationForceExternallyVisibleDefinition() const;
- /// isOverloadedOperator - Whether this function declaration
- /// represents an C++ overloaded operator, e.g., "operator+".
+ /// Whether this function declaration represents an C++ overloaded
+ /// operator, e.g., "operator+".
bool isOverloadedOperator() const {
return getOverloadedOperator() != OO_None;
}
@@ -2272,7 +2334,7 @@ public:
const IdentifierInfo *getLiteralIdentifier() const;
- /// \brief If this function is an instantiation of a member function
+ /// If this function is an instantiation of a member function
/// of a class template specialization, retrieves the function from
/// which it was instantiated.
///
@@ -2295,22 +2357,22 @@ public:
/// declaration returned by getInstantiatedFromMemberFunction().
FunctionDecl *getInstantiatedFromMemberFunction() const;
- /// \brief What kind of templated function this is.
+ /// What kind of templated function this is.
TemplatedKind getTemplatedKind() const;
- /// \brief If this function is an instantiation of a member function of a
+ /// If this function is an instantiation of a member function of a
/// class template specialization, retrieves the member specialization
/// information.
MemberSpecializationInfo *getMemberSpecializationInfo() const;
- /// \brief Specify that this record is an instantiation of the
+ /// Specify that this record is an instantiation of the
/// member function FD.
void setInstantiationOfMemberFunction(FunctionDecl *FD,
TemplateSpecializationKind TSK) {
setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
}
- /// \brief Retrieves the function template that is described by this
+ /// Retrieves the function template that is described by this
/// function declaration.
///
/// Every function template is represented as a FunctionTemplateDecl
@@ -2326,50 +2388,50 @@ public:
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
- /// \brief Determine whether this function is a function template
+ /// Determine whether this function is a function template
/// specialization.
bool isFunctionTemplateSpecialization() const {
return getPrimaryTemplate() != nullptr;
}
- /// \brief Retrieve the class scope template pattern that this function
+ /// Retrieve the class scope template pattern that this function
/// template specialization is instantiated from.
FunctionDecl *getClassScopeSpecializationPattern() const;
- /// \brief If this function is actually a function template specialization,
+ /// If this function is actually a function template specialization,
/// retrieve information about this function template specialization.
/// Otherwise, returns NULL.
FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo() const;
- /// \brief Determines whether this function is a function template
+ /// Determines whether this function is a function template
/// specialization or a member of a class template specialization that can
/// be implicitly instantiated.
bool isImplicitlyInstantiable() const;
- /// \brief Determines if the given function was instantiated from a
+ /// Determines if the given function was instantiated from a
/// function template.
bool isTemplateInstantiation() const;
- /// \brief Retrieve the function declaration from which this function could
+ /// Retrieve the function declaration from which this function could
/// be instantiated, if it is an instantiation (rather than a non-template
/// or a specialization, for example).
FunctionDecl *getTemplateInstantiationPattern() const;
- /// \brief Retrieve the primary template that this function template
+ /// Retrieve the primary template that this function template
/// specialization either specializes or was instantiated from.
///
/// If this function declaration is not a function template specialization,
/// returns NULL.
FunctionTemplateDecl *getPrimaryTemplate() const;
- /// \brief Retrieve the template arguments used to produce this function
+ /// Retrieve the template arguments used to produce this function
/// template specialization from the primary template.
///
/// If this function declaration is not a function template specialization,
/// returns NULL.
const TemplateArgumentList *getTemplateSpecializationArgs() const;
- /// \brief Retrieve the template argument list as written in the sources,
+ /// Retrieve the template argument list as written in the sources,
/// if any.
///
/// If this function declaration is not a function template specialization
@@ -2379,7 +2441,7 @@ public:
const ASTTemplateArgumentListInfo*
getTemplateSpecializationArgsAsWritten() const;
- /// \brief Specify that this function declaration is actually a function
+ /// Specify that this function declaration is actually a function
/// template specialization.
///
/// \param Template the function template that this function template
@@ -2409,7 +2471,7 @@ public:
PointOfInstantiation);
}
- /// \brief Specifies that this function declaration is actually a
+ /// Specifies that this function declaration is actually a
/// dependent function template specialization.
void setDependentTemplateSpecialization(ASTContext &Context,
const UnresolvedSetImpl &Templates,
@@ -2418,16 +2480,16 @@ public:
DependentFunctionTemplateSpecializationInfo *
getDependentSpecializationInfo() const;
- /// \brief Determine what kind of template instantiation this function
+ /// Determine what kind of template instantiation this function
/// represents.
TemplateSpecializationKind getTemplateSpecializationKind() const;
- /// \brief Determine what kind of template instantiation this function
+ /// Determine what kind of template instantiation this function
/// represents.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
SourceLocation PointOfInstantiation = SourceLocation());
- /// \brief Retrieve the (first) point of instantiation of a function template
+ /// Retrieve the (first) point of instantiation of a function template
/// specialization or a member of a class template specialization.
///
/// \returns the first point of instantiation, if this function was
@@ -2435,20 +2497,24 @@ public:
/// location.
SourceLocation getPointOfInstantiation() const;
- /// \brief Determine whether this is or was instantiated from an out-of-line
+ /// Determine whether this is or was instantiated from an out-of-line
/// definition of a member function.
bool isOutOfLine() const override;
- /// \brief Identify a memory copying or setting function.
+ /// Identify a memory copying or setting function.
/// If the given function is a memory copy or setting function, returns
/// the corresponding Builtin ID. If the function is not a memory function,
/// returns 0.
unsigned getMemoryFunctionKind() const;
- /// \brief Returns ODRHash of the function. This value is calculated and
+ /// Returns ODRHash of the function. This value is calculated and
/// stored on first call, then the stored value returned on the other calls.
unsigned getODRHash();
+ /// Returns cached ODRHash of the function. This must have been previously
+ /// computed and stored.
+ unsigned getODRHash() const;
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) {
@@ -2462,8 +2528,7 @@ public:
}
};
-/// FieldDecl - An instance of this class is created by Sema::ActOnField to
-/// represent a member of a struct/union/class.
+/// Represents a member of a struct/union/class.
class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
unsigned BitField : 1;
unsigned Mutable : 1;
@@ -2499,7 +2564,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
Expr *BitWidth;
};
- /// \brief Storage for either the bit-width, the in-class initializer, or
+ /// Storage for either the bit-width, the in-class initializer, or
/// both (via InitAndBitWidth), or the captured variable length array bound.
///
/// If the storage kind is ISK_InClassCopyInit or
@@ -2534,20 +2599,20 @@ public:
static FieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
- /// getFieldIndex - Returns the index of this field within its record,
+ /// Returns the index of this field within its record,
/// as appropriate for passing to ASTRecordLayout::getFieldOffset.
unsigned getFieldIndex() const;
- /// isMutable - Determines whether this field is mutable (C++ only).
+ /// Determines whether this field is mutable (C++ only).
bool isMutable() const { return Mutable; }
- /// \brief Determines whether this field is a bitfield.
+ /// Determines whether this field is a bitfield.
bool isBitField() const { return BitField; }
- /// @brief Determines whether this is an unnamed bitfield.
+ /// Determines whether this is an unnamed bitfield.
bool isUnnamedBitfield() const { return isBitField() && !getDeclName(); }
- /// isAnonymousStructOrUnion - Determines whether this field is a
+ /// Determines whether this field is a
/// representative for an anonymous struct or union. Such fields are
/// unnamed and are implicitly generated by the implementation to
/// store the data for the anonymous union or struct.
@@ -2564,7 +2629,7 @@ public:
unsigned getBitWidthValue(const ASTContext &Ctx) const;
- /// setBitWidth - Set the bit-field width for this member.
+ /// Set the bit-field width for this member.
// Note: used by some clients (i.e., do not remove it).
void setBitWidth(Expr *Width) {
assert(!hasCapturedVLAType() && !BitField &&
@@ -2578,7 +2643,7 @@ public:
BitField = true;
}
- /// removeBitWidth - Remove the bit-field width from this member.
+ /// Remove the bit-field width from this member.
// Note: used by some clients (i.e., do not remove it).
void removeBitWidth() {
assert(isBitField() && "no bitfield width to remove");
@@ -2586,6 +2651,11 @@ public:
BitField = false;
}
+ /// Is this a zero-length bit-field? Such bit-fields aren't really bit-fields
+ /// at all and instead act as a separator between contiguous runs of other
+ /// bit-fields.
+ bool isZeroLengthBitField(const ASTContext &Ctx) const;
+
/// Get the kind of (C++11) default member initializer that this field has.
InClassInitStyle getInClassInitStyle() const {
InitStorageKind storageKind = InitStorage.getInt();
@@ -2610,8 +2680,7 @@ public:
return static_cast<Expr*>(Ptr);
}
- /// setInClassInitializer - Set the C++11 in-class initializer for this
- /// member.
+ /// Set the C++11 in-class initializer for this member.
void setInClassInitializer(Expr *Init) {
assert(hasInClassInitializer() && !getInClassInitializer());
if (BitField)
@@ -2620,30 +2689,29 @@ public:
InitStorage.setPointer(Init);
}
- /// removeInClassInitializer - Remove the C++11 in-class initializer from this
- /// member.
+ /// Remove the C++11 in-class initializer from this member.
void removeInClassInitializer() {
assert(hasInClassInitializer() && "no initializer to remove");
InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
}
- /// \brief Determine whether this member captures the variable length array
+ /// Determine whether this member captures the variable length array
/// type.
bool hasCapturedVLAType() const {
return InitStorage.getInt() == ISK_CapturedVLAType;
}
- /// \brief Get the captured variable length array type.
+ /// Get the captured variable length array type.
const VariableArrayType *getCapturedVLAType() const {
return hasCapturedVLAType() ? static_cast<const VariableArrayType *>(
InitStorage.getPointer())
: nullptr;
}
- /// \brief Set the captured variable length array type for this field.
+ /// Set the captured variable length array type for this field.
void setCapturedVLAType(const VariableArrayType *VLAType);
- /// getParent - Returns the parent of this field declaration, which
+ /// Returns the parent of this field declaration, which
/// is the struct in which this field is defined.
const RecordDecl *getParent() const {
return cast<RecordDecl>(getDeclContext());
@@ -2664,7 +2732,7 @@ public:
static bool classofKind(Kind K) { return K >= firstField && K <= lastField; }
};
-/// EnumConstantDecl - An instance of this object exists for each enum constant
+/// An instance of this object exists for each enum constant
/// that is defined. For example, in "enum X {a,b}", each of a/b are
/// EnumConstantDecl's, X is an instance of EnumDecl, and the type of a/b is a
/// TagType for the X EnumDecl.
@@ -2705,9 +2773,8 @@ public:
static bool classofKind(Kind K) { return K == EnumConstant; }
};
-/// IndirectFieldDecl - An instance of this class is created to represent a
-/// field injected from an anonymous union/struct into the parent scope.
-/// IndirectFieldDecl are always implicit.
+/// Represents a field injected from an anonymous union/struct into the parent
+/// scope. These are always implicit.
class IndirectFieldDecl : public ValueDecl,
public Mergeable<IndirectFieldDecl> {
NamedDecl **Chaining;
@@ -2756,17 +2823,17 @@ public:
static bool classofKind(Kind K) { return K == IndirectField; }
};
-/// TypeDecl - Represents a declaration of a type.
+/// Represents a declaration of a type.
class TypeDecl : public NamedDecl {
friend class ASTContext;
- /// TypeForDecl - This indicates the Type object that represents
+ /// This indicates the Type object that represents
/// this TypeDecl. It is a cache maintained by
/// ASTContext::getTypedefType, ASTContext::getTagDeclType, and
/// ASTContext::getTemplateTypeParmType, and TemplateTypeParmDecl.
mutable const Type *TypeForDecl = nullptr;
- /// LocStart - The start of the source range for this declaration.
+ /// The start of the source range for this declaration.
SourceLocation LocStart;
void anchor() override;
@@ -2800,13 +2867,16 @@ public:
/// Base class for declarations which introduce a typedef-name.
class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
- using ModedTInfo = std::pair<TypeSourceInfo *, QualType>;
- llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *> MaybeModedTInfo;
+ struct alignas(8) ModedTInfo {
+ TypeSourceInfo *first;
+ QualType second;
+ };
- // FIXME: This can be packed into the bitfields in Decl.
- /// If 0, we have not computed IsTransparentTag.
- /// Otherwise, IsTransparentTag is (CacheIsTransparentTag >> 1).
- mutable unsigned CacheIsTransparentTag : 2;
+ /// If int part is 0, we have not computed IsTransparentTag.
+ /// Otherwise, IsTransparentTag is (getInt() >> 1).
+ mutable llvm::PointerIntPair<
+ llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
+ MaybeModedTInfo;
void anchor() override;
@@ -2815,7 +2885,7 @@ protected:
SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, TypeSourceInfo *TInfo)
: TypeDecl(DK, DC, IdLoc, Id, StartLoc), redeclarable_base(C),
- MaybeModedTInfo(TInfo), CacheIsTransparentTag(0) {}
+ MaybeModedTInfo(TInfo, 0) {}
using redeclarable_base = Redeclarable<TypedefNameDecl>;
@@ -2842,26 +2912,29 @@ public:
using redeclarable_base::getMostRecentDecl;
using redeclarable_base::isFirstDecl;
- bool isModed() const { return MaybeModedTInfo.is<ModedTInfo*>(); }
+ bool isModed() const {
+ return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
+ }
TypeSourceInfo *getTypeSourceInfo() const {
- return isModed()
- ? MaybeModedTInfo.get<ModedTInfo*>()->first
- : MaybeModedTInfo.get<TypeSourceInfo*>();
+ return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
+ : MaybeModedTInfo.getPointer().get<TypeSourceInfo *>();
}
QualType getUnderlyingType() const {
- return isModed()
- ? MaybeModedTInfo.get<ModedTInfo*>()->second
- : MaybeModedTInfo.get<TypeSourceInfo*>()->getType();
+ return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
+ : MaybeModedTInfo.getPointer()
+ .get<TypeSourceInfo *>()
+ ->getType();
}
void setTypeSourceInfo(TypeSourceInfo *newType) {
- MaybeModedTInfo = newType;
+ MaybeModedTInfo.setPointer(newType);
}
void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy) {
- MaybeModedTInfo = new (getASTContext()) ModedTInfo(unmodedTSI, modedTy);
+ MaybeModedTInfo.setPointer(new (getASTContext(), 8)
+ ModedTInfo({unmodedTSI, modedTy}));
}
/// Retrieves the canonical declaration of this typedef-name.
@@ -2878,8 +2951,8 @@ public:
/// Determines if this typedef shares a name and spelling location with its
/// underlying tag type, as is the case with the NS_ENUM macro.
bool isTransparentTag() const {
- if (CacheIsTransparentTag)
- return CacheIsTransparentTag & 0x2;
+ if (MaybeModedTInfo.getInt())
+ return MaybeModedTInfo.getInt() & 0x2;
return isTransparentTagSlow();
}
@@ -2893,7 +2966,7 @@ private:
bool isTransparentTagSlow() const;
};
-/// TypedefDecl - Represents the declaration of a typedef-name via the 'typedef'
+/// Represents the declaration of a typedef-name via the 'typedef'
/// type specifier.
class TypedefDecl : public TypedefNameDecl {
TypedefDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
@@ -2913,7 +2986,7 @@ public:
static bool classofKind(Kind K) { return K == Typedef; }
};
-/// TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x
+/// Represents the declaration of a typedef-name via a C++11
/// alias-declaration.
class TypeAliasDecl : public TypedefNameDecl {
/// The template for which this is the pattern, if any.
@@ -2940,7 +3013,7 @@ public:
static bool classofKind(Kind K) { return K == TypeAlias; }
};
-/// TagDecl - Represents the declaration of a struct/union/class/enum.
+/// Represents the declaration of a struct/union/class/enum.
class TagDecl
: public TypeDecl, public DeclContext, public Redeclarable<TagDecl> {
public:
@@ -2949,25 +3022,24 @@ public:
private:
// FIXME: This can be packed into the bitfields in Decl.
- /// TagDeclKind - The TagKind enum.
+ /// The TagKind enum.
unsigned TagDeclKind : 3;
- /// IsCompleteDefinition - True if this is a definition ("struct foo
- /// {};"), false if it is a declaration ("struct foo;"). It is not
- /// a definition until the definition has been fully processed.
+ /// True if this is a definition ("struct foo {};"), false if it is a
+ /// declaration ("struct foo;"). It is not considered a definition
+ /// until the definition has been fully processed.
unsigned IsCompleteDefinition : 1;
protected:
- /// IsBeingDefined - True if this is currently being defined.
+ /// True if this is currently being defined.
unsigned IsBeingDefined : 1;
private:
- /// IsEmbeddedInDeclarator - True if this tag declaration is
- /// "embedded" (i.e., defined or declared for the very first time)
- /// in the syntax of a declarator.
+ /// True if this tag declaration is "embedded" (i.e., defined or declared
+ /// for the very first time) in the syntax of a declarator.
unsigned IsEmbeddedInDeclarator : 1;
- /// \brief True if this tag is free standing, e.g. "struct foo;".
+ /// True if this tag is free standing, e.g. "struct foo;".
unsigned IsFreeStanding : 1;
protected:
@@ -2975,21 +3047,21 @@ protected:
unsigned NumPositiveBits : 8;
unsigned NumNegativeBits : 8;
- /// IsScoped - True if this tag declaration is a scoped enumeration. Only
+ /// True if this tag declaration is a scoped enumeration. Only
/// possible in C++11 mode.
unsigned IsScoped : 1;
- /// IsScopedUsingClassTag - If this tag declaration is a scoped enum,
+ /// If this tag declaration is a scoped enum,
/// then this is true if the scoped enum was declared using the class
/// tag, false if it was declared with the struct tag. No meaning is
/// associated if this tag declaration is not a scoped enum.
unsigned IsScopedUsingClassTag : 1;
- /// IsFixed - True if this is an enumeration with fixed underlying type. Only
+ /// True if this is an enumeration with fixed underlying type. Only
/// possible in C++11, Microsoft extensions, or Objective C mode.
unsigned IsFixed : 1;
- /// \brief Indicates whether it is possible for declarations of this kind
+ /// Indicates whether it is possible for declarations of this kind
/// to have an out-of-date definition.
///
/// This option is only enabled when modules are enabled.
@@ -3006,7 +3078,7 @@ private:
// to be used for the (uncommon) case of out-of-line declarations.
using ExtInfo = QualifierInfo;
- /// \brief If the (out-of-line) tag declaration name
+ /// If the (out-of-line) tag declaration name
/// is qualified, it points to the qualifier info (nns and range);
/// otherwise, if the tag declaration is anonymous and it is part of
/// a typedef or alias, it points to the TypedefNameDecl (used for mangling);
@@ -3050,7 +3122,7 @@ protected:
return getMostRecentDecl();
}
- /// @brief Completes the definition of this tag declaration.
+ /// Completes the definition of this tag declaration.
///
/// This is a helper function for derived classes.
void completeDefinition();
@@ -3072,11 +3144,11 @@ public:
SourceRange getBraceRange() const { return BraceRange; }
void setBraceRange(SourceRange R) { BraceRange = R; }
- /// getInnerLocStart - Return SourceLocation representing start of source
+ /// Return SourceLocation representing start of source
/// range ignoring outer template declarations.
SourceLocation getInnerLocStart() const { return getLocStart(); }
- /// getOuterLocStart - Return SourceLocation representing start of source
+ /// Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
SourceLocation getOuterLocStart() const;
SourceRange getSourceRange() const override LLVM_READONLY;
@@ -3086,25 +3158,24 @@ public:
return const_cast<TagDecl*>(this)->getCanonicalDecl();
}
- /// isThisDeclarationADefinition() - Return true if this declaration
- /// is a completion definition of the type. Provided for consistency.
+ /// Return true if this declaration is a completion definition of the type.
+ /// Provided for consistency.
bool isThisDeclarationADefinition() const {
return isCompleteDefinition();
}
- /// isCompleteDefinition - Return true if this decl has its body
- /// fully specified.
+ /// Return true if this decl has its body fully specified.
bool isCompleteDefinition() const {
return IsCompleteDefinition;
}
- /// \brief Return true if this complete decl is
+ /// Return true if this complete decl is
/// required to be complete for some existing use.
bool isCompleteDefinitionRequired() const {
return IsCompleteDefinitionRequired;
}
- /// isBeingDefined - Return true if this decl is currently being defined.
+ /// Return true if this decl is currently being defined.
bool isBeingDefined() const {
return IsBeingDefined;
}
@@ -3121,19 +3192,19 @@ public:
IsFreeStanding = isFreeStanding;
}
- /// \brief Whether this declaration declares a type that is
+ /// Whether this declaration declares a type that is
/// dependent, i.e., a type that somehow depends on template
/// parameters.
bool isDependentType() const { return isDependentContext(); }
- /// @brief Starts the definition of this tag declaration.
+ /// Starts the definition of this tag declaration.
///
/// This method should be invoked at the beginning of the definition
/// of this tag declaration. It will set the tag type into a state
/// where it is in the process of being defined.
void startDefinition();
- /// getDefinition - Returns the TagDecl that actually defines this
+ /// Returns the TagDecl that actually defines this
/// struct/union/class/enum. When determining whether or not a
/// struct/union/class/enum has a definition, one should use this
/// method as opposed to 'isDefinition'. 'isDefinition' indicates
@@ -3191,14 +3262,14 @@ public:
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD);
- /// \brief Retrieve the nested-name-specifier that qualifies the name of this
+ /// Retrieve the nested-name-specifier that qualifies the name of this
/// declaration, if it was present in the source.
NestedNameSpecifier *getQualifier() const {
return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
: nullptr;
}
- /// \brief Retrieve the nested-name-specifier (with source-location
+ /// Retrieve the nested-name-specifier (with source-location
/// information) that qualifies the name of this declaration, if it was
/// present in the source.
NestedNameSpecifierLoc getQualifierLoc() const {
@@ -3233,11 +3304,11 @@ public:
}
};
-/// EnumDecl - Represents an enum. In C++11, enums can be forward-declared
+/// Represents an enum. In C++11, enums can be forward-declared
/// with a fixed underlying type, and in C we allow them to be forward-declared
/// with no underlying type as an extension.
class EnumDecl : public TagDecl {
- /// IntegerType - This represent the integer type that the enum corresponds
+ /// This represent the integer type that the enum corresponds
/// to for code generation purposes. Note that the enumerator constants may
/// have a different type than this does.
///
@@ -3253,17 +3324,21 @@ class EnumDecl : public TagDecl {
/// extra pointer when TypeSourceInfo is needed.
llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
- /// PromotionType - The integer type that values of this type should
+ /// The integer type that values of this type should
/// promote to. In C, enumerators are generally of an integer type
/// directly, but gcc-style large enumerators (and all enumerators
/// in C++) are of the enum type instead.
QualType PromotionType;
- /// \brief If this enumeration is an instantiation of a member enumeration
+ /// If this enumeration is an instantiation of a member enumeration
/// of a class template specialization, this is the member specialization
/// information.
MemberSpecializationInfo *SpecializationInfo = nullptr;
+ /// Store the ODRHash after first calculation.
+ unsigned HasODRHash : 1;
+ unsigned ODRHash;
+
EnumDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl,
bool Scoped, bool ScopedUsingClassTag, bool Fixed)
@@ -3275,6 +3350,8 @@ class EnumDecl : public TagDecl {
IsScoped = Scoped;
IsScopedUsingClassTag = ScopedUsingClassTag;
IsFixed = Fixed;
+ HasODRHash = false;
+ ODRHash = 0;
}
void anchor() override;
@@ -3317,9 +3394,9 @@ public:
bool IsFixed);
static EnumDecl *CreateDeserialized(ASTContext &C, unsigned ID);
- /// completeDefinition - When created, the EnumDecl corresponds to a
+ /// When created, the EnumDecl corresponds to a
/// forward-declared enum. This method is used to mark the
- /// declaration as being defined; it's enumerators have already been
+ /// declaration as being defined; its enumerators have already been
/// added (via DeclContext::addDecl). NewType is the new underlying
/// type of the enumeration type.
void completeDefinition(QualType NewType,
@@ -3327,8 +3404,7 @@ public:
unsigned NumPositiveBits,
unsigned NumNegativeBits);
- // enumerator_iterator - Iterates through the enumerators of this
- // enumeration.
+ // Iterates through the enumerators of this enumeration.
using enumerator_iterator = specific_decl_iterator<EnumConstantDecl>;
using enumerator_range =
llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
@@ -3351,14 +3427,13 @@ public:
return enumerator_iterator(E->decls_end());
}
- /// getPromotionType - Return the integer type that enumerators
- /// should promote to.
+ /// Return the integer type that enumerators should promote to.
QualType getPromotionType() const { return PromotionType; }
- /// \brief Set the promotion type.
+ /// Set the promotion type.
void setPromotionType(QualType T) { PromotionType = T; }
- /// getIntegerType - Return the integer type this enum decl corresponds to.
+ /// Return the integer type this enum decl corresponds to.
/// This returns a null QualType for an enum forward definition with no fixed
/// underlying type.
QualType getIntegerType() const {
@@ -3369,23 +3444,23 @@ public:
return IntegerType.get<TypeSourceInfo*>()->getType().getUnqualifiedType();
}
- /// \brief Set the underlying integer type.
+ /// Set the underlying integer type.
void setIntegerType(QualType T) { IntegerType = T.getTypePtrOrNull(); }
- /// \brief Set the underlying integer type source info.
+ /// Set the underlying integer type source info.
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo) { IntegerType = TInfo; }
- /// \brief Return the type source info for the underlying integer type,
+ /// Return the type source info for the underlying integer type,
/// if no type source info exists, return 0.
TypeSourceInfo *getIntegerTypeSourceInfo() const {
return IntegerType.dyn_cast<TypeSourceInfo*>();
}
- /// \brief Retrieve the source range that covers the underlying type if
+ /// Retrieve the source range that covers the underlying type if
/// specified.
SourceRange getIntegerTypeRange() const LLVM_READONLY;
- /// \brief Returns the width in bits required to store all the
+ /// Returns the width in bits required to store all the
/// non-negative enumerators of this enum.
unsigned getNumPositiveBits() const {
return NumPositiveBits;
@@ -3395,7 +3470,7 @@ public:
assert(NumPositiveBits == Num && "can't store this bitcount");
}
- /// \brief Returns the width in bits required to store all the
+ /// Returns the width in bits required to store all the
/// negative enumerators of this enum. These widths include
/// the rightmost leading 1; that is:
///
@@ -3411,25 +3486,29 @@ public:
NumNegativeBits = Num;
}
- /// \brief Returns true if this is a C++11 scoped enumeration.
+ /// Returns true if this is a C++11 scoped enumeration.
bool isScoped() const {
return IsScoped;
}
- /// \brief Returns true if this is a C++11 scoped enumeration.
+ /// Returns true if this is a C++11 scoped enumeration.
bool isScopedUsingClassTag() const {
return IsScopedUsingClassTag;
}
- /// \brief Returns true if this is an Objective-C, C++11, or
+ /// Returns true if this is an Objective-C, C++11, or
/// Microsoft-style enumeration with a fixed underlying type.
bool isFixed() const {
return IsFixed;
}
- /// \brief Returns true if this can be considered a complete type.
+ unsigned getODRHash();
+
+ /// Returns true if this can be considered a complete type.
bool isComplete() const {
- return isCompleteDefinition() || isFixed();
+ // IntegerType is set for fixed type enums and non-fixed but implicitly
+ // int-sized Microsoft enums.
+ return isCompleteDefinition() || IntegerType;
}
/// Returns true if this enum is either annotated with
@@ -3444,33 +3523,33 @@ public:
/// enum_extensibility(open).
bool isClosedNonFlag() const;
- /// \brief Retrieve the enum definition from which this enumeration could
+ /// Retrieve the enum definition from which this enumeration could
/// be instantiated, if it is an instantiation (rather than a non-template).
EnumDecl *getTemplateInstantiationPattern() const;
- /// \brief Returns the enumeration (declared within the template)
+ /// Returns the enumeration (declared within the template)
/// from which this enumeration type was instantiated, or NULL if
/// this enumeration was not instantiated from any template.
EnumDecl *getInstantiatedFromMemberEnum() const;
- /// \brief If this enumeration is a member of a specialization of a
+ /// If this enumeration is a member of a specialization of a
/// templated class, determine what kind of template specialization
/// or instantiation this is.
TemplateSpecializationKind getTemplateSpecializationKind() const;
- /// \brief For an enumeration member that was instantiated from a member
+ /// For an enumeration member that was instantiated from a member
/// enumeration of a templated class, set the template specialiation kind.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
SourceLocation PointOfInstantiation = SourceLocation());
- /// \brief If this enumeration is an instantiation of a member enumeration of
+ /// If this enumeration is an instantiation of a member enumeration of
/// a class template specialization, retrieves the member specialization
/// information.
MemberSpecializationInfo *getMemberSpecializationInfo() const {
return SpecializationInfo;
}
- /// \brief Specify that this enumeration is an instantiation of the
+ /// Specify that this enumeration is an instantiation of the
/// member enumeration ED.
void setInstantiationOfMemberEnum(EnumDecl *ED,
TemplateSpecializationKind TSK) {
@@ -3481,36 +3560,74 @@ public:
static bool classofKind(Kind K) { return K == Enum; }
};
-/// RecordDecl - Represents a struct/union/class. For example:
+/// Represents a struct/union/class. For example:
/// struct X; // Forward declaration, no "body".
/// union Y { int A, B; }; // Has body with members A and B (FieldDecls).
/// This decl will be marked invalid if *any* members are invalid.
class RecordDecl : public TagDecl {
+public:
+ /// Enum that represents the different ways arguments are passed to and
+ /// returned from function calls. This takes into account the target-specific
+ /// and version-specific rules along with the rules determined by the
+ /// language.
+ enum ArgPassingKind : unsigned {
+ /// The argument of this type can be passed directly in registers.
+ APK_CanPassInRegs,
+
+ /// The argument of this type cannot be passed directly in registers.
+ /// Records containing this type as a subobject are not forced to be passed
+ /// indirectly. This value is used only in C++. This value is required by
+ /// C++ because, in uncommon situations, it is possible for a class to have
+ /// only trivial copy/move constructors even when one of its subobjects has
+ /// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
+ /// constructor in the derived class is deleted).
+ APK_CannotPassInRegs,
+
+ /// The argument of this type cannot be passed directly in registers.
+ /// Records containing this type as a subobject are forced to be passed
+ /// indirectly.
+ APK_CanNeverPassInRegs
+ };
+
+private:
friend class DeclContext;
// FIXME: This can be packed into the bitfields in Decl.
- /// HasFlexibleArrayMember - This is true if this struct ends with a flexible
+ /// This is true if this struct ends with a flexible
/// array member (e.g. int X[]) or if this union contains a struct that does.
/// If so, this cannot be contained in arrays or other structs as a member.
- bool HasFlexibleArrayMember : 1;
+ unsigned HasFlexibleArrayMember : 1;
- /// AnonymousStructOrUnion - Whether this is the type of an anonymous struct
- /// or union.
- bool AnonymousStructOrUnion : 1;
+ /// Whether this is the type of an anonymous struct or union.
+ unsigned AnonymousStructOrUnion : 1;
- /// HasObjectMember - This is true if this struct has at least one member
+ /// This is true if this struct has at least one member
/// containing an Objective-C object pointer type.
- bool HasObjectMember : 1;
-
- /// HasVolatileMember - This is true if struct has at least one member of
+ unsigned HasObjectMember : 1;
+
+ /// This is true if struct has at least one member of
/// 'volatile' type.
- bool HasVolatileMember : 1;
+ unsigned HasVolatileMember : 1;
- /// \brief Whether the field declarations of this record have been loaded
+ /// Whether the field declarations of this record have been loaded
/// from external storage. To avoid unnecessary deserialization of
/// methods/nested types we allow deserialization of just the fields
/// when needed.
- mutable bool LoadedFieldsFromExternalStorage : 1;
+ mutable unsigned LoadedFieldsFromExternalStorage : 1;
+
+ /// Basic properties of non-trivial C structs.
+ unsigned NonTrivialToPrimitiveDefaultInitialize : 1;
+ unsigned NonTrivialToPrimitiveCopy : 1;
+ unsigned NonTrivialToPrimitiveDestroy : 1;
+
+ /// Indicates whether this struct is destroyed in the callee.
+ ///
+ /// Please note that MSVC won't merge adjacent bitfields if they don't have
+ /// the same type.
+ unsigned ParamDestroyedInCallee : 1;
+
+ /// Represents the way this type is passed to a function.
+ unsigned ArgPassingRestrictions : 2;
protected:
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
@@ -3541,10 +3658,9 @@ public:
bool hasFlexibleArrayMember() const { return HasFlexibleArrayMember; }
void setHasFlexibleArrayMember(bool V) { HasFlexibleArrayMember = V; }
- /// isAnonymousStructOrUnion - Whether this is an anonymous struct
- /// or union. To be an anonymous struct or union, it must have been
- /// declared without a name and there must be no objects of this
- /// type declared, e.g.,
+ /// Whether this is an anonymous struct or union. To be an anonymous
+ /// struct or union, it must have been declared without a name and
+ /// there must be no objects of this type declared, e.g.,
/// @code
/// union { int i; float f; };
/// @endcode
@@ -3571,7 +3687,55 @@ public:
LoadedFieldsFromExternalStorage = val;
}
- /// \brief Determines whether this declaration represents the
+ /// Functions to query basic properties of non-trivial C structs.
+ bool isNonTrivialToPrimitiveDefaultInitialize() const {
+ return NonTrivialToPrimitiveDefaultInitialize;
+ }
+
+ void setNonTrivialToPrimitiveDefaultInitialize(bool V) {
+ NonTrivialToPrimitiveDefaultInitialize = V;
+ }
+
+ bool isNonTrivialToPrimitiveCopy() const {
+ return NonTrivialToPrimitiveCopy;
+ }
+
+ void setNonTrivialToPrimitiveCopy(bool V) {
+ NonTrivialToPrimitiveCopy = V;
+ }
+
+ bool isNonTrivialToPrimitiveDestroy() const {
+ return NonTrivialToPrimitiveDestroy;
+ }
+
+ void setNonTrivialToPrimitiveDestroy(bool V) {
+ NonTrivialToPrimitiveDestroy = V;
+ }
+
+ /// Determine whether this class can be passed in registers. In C++ mode,
+ /// it must have at least one trivial, non-deleted copy or move constructor.
+ /// FIXME: This should be set as part of completeDefinition.
+ bool canPassInRegisters() const {
+ return getArgPassingRestrictions() == APK_CanPassInRegs;
+ }
+
+ ArgPassingKind getArgPassingRestrictions() const {
+ return static_cast<ArgPassingKind>(ArgPassingRestrictions);
+ }
+
+ void setArgPassingRestrictions(ArgPassingKind Kind) {
+ ArgPassingRestrictions = static_cast<uint8_t>(Kind);
+ }
+
+ bool isParamDestroyedInCallee() const {
+ return ParamDestroyedInCallee;
+ }
+
+ void setParamDestroyedInCallee(bool V) {
+ ParamDestroyedInCallee = V;
+ }
+
+ /// Determines whether this declaration represents the
/// injected class name.
///
/// The injected class name in C++ is the name of the class that
@@ -3586,19 +3750,19 @@ public:
/// \endcode
bool isInjectedClassName() const;
- /// \brief Determine whether this record is a class describing a lambda
+ /// Determine whether this record is a class describing a lambda
/// function object.
bool isLambda() const;
- /// \brief Determine whether this record is a record for captured variables in
+ /// Determine whether this record is a record for captured variables in
/// CapturedStmt construct.
bool isCapturedRecord() const;
- /// \brief Mark the record as a record for captured variables in CapturedStmt
+ /// Mark the record as a record for captured variables in CapturedStmt
/// construct.
void setCapturedRecord();
- /// getDefinition - Returns the RecordDecl that actually defines
+ /// Returns the RecordDecl that actually defines
/// this struct/union/class. When determining whether or not a
/// struct/union/class is completely defined, one should use this
/// method as opposed to 'isCompleteDefinition'.
@@ -3623,14 +3787,12 @@ public:
return field_iterator(decl_iterator());
}
- // field_empty - Whether there are any fields (non-static data
- // members) in this record.
+ // Whether there are any fields (non-static data members) in this record.
bool field_empty() const {
return field_begin() == field_end();
}
- /// completeDefinition - Notes that the definition of this type is
- /// now complete.
+ /// Note that the definition of this type is now complete.
virtual void completeDefinition();
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -3638,12 +3800,12 @@ public:
return K >= firstRecord && K <= lastRecord;
}
- /// \brief Get whether or not this is an ms_struct which can
+ /// Get whether or not this is an ms_struct which can
/// be turned on with an attribute, pragma, or -mms-bitfields
/// commandline option.
bool isMsStruct(const ASTContext &C) const;
- /// \brief Whether we are allowed to insert extra padding between fields.
+ /// Whether we are allowed to insert extra padding between fields.
/// These padding are added to help AddressSanitizer detect
/// intra-object-overflow bugs.
bool mayInsertExtraPadding(bool EmitRemark = false) const;
@@ -3653,7 +3815,7 @@ public:
const FieldDecl *findFirstNamedDataMember() const;
private:
- /// \brief Deserialize just the fields.
+ /// Deserialize just the fields.
void LoadFieldsFromExternalStorage() const;
};
@@ -3689,7 +3851,7 @@ public:
static bool classofKind(Kind K) { return K == FileScopeAsm; }
};
-/// BlockDecl - This represents a block literal declaration, which is like an
+/// Pepresents a block literal declaration, which is like an
/// unnamed FunctionDecl. For example:
/// ^{ statement-body } or ^(int arg1, float arg2){ statement-body }
class BlockDecl : public Decl, public DeclContext {
@@ -3739,7 +3901,11 @@ private:
bool BlockMissingReturnType : 1;
bool IsConversionFromLambda : 1;
- /// ParamInfo - new[]'d array of pointers to ParmVarDecls for the formal
+ /// A bit that indicates this block is passed directly to a function as a
+ /// non-escaping parameter.
+ bool DoesNotEscape : 1;
+
+ /// A new[]'d array of pointers to ParmVarDecls for the formal
/// parameters of this function. This is null if a prototype or if there are
/// no formals.
ParmVarDecl **ParamInfo = nullptr;
@@ -3758,7 +3924,7 @@ protected:
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
: Decl(Block, DC, CaretLoc), DeclContext(Block), IsVariadic(false),
CapturesCXXThis(false), BlockMissingReturnType(true),
- IsConversionFromLambda(false) {}
+ IsConversionFromLambda(false), DoesNotEscape(false) {}
public:
static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
@@ -3808,11 +3974,11 @@ public:
void setParams(ArrayRef<ParmVarDecl *> NewParamInfo);
- /// hasCaptures - True if this block (or its nested blocks) captures
+ /// True if this block (or its nested blocks) captures
/// anything of local storage from its enclosing scopes.
bool hasCaptures() const { return NumCaptures != 0 || CapturesCXXThis; }
- /// getNumCaptures - Returns the number of captured variables.
+ /// Returns the number of captured variables.
/// Does not include an entry for 'this'.
unsigned getNumCaptures() const { return NumCaptures; }
@@ -3830,6 +3996,9 @@ public:
bool isConversionFromLambda() const { return IsConversionFromLambda; }
void setIsConversionFromLambda(bool val) { IsConversionFromLambda = val; }
+ bool doesNotEscape() const { return DoesNotEscape; }
+ void setDoesNotEscape() { DoesNotEscape = true; }
+
bool capturesVariable(const VarDecl *var) const;
void setCaptures(ASTContext &Context, ArrayRef<Capture> Captures,
@@ -3861,8 +4030,7 @@ public:
}
};
-/// \brief This represents the body of a CapturedStmt, and serves as its
-/// DeclContext.
+/// Represents the body of a CapturedStmt, and serves as its DeclContext.
class CapturedDecl final
: public Decl,
public DeclContext,
@@ -3873,13 +4041,13 @@ protected:
}
private:
- /// \brief The number of parameters to the outlined function.
+ /// The number of parameters to the outlined function.
unsigned NumParams;
- /// \brief The position of context parameter in list of parameters.
+ /// The position of context parameter in list of parameters.
unsigned ContextParam;
- /// \brief The body of the outlined function.
+ /// The body of the outlined function.
llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
explicit CapturedDecl(DeclContext *DC, unsigned NumParams);
@@ -3927,7 +4095,7 @@ public:
return {getParams(), getNumParams()};
}
- /// \brief Retrieve the parameter containing captured variables.
+ /// Retrieve the parameter containing captured variables.
ImplicitParamDecl *getContextParam() const {
assert(ContextParam < NumParams);
return getParam(ContextParam);
@@ -3942,9 +4110,9 @@ public:
using param_iterator = ImplicitParamDecl *const *;
using param_range = llvm::iterator_range<param_iterator>;
- /// \brief Retrieve an iterator pointing to the first parameter decl.
+ /// Retrieve an iterator pointing to the first parameter decl.
param_iterator param_begin() const { return getParams(); }
- /// \brief Retrieve an iterator one past the last parameter decl.
+ /// Retrieve an iterator one past the last parameter decl.
param_iterator param_end() const { return getParams() + NumParams; }
// Implement isa/cast/dyncast/etc.
@@ -3958,7 +4126,7 @@ public:
}
};
-/// \brief Describes a module import declaration, which makes the contents
+/// Describes a module import declaration, which makes the contents
/// of the named module visible in the current translation unit.
///
/// An import declaration imports the named module (or submodule). For example:
@@ -3975,7 +4143,7 @@ class ImportDecl final : public Decl,
friend class ASTReader;
friend TrailingObjects;
- /// \brief The imported module, along with a bit that indicates whether
+ /// The imported module, along with a bit that indicates whether
/// we have source-location information for each identifier in the module
/// name.
///
@@ -3983,7 +4151,7 @@ class ImportDecl final : public Decl,
/// end of the import declaration.
llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
- /// \brief The next import in the list of imports local to the translation
+ /// The next import in the list of imports local to the translation
/// unit being parsed (not loaded from an AST file).
ImportDecl *NextLocalImport = nullptr;
@@ -3996,25 +4164,25 @@ class ImportDecl final : public Decl,
ImportDecl(EmptyShell Empty) : Decl(Import, Empty) {}
public:
- /// \brief Create a new module import declaration.
+ /// Create a new module import declaration.
static ImportDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, Module *Imported,
ArrayRef<SourceLocation> IdentifierLocs);
- /// \brief Create a new module import declaration for an implicitly-generated
+ /// Create a new module import declaration for an implicitly-generated
/// import.
static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, Module *Imported,
SourceLocation EndLoc);
- /// \brief Create a new, deserialized module import declaration.
+ /// Create a new, deserialized module import declaration.
static ImportDecl *CreateDeserialized(ASTContext &C, unsigned ID,
unsigned NumLocations);
- /// \brief Retrieve the module that was imported by the import declaration.
+ /// Retrieve the module that was imported by the import declaration.
Module *getImportedModule() const { return ImportedAndComplete.getPointer(); }
- /// \brief Retrieves the locations of each of the identifiers that make up
+ /// Retrieves the locations of each of the identifiers that make up
/// the complete module name in the import declaration.
///
/// This will return an empty array if the locations of the individual
@@ -4027,7 +4195,7 @@ public:
static bool classofKind(Kind K) { return K == Import; }
};
-/// \brief Represents a C++ Modules TS module export declaration.
+/// Represents a C++ Modules TS module export declaration.
///
/// For example:
/// \code
@@ -4039,7 +4207,7 @@ class ExportDecl final : public Decl, public DeclContext {
private:
friend class ASTDeclReader;
- /// \brief The source location for the right brace (if valid).
+ /// The source location for the right brace (if valid).
SourceLocation RBraceLoc;
ExportDecl(DeclContext *DC, SourceLocation ExportLoc)
@@ -4077,7 +4245,7 @@ public:
}
};
-/// \brief Represents an empty-declaration.
+/// Represents an empty-declaration.
class EmptyDecl : public Decl {
EmptyDecl(DeclContext *DC, SourceLocation L) : Decl(Empty, DC, L) {}
@@ -4111,7 +4279,7 @@ template<typename decl_type>
void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
// Note: This routine is implemented here because we need both NamedDecl
// and Redeclarable to be defined.
- assert(RedeclLink.NextIsLatest() &&
+ assert(RedeclLink.isFirst() &&
"setPreviousDecl on a decl already in a redeclaration chain");
if (PrevDecl) {
@@ -4119,7 +4287,7 @@ void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
// redeclaration, or we can build invalid chains. If the most recent
// redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
First = PrevDecl->getFirstDecl();
- assert(First->RedeclLink.NextIsLatest() && "Expected first");
+ assert(First->RedeclLink.isFirst() && "Expected first");
decl_type *MostRecent = First->getNextRedeclaration();
RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
@@ -4142,7 +4310,7 @@ void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) {
// Inline function definitions.
-/// \brief Check if the given decl is complete.
+/// Check if the given decl is complete.
///
/// We use this function to break a cycle between the inline definitions in
/// Type.h and Decl.h.
@@ -4150,7 +4318,7 @@ inline bool IsEnumDeclComplete(EnumDecl *ED) {
return ED->isComplete();
}
-/// \brief Check if the given decl is scoped.
+/// Check if the given decl is scoped.
///
/// We use this function to break a cycle between the inline definitions in
/// Type.h and Decl.h.
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index f93c9f0b9aaa..f99bd627877c 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -19,7 +19,6 @@
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
-#include "clang/Basic/VersionTuple.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
@@ -28,6 +27,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/VersionTuple.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
@@ -67,7 +67,7 @@ class TemplateDecl;
class TranslationUnitDecl;
class UsingDirectiveDecl;
-/// \brief Captures the result of checking the availability of a
+/// Captures the result of checking the availability of a
/// declaration.
enum AvailabilityResult {
AR_Available = 0,
@@ -83,9 +83,9 @@ enum AvailabilityResult {
/// (and its subclasses) in its Decl::operator new(). Proper alignment
/// of all subclasses (not requiring more than the alignment of Decl) is
/// asserted in DeclBase.cpp.
-class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) Decl {
+class alignas(8) Decl {
public:
- /// \brief Lists the kind of concrete classes of Decl.
+ /// Lists the kind of concrete classes of Decl.
enum Kind {
#define DECL(DERIVED, BASE) DERIVED,
#define ABSTRACT_DECL(DECL)
@@ -96,7 +96,7 @@ public:
#include "clang/AST/DeclNodes.inc"
};
- /// \brief A placeholder type used to construct an empty shell of a
+ /// A placeholder type used to construct an empty shell of a
/// decl-derived type that will be filled in later (e.g., by some
/// deserialization method).
struct EmptyShell {};
@@ -231,7 +231,7 @@ public:
};
protected:
- /// \brief The next declaration within the same lexical
+ /// The next declaration within the same lexical
/// DeclContext. These pointers form the linked list that is
/// traversed via DeclContext's decls_begin()/decls_end().
///
@@ -288,27 +288,28 @@ private:
/// the implementation rather than explicitly written by the user.
unsigned Implicit : 1;
- /// \brief Whether this declaration was "used", meaning that a definition is
+ /// Whether this declaration was "used", meaning that a definition is
/// required.
unsigned Used : 1;
- /// \brief Whether this declaration was "referenced".
+ /// Whether this declaration was "referenced".
/// The difference with 'Used' is whether the reference appears in a
/// evaluated context or not, e.g. functions used in uninstantiated templates
/// are regarded as "referenced" but not "used".
unsigned Referenced : 1;
- /// \brief Whether this declaration is a top-level declaration (function,
+ /// Whether this declaration is a top-level declaration (function,
/// global variable, etc.) that is lexically inside an objc container
/// definition.
unsigned TopLevelDeclInObjCContainer : 1;
- /// \brief Whether statistic collection is enabled.
+ /// Whether statistic collection is enabled.
static bool StatisticsEnabled;
protected:
friend class ASTDeclReader;
friend class ASTDeclWriter;
+ friend class ASTNodeImporter;
friend class ASTReader;
friend class CXXClassMemberWrapper;
friend class LinkageComputer;
@@ -318,17 +319,17 @@ protected:
// NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
unsigned Access : 2;
- /// \brief Whether this declaration was loaded from an AST file.
+ /// Whether this declaration was loaded from an AST file.
unsigned FromASTFile : 1;
/// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
unsigned IdentifierNamespace : 13;
- /// \brief If 0, we have not computed the linkage of this declaration.
+ /// If 0, we have not computed the linkage of this declaration.
/// Otherwise, it is the linkage + 1.
mutable unsigned CacheValidAndLinkage : 3;
- /// \brief Allocate memory for a deserialized declaration.
+ /// Allocate memory for a deserialized declaration.
///
/// This routine must be used to allocate memory for any declaration that is
/// deserialized from a module file.
@@ -340,7 +341,7 @@ protected:
void *operator new(std::size_t Size, const ASTContext &Ctx, unsigned ID,
std::size_t Extra = 0);
- /// \brief Allocate memory for a non-deserialized declaration.
+ /// Allocate memory for a non-deserialized declaration.
void *operator new(std::size_t Size, const ASTContext &Ctx,
DeclContext *Parent, std::size_t Extra = 0);
@@ -384,7 +385,7 @@ protected:
virtual ~Decl();
- /// \brief Update a potentially out-of-date declaration.
+ /// Update a potentially out-of-date declaration.
void updateOutOfDate(IdentifierInfo &II) const;
Linkage getCachedLinkage() const {
@@ -400,7 +401,7 @@ protected:
}
public:
- /// \brief Source range that this declaration covers.
+ /// Source range that this declaration covers.
virtual SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getLocation(), getLocation());
}
@@ -462,7 +463,7 @@ public:
return AccessSpecifier(Access);
}
- /// \brief Retrieve the access specifier for this declaration, even though
+ /// Retrieve the access specifier for this declaration, even though
/// it may not yet have been properly set.
AccessSpecifier getAccessUnsafe() const {
return AccessSpecifier(Access);
@@ -551,7 +552,7 @@ public:
bool isImplicit() const { return Implicit; }
void setImplicit(bool I = true) { Implicit = I; }
- /// \brief Whether *any* (re-)declaration of the entity was used, meaning that
+ /// Whether *any* (re-)declaration of the entity was used, meaning that
/// a definition is required.
///
/// \param CheckUsedAttr When true, also consider the "used" attribute
@@ -559,28 +560,28 @@ public:
/// whether the function is used.
bool isUsed(bool CheckUsedAttr = true) const;
- /// \brief Set whether the declaration is used, in the sense of odr-use.
+ /// Set whether the declaration is used, in the sense of odr-use.
///
/// This should only be used immediately after creating a declaration.
/// It intentionally doesn't notify any listeners.
void setIsUsed() { getCanonicalDecl()->Used = true; }
- /// \brief Mark the declaration used, in the sense of odr-use.
+ /// Mark the declaration used, in the sense of odr-use.
///
/// This notifies any mutation listeners in addition to setting a bit
/// indicating the declaration is used.
void markUsed(ASTContext &C);
- /// \brief Whether any declaration of this entity was referenced.
+ /// Whether any declaration of this entity was referenced.
bool isReferenced() const;
- /// \brief Whether this declaration was referenced. This should not be relied
+ /// Whether this declaration was referenced. This should not be relied
/// upon for anything other than debugging.
bool isThisDeclarationReferenced() const { return Referenced; }
void setReferenced(bool R = true) { Referenced = R; }
- /// \brief Whether this declaration is a top-level declaration (function,
+ /// Whether this declaration is a top-level declaration (function,
/// global variable, etc.) that is lexically inside an objc container
/// definition.
bool isTopLevelDeclInObjCContainer() const {
@@ -591,17 +592,17 @@ public:
TopLevelDeclInObjCContainer = V;
}
- /// \brief Looks on this and related declarations for an applicable
+ /// Looks on this and related declarations for an applicable
/// external source symbol attribute.
ExternalSourceSymbolAttr *getExternalSourceSymbolAttr() const;
- /// \brief Whether this declaration was marked as being private to the
+ /// Whether this declaration was marked as being private to the
/// module in which it was defined.
bool isModulePrivate() const {
return getModuleOwnershipKind() == ModuleOwnershipKind::ModulePrivate;
}
- /// \brief Whether this declaration is exported (by virtue of being lexically
+ /// Whether this declaration is exported (by virtue of being lexically
/// within an ExportDecl or by being a NamespaceDecl).
bool isExported() const;
@@ -613,7 +614,7 @@ public:
const Attr *getDefiningAttr() const;
protected:
- /// \brief Specify that this declaration was marked as being private
+ /// Specify that this declaration was marked as being private
/// to the module in which it was defined.
void setModulePrivate() {
// The module-private specifier has no effect on unowned declarations.
@@ -623,14 +624,14 @@ protected:
setModuleOwnershipKind(ModuleOwnershipKind::ModulePrivate);
}
- /// \brief Set the owning module ID.
+ /// Set the owning module ID.
void setOwningModuleID(unsigned ID) {
assert(isFromASTFile() && "Only works on a deserialized declaration");
*((unsigned*)this - 2) = ID;
}
public:
- /// \brief Determine the availability of the given declaration.
+ /// Determine the availability of the given declaration.
///
/// This routine will determine the most restrictive availability of
/// the given declaration (e.g., preferring 'unavailable' to
@@ -643,11 +644,16 @@ public:
///
/// \param EnclosingVersion The version to compare with. If empty, assume the
/// deployment target version.
+ ///
+ /// \param RealizedPlatform If non-NULL and the availability result is found
+ /// in an available attribute it will set to the platform which is written in
+ /// the available attribute.
AvailabilityResult
getAvailability(std::string *Message = nullptr,
- VersionTuple EnclosingVersion = VersionTuple()) const;
+ VersionTuple EnclosingVersion = VersionTuple(),
+ StringRef *RealizedPlatform = nullptr) const;
- /// \brief Retrieve the version of the target platform in which this
+ /// Retrieve the version of the target platform in which this
/// declaration was introduced.
///
/// \returns An empty version tuple if this declaration has no 'introduced'
@@ -655,7 +661,7 @@ public:
/// attribute otherwise.
VersionTuple getVersionIntroduced() const;
- /// \brief Determine whether this declaration is marked 'deprecated'.
+ /// Determine whether this declaration is marked 'deprecated'.
///
/// \param Message If non-NULL and the declaration is deprecated,
/// this will be set to the message describing why the declaration
@@ -664,7 +670,7 @@ public:
return getAvailability(Message) == AR_Deprecated;
}
- /// \brief Determine whether this declaration is marked 'unavailable'.
+ /// Determine whether this declaration is marked 'unavailable'.
///
/// \param Message If non-NULL and the declaration is unavailable,
/// this will be set to the message describing why the declaration
@@ -673,7 +679,7 @@ public:
return getAvailability(Message) == AR_Unavailable;
}
- /// \brief Determine whether this is a weak-imported symbol.
+ /// Determine whether this is a weak-imported symbol.
///
/// Weak-imported symbols are typically marked with the
/// 'weak_import' attribute, but may also be marked with an
@@ -681,7 +687,7 @@ public:
/// the introduction of this feature.
bool isWeakImported() const;
- /// \brief Determines whether this symbol can be weak-imported,
+ /// Determines whether this symbol can be weak-imported,
/// e.g., whether it would be well-formed to add the weak_import
/// attribute.
///
@@ -689,11 +695,11 @@ public:
/// declaration cannot be weak-imported because it has a definition.
bool canBeWeakImported(bool &IsDefinition) const;
- /// \brief Determine whether this declaration came from an AST file (such as
+ /// Determine whether this declaration came from an AST file (such as
/// a precompiled header or module) rather than having been parsed.
bool isFromASTFile() const { return FromASTFile; }
- /// \brief Retrieve the global declaration ID associated with this
+ /// Retrieve the global declaration ID associated with this
/// declaration, which specifies where this Decl was loaded from.
unsigned getGlobalID() const {
if (isFromASTFile())
@@ -701,7 +707,7 @@ public:
return 0;
}
- /// \brief Retrieve the global ID of the module that owns this particular
+ /// Retrieve the global ID of the module that owns this particular
/// declaration.
unsigned getOwningModuleID() const {
if (isFromASTFile())
@@ -716,7 +722,7 @@ protected:
bool hasLocalOwningModuleStorage() const;
public:
- /// \brief Get the imported owning module, if this decl is from an imported
+ /// Get the imported owning module, if this decl is from an imported
/// (non-local) module.
Module *getImportedOwningModule() const {
if (!isFromASTFile() || !hasOwningModule())
@@ -725,7 +731,7 @@ public:
return getOwningModuleSlow();
}
- /// \brief Get the local owning module, if known. Returns nullptr if owner is
+ /// Get the local owning module, if known. Returns nullptr if owner is
/// not yet known or declaration is not from a module.
Module *getLocalOwningModule() const {
if (isFromASTFile() || !hasOwningModule())
@@ -759,7 +765,7 @@ public:
/// all declarations in a global module fragment are unowned.
Module *getOwningModuleForLinkage(bool IgnoreLinkage = false) const;
- /// \brief Determine whether this declaration might be hidden from name
+ /// Determine whether this declaration might be hidden from name
/// lookup. Note that the declaration might be visible even if this returns
/// \c false, if the owning module is visible within the query context.
// FIXME: Rename this to make it clearer what it does.
@@ -774,12 +780,12 @@ public:
setModuleOwnershipKind(ModuleOwnershipKind::Visible);
}
- /// \brief Get the kind of module ownership for this declaration.
+ /// Get the kind of module ownership for this declaration.
ModuleOwnershipKind getModuleOwnershipKind() const {
return NextInContextAndBits.getInt();
}
- /// \brief Set whether this declaration is hidden from name lookup.
+ /// Set whether this declaration is hidden from name lookup.
void setModuleOwnershipKind(ModuleOwnershipKind MOK) {
assert(!(getModuleOwnershipKind() == ModuleOwnershipKind::Unowned &&
MOK != ModuleOwnershipKind::Unowned && !isFromASTFile() &&
@@ -836,6 +842,10 @@ public:
void setLexicalDeclContext(DeclContext *DC);
+ /// Determine whether this declaration is a templated entity (whether it is
+ // within the scope of a template parameter).
+ bool isTemplated() const;
+
/// isDefinedOutsideFunctionOrMethod - This predicate returns true if this
/// scoped decl is defined outside the current function or method. This is
/// roughly global variables and functions, but also handles enums (which
@@ -844,7 +854,7 @@ public:
return getParentFunctionOrMethod() == nullptr;
}
- /// \brief Returns true if this declaration lexically is inside a function.
+ /// Returns true if this declaration lexically is inside a function.
/// It recognizes non-defining declarations as well as members of local
/// classes:
/// \code
@@ -853,7 +863,7 @@ public:
/// \endcode
bool isLexicallyWithinFunctionOrMethod() const;
- /// \brief If this decl is defined inside a function/method/block it returns
+ /// If this decl is defined inside a function/method/block it returns
/// the corresponding DeclContext, otherwise it returns null.
const DeclContext *getParentFunctionOrMethod() const;
DeclContext *getParentFunctionOrMethod() {
@@ -861,32 +871,32 @@ public:
const_cast<const Decl*>(this)->getParentFunctionOrMethod());
}
- /// \brief Retrieves the "canonical" declaration of the given declaration.
+ /// Retrieves the "canonical" declaration of the given declaration.
virtual Decl *getCanonicalDecl() { return this; }
const Decl *getCanonicalDecl() const {
return const_cast<Decl*>(this)->getCanonicalDecl();
}
- /// \brief Whether this particular Decl is a canonical one.
+ /// Whether this particular Decl is a canonical one.
bool isCanonicalDecl() const { return getCanonicalDecl() == this; }
protected:
- /// \brief Returns the next redeclaration or itself if this is the only decl.
+ /// Returns the next redeclaration or itself if this is the only decl.
///
/// Decl subclasses that can be redeclared should override this method so that
/// Decl::redecl_iterator can iterate over them.
virtual Decl *getNextRedeclarationImpl() { return this; }
- /// \brief Implementation of getPreviousDecl(), to be overridden by any
+ /// Implementation of getPreviousDecl(), to be overridden by any
/// subclass that has a redeclaration chain.
virtual Decl *getPreviousDeclImpl() { return nullptr; }
- /// \brief Implementation of getMostRecentDecl(), to be overridden by any
+ /// Implementation of getMostRecentDecl(), to be overridden by any
/// subclass that has a redeclaration chain.
virtual Decl *getMostRecentDeclImpl() { return this; }
public:
- /// \brief Iterates through all the redeclarations of the same decl.
+ /// Iterates through all the redeclarations of the same decl.
class redecl_iterator {
/// Current - The current declaration.
Decl *Current = nullptr;
@@ -931,7 +941,7 @@ public:
using redecl_range = llvm::iterator_range<redecl_iterator>;
- /// \brief Returns an iterator range for all the redeclarations of the same
+ /// Returns an iterator range for all the redeclarations of the same
/// decl. It will iterate at least once (when this decl is the only one).
redecl_range redecls() const {
return redecl_range(redecls_begin(), redecls_end());
@@ -943,26 +953,26 @@ public:
redecl_iterator redecls_end() const { return redecl_iterator(); }
- /// \brief Retrieve the previous declaration that declares the same entity
+ /// Retrieve the previous declaration that declares the same entity
/// as this declaration, or NULL if there is no previous declaration.
Decl *getPreviousDecl() { return getPreviousDeclImpl(); }
- /// \brief Retrieve the most recent declaration that declares the same entity
+ /// Retrieve the most recent declaration that declares the same entity
/// as this declaration, or NULL if there is no previous declaration.
const Decl *getPreviousDecl() const {
return const_cast<Decl *>(this)->getPreviousDeclImpl();
}
- /// \brief True if this is the first declaration in its redeclaration chain.
+ /// True if this is the first declaration in its redeclaration chain.
bool isFirstDecl() const {
return getPreviousDecl() == nullptr;
}
- /// \brief Retrieve the most recent declaration that declares the same entity
+ /// Retrieve the most recent declaration that declares the same entity
/// as this declaration (which may be this declaration).
Decl *getMostRecentDecl() { return getMostRecentDeclImpl(); }
- /// \brief Retrieve the most recent declaration that declares the same entity
+ /// Retrieve the most recent declaration that declares the same entity
/// as this declaration (which may be this declaration).
const Decl *getMostRecentDecl() const {
return const_cast<Decl *>(this)->getMostRecentDeclImpl();
@@ -973,7 +983,7 @@ public:
/// top-level Stmt* of that body. Otherwise this method returns null.
virtual Stmt* getBody() const { return nullptr; }
- /// \brief Returns true if this \c Decl represents a declaration for a body of
+ /// Returns true if this \c Decl represents a declaration for a body of
/// code, such as a function or method definition.
/// Note that \c hasBody can also return true if any redeclaration of this
/// \c Decl represents a declaration for a body of code.
@@ -996,24 +1006,24 @@ public:
/// template parameter pack.
bool isTemplateParameterPack() const;
- /// \brief Whether this declaration is a parameter pack.
+ /// Whether this declaration is a parameter pack.
bool isParameterPack() const;
- /// \brief returns true if this declaration is a template
+ /// returns true if this declaration is a template
bool isTemplateDecl() const;
- /// \brief Whether this declaration is a function or function template.
+ /// Whether this declaration is a function or function template.
bool isFunctionOrFunctionTemplate() const {
return (DeclKind >= Decl::firstFunction &&
DeclKind <= Decl::lastFunction) ||
DeclKind == FunctionTemplate;
}
- /// \brief If this is a declaration that describes some template, this
+ /// If this is a declaration that describes some template, this
/// method returns that template declaration.
TemplateDecl *getDescribedTemplate() const;
- /// \brief Returns the function itself, or the templated function if this is a
+ /// Returns the function itself, or the templated function if this is a
/// function template.
FunctionDecl *getAsFunction() LLVM_READONLY;
@@ -1021,7 +1031,7 @@ public:
return const_cast<Decl *>(this)->getAsFunction();
}
- /// \brief Changes the namespace of this declaration to reflect that it's
+ /// Changes the namespace of this declaration to reflect that it's
/// a function-local extern declaration.
///
/// These declarations appear in the lexical context of the extern
@@ -1042,14 +1052,14 @@ public:
IdentifierNamespace |= IDNS_Ordinary;
}
- /// \brief Determine whether this is a block-scope declaration with linkage.
+ /// Determine whether this is a block-scope declaration with linkage.
/// This will either be a local variable declaration declared 'extern', or a
/// local function declaration.
bool isLocalExternDecl() {
return IdentifierNamespace & IDNS_LocalExtern;
}
- /// \brief Changes the namespace of this declaration to reflect that it's
+ /// Changes the namespace of this declaration to reflect that it's
/// the object of a friend declaration.
///
/// These declarations appear in the lexical context of the friending
@@ -1091,7 +1101,7 @@ public:
FOK_Undeclared ///< A friend of a previously-undeclared entity.
};
- /// \brief Determines whether this declaration is the object of a
+ /// Determines whether this declaration is the object of a
/// friend declaration and, if so, what kind.
///
/// There is currently no direct way to find the associated FriendDecl.
@@ -1131,7 +1141,7 @@ public:
void dump(raw_ostream &Out, bool Deserialize = false) const;
- /// \brief Looks through the Decl's underlying type to extract a FunctionType
+ /// Looks through the Decl's underlying type to extract a FunctionType
/// when possible. Will return null if the type underlying the Decl does not
/// have a FunctionType.
const FunctionType *getFunctionType(bool BlocksToo = true) const;
@@ -1145,7 +1155,7 @@ protected:
ASTMutationListener *getASTMutationListener() const;
};
-/// \brief Determine whether two declarations declare the same entity.
+/// Determine whether two declarations declare the same entity.
inline bool declaresSameEntity(const Decl *D1, const Decl *D2) {
if (!D1 || !D2)
return false;
@@ -1172,7 +1182,7 @@ public:
void print(raw_ostream &OS) const override;
};
-/// \brief The results of name lookup within a DeclContext. This is either a
+/// The results of name lookup within a DeclContext. This is either a
/// single result (with no stable storage) or a collection of results (with
/// stable storage provided by the lookup table).
class DeclContextLookupResult {
@@ -1253,36 +1263,36 @@ class DeclContext {
/// DeclKind - This indicates which class this is.
unsigned DeclKind : 8;
- /// \brief Whether this declaration context also has some external
+ /// Whether this declaration context also has some external
/// storage that contains additional declarations that are lexically
/// part of this context.
mutable bool ExternalLexicalStorage : 1;
- /// \brief Whether this declaration context also has some external
+ /// Whether this declaration context also has some external
/// storage that contains additional declarations that are visible
/// in this context.
mutable bool ExternalVisibleStorage : 1;
- /// \brief Whether this declaration context has had external visible
+ /// Whether this declaration context has had external visible
/// storage added since the last lookup. In this case, \c LookupPtr's
/// invariant may not hold and needs to be fixed before we perform
/// another lookup.
mutable bool NeedToReconcileExternalVisibleStorage : 1;
- /// \brief If \c true, this context may have local lexical declarations
+ /// If \c true, this context may have local lexical declarations
/// that are missing from the lookup table.
mutable bool HasLazyLocalLexicalLookups : 1;
- /// \brief If \c true, the external source may have lexical declarations
+ /// If \c true, the external source may have lexical declarations
/// that are missing from the lookup table.
mutable bool HasLazyExternalLexicalLookups : 1;
- /// \brief If \c true, lookups should only return identifier from
+ /// If \c true, lookups should only return identifier from
/// DeclContext scope (for example TranslationUnit). Used in
/// LookupQualifiedName()
mutable bool UseQualifiedLookup : 1;
- /// \brief Pointer to the data structure used to lookup declarations
+ /// Pointer to the data structure used to lookup declarations
/// within this context (or a DependentStoredDeclsMap if this is a
/// dependent context). We maintain the invariant that, if the map
/// contains an entry for a DeclarationName (and we haven't lazily
@@ -1305,7 +1315,7 @@ protected:
/// another pointer.
mutable Decl *LastDecl = nullptr;
- /// \brief Build up a chain of declarations.
+ /// Build up a chain of declarations.
///
/// \returns the first/last pair of declarations.
static std::pair<Decl *, Decl *>
@@ -1388,7 +1398,7 @@ public:
}
}
- /// \brief Test whether the context supports looking up names.
+ /// Test whether the context supports looking up names.
bool isLookupContext() const {
return !isFunctionOrMethod() && DeclKind != Decl::LinkageSpec &&
DeclKind != Decl::Export;
@@ -1414,7 +1424,7 @@ public:
bool isInlineNamespace() const;
- /// \brief Determines whether this context is dependent on a
+ /// Determines whether this context is dependent on a
/// template parameter.
bool isDependentContext() const;
@@ -1435,28 +1445,28 @@ public:
/// C++0x scoped enums), and C++ linkage specifications.
bool isTransparentContext() const;
- /// \brief Determines whether this context or some of its ancestors is a
+ /// Determines whether this context or some of its ancestors is a
/// linkage specification context that specifies C linkage.
bool isExternCContext() const;
- /// \brief Retrieve the nearest enclosing C linkage specification context.
+ /// Retrieve the nearest enclosing C linkage specification context.
const LinkageSpecDecl *getExternCContext() const;
- /// \brief Determines whether this context or some of its ancestors is a
+ /// Determines whether this context or some of its ancestors is a
/// linkage specification context that specifies C++ linkage.
bool isExternCXXContext() const;
- /// \brief Determine whether this declaration context is equivalent
+ /// Determine whether this declaration context is equivalent
/// to the declaration context DC.
bool Equals(const DeclContext *DC) const {
return DC && this->getPrimaryContext() == DC->getPrimaryContext();
}
- /// \brief Determine whether this declaration context encloses the
+ /// Determine whether this declaration context encloses the
/// declaration context DC.
bool Encloses(const DeclContext *DC) const;
- /// \brief Find the nearest non-closure ancestor of this context,
+ /// Find the nearest non-closure ancestor of this context,
/// i.e. the innermost semantic parent of this context which is not
/// a closure. A context may be its own non-closure ancestor.
Decl *getNonClosureAncestor();
@@ -1483,19 +1493,19 @@ public:
return const_cast<DeclContext *>(this)->getRedeclContext();
}
- /// \brief Retrieve the nearest enclosing namespace context.
+ /// Retrieve the nearest enclosing namespace context.
DeclContext *getEnclosingNamespaceContext();
const DeclContext *getEnclosingNamespaceContext() const {
return const_cast<DeclContext *>(this)->getEnclosingNamespaceContext();
}
- /// \brief Retrieve the outermost lexically enclosing record context.
+ /// Retrieve the outermost lexically enclosing record context.
RecordDecl *getOuterLexicalRecordContext();
const RecordDecl *getOuterLexicalRecordContext() const {
return const_cast<DeclContext *>(this)->getOuterLexicalRecordContext();
}
- /// \brief Test if this context is part of the enclosing namespace set of
+ /// Test if this context is part of the enclosing namespace set of
/// the context NS, as defined in C++0x [namespace.def]p9. If either context
/// isn't a namespace, this is equivalent to Equals().
///
@@ -1503,7 +1513,7 @@ public:
/// inline, its enclosing namespace, recursively.
bool InEnclosingNamespaceSetOf(const DeclContext *NS) const;
- /// \brief Collects all of the declaration contexts that are semantically
+ /// Collects all of the declaration contexts that are semantically
/// connected to this declaration context.
///
/// For declaration contexts that have multiple semantically connected but
@@ -1659,7 +1669,7 @@ public:
}
};
- /// \brief Iterates over a filtered subrange of declarations stored
+ /// Iterates over a filtered subrange of declarations stored
/// in a DeclContext.
///
/// This iterator visits only those declarations that are of type
@@ -1735,7 +1745,7 @@ public:
}
};
- /// @brief Add the declaration D into this context.
+ /// Add the declaration D into this context.
///
/// This routine should be invoked when the declaration D has first
/// been declared, to place D into the context where it was
@@ -1749,7 +1759,7 @@ public:
/// semantic context via makeDeclVisibleInContext.
void addDecl(Decl *D);
- /// @brief Add the declaration D into this context, but suppress
+ /// Add the declaration D into this context, but suppress
/// searches for external declarations with the same name.
///
/// Although analogous in function to addDecl, this removes an
@@ -1759,7 +1769,7 @@ public:
/// See the ASTImporter for use cases.
void addDeclInternal(Decl *D);
- /// @brief Add the declaration D to this context without modifying
+ /// Add the declaration D to this context without modifying
/// any lookup tables.
///
/// This is useful for some operations in dependent contexts where
@@ -1767,12 +1777,16 @@ public:
/// only happens with friends.
void addHiddenDecl(Decl *D);
- /// @brief Removes a declaration from this context.
+ /// Removes a declaration from this context.
void removeDecl(Decl *D);
-
- /// @brief Checks whether a declaration is in this context.
+
+ /// Checks whether a declaration is in this context.
bool containsDecl(Decl *D) const;
+ /// Checks whether a declaration is in this context.
+ /// This also loads the Decls from the external source before the check.
+ bool containsDeclAndLoad(Decl *D) const;
+
using lookup_result = DeclContextLookupResult;
using lookup_iterator = lookup_result::iterator;
@@ -1783,12 +1797,12 @@ public:
/// routine will not look into parent contexts.
lookup_result lookup(DeclarationName Name) const;
- /// \brief Find the declarations with the given name that are visible
+ /// Find the declarations with the given name that are visible
/// within this context; don't attempt to retrieve anything from an
/// external source.
lookup_result noload_lookup(DeclarationName Name);
- /// \brief A simplistic name lookup mechanism that performs name lookup
+ /// A simplistic name lookup mechanism that performs name lookup
/// into this declaration context without consulting the external source.
///
/// This function should almost never be used, because it subverts the
@@ -1800,7 +1814,7 @@ public:
void localUncachedLookup(DeclarationName Name,
SmallVectorImpl<NamedDecl *> &Results);
- /// @brief Makes a declaration visible within this context.
+ /// Makes a declaration visible within this context.
///
/// This routine makes the declaration D visible to name lookup
/// within this context and, if this is a transparent context,
@@ -1823,13 +1837,15 @@ public:
using lookups_range = llvm::iterator_range<all_lookups_iterator>;
lookups_range lookups() const;
- lookups_range noload_lookups() const;
+ // Like lookups(), but avoids loading external declarations.
+ // If PreserveInternalState, avoids building lookup data structures too.
+ lookups_range noload_lookups(bool PreserveInternalState) const;
- /// \brief Iterators over all possible lookups within this context.
+ /// Iterators over all possible lookups within this context.
all_lookups_iterator lookups_begin() const;
all_lookups_iterator lookups_end() const;
- /// \brief Iterators over all possible lookups within this context that are
+ /// Iterators over all possible lookups within this context that are
/// currently loaded; don't attempt to retrieve anything from an external
/// source.
all_lookups_iterator noload_lookups_begin() const;
@@ -1861,7 +1877,7 @@ public:
// Low-level accessors
- /// \brief Mark that there are external lexical declarations that we need
+ /// Mark that there are external lexical declarations that we need
/// to include in our lookup table (and that are not available as external
/// visible lookups). These extra lookup results will be found by walking
/// the lexical declarations of this context. This should be used only if
@@ -1873,28 +1889,28 @@ public:
HasLazyExternalLexicalLookups = true;
}
- /// \brief Retrieve the internal representation of the lookup structure.
+ /// Retrieve the internal representation of the lookup structure.
/// This may omit some names if we are lazily building the structure.
StoredDeclsMap *getLookupPtr() const { return LookupPtr; }
- /// \brief Ensure the lookup structure is fully-built and return it.
+ /// Ensure the lookup structure is fully-built and return it.
StoredDeclsMap *buildLookup();
- /// \brief Whether this DeclContext has external storage containing
+ /// Whether this DeclContext has external storage containing
/// additional declarations that are lexically in this context.
bool hasExternalLexicalStorage() const { return ExternalLexicalStorage; }
- /// \brief State whether this DeclContext has external storage for
+ /// State whether this DeclContext has external storage for
/// declarations lexically in this context.
void setHasExternalLexicalStorage(bool ES = true) {
ExternalLexicalStorage = ES;
}
- /// \brief Whether this DeclContext has external storage containing
+ /// Whether this DeclContext has external storage containing
/// additional declarations that are visible in this context.
bool hasExternalVisibleStorage() const { return ExternalVisibleStorage; }
- /// \brief State whether this DeclContext has external storage for
+ /// State whether this DeclContext has external storage for
/// declarations visible in this context.
void setHasExternalVisibleStorage(bool ES = true) {
ExternalVisibleStorage = ES;
@@ -1902,7 +1918,7 @@ public:
NeedToReconcileExternalVisibleStorage = true;
}
- /// \brief Determine whether the given declaration is stored in the list of
+ /// Determine whether the given declaration is stored in the list of
/// declarations lexically within this context.
bool isDeclInLexicalTraversal(const Decl *D) const {
return D && (D->NextInContextAndBits.getPointer() || D == FirstDecl ||
@@ -1933,7 +1949,7 @@ private:
void reconcileExternalVisibleStorage() const;
bool LoadLexicalDeclsFromExternalStorage() const;
- /// @brief Makes a declaration visible within this context, but
+ /// Makes a declaration visible within this context, but
/// suppresses searches for external declarations with the same
/// name.
///
@@ -1943,6 +1959,7 @@ private:
StoredDeclsMap *CreateStoredDeclsMap(ASTContext &C) const;
+ void loadLazyLocalLexicalLookups();
void buildLookupImpl(DeclContext *DCtx, bool Internal);
void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,
bool Rediscoverable);
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 88dc9a655917..1d0489912c6b 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
/// \file
-/// \brief Defines the C++ Decl subclasses, other than those for templates
+/// Defines the C++ Decl subclasses, other than those for templates
/// (found in DeclTemplate.h) and friends (in DeclFriend.h).
//
//===----------------------------------------------------------------------===//
@@ -20,6 +20,7 @@
#include "clang/AST/ASTUnresolvedSet.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExternalASTSource.h"
@@ -72,7 +73,7 @@ class TemplateDecl;
class TemplateParameterList;
class UsingDecl;
-/// \brief Represents any kind of function declaration, whether it is a
+/// Represents any kind of function declaration, whether it is a
/// concrete function or a function template.
class AnyFunctionDecl {
NamedDecl *Function;
@@ -83,11 +84,11 @@ public:
AnyFunctionDecl(FunctionDecl *FD) : Function(FD) {}
AnyFunctionDecl(FunctionTemplateDecl *FTD);
- /// \brief Implicily converts any function or function template into a
+ /// Implicily converts any function or function template into a
/// named declaration.
operator NamedDecl *() const { return Function; }
- /// \brief Retrieve the underlying function or function template.
+ /// Retrieve the underlying function or function template.
NamedDecl *get() const { return Function; }
static AnyFunctionDecl getFromNamedDecl(NamedDecl *ND) {
@@ -118,7 +119,7 @@ namespace llvm {
namespace clang {
-/// \brief Represents an access specifier followed by colon ':'.
+/// Represents an access specifier followed by colon ':'.
///
/// An objects of this class represents sugar for the syntactic occurrence
/// of an access specifier followed by a colon in the list of member
@@ -129,7 +130,7 @@ namespace clang {
/// Also note that this class has nothing to do with so-called
/// "access declarations" (C++98 11.3 [class.access.dcl]).
class AccessSpecDecl : public Decl {
- /// \brief The location of the ':'.
+ /// The location of the ':'.
SourceLocation ColonLoc;
AccessSpecDecl(AccessSpecifier AS, DeclContext *DC,
@@ -143,16 +144,16 @@ class AccessSpecDecl : public Decl {
virtual void anchor();
public:
- /// \brief The location of the access specifier.
+ /// The location of the access specifier.
SourceLocation getAccessSpecifierLoc() const { return getLocation(); }
- /// \brief Sets the location of the access specifier.
+ /// Sets the location of the access specifier.
void setAccessSpecifierLoc(SourceLocation ASLoc) { setLocation(ASLoc); }
- /// \brief The location of the colon following the access specifier.
+ /// The location of the colon following the access specifier.
SourceLocation getColonLoc() const { return ColonLoc; }
- /// \brief Sets the location of the colon.
+ /// Sets the location of the colon.
void setColonLoc(SourceLocation CLoc) { ColonLoc = CLoc; }
SourceRange getSourceRange() const override LLVM_READONLY {
@@ -172,7 +173,7 @@ public:
static bool classofKind(Kind K) { return K == AccessSpec; }
};
-/// \brief Represents a base class of a C++ class.
+/// Represents a base class of a C++ class.
///
/// Each CXXBaseSpecifier represents a single, direct base class (or
/// struct) of a C++ class (or struct). It specifies the type of that
@@ -189,35 +190,35 @@ public:
/// In this code, C will have two CXXBaseSpecifiers, one for "public
/// virtual A" and the other for "protected B".
class CXXBaseSpecifier {
- /// \brief The source code range that covers the full base
+ /// The source code range that covers the full base
/// specifier, including the "virtual" (if present) and access
/// specifier (if present).
SourceRange Range;
- /// \brief The source location of the ellipsis, if this is a pack
+ /// The source location of the ellipsis, if this is a pack
/// expansion.
SourceLocation EllipsisLoc;
- /// \brief Whether this is a virtual base class or not.
+ /// Whether this is a virtual base class or not.
unsigned Virtual : 1;
- /// \brief Whether this is the base of a class (true) or of a struct (false).
+ /// Whether this is the base of a class (true) or of a struct (false).
///
/// This determines the mapping from the access specifier as written in the
/// source code to the access specifier used for semantic analysis.
unsigned BaseOfClass : 1;
- /// \brief Access specifier as written in the source code (may be AS_none).
+ /// Access specifier as written in the source code (may be AS_none).
///
/// The actual type of data stored here is an AccessSpecifier, but we use
/// "unsigned" here to work around a VC++ bug.
unsigned Access : 2;
- /// \brief Whether the class contains a using declaration
+ /// Whether the class contains a using declaration
/// to inherit the named class's constructors.
unsigned InheritConstructors : 1;
- /// \brief The type of the base class.
+ /// The type of the base class.
///
/// This will be a class or struct (or a typedef of such). The source code
/// range does not include the \c virtual or the access specifier.
@@ -230,40 +231,40 @@ public:
: Range(R), EllipsisLoc(EllipsisLoc), Virtual(V), BaseOfClass(BC),
Access(A), InheritConstructors(false), BaseTypeInfo(TInfo) {}
- /// \brief Retrieves the source range that contains the entire base specifier.
+ /// Retrieves the source range that contains the entire base specifier.
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
- /// \brief Get the location at which the base class type was written.
+ /// Get the location at which the base class type was written.
SourceLocation getBaseTypeLoc() const LLVM_READONLY {
return BaseTypeInfo->getTypeLoc().getLocStart();
}
- /// \brief Determines whether the base class is a virtual base class (or not).
+ /// Determines whether the base class is a virtual base class (or not).
bool isVirtual() const { return Virtual; }
- /// \brief Determine whether this base class is a base of a class declared
+ /// Determine whether this base class is a base of a class declared
/// with the 'class' keyword (vs. one declared with the 'struct' keyword).
bool isBaseOfClass() const { return BaseOfClass; }
- /// \brief Determine whether this base specifier is a pack expansion.
+ /// Determine whether this base specifier is a pack expansion.
bool isPackExpansion() const { return EllipsisLoc.isValid(); }
- /// \brief Determine whether this base class's constructors get inherited.
+ /// Determine whether this base class's constructors get inherited.
bool getInheritConstructors() const { return InheritConstructors; }
- /// \brief Set that this base class's constructors should be inherited.
+ /// Set that this base class's constructors should be inherited.
void setInheritConstructors(bool Inherit = true) {
InheritConstructors = Inherit;
}
- /// \brief For a pack expansion, determine the location of the ellipsis.
+ /// For a pack expansion, determine the location of the ellipsis.
SourceLocation getEllipsisLoc() const {
return EllipsisLoc;
}
- /// \brief Returns the access specifier for this base specifier.
+ /// Returns the access specifier for this base specifier.
///
/// This is the actual base specifier as used for semantic analysis, so
/// the result can never be AS_none. To retrieve the access specifier as
@@ -275,7 +276,7 @@ public:
return (AccessSpecifier)Access;
}
- /// \brief Retrieves the access specifier as written in the source code
+ /// Retrieves the access specifier as written in the source code
/// (which may mean that no access specifier was explicitly written).
///
/// Use getAccessSpecifier() to retrieve the access specifier for use in
@@ -284,18 +285,18 @@ public:
return (AccessSpecifier)Access;
}
- /// \brief Retrieves the type of the base class.
+ /// Retrieves the type of the base class.
///
/// This type will always be an unqualified class type.
QualType getType() const {
return BaseTypeInfo->getType().getUnqualifiedType();
}
- /// \brief Retrieves the type and source location of the base class.
+ /// Retrieves the type and source location of the base class.
TypeSourceInfo *getTypeSourceInfo() const { return BaseTypeInfo; }
};
-/// \brief Represents a C++ struct/union/class.
+/// Represents a C++ struct/union/class.
class CXXRecordDecl : public RecordDecl {
friend class ASTDeclReader;
friend class ASTDeclWriter;
@@ -321,16 +322,16 @@ class CXXRecordDecl : public RecordDecl {
};
struct DefinitionData {
- /// \brief True if this class has any user-declared constructors.
+ /// True if this class has any user-declared constructors.
unsigned UserDeclaredConstructor : 1;
- /// \brief The user-declared special members which this class has.
+ /// The user-declared special members which this class has.
unsigned UserDeclaredSpecialMembers : 6;
- /// \brief True when this class is an aggregate.
+ /// True when this class is an aggregate.
unsigned Aggregate : 1;
- /// \brief True when this class is a POD-type.
+ /// True when this class is a POD-type.
unsigned PlainOldData : 1;
/// true when this class is empty for traits purposes,
@@ -339,15 +340,20 @@ class CXXRecordDecl : public RecordDecl {
/// class. Doesn't take union-ness into account.
unsigned Empty : 1;
- /// \brief True when this class is polymorphic, i.e., has at
+ /// True when this class is polymorphic, i.e., has at
/// least one virtual member or derives from a polymorphic class.
unsigned Polymorphic : 1;
- /// \brief True when this class is abstract, i.e., has at least
+ /// True when this class is abstract, i.e., has at least
/// one pure virtual function, (that can come from a base class).
unsigned Abstract : 1;
- /// \brief True when this class has standard layout.
+ /// True when this class is standard-layout, per the applicable
+ /// language rules (including DRs).
+ unsigned IsStandardLayout : 1;
+
+ /// True when this class was standard-layout under the C++11
+ /// definition.
///
/// C++11 [class]p7. A standard-layout class is a class that:
/// * has no non-static data members of type non-standard-layout class (or
@@ -361,57 +367,63 @@ class CXXRecordDecl : public RecordDecl {
/// classes with non-static data members, and
/// * has no base classes of the same type as the first non-static data
/// member.
- unsigned IsStandardLayout : 1;
+ unsigned IsCXX11StandardLayout : 1;
- /// \brief True when there are no non-empty base classes.
- ///
+ /// True when any base class has any declared non-static data
+ /// members or bit-fields.
/// This is a helper bit of state used to implement IsStandardLayout more
/// efficiently.
- unsigned HasNoNonEmptyBases : 1;
+ unsigned HasBasesWithFields : 1;
+
+ /// True when any base class has any declared non-static data
+ /// members.
+ /// This is a helper bit of state used to implement IsCXX11StandardLayout
+ /// more efficiently.
+ unsigned HasBasesWithNonStaticDataMembers : 1;
- /// \brief True when there are private non-static data members.
+ /// True when there are private non-static data members.
unsigned HasPrivateFields : 1;
- /// \brief True when there are protected non-static data members.
+ /// True when there are protected non-static data members.
unsigned HasProtectedFields : 1;
- /// \brief True when there are private non-static data members.
+ /// True when there are private non-static data members.
unsigned HasPublicFields : 1;
- /// \brief True if this class (or any subobject) has mutable fields.
+ /// True if this class (or any subobject) has mutable fields.
unsigned HasMutableFields : 1;
- /// \brief True if this class (or any nested anonymous struct or union)
+ /// True if this class (or any nested anonymous struct or union)
/// has variant members.
unsigned HasVariantMembers : 1;
- /// \brief True if there no non-field members declared by the user.
+ /// True if there no non-field members declared by the user.
unsigned HasOnlyCMembers : 1;
- /// \brief True if any field has an in-class initializer, including those
+ /// True if any field has an in-class initializer, including those
/// within anonymous unions or structs.
unsigned HasInClassInitializer : 1;
- /// \brief True if any field is of reference type, and does not have an
+ /// True if any field is of reference type, and does not have an
/// in-class initializer.
///
/// In this case, value-initialization of this class is illegal in C++98
/// even if the class has a trivial default constructor.
unsigned HasUninitializedReferenceMember : 1;
- /// \brief True if any non-mutable field whose type doesn't have a user-
+ /// True if any non-mutable field whose type doesn't have a user-
/// provided default ctor also doesn't have an in-class initializer.
unsigned HasUninitializedFields : 1;
- /// \brief True if there are any member using-declarations that inherit
+ /// True if there are any member using-declarations that inherit
/// constructors from a base class.
unsigned HasInheritedConstructor : 1;
- /// \brief True if there are any member using-declarations named
+ /// True if there are any member using-declarations named
/// 'operator='.
unsigned HasInheritedAssignment : 1;
- /// \brief These flags are \c true if a defaulted corresponding special
+ /// These flags are \c true if a defaulted corresponding special
/// member can't be fully analyzed without performing overload resolution.
/// @{
unsigned NeedOverloadResolutionForCopyConstructor : 1;
@@ -420,7 +432,7 @@ class CXXRecordDecl : public RecordDecl {
unsigned NeedOverloadResolutionForDestructor : 1;
/// @}
- /// \brief These flags are \c true if an implicit defaulted corresponding
+ /// These flags are \c true if an implicit defaulted corresponding
/// special member would be defined as deleted.
/// @{
unsigned DefaultedCopyConstructorIsDeleted : 1;
@@ -429,7 +441,7 @@ class CXXRecordDecl : public RecordDecl {
unsigned DefaultedDestructorIsDeleted : 1;
/// @}
- /// \brief The trivial special members which this class has, per
+ /// The trivial special members which this class has, per
/// C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25,
/// C++11 [class.dtor]p5, or would have if the member were not suppressed.
///
@@ -437,7 +449,12 @@ class CXXRecordDecl : public RecordDecl {
/// which have been declared but not yet defined.
unsigned HasTrivialSpecialMembers : 6;
- /// \brief The declared special members of this class which are known to be
+ /// These bits keep track of the triviality of special functions for the
+ /// purpose of calls. Only the bits corresponding to SMF_CopyConstructor,
+ /// SMF_MoveConstructor, and SMF_Destructor are meaningful here.
+ unsigned HasTrivialSpecialMembersForCall : 6;
+
+ /// The declared special members of this class which are known to be
/// non-trivial.
///
/// This excludes any user-declared but not user-provided special members
@@ -445,108 +462,108 @@ class CXXRecordDecl : public RecordDecl {
/// members which have not yet been declared.
unsigned DeclaredNonTrivialSpecialMembers : 6;
- /// \brief True when this class has a destructor with no semantic effect.
+ /// These bits keep track of the declared special members that are
+ /// non-trivial for the purpose of calls.
+ /// Only the bits corresponding to SMF_CopyConstructor,
+ /// SMF_MoveConstructor, and SMF_Destructor are meaningful here.
+ unsigned DeclaredNonTrivialSpecialMembersForCall : 6;
+
+ /// True when this class has a destructor with no semantic effect.
unsigned HasIrrelevantDestructor : 1;
- /// \brief True when this class has at least one user-declared constexpr
+ /// True when this class has at least one user-declared constexpr
/// constructor which is neither the copy nor move constructor.
unsigned HasConstexprNonCopyMoveConstructor : 1;
- /// \brief True if this class has a (possibly implicit) defaulted default
+ /// True if this class has a (possibly implicit) defaulted default
/// constructor.
unsigned HasDefaultedDefaultConstructor : 1;
- /// \brief True if this class can be passed in a non-address-preserving
- /// fashion (such as in registers) according to the C++ language rules.
- /// This does not imply anything about how the ABI in use will actually
- /// pass an object of this class.
- unsigned CanPassInRegisters : 1;
-
- /// \brief True if a defaulted default constructor for this class would
+ /// True if a defaulted default constructor for this class would
/// be constexpr.
unsigned DefaultedDefaultConstructorIsConstexpr : 1;
- /// \brief True if this class has a constexpr default constructor.
+ /// True if this class has a constexpr default constructor.
///
/// This is true for either a user-declared constexpr default constructor
/// or an implicitly declared constexpr default constructor.
unsigned HasConstexprDefaultConstructor : 1;
- /// \brief True when this class contains at least one non-static data
+ /// True when this class contains at least one non-static data
/// member or base class of non-literal or volatile type.
unsigned HasNonLiteralTypeFieldsOrBases : 1;
- /// \brief True when visible conversion functions are already computed
+ /// True when visible conversion functions are already computed
/// and are available.
unsigned ComputedVisibleConversions : 1;
- /// \brief Whether we have a C++11 user-provided default constructor (not
+ /// Whether we have a C++11 user-provided default constructor (not
/// explicitly deleted or defaulted).
unsigned UserProvidedDefaultConstructor : 1;
- /// \brief The special members which have been declared for this class,
+ /// The special members which have been declared for this class,
/// either by the user or implicitly.
unsigned DeclaredSpecialMembers : 6;
- /// \brief Whether an implicit copy constructor could have a const-qualified
+ /// Whether an implicit copy constructor could have a const-qualified
/// parameter, for initializing virtual bases and for other subobjects.
unsigned ImplicitCopyConstructorCanHaveConstParamForVBase : 1;
unsigned ImplicitCopyConstructorCanHaveConstParamForNonVBase : 1;
- /// \brief Whether an implicit copy assignment operator would have a
+ /// Whether an implicit copy assignment operator would have a
/// const-qualified parameter.
unsigned ImplicitCopyAssignmentHasConstParam : 1;
- /// \brief Whether any declared copy constructor has a const-qualified
+ /// Whether any declared copy constructor has a const-qualified
/// parameter.
unsigned HasDeclaredCopyConstructorWithConstParam : 1;
- /// \brief Whether any declared copy assignment operator has either a
+ /// Whether any declared copy assignment operator has either a
/// const-qualified reference parameter or a non-reference parameter.
unsigned HasDeclaredCopyAssignmentWithConstParam : 1;
- /// \brief Whether this class describes a C++ lambda.
+ /// Whether this class describes a C++ lambda.
unsigned IsLambda : 1;
- /// \brief Whether we are currently parsing base specifiers.
+ /// Whether we are currently parsing base specifiers.
unsigned IsParsingBaseSpecifiers : 1;
unsigned HasODRHash : 1;
- /// \brief A hash of parts of the class to help in ODR checking.
+ /// A hash of parts of the class to help in ODR checking.
unsigned ODRHash = 0;
- /// \brief The number of base class specifiers in Bases.
+ /// The number of base class specifiers in Bases.
unsigned NumBases = 0;
- /// \brief The number of virtual base class specifiers in VBases.
+ /// The number of virtual base class specifiers in VBases.
unsigned NumVBases = 0;
- /// \brief Base classes of this class.
+ /// Base classes of this class.
///
/// FIXME: This is wasted space for a union.
LazyCXXBaseSpecifiersPtr Bases;
- /// \brief direct and indirect virtual base classes of this class.
+ /// direct and indirect virtual base classes of this class.
LazyCXXBaseSpecifiersPtr VBases;
- /// \brief The conversion functions of this C++ class (but not its
+ /// The conversion functions of this C++ class (but not its
/// inherited conversion functions).
///
/// Each of the entries in this overload set is a CXXConversionDecl.
LazyASTUnresolvedSet Conversions;
- /// \brief The conversion functions of this C++ class and all those
+ /// The conversion functions of this C++ class and all those
/// inherited conversion functions that are visible in this class.
///
/// Each of the entries in this overload set is a CXXConversionDecl or a
/// FunctionTemplateDecl.
LazyASTUnresolvedSet VisibleConversions;
- /// \brief The declaration which defines this record.
+ /// The declaration which defines this record.
CXXRecordDecl *Definition;
- /// \brief The first friend declaration in this class, or null if there
+ /// The first friend declaration in this class, or null if there
/// aren't any.
///
/// This is actually currently stored in reverse order.
@@ -554,14 +571,14 @@ class CXXRecordDecl : public RecordDecl {
DefinitionData(CXXRecordDecl *D);
- /// \brief Retrieve the set of direct base classes.
+ /// Retrieve the set of direct base classes.
CXXBaseSpecifier *getBases() const {
if (!Bases.isOffset())
return Bases.get(nullptr);
return getBasesSlowCase();
}
- /// \brief Retrieve the set of virtual base classes.
+ /// Retrieve the set of virtual base classes.
CXXBaseSpecifier *getVBases() const {
if (!VBases.isOffset())
return VBases.get(nullptr);
@@ -583,11 +600,11 @@ class CXXRecordDecl : public RecordDecl {
struct DefinitionData *DefinitionData;
- /// \brief Describes a C++ closure type (generated by a lambda expression).
+ /// Describes a C++ closure type (generated by a lambda expression).
struct LambdaDefinitionData : public DefinitionData {
using Capture = LambdaCapture;
- /// \brief Whether this lambda is known to be dependent, even if its
+ /// Whether this lambda is known to be dependent, even if its
/// context isn't dependent.
///
/// A lambda with a non-dependent context can be dependent if it occurs
@@ -597,33 +614,33 @@ class CXXRecordDecl : public RecordDecl {
/// artifact of having to parse the default arguments before.
unsigned Dependent : 1;
- /// \brief Whether this lambda is a generic lambda.
+ /// Whether this lambda is a generic lambda.
unsigned IsGenericLambda : 1;
- /// \brief The Default Capture.
+ /// The Default Capture.
unsigned CaptureDefault : 2;
- /// \brief The number of captures in this lambda is limited 2^NumCaptures.
+ /// The number of captures in this lambda is limited 2^NumCaptures.
unsigned NumCaptures : 15;
- /// \brief The number of explicit captures in this lambda.
+ /// The number of explicit captures in this lambda.
unsigned NumExplicitCaptures : 13;
- /// \brief The number used to indicate this lambda expression for name
+ /// The number used to indicate this lambda expression for name
/// mangling in the Itanium C++ ABI.
unsigned ManglingNumber = 0;
- /// \brief The declaration that provides context for this lambda, if the
+ /// The declaration that provides context for this lambda, if the
/// actual DeclContext does not suffice. This is used for lambdas that
/// occur within default arguments of function parameters within the class
/// or within a data member initializer.
LazyDeclPtr ContextDecl;
- /// \brief The list of captures, both explicit and implicit, for this
+ /// The list of captures, both explicit and implicit, for this
/// lambda.
Capture *Captures = nullptr;
- /// \brief The type of the call method.
+ /// The type of the call method.
TypeSourceInfo *MethodTyInfo;
LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
@@ -661,7 +678,7 @@ class CXXRecordDecl : public RecordDecl {
return static_cast<LambdaDefinitionData&>(*DD);
}
- /// \brief The template or declaration that this declaration
+ /// The template or declaration that this declaration
/// describes or was instantiated from, respectively.
///
/// For non-templates, this value will be null. For record
@@ -673,11 +690,11 @@ class CXXRecordDecl : public RecordDecl {
llvm::PointerUnion<ClassTemplateDecl *, MemberSpecializationInfo *>
TemplateOrInstantiation;
- /// \brief Called from setBases and addedMember to notify the class that a
+ /// Called from setBases and addedMember to notify the class that a
/// direct or virtual base class or a member of class type has been added.
void addedClassSubobject(CXXRecordDecl *Base);
- /// \brief Notify the class that member has been added.
+ /// Notify the class that member has been added.
///
/// This routine helps maintain information about the class based on which
/// members have been added. It will be invoked by DeclContext::addDecl()
@@ -686,20 +703,26 @@ class CXXRecordDecl : public RecordDecl {
void markedVirtualFunctionPure();
- /// \brief Get the head of our list of friend declarations, possibly
+ /// Get the head of our list of friend declarations, possibly
/// deserializing the friends from an external AST source.
FriendDecl *getFirstFriend() const;
+ /// Determine whether this class has an empty base class subobject of type X
+ /// or of one of the types that might be at offset 0 within X (per the C++
+ /// "standard layout" rules).
+ bool hasSubobjectAtOffsetZeroOfEmptyBaseType(ASTContext &Ctx,
+ const CXXRecordDecl *X);
+
protected:
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, CXXRecordDecl *PrevDecl);
public:
- /// \brief Iterator that traverses the base classes of a class.
+ /// Iterator that traverses the base classes of a class.
using base_class_iterator = CXXBaseSpecifier *;
- /// \brief Iterator that traverses the base classes of a class.
+ /// Iterator that traverses the base classes of a class.
using base_class_const_iterator = const CXXBaseSpecifier *;
CXXRecordDecl *getCanonicalDecl() override {
@@ -728,6 +751,21 @@ public:
return const_cast<CXXRecordDecl*>(this)->getMostRecentDecl();
}
+ CXXRecordDecl *getMostRecentNonInjectedDecl() {
+ CXXRecordDecl *Recent =
+ static_cast<CXXRecordDecl *>(this)->getMostRecentDecl();
+ while (Recent->isInjectedClassName()) {
+ // FIXME: Does injected class name need to be in the redeclarations chain?
+ assert(Recent->getPreviousDecl());
+ Recent = Recent->getPreviousDecl();
+ }
+ return Recent;
+ }
+
+ const CXXRecordDecl *getMostRecentNonInjectedDecl() const {
+ return const_cast<CXXRecordDecl*>(this)->getMostRecentNonInjectedDecl();
+ }
+
CXXRecordDecl *getDefinition() const {
// We only need an update if we don't already know which
// declaration is the definition.
@@ -752,6 +790,18 @@ public:
return data().Polymorphic || data().NumVBases != 0;
}
+ /// @returns true if class is dynamic or might be dynamic because the
+ /// definition is incomplete of dependent.
+ bool mayBeDynamicClass() const {
+ return !hasDefinition() || isDynamicClass() || hasAnyDependentBases();
+ }
+
+ /// @returns true if class is non dynamic or might be non dynamic because the
+ /// definition is incomplete of dependent.
+ bool mayBeNonDynamicClass() const {
+ return !hasDefinition() || !isDynamicClass() || hasAnyDependentBases();
+ }
+
void setIsParsingBaseSpecifiers() { data().IsParsingBaseSpecifiers = true; }
bool isParsingBaseSpecifiers() const {
@@ -760,10 +810,10 @@ public:
unsigned getODRHash() const;
- /// \brief Sets the base classes of this struct or class.
+ /// Sets the base classes of this struct or class.
void setBases(CXXBaseSpecifier const * const *Bases, unsigned NumBases);
- /// \brief Retrieves the number of base classes of this class.
+ /// Retrieves the number of base classes of this class.
unsigned getNumBases() const { return data().NumBases; }
using base_class_range = llvm::iterator_range<base_class_iterator>;
@@ -784,7 +834,7 @@ public:
return bases_begin() + data().NumBases;
}
- /// \brief Retrieves the number of virtual base classes of this class.
+ /// Retrieves the number of virtual base classes of this class.
unsigned getNumVBases() const { return data().NumVBases; }
base_class_range vbases() {
@@ -801,7 +851,7 @@ public:
return vbases_begin() + data().NumVBases;
}
- /// \brief Determine whether this class has any dependent base classes which
+ /// Determine whether this class has any dependent base classes which
/// are not the current instantiation.
bool hasAnyDependentBases() const;
@@ -816,13 +866,13 @@ public:
return method_range(method_begin(), method_end());
}
- /// \brief Method begin iterator. Iterates in the order the methods
+ /// Method begin iterator. Iterates in the order the methods
/// were declared.
method_iterator method_begin() const {
return method_iterator(decls_begin());
}
- /// \brief Method past-the-end iterator.
+ /// Method past-the-end iterator.
method_iterator method_end() const {
return method_iterator(decls_end());
}
@@ -857,7 +907,7 @@ public:
return data().FirstFriend.isValid();
}
- /// \brief \c true if a defaulted copy constructor for this class would be
+ /// \c true if a defaulted copy constructor for this class would be
/// deleted.
bool defaultedCopyConstructorIsDeleted() const {
assert((!needsOverloadResolutionForCopyConstructor() ||
@@ -866,7 +916,7 @@ public:
return data().DefaultedCopyConstructorIsDeleted;
}
- /// \brief \c true if a defaulted move constructor for this class would be
+ /// \c true if a defaulted move constructor for this class would be
/// deleted.
bool defaultedMoveConstructorIsDeleted() const {
assert((!needsOverloadResolutionForMoveConstructor() ||
@@ -875,7 +925,7 @@ public:
return data().DefaultedMoveConstructorIsDeleted;
}
- /// \brief \c true if a defaulted destructor for this class would be deleted.
+ /// \c true if a defaulted destructor for this class would be deleted.
bool defaultedDestructorIsDeleted() const {
assert((!needsOverloadResolutionForDestructor() ||
(data().DeclaredSpecialMembers & SMF_Destructor)) &&
@@ -883,41 +933,41 @@ public:
return data().DefaultedDestructorIsDeleted;
}
- /// \brief \c true if we know for sure that this class has a single,
+ /// \c true if we know for sure that this class has a single,
/// accessible, unambiguous copy constructor that is not deleted.
bool hasSimpleCopyConstructor() const {
return !hasUserDeclaredCopyConstructor() &&
!data().DefaultedCopyConstructorIsDeleted;
}
- /// \brief \c true if we know for sure that this class has a single,
+ /// \c true if we know for sure that this class has a single,
/// accessible, unambiguous move constructor that is not deleted.
bool hasSimpleMoveConstructor() const {
return !hasUserDeclaredMoveConstructor() && hasMoveConstructor() &&
!data().DefaultedMoveConstructorIsDeleted;
}
- /// \brief \c true if we know for sure that this class has a single,
+ /// \c true if we know for sure that this class has a single,
/// accessible, unambiguous move assignment operator that is not deleted.
bool hasSimpleMoveAssignment() const {
return !hasUserDeclaredMoveAssignment() && hasMoveAssignment() &&
!data().DefaultedMoveAssignmentIsDeleted;
}
- /// \brief \c true if we know for sure that this class has an accessible
+ /// \c true if we know for sure that this class has an accessible
/// destructor that is not deleted.
bool hasSimpleDestructor() const {
return !hasUserDeclaredDestructor() &&
!data().DefaultedDestructorIsDeleted;
}
- /// \brief Determine whether this class has any default constructors.
+ /// Determine whether this class has any default constructors.
bool hasDefaultConstructor() const {
return (data().DeclaredSpecialMembers & SMF_DefaultConstructor) ||
needsImplicitDefaultConstructor();
}
- /// \brief Determine if we need to declare a default constructor for
+ /// Determine if we need to declare a default constructor for
/// this class.
///
/// This value is used for lazy creation of default constructors.
@@ -930,33 +980,33 @@ public:
!isLambda();
}
- /// \brief Determine whether this class has any user-declared constructors.
+ /// Determine whether this class has any user-declared constructors.
///
/// When true, a default constructor will not be implicitly declared.
bool hasUserDeclaredConstructor() const {
return data().UserDeclaredConstructor;
}
- /// \brief Whether this class has a user-provided default constructor
+ /// Whether this class has a user-provided default constructor
/// per C++11.
bool hasUserProvidedDefaultConstructor() const {
return data().UserProvidedDefaultConstructor;
}
- /// \brief Determine whether this class has a user-declared copy constructor.
+ /// Determine whether this class has a user-declared copy constructor.
///
/// When false, a copy constructor will be implicitly declared.
bool hasUserDeclaredCopyConstructor() const {
return data().UserDeclaredSpecialMembers & SMF_CopyConstructor;
}
- /// \brief Determine whether this class needs an implicit copy
+ /// Determine whether this class needs an implicit copy
/// constructor to be lazily declared.
bool needsImplicitCopyConstructor() const {
return !(data().DeclaredSpecialMembers & SMF_CopyConstructor);
}
- /// \brief Determine whether we need to eagerly declare a defaulted copy
+ /// Determine whether we need to eagerly declare a defaulted copy
/// constructor for this class.
bool needsOverloadResolutionForCopyConstructor() const {
// C++17 [class.copy.ctor]p6:
@@ -971,7 +1021,7 @@ public:
return data().NeedOverloadResolutionForCopyConstructor;
}
- /// \brief Determine whether an implicit copy constructor for this type
+ /// Determine whether an implicit copy constructor for this type
/// would have a parameter with a const-qualified reference type.
bool implicitCopyConstructorHasConstParam() const {
return data().ImplicitCopyConstructorCanHaveConstParamForNonVBase &&
@@ -979,7 +1029,7 @@ public:
data().ImplicitCopyConstructorCanHaveConstParamForVBase);
}
- /// \brief Determine whether this class has a copy constructor with
+ /// Determine whether this class has a copy constructor with
/// a parameter type which is a reference to a const-qualified type.
bool hasCopyConstructorWithConstParam() const {
return data().HasDeclaredCopyConstructorWithConstParam ||
@@ -987,7 +1037,7 @@ public:
implicitCopyConstructorHasConstParam());
}
- /// \brief Whether this class has a user-declared move constructor or
+ /// Whether this class has a user-declared move constructor or
/// assignment operator.
///
/// When false, a move constructor and assignment operator may be
@@ -997,19 +1047,19 @@ public:
(SMF_MoveConstructor | SMF_MoveAssignment);
}
- /// \brief Determine whether this class has had a move constructor
+ /// Determine whether this class has had a move constructor
/// declared by the user.
bool hasUserDeclaredMoveConstructor() const {
return data().UserDeclaredSpecialMembers & SMF_MoveConstructor;
}
- /// \brief Determine whether this class has a move constructor.
+ /// Determine whether this class has a move constructor.
bool hasMoveConstructor() const {
return (data().DeclaredSpecialMembers & SMF_MoveConstructor) ||
needsImplicitMoveConstructor();
}
- /// \brief Set that we attempted to declare an implicit copy
+ /// Set that we attempted to declare an implicit copy
/// constructor, but overload resolution failed so we deleted it.
void setImplicitCopyConstructorIsDeleted() {
assert((data().DefaultedCopyConstructorIsDeleted ||
@@ -1018,7 +1068,7 @@ public:
data().DefaultedCopyConstructorIsDeleted = true;
}
- /// \brief Set that we attempted to declare an implicit move
+ /// Set that we attempted to declare an implicit move
/// constructor, but overload resolution failed so we deleted it.
void setImplicitMoveConstructorIsDeleted() {
assert((data().DefaultedMoveConstructorIsDeleted ||
@@ -1027,7 +1077,7 @@ public:
data().DefaultedMoveConstructorIsDeleted = true;
}
- /// \brief Set that we attempted to declare an implicit destructor,
+ /// Set that we attempted to declare an implicit destructor,
/// but overload resolution failed so we deleted it.
void setImplicitDestructorIsDeleted() {
assert((data().DefaultedDestructorIsDeleted ||
@@ -1036,7 +1086,7 @@ public:
data().DefaultedDestructorIsDeleted = true;
}
- /// \brief Determine whether this class should get an implicit move
+ /// Determine whether this class should get an implicit move
/// constructor or if any existing special member function inhibits this.
bool needsImplicitMoveConstructor() const {
return !(data().DeclaredSpecialMembers & SMF_MoveConstructor) &&
@@ -1046,39 +1096,39 @@ public:
!hasUserDeclaredDestructor();
}
- /// \brief Determine whether we need to eagerly declare a defaulted move
+ /// Determine whether we need to eagerly declare a defaulted move
/// constructor for this class.
bool needsOverloadResolutionForMoveConstructor() const {
return data().NeedOverloadResolutionForMoveConstructor;
}
- /// \brief Determine whether this class has a user-declared copy assignment
+ /// Determine whether this class has a user-declared copy assignment
/// operator.
///
- /// When false, a copy assigment operator will be implicitly declared.
+ /// When false, a copy assignment operator will be implicitly declared.
bool hasUserDeclaredCopyAssignment() const {
return data().UserDeclaredSpecialMembers & SMF_CopyAssignment;
}
- /// \brief Determine whether this class needs an implicit copy
+ /// Determine whether this class needs an implicit copy
/// assignment operator to be lazily declared.
bool needsImplicitCopyAssignment() const {
return !(data().DeclaredSpecialMembers & SMF_CopyAssignment);
}
- /// \brief Determine whether we need to eagerly declare a defaulted copy
+ /// Determine whether we need to eagerly declare a defaulted copy
/// assignment operator for this class.
bool needsOverloadResolutionForCopyAssignment() const {
return data().HasMutableFields;
}
- /// \brief Determine whether an implicit copy assignment operator for this
+ /// Determine whether an implicit copy assignment operator for this
/// type would have a parameter with a const-qualified reference type.
bool implicitCopyAssignmentHasConstParam() const {
return data().ImplicitCopyAssignmentHasConstParam;
}
- /// \brief Determine whether this class has a copy assignment operator with
+ /// Determine whether this class has a copy assignment operator with
/// a parameter type which is a reference to a const-qualified type or is not
/// a reference.
bool hasCopyAssignmentWithConstParam() const {
@@ -1087,19 +1137,19 @@ public:
implicitCopyAssignmentHasConstParam());
}
- /// \brief Determine whether this class has had a move assignment
+ /// Determine whether this class has had a move assignment
/// declared by the user.
bool hasUserDeclaredMoveAssignment() const {
return data().UserDeclaredSpecialMembers & SMF_MoveAssignment;
}
- /// \brief Determine whether this class has a move assignment operator.
+ /// Determine whether this class has a move assignment operator.
bool hasMoveAssignment() const {
return (data().DeclaredSpecialMembers & SMF_MoveAssignment) ||
needsImplicitMoveAssignment();
}
- /// \brief Set that we attempted to declare an implicit move assignment
+ /// Set that we attempted to declare an implicit move assignment
/// operator, but overload resolution failed so we deleted it.
void setImplicitMoveAssignmentIsDeleted() {
assert((data().DefaultedMoveAssignmentIsDeleted ||
@@ -1108,7 +1158,7 @@ public:
data().DefaultedMoveAssignmentIsDeleted = true;
}
- /// \brief Determine whether this class should get an implicit move
+ /// Determine whether this class should get an implicit move
/// assignment operator or if any existing special member function inhibits
/// this.
bool needsImplicitMoveAssignment() const {
@@ -1123,53 +1173,53 @@ public:
!isLambda();
}
- /// \brief Determine whether we need to eagerly declare a move assignment
+ /// Determine whether we need to eagerly declare a move assignment
/// operator for this class.
bool needsOverloadResolutionForMoveAssignment() const {
return data().NeedOverloadResolutionForMoveAssignment;
}
- /// \brief Determine whether this class has a user-declared destructor.
+ /// Determine whether this class has a user-declared destructor.
///
/// When false, a destructor will be implicitly declared.
bool hasUserDeclaredDestructor() const {
return data().UserDeclaredSpecialMembers & SMF_Destructor;
}
- /// \brief Determine whether this class needs an implicit destructor to
+ /// Determine whether this class needs an implicit destructor to
/// be lazily declared.
bool needsImplicitDestructor() const {
return !(data().DeclaredSpecialMembers & SMF_Destructor);
}
- /// \brief Determine whether we need to eagerly declare a destructor for this
+ /// Determine whether we need to eagerly declare a destructor for this
/// class.
bool needsOverloadResolutionForDestructor() const {
return data().NeedOverloadResolutionForDestructor;
}
- /// \brief Determine whether this class describes a lambda function object.
+ /// Determine whether this class describes a lambda function object.
bool isLambda() const {
// An update record can't turn a non-lambda into a lambda.
auto *DD = DefinitionData;
return DD && DD->IsLambda;
}
- /// \brief Determine whether this class describes a generic
+ /// Determine whether this class describes a generic
/// lambda function object (i.e. function call operator is
/// a template).
bool isGenericLambda() const;
- /// \brief Retrieve the lambda call operator of the closure type
+ /// Retrieve the lambda call operator of the closure type
/// if this is a closure type.
CXXMethodDecl *getLambdaCallOperator() const;
- /// \brief Retrieve the lambda static invoker, the address of which
+ /// 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.
CXXMethodDecl *getLambdaStaticInvoker() const;
- /// \brief Retrieve the generic lambda's template parameter list.
+ /// Retrieve the generic lambda's template parameter list.
/// Returns null if the class does not represent a lambda or a generic
/// lambda.
TemplateParameterList *getGenericLambdaTemplateParameterList() const;
@@ -1179,7 +1229,7 @@ public:
return static_cast<LambdaCaptureDefault>(getLambdaData().CaptureDefault);
}
- /// \brief For a closure type, retrieve the mapping from captured
+ /// For a closure type, retrieve the mapping from captured
/// variables and \c this to the non-static data members that store the
/// values or references of the captures.
///
@@ -1225,7 +1275,7 @@ public:
/// this class must currently be in the process of being defined.
void removeConversion(const NamedDecl *Old);
- /// \brief Get all conversion functions visible in current class,
+ /// Get all conversion functions visible in current class,
/// including conversion function templates.
llvm::iterator_range<conversion_iterator> getVisibleConversionFunctions();
@@ -1235,12 +1285,12 @@ public:
/// functions (C++ [dcl.init.aggr]p1).
bool isAggregate() const { return data().Aggregate; }
- /// \brief Whether this class has any in-class initializers
+ /// Whether this class has any in-class initializers
/// for non-static data members (including those in anonymous unions or
/// structs).
bool hasInClassInitializer() const { return data().HasInClassInitializer; }
- /// \brief Whether this class or any of its subobjects has any members of
+ /// Whether this class or any of its subobjects has any members of
/// reference type which would make value-initialization ill-formed.
///
/// Per C++03 [dcl.init]p5:
@@ -1253,7 +1303,7 @@ public:
data().HasUninitializedReferenceMember;
}
- /// \brief Whether this class is a POD-type (C++ [class]p4)
+ /// Whether this class is a POD-type (C++ [class]p4)
///
/// For purposes of this function a class is POD if it is an aggregate
/// that has no non-static non-POD data members, no reference data
@@ -1263,11 +1313,11 @@ public:
/// Note that this is the C++ TR1 definition of POD.
bool isPOD() const { return data().PlainOldData; }
- /// \brief True if this class is C-like, without C++-specific features, e.g.
+ /// True if this class is C-like, without C++-specific features, e.g.
/// it contains only public fields, no bases, tag kind is not 'class', etc.
bool isCLike() const;
- /// \brief Determine whether this is an empty class in the sense of
+ /// Determine whether this is an empty class in the sense of
/// (C++11 [meta.unary.prop]).
///
/// The CXXRecordDecl is a class type, but not a union type,
@@ -1278,7 +1328,7 @@ public:
/// \note This does NOT include a check for union-ness.
bool isEmpty() const { return data().Empty; }
- /// \brief Determine whether this class has direct non-static data members.
+ /// Determine whether this class has direct non-static data members.
bool hasDirectFields() const {
auto &D = data();
return D.HasPublicFields || D.HasProtectedFields || D.HasPrivateFields;
@@ -1288,32 +1338,36 @@ public:
/// which means that the class contains or inherits a virtual function.
bool isPolymorphic() const { return data().Polymorphic; }
- /// \brief Determine whether this class has a pure virtual function.
+ /// Determine whether this class has a pure virtual function.
///
/// The class is is abstract per (C++ [class.abstract]p2) if it declares
/// a pure virtual function or inherits a pure virtual function that is
/// not overridden.
bool isAbstract() const { return data().Abstract; }
- /// \brief Determine whether this class has standard layout per
- /// (C++ [class]p7)
+ /// Determine whether this class is standard-layout per
+ /// C++ [class]p7.
bool isStandardLayout() const { return data().IsStandardLayout; }
- /// \brief Determine whether this class, or any of its class subobjects,
+ /// Determine whether this class was standard-layout per
+ /// C++11 [class]p7, specifically using the C++11 rules without any DRs.
+ bool isCXX11StandardLayout() const { return data().IsCXX11StandardLayout; }
+
+ /// Determine whether this class, or any of its class subobjects,
/// contains a mutable field.
bool hasMutableFields() const { return data().HasMutableFields; }
- /// \brief Determine whether this class has any variant members.
+ /// Determine whether this class has any variant members.
bool hasVariantMembers() const { return data().HasVariantMembers; }
- /// \brief Determine whether this class has a trivial default constructor
+ /// Determine whether this class has a trivial default constructor
/// (C++11 [class.ctor]p5).
bool hasTrivialDefaultConstructor() const {
return hasDefaultConstructor() &&
(data().HasTrivialSpecialMembers & SMF_DefaultConstructor);
}
- /// \brief Determine whether this class has a non-trivial default constructor
+ /// Determine whether this class has a non-trivial default constructor
/// (C++11 [class.ctor]p5).
bool hasNonTrivialDefaultConstructor() const {
return (data().DeclaredNonTrivialSpecialMembers & SMF_DefaultConstructor) ||
@@ -1321,7 +1375,7 @@ public:
!(data().HasTrivialSpecialMembers & SMF_DefaultConstructor));
}
- /// \brief Determine whether this class has at least one constexpr constructor
+ /// Determine whether this class has at least one constexpr constructor
/// other than the copy or move constructors.
bool hasConstexprNonCopyMoveConstructor() const {
return data().HasConstexprNonCopyMoveConstructor ||
@@ -1329,41 +1383,56 @@ public:
defaultedDefaultConstructorIsConstexpr());
}
- /// \brief Determine whether a defaulted default constructor for this class
+ /// Determine whether a defaulted default constructor for this class
/// would be constexpr.
bool defaultedDefaultConstructorIsConstexpr() const {
return data().DefaultedDefaultConstructorIsConstexpr &&
(!isUnion() || hasInClassInitializer() || !hasVariantMembers());
}
- /// \brief Determine whether this class has a constexpr default constructor.
+ /// Determine whether this class has a constexpr default constructor.
bool hasConstexprDefaultConstructor() const {
return data().HasConstexprDefaultConstructor ||
(needsImplicitDefaultConstructor() &&
defaultedDefaultConstructorIsConstexpr());
}
- /// \brief Determine whether this class has a trivial copy constructor
+ /// Determine whether this class has a trivial copy constructor
/// (C++ [class.copy]p6, C++11 [class.copy]p12)
bool hasTrivialCopyConstructor() const {
return data().HasTrivialSpecialMembers & SMF_CopyConstructor;
}
- /// \brief Determine whether this class has a non-trivial copy constructor
+ bool hasTrivialCopyConstructorForCall() const {
+ return data().HasTrivialSpecialMembersForCall & SMF_CopyConstructor;
+ }
+
+ /// Determine whether this class has a non-trivial copy constructor
/// (C++ [class.copy]p6, C++11 [class.copy]p12)
bool hasNonTrivialCopyConstructor() const {
return data().DeclaredNonTrivialSpecialMembers & SMF_CopyConstructor ||
!hasTrivialCopyConstructor();
}
- /// \brief Determine whether this class has a trivial move constructor
+ bool hasNonTrivialCopyConstructorForCall() const {
+ return (data().DeclaredNonTrivialSpecialMembersForCall &
+ SMF_CopyConstructor) ||
+ !hasTrivialCopyConstructorForCall();
+ }
+
+ /// Determine whether this class has a trivial move constructor
/// (C++11 [class.copy]p12)
bool hasTrivialMoveConstructor() const {
return hasMoveConstructor() &&
(data().HasTrivialSpecialMembers & SMF_MoveConstructor);
}
- /// \brief Determine whether this class has a non-trivial move constructor
+ bool hasTrivialMoveConstructorForCall() const {
+ return hasMoveConstructor() &&
+ (data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor);
+ }
+
+ /// Determine whether this class has a non-trivial move constructor
/// (C++11 [class.copy]p12)
bool hasNonTrivialMoveConstructor() const {
return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveConstructor) ||
@@ -1371,27 +1440,34 @@ public:
!(data().HasTrivialSpecialMembers & SMF_MoveConstructor));
}
- /// \brief Determine whether this class has a trivial copy assignment operator
+ bool hasNonTrivialMoveConstructorForCall() const {
+ return (data().DeclaredNonTrivialSpecialMembersForCall &
+ SMF_MoveConstructor) ||
+ (needsImplicitMoveConstructor() &&
+ !(data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor));
+ }
+
+ /// Determine whether this class has a trivial copy assignment operator
/// (C++ [class.copy]p11, C++11 [class.copy]p25)
bool hasTrivialCopyAssignment() const {
return data().HasTrivialSpecialMembers & SMF_CopyAssignment;
}
- /// \brief Determine whether this class has a non-trivial copy assignment
+ /// Determine whether this class has a non-trivial copy assignment
/// operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool hasNonTrivialCopyAssignment() const {
return data().DeclaredNonTrivialSpecialMembers & SMF_CopyAssignment ||
!hasTrivialCopyAssignment();
}
- /// \brief Determine whether this class has a trivial move assignment operator
+ /// Determine whether this class has a trivial move assignment operator
/// (C++11 [class.copy]p25)
bool hasTrivialMoveAssignment() const {
return hasMoveAssignment() &&
(data().HasTrivialSpecialMembers & SMF_MoveAssignment);
}
- /// \brief Determine whether this class has a non-trivial move assignment
+ /// Determine whether this class has a non-trivial move assignment
/// operator (C++11 [class.copy]p25)
bool hasNonTrivialMoveAssignment() const {
return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveAssignment) ||
@@ -1399,19 +1475,32 @@ public:
!(data().HasTrivialSpecialMembers & SMF_MoveAssignment));
}
- /// \brief Determine whether this class has a trivial destructor
+ /// Determine whether this class has a trivial destructor
/// (C++ [class.dtor]p3)
bool hasTrivialDestructor() const {
return data().HasTrivialSpecialMembers & SMF_Destructor;
}
- /// \brief Determine whether this class has a non-trivial destructor
+ bool hasTrivialDestructorForCall() const {
+ return data().HasTrivialSpecialMembersForCall & SMF_Destructor;
+ }
+
+ /// Determine whether this class has a non-trivial destructor
/// (C++ [class.dtor]p3)
bool hasNonTrivialDestructor() const {
return !(data().HasTrivialSpecialMembers & SMF_Destructor);
}
- /// \brief Determine whether declaring a const variable with this type is ok
+ bool hasNonTrivialDestructorForCall() const {
+ return !(data().HasTrivialSpecialMembersForCall & SMF_Destructor);
+ }
+
+ void setHasTrivialSpecialMemberForCall() {
+ data().HasTrivialSpecialMembersForCall =
+ (SMF_CopyConstructor | SMF_MoveConstructor | SMF_Destructor);
+ }
+
+ /// Determine whether declaring a const variable with this type is ok
/// per core issue 253.
bool allowConstDefaultInit() const {
return !data().HasUninitializedFields ||
@@ -1419,7 +1508,7 @@ public:
needsImplicitDefaultConstructor());
}
- /// \brief Determine whether this class has a destructor which has no
+ /// Determine whether this class has a destructor which has no
/// semantic effect.
///
/// Any such destructor will be trivial, public, defaulted and not deleted,
@@ -1428,41 +1517,29 @@ public:
return data().HasIrrelevantDestructor;
}
- /// \brief Determine whether this class has at least one trivial, non-deleted
- /// copy or move constructor.
- bool canPassInRegisters() const {
- return data().CanPassInRegisters;
- }
-
- /// \brief Set that we can pass this RecordDecl in registers.
- // FIXME: This should be set as part of completeDefinition.
- void setCanPassInRegisters(bool CanPass) {
- data().CanPassInRegisters = CanPass;
- }
-
- /// \brief Determine whether this class has a non-literal or/ volatile type
+ /// Determine whether this class has a non-literal or/ volatile type
/// non-static data member or base class.
bool hasNonLiteralTypeFieldsOrBases() const {
return data().HasNonLiteralTypeFieldsOrBases;
}
- /// \brief Determine whether this class has a using-declaration that names
+ /// Determine whether this class has a using-declaration that names
/// a user-declared base class constructor.
bool hasInheritedConstructor() const {
return data().HasInheritedConstructor;
}
- /// \brief Determine whether this class has a using-declaration that names
+ /// Determine whether this class has a using-declaration that names
/// a base class assignment operator.
bool hasInheritedAssignment() const {
return data().HasInheritedAssignment;
}
- /// \brief Determine whether this class is considered trivially copyable per
+ /// Determine whether this class is considered trivially copyable per
/// (C++11 [class]p6).
bool isTriviallyCopyable() const;
- /// \brief Determine whether this class is considered trivial.
+ /// Determine whether this class is considered trivial.
///
/// C++11 [class]p6:
/// "A trivial class is a class that has a trivial default constructor and
@@ -1471,7 +1548,7 @@ public:
return isTriviallyCopyable() && hasTrivialDefaultConstructor();
}
- /// \brief Determine whether this class is a literal type.
+ /// Determine whether this class is a literal type.
///
/// C++11 [basic.types]p10:
/// A class type that has all the following properties:
@@ -1497,7 +1574,7 @@ public:
hasTrivialDefaultConstructor());
}
- /// \brief If this record is an instantiation of a member class,
+ /// If this record is an instantiation of a member class,
/// retrieves the member class from which it was instantiated.
///
/// This routine will return non-null for (non-templated) member
@@ -1518,17 +1595,17 @@ public:
/// declaration returned by getInstantiatedFromMemberClass().
CXXRecordDecl *getInstantiatedFromMemberClass() const;
- /// \brief If this class is an instantiation of a member class of a
+ /// If this class is an instantiation of a member class of a
/// class template specialization, retrieves the member specialization
/// information.
MemberSpecializationInfo *getMemberSpecializationInfo() const;
- /// \brief Specify that this record is an instantiation of the
+ /// Specify that this record is an instantiation of the
/// member class \p RD.
void setInstantiationOfMemberClass(CXXRecordDecl *RD,
TemplateSpecializationKind TSK);
- /// \brief Retrieves the class template that is described by this
+ /// Retrieves the class template that is described by this
/// class declaration.
///
/// Every class template is represented as a ClassTemplateDecl and a
@@ -1543,15 +1620,15 @@ public:
void setDescribedClassTemplate(ClassTemplateDecl *Template);
- /// \brief Determine whether this particular class is a specialization or
+ /// Determine whether this particular class is a specialization or
/// instantiation of a class template or member class of a class template,
/// and how it was instantiated or specialized.
TemplateSpecializationKind getTemplateSpecializationKind() const;
- /// \brief Set the kind of specialization or template instantiation this is.
+ /// Set the kind of specialization or template instantiation this is.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
- /// \brief Retrieve the record declaration from which this record could be
+ /// Retrieve the record declaration from which this record could be
/// instantiated. Returns null if this class is not a template instantiation.
const CXXRecordDecl *getTemplateInstantiationPattern() const;
@@ -1560,17 +1637,17 @@ public:
->getTemplateInstantiationPattern());
}
- /// \brief Returns the destructor decl for this class.
+ /// Returns the destructor decl for this class.
CXXDestructorDecl *getDestructor() const;
- /// \brief Returns true if the class destructor, or any implicitly invoked
+ /// Returns true if the class destructor, or any implicitly invoked
/// destructors are marked noreturn.
bool isAnyDestructorNoReturn() const;
- /// \brief If the class is a local class [class.local], returns
+ /// If the class is a local class [class.local], returns
/// the enclosing function declaration.
const FunctionDecl *isLocalClass() const {
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(getDeclContext()))
+ if (const auto *RD = dyn_cast<CXXRecordDecl>(getDeclContext()))
return RD->isLocalClass();
return dyn_cast<FunctionDecl>(getDeclContext());
@@ -1581,11 +1658,11 @@ public:
const_cast<const CXXRecordDecl*>(this)->isLocalClass());
}
- /// \brief Determine whether this dependent class is a current instantiation,
+ /// Determine whether this dependent class is a current instantiation,
/// when viewed from within the given context.
bool isCurrentInstantiation(const DeclContext *CurContext) const;
- /// \brief Determine whether this class is derived from the class \p Base.
+ /// Determine whether this class is derived from the class \p Base.
///
/// This routine only determines whether this class is derived from \p Base,
/// but does not account for factors that may make a Derived -> Base class
@@ -1597,7 +1674,7 @@ public:
/// \returns true if this class is derived from Base, false otherwise.
bool isDerivedFrom(const CXXRecordDecl *Base) const;
- /// \brief Determine whether this class is derived from the type \p Base.
+ /// Determine whether this class is derived from the type \p Base.
///
/// This routine only determines whether this class is derived from \p Base,
/// but does not account for factors that may make a Derived -> Base class
@@ -1615,7 +1692,7 @@ public:
/// tangling input and output in \p Paths
bool isDerivedFrom(const CXXRecordDecl *Base, CXXBasePaths &Paths) const;
- /// \brief Determine whether this class is virtually derived from
+ /// Determine whether this class is virtually derived from
/// the class \p Base.
///
/// This routine only determines whether this class is virtually
@@ -1630,11 +1707,11 @@ public:
/// false otherwise.
bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const;
- /// \brief Determine whether this class is provably not derived from
+ /// Determine whether this class is provably not derived from
/// the type \p Base.
bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const;
- /// \brief Function type used by forallBases() as a callback.
+ /// Function type used by forallBases() as a callback.
///
/// \param BaseDefinition the definition of the base class
///
@@ -1642,7 +1719,7 @@ public:
using ForallBasesCallback =
llvm::function_ref<bool(const CXXRecordDecl *BaseDefinition)>;
- /// \brief Determines if the given callback holds for all the direct
+ /// Determines if the given callback holds for all the direct
/// or indirect base classes of this type.
///
/// The class itself does not count as a base class. This routine
@@ -1658,7 +1735,7 @@ public:
bool forallBases(ForallBasesCallback BaseMatches,
bool AllowShortCircuit = true) const;
- /// \brief Function type used by lookupInBases() to determine whether a
+ /// Function type used by lookupInBases() to determine whether a
/// specific base class subobject matches the lookup criteria.
///
/// \param Specifier the base-class specifier that describes the inheritance
@@ -1672,7 +1749,7 @@ public:
llvm::function_ref<bool(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path)>;
- /// \brief Look for entities within the base classes of this C++ class,
+ /// Look for entities within the base classes of this C++ class,
/// transitively searching all base class subobjects.
///
/// This routine uses the callback function \p BaseMatches to find base
@@ -1696,7 +1773,7 @@ public:
bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths,
bool LookupInDependent = false) const;
- /// \brief Base-class lookup callback that determines whether the given
+ /// Base-class lookup callback that determines whether the given
/// base class specifier refers to a specific class declaration.
///
/// This callback can be used with \c lookupInBases() to determine whether
@@ -1706,7 +1783,7 @@ public:
static bool FindBaseClass(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path, const CXXRecordDecl *BaseRecord);
- /// \brief Base-class lookup callback that determines whether the
+ /// Base-class lookup callback that determines whether the
/// given base class specifier refers to a specific class
/// declaration and describes virtual derivation.
///
@@ -1719,7 +1796,7 @@ public:
CXXBasePath &Path,
const CXXRecordDecl *BaseRecord);
- /// \brief Base-class lookup callback that determines whether there exists
+ /// 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
@@ -1727,7 +1804,7 @@ public:
static bool FindTagMember(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path, DeclarationName Name);
- /// \brief Base-class lookup callback that determines whether there exists
+ /// 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
@@ -1735,7 +1812,7 @@ public:
static bool FindOrdinaryMember(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path, DeclarationName Name);
- /// \brief Base-class lookup callback that determines whether there exists
+ /// 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
@@ -1745,7 +1822,7 @@ public:
FindOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path, DeclarationName Name);
- /// \brief Base-class lookup callback that determines whether there exists
+ /// 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
@@ -1753,7 +1830,7 @@ public:
static bool FindOMPReductionMember(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path, DeclarationName Name);
- /// \brief Base-class lookup callback that determines whether there exists
+ /// 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
@@ -1763,12 +1840,12 @@ public:
CXXBasePath &Path,
DeclarationName Name);
- /// \brief Retrieve the final overriders for each virtual member
+ /// 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.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const;
- /// \brief Get the indirect primary bases for this class.
+ /// Get the indirect primary bases for this class.
void getIndirectPrimaryBases(CXXIndirectPrimaryBaseSet& Bases) const;
/// Performs an imprecise lookup of a dependent name in this class.
@@ -1784,7 +1861,7 @@ public:
/// GraphViz.
void viewInheritance(ASTContext& Context) const;
- /// \brief Calculates the access of a decl that is reached
+ /// Calculates the access of a decl that is reached
/// along a path.
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess,
AccessSpecifier DeclAccess) {
@@ -1793,14 +1870,16 @@ public:
return (PathAccess > DeclAccess ? PathAccess : DeclAccess);
}
- /// \brief Indicates that the declaration of a defaulted or deleted special
+ /// Indicates that the declaration of a defaulted or deleted special
/// member function is now complete.
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD);
- /// \brief Indicates that the definition of this class is now complete.
+ void setTrivialForCallFlags(CXXMethodDecl *MD);
+
+ /// Indicates that the definition of this class is now complete.
void completeDefinition() override;
- /// \brief Indicates that the definition of this class is now complete,
+ /// Indicates that the definition of this class is now complete,
/// and provides a final overrider map to help determine
///
/// \param FinalOverriders The final overrider map for this class, which can
@@ -1809,7 +1888,7 @@ public:
/// definition.
void completeDefinition(CXXFinalOverriderMap *FinalOverriders);
- /// \brief Determine whether this class may end up being abstract, even though
+ /// Determine whether this class may end up being abstract, even though
/// it is not yet known to be abstract.
///
/// \returns true if this class is not known to be abstract but has any
@@ -1818,7 +1897,7 @@ public:
/// actually abstract.
bool mayBeAbstract() const;
- /// \brief If this is the closure type of a lambda expression, retrieve the
+ /// If this is the closure type of a lambda expression, retrieve the
/// number to be used for name mangling in the Itanium C++ ABI.
///
/// Zero indicates that this closure type has internal linkage, so the
@@ -1829,7 +1908,7 @@ public:
return getLambdaData().ManglingNumber;
}
- /// \brief Retrieve the declaration that provides additional context for a
+ /// Retrieve the declaration that provides additional context for a
/// lambda, when the normal declaration context is not specific enough.
///
/// Certain contexts (default arguments of in-class function parameters and
@@ -1840,17 +1919,17 @@ public:
/// the declaration context suffices.
Decl *getLambdaContextDecl() const;
- /// \brief Set the mangling number and context declaration for a lambda
+ /// Set the mangling number and context declaration for a lambda
/// class.
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl) {
getLambdaData().ManglingNumber = ManglingNumber;
getLambdaData().ContextDecl = ContextDecl;
}
- /// \brief Returns the inheritance model used for this record.
+ /// Returns the inheritance model used for this record.
MSInheritanceAttr::Spelling getMSInheritanceModel() const;
- /// \brief Calculate what the inheritance model would be for this class.
+ /// Calculate what the inheritance model would be for this class.
MSInheritanceAttr::Spelling calculateInheritanceModel() const;
/// In the Microsoft C++ ABI, use zero for the field offset of a null data
@@ -1865,11 +1944,11 @@ public:
(hasDefinition() && isPolymorphic());
}
- /// \brief Controls when vtordisps will be emitted if this record is used as a
+ /// Controls when vtordisps will be emitted if this record is used as a
/// virtual base.
MSVtorDispAttr::Mode getMSVtorDispMode() const;
- /// \brief Determine whether this lambda expression was known to be dependent
+ /// Determine whether this lambda expression was known to be dependent
/// at the time it was created, even if its context does not appear to be
/// dependent.
///
@@ -1888,8 +1967,8 @@ public:
return getLambdaData().MethodTyInfo;
}
- // \brief Determine whether this type is an Interface Like type for
- // __interface inheritence purposes.
+ // Determine whether this type is an Interface Like type for
+ // __interface inheritance purposes.
bool isInterfaceLike() const;
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -1898,7 +1977,7 @@ public:
}
};
-/// \brief Represents a C++ deduction guide declaration.
+/// Represents a C++ deduction guide declaration.
///
/// \code
/// template<typename T> struct A { A(); A(T); };
@@ -1957,7 +2036,7 @@ public:
static bool classofKind(Kind K) { return K == CXXDeductionGuide; }
};
-/// \brief Represents a static or instance method of a struct/union/class.
+/// Represents a static or instance method of a struct/union/class.
///
/// In the terminology of the C++ Standard, these are the (static and
/// non-static) member functions, whether virtual or not.
@@ -2007,8 +2086,7 @@ public:
bool isVolatile() const { return getType()->castAs<FunctionType>()->isVolatile(); }
bool isVirtual() const {
- CXXMethodDecl *CD =
- cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl());
+ CXXMethodDecl *CD = const_cast<CXXMethodDecl*>(this)->getCanonicalDecl();
// Member function is virtual if it is marked explicitly so, or if it is
// declared in __interface -- then it is automatically pure virtual.
@@ -2031,16 +2109,16 @@ public:
Base, IsAppleKext);
}
- /// \brief Determine whether this is a usual deallocation function
+ /// Determine whether this is a usual deallocation function
/// (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded
/// delete or delete[] operator with a particular signature.
bool isUsualDeallocationFunction() const;
- /// \brief Determine whether this is a copy-assignment operator, regardless
+ /// Determine whether this is a copy-assignment operator, regardless
/// of whether it was declared implicitly or explicitly.
bool isCopyAssignmentOperator() const;
- /// \brief Determine whether this is a move assignment operator.
+ /// Determine whether this is a move assignment operator.
bool isMoveAssignmentOperator() const;
CXXMethodDecl *getCanonicalDecl() override {
@@ -2093,7 +2171,7 @@ public:
cast<CXXRecordDecl>(FunctionDecl::getParent()));
}
- /// \brief Returns the type of the \c this pointer.
+ /// Returns the type of the \c this pointer.
///
/// Should only be called for instance (i.e., non-static) methods. Note
/// that for the call operator of a lambda closure type, this returns the
@@ -2105,7 +2183,7 @@ public:
return getType()->getAs<FunctionProtoType>()->getTypeQuals();
}
- /// \brief Retrieve the ref-qualifier associated with this method.
+ /// Retrieve the ref-qualifier associated with this method.
///
/// In the following example, \c f() has an lvalue ref-qualifier, \c g()
/// has an rvalue ref-qualifier, and \c h() has no ref-qualifier.
@@ -2122,7 +2200,7 @@ public:
bool hasInlineBody() const;
- /// \brief Determine whether this is a lambda closure type's static member
+ /// Determine whether this is a lambda closure type's static member
/// function that is used for the result of the lambda's conversion to
/// function pointer (for a lambda with no captures).
///
@@ -2131,7 +2209,7 @@ public:
/// or clone the function call operator.
bool isLambdaStaticInvoker() const;
- /// \brief Find the method in \p RD that corresponds to this one.
+ /// Find the method in \p RD that corresponds to this one.
///
/// Find if \p RD or one of the classes it inherits from override this method.
/// If so, return it. \p RD is assumed to be a subclass of the class defining
@@ -2154,7 +2232,7 @@ public:
}
};
-/// \brief Represents a C++ base or member initializer.
+/// Represents a C++ base or member initializer.
///
/// This is part of a constructor initializer that
/// initializes one non-static member variable or one base class. For
@@ -2170,13 +2248,13 @@ public:
/// };
/// \endcode
class CXXCtorInitializer final {
- /// \brief Either the base class name/delegating constructor type (stored as
+ /// Either the base class name/delegating constructor type (stored as
/// a TypeSourceInfo*), an normal field (FieldDecl), or an anonymous field
/// (IndirectFieldDecl*) being initialized.
llvm::PointerUnion3<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *>
Initializee;
- /// \brief The source location for the field name or, for a base initializer
+ /// The source location for the field name or, for a base initializer
/// pack expansion, the location of the ellipsis.
///
/// In the case of a delegating
@@ -2184,25 +2262,25 @@ class CXXCtorInitializer final {
/// Initializee points to the CXXConstructorDecl (to allow loop detection).
SourceLocation MemberOrEllipsisLocation;
- /// \brief The argument used to initialize the base or member, which may
+ /// The argument used to initialize the base or member, which may
/// end up constructing an object (when multiple arguments are involved).
Stmt *Init;
- /// \brief Location of the left paren of the ctor-initializer.
+ /// Location of the left paren of the ctor-initializer.
SourceLocation LParenLoc;
- /// \brief Location of the right paren of the ctor-initializer.
+ /// Location of the right paren of the ctor-initializer.
SourceLocation RParenLoc;
- /// \brief If the initializee is a type, whether that type makes this
+ /// If the initializee is a type, whether that type makes this
/// a delegating initialization.
unsigned IsDelegating : 1;
- /// \brief If the initializer is a base initializer, this keeps track
+ /// If the initializer is a base initializer, this keeps track
/// of whether the base is virtual or not.
unsigned IsVirtual : 1;
- /// \brief Whether or not the initializer is explicitly written
+ /// Whether or not the initializer is explicitly written
/// in the sources.
unsigned IsWritten : 1;
@@ -2211,35 +2289,35 @@ class CXXCtorInitializer final {
unsigned SourceOrder : 13;
public:
- /// \brief Creates a new base-class initializer.
+ /// Creates a new base-class initializer.
explicit
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual,
SourceLocation L, Expr *Init, SourceLocation R,
SourceLocation EllipsisLoc);
- /// \brief Creates a new member initializer.
+ /// Creates a new member initializer.
explicit
CXXCtorInitializer(ASTContext &Context, FieldDecl *Member,
SourceLocation MemberLoc, SourceLocation L, Expr *Init,
SourceLocation R);
- /// \brief Creates a new anonymous field initializer.
+ /// Creates a new anonymous field initializer.
explicit
CXXCtorInitializer(ASTContext &Context, IndirectFieldDecl *Member,
SourceLocation MemberLoc, SourceLocation L, Expr *Init,
SourceLocation R);
- /// \brief Creates a new delegating initializer.
+ /// Creates a new delegating initializer.
explicit
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo,
SourceLocation L, Expr *Init, SourceLocation R);
- /// \brief Determine whether this initializer is initializing a base class.
+ /// Determine whether this initializer is initializing a base class.
bool isBaseInitializer() const {
return Initializee.is<TypeSourceInfo*>() && !IsDelegating;
}
- /// \brief Determine whether this initializer is initializing a non-static
+ /// Determine whether this initializer is initializing a non-static
/// data member.
bool isMemberInitializer() const { return Initializee.is<FieldDecl*>(); }
@@ -2251,7 +2329,7 @@ public:
return Initializee.is<IndirectFieldDecl*>();
}
- /// \brief Determine whether this initializer is an implicit initializer
+ /// Determine whether this initializer is an implicit initializer
/// generated for a field with an initializer defined on the member
/// declaration.
///
@@ -2261,18 +2339,18 @@ public:
return Init->getStmtClass() == Stmt::CXXDefaultInitExprClass;
}
- /// \brief Determine whether this initializer is creating a delegating
+ /// Determine whether this initializer is creating a delegating
/// constructor.
bool isDelegatingInitializer() const {
return Initializee.is<TypeSourceInfo*>() && IsDelegating;
}
- /// \brief Determine whether this initializer is a pack expansion.
+ /// Determine whether this initializer is a pack expansion.
bool isPackExpansion() const {
return isBaseInitializer() && MemberOrEllipsisLocation.isValid();
}
- // \brief For a pack expansion, returns the location of the ellipsis.
+ // For a pack expansion, returns the location of the ellipsis.
SourceLocation getEllipsisLoc() const {
assert(isPackExpansion() && "Initializer is not a pack expansion");
return MemberOrEllipsisLocation;
@@ -2294,13 +2372,13 @@ public:
return IsVirtual;
}
- /// \brief Returns the declarator information for a base class or delegating
+ /// Returns the declarator information for a base class or delegating
/// initializer.
TypeSourceInfo *getTypeSourceInfo() const {
return Initializee.dyn_cast<TypeSourceInfo *>();
}
- /// \brief If this is a member initializer, returns the declaration of the
+ /// If this is a member initializer, returns the declaration of the
/// non-static data member being initialized. Otherwise, returns null.
FieldDecl *getMember() const {
if (isMemberInitializer())
@@ -2326,23 +2404,23 @@ public:
return MemberOrEllipsisLocation;
}
- /// \brief Determine the source location of the initializer.
+ /// Determine the source location of the initializer.
SourceLocation getSourceLocation() const;
- /// \brief Determine the source range covering the entire initializer.
+ /// Determine the source range covering the entire initializer.
SourceRange getSourceRange() const LLVM_READONLY;
- /// \brief Determine whether this initializer is explicitly written
+ /// Determine whether this initializer is explicitly written
/// in the source code.
bool isWritten() const { return IsWritten; }
- /// \brief Return the source position of the initializer, counting from 0.
+ /// Return the source position of the initializer, counting from 0.
/// If the initializer was implicit, -1 is returned.
int getSourceOrder() const {
return IsWritten ? static_cast<int>(SourceOrder) : -1;
}
- /// \brief Set the source order of this initializer.
+ /// Set the source order of this initializer.
///
/// This can only be called once for each initializer; it cannot be called
/// on an initializer having a positive number of (implicit) array indices.
@@ -2363,8 +2441,8 @@ public:
SourceLocation getLParenLoc() const { return LParenLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
- /// \brief Get the initializer.
- Expr *getInit() const { return static_cast<Expr*>(Init); }
+ /// Get the initializer.
+ Expr *getInit() const { return static_cast<Expr *>(Init); }
};
/// Description of a constructor that was inherited from a base class.
@@ -2384,7 +2462,7 @@ public:
CXXConstructorDecl *getConstructor() const { return BaseCtor; }
};
-/// \brief Represents a C++ constructor within a class.
+/// Represents a C++ constructor within a class.
///
/// For example:
///
@@ -2399,12 +2477,12 @@ class CXXConstructorDecl final
private llvm::TrailingObjects<CXXConstructorDecl, InheritedConstructor> {
/// \name Support for base and member initializers.
/// \{
- /// \brief The arguments used to initialize the base or member.
+ /// The arguments used to initialize the base or member.
LazyCXXCtorInitializersPtr CtorInitializers;
unsigned NumCtorInitializers : 31;
/// \}
- /// \brief Whether this constructor declaration is an implicitly-declared
+ /// Whether this constructor declaration is an implicitly-declared
/// inheriting constructor.
unsigned IsInheritingConstructor : 1;
@@ -2439,10 +2517,10 @@ public:
bool isConstexpr,
InheritedConstructor Inherited = InheritedConstructor());
- /// \brief Iterates through the member/base initializer list.
+ /// Iterates through the member/base initializer list.
using init_iterator = CXXCtorInitializer **;
- /// \brief Iterates through the member/base initializer list.
+ /// Iterates through the member/base initializer list.
using init_const_iterator = CXXCtorInitializer *const *;
using init_range = llvm::iterator_range<init_iterator>;
@@ -2453,21 +2531,21 @@ public:
return init_const_range(init_begin(), init_end());
}
- /// \brief Retrieve an iterator to the first initializer.
+ /// Retrieve an iterator to the first initializer.
init_iterator init_begin() {
const auto *ConstThis = this;
return const_cast<init_iterator>(ConstThis->init_begin());
}
- /// \brief Retrieve an iterator to the first initializer.
+ /// Retrieve an iterator to the first initializer.
init_const_iterator init_begin() const;
- /// \brief Retrieve an iterator past the last initializer.
+ /// Retrieve an iterator past the last initializer.
init_iterator init_end() {
return init_begin() + NumCtorInitializers;
}
- /// \brief Retrieve an iterator past the last initializer.
+ /// Retrieve an iterator past the last initializer.
init_const_iterator init_end() const {
return init_begin() + NumCtorInitializers;
}
@@ -2490,7 +2568,7 @@ public:
return init_const_reverse_iterator(init_begin());
}
- /// \brief Determine the number of arguments used to initialize the member
+ /// Determine the number of arguments used to initialize the member
/// or base.
unsigned getNumCtorInitializers() const {
return NumCtorInitializers;
@@ -2512,13 +2590,13 @@ public:
return getCanonicalDecl()->isExplicitSpecified();
}
- /// \brief Determine whether this constructor is a delegating constructor.
+ /// Determine whether this constructor is a delegating constructor.
bool isDelegatingConstructor() const {
return (getNumCtorInitializers() == 1) &&
init_begin()[0]->isDelegatingInitializer();
}
- /// \brief When this constructor delegates to another, retrieve the target.
+ /// When this constructor delegates to another, retrieve the target.
CXXConstructorDecl *getTargetConstructor() const;
/// Whether this constructor is a default
@@ -2526,7 +2604,7 @@ public:
/// default-initialize a class of this type.
bool isDefaultConstructor() const;
- /// \brief Whether this constructor is a copy constructor (C++ [class.copy]p2,
+ /// Whether this constructor is a copy constructor (C++ [class.copy]p2,
/// which can be used to copy the class.
///
/// \p TypeQuals will be set to the qualifiers on the
@@ -2549,27 +2627,27 @@ public:
return isCopyConstructor(TypeQuals);
}
- /// \brief Determine whether this constructor is a move constructor
+ /// Determine whether this constructor is a move constructor
/// (C++11 [class.copy]p3), which can be used to move values of the class.
///
/// \param TypeQuals If this constructor is a move constructor, will be set
/// to the type qualifiers on the referent of the first parameter's type.
bool isMoveConstructor(unsigned &TypeQuals) const;
- /// \brief Determine whether this constructor is a move constructor
+ /// Determine whether this constructor is a move constructor
/// (C++11 [class.copy]p3), which can be used to move values of the class.
bool isMoveConstructor() const {
unsigned TypeQuals = 0;
return isMoveConstructor(TypeQuals);
}
- /// \brief Determine whether this is a copy or move constructor.
+ /// Determine whether this is a copy or move constructor.
///
/// \param TypeQuals Will be set to the type qualifiers on the reference
/// parameter, if in fact this is a copy or move constructor.
bool isCopyOrMoveConstructor(unsigned &TypeQuals) const;
- /// \brief Determine whether this a copy or move constructor.
+ /// Determine whether this a copy or move constructor.
bool isCopyOrMoveConstructor() const {
unsigned Quals;
return isCopyOrMoveConstructor(Quals);
@@ -2580,16 +2658,16 @@ public:
/// used for user-defined conversions.
bool isConvertingConstructor(bool AllowExplicit) const;
- /// \brief Determine whether this is a member template specialization that
+ /// Determine whether this is a member template specialization that
/// would copy the object to itself. Such constructors are never used to copy
/// an object.
bool isSpecializationCopyingObject() const;
- /// \brief Determine whether this is an implicit constructor synthesized to
+ /// Determine whether this is an implicit constructor synthesized to
/// model a call to a constructor inherited from a base class.
bool isInheritingConstructor() const { return IsInheritingConstructor; }
- /// \brief Get the constructor that this inheriting constructor is based on.
+ /// Get the constructor that this inheriting constructor is based on.
InheritedConstructor getInheritedConstructor() const {
return IsInheritingConstructor ? *getTrailingObjects<InheritedConstructor>()
: InheritedConstructor();
@@ -2607,7 +2685,7 @@ public:
static bool classofKind(Kind K) { return K == CXXConstructor; }
};
-/// \brief Represents a C++ destructor within a class.
+/// Represents a C++ destructor within a class.
///
/// For example:
///
@@ -2669,7 +2747,7 @@ public:
static bool classofKind(Kind K) { return K == CXXDestructor; }
};
-/// \brief Represents a C++ conversion function within a class.
+/// Represents a C++ conversion function within a class.
///
/// For example:
///
@@ -2713,12 +2791,12 @@ public:
return getCanonicalDecl()->isExplicitSpecified();
}
- /// \brief Returns the type that this conversion function is converting to.
+ /// Returns the type that this conversion function is converting to.
QualType getConversionType() const {
return getType()->getAs<FunctionType>()->getReturnType();
}
- /// \brief Determine whether this conversion function is a conversion from
+ /// Determine whether this conversion function is a conversion from
/// a lambda closure type to a block pointer.
bool isLambdaToBlockPointerConversion() const;
@@ -2734,7 +2812,7 @@ public:
static bool classofKind(Kind K) { return K == CXXConversion; }
};
-/// \brief Represents a linkage specification.
+/// Represents a linkage specification.
///
/// For example:
/// \code
@@ -2744,7 +2822,7 @@ class LinkageSpecDecl : public Decl, public DeclContext {
virtual void anchor();
public:
- /// \brief Represents the language in a linkage specification.
+ /// Represents the language in a linkage specification.
///
/// The values are part of the serialization ABI for
/// ASTs and cannot be changed without altering that ABI. To help
@@ -2756,20 +2834,20 @@ public:
};
private:
- /// \brief The language for this linkage specification.
+ /// The language for this linkage specification.
unsigned Language : 3;
- /// \brief True if this linkage spec has braces.
+ /// True if this linkage spec has braces.
///
/// This is needed so that hasBraces() returns the correct result while the
/// linkage spec body is being parsed. Once RBraceLoc has been set this is
/// not used, so it doesn't need to be serialized.
unsigned HasBraces : 1;
- /// \brief The source location for the extern keyword.
+ /// The source location for the extern keyword.
SourceLocation ExternLoc;
- /// \brief The source location for the right brace (if valid).
+ /// The source location for the right brace (if valid).
SourceLocation RBraceLoc;
LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc,
@@ -2785,13 +2863,13 @@ public:
bool HasBraces);
static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID);
- /// \brief Return the language specified by this linkage specification.
+ /// Return the language specified by this linkage specification.
LanguageIDs getLanguage() const { return LanguageIDs(Language); }
- /// \brief Set the language specified by this linkage specification.
+ /// Set the language specified by this linkage specification.
void setLanguage(LanguageIDs L) { Language = L; }
- /// \brief Determines whether this linkage specification had braces in
+ /// Determines whether this linkage specification had braces in
/// its syntactic form.
bool hasBraces() const {
assert(!RBraceLoc.isValid() || HasBraces);
@@ -2830,7 +2908,7 @@ public:
}
};
-/// \brief Represents C++ using-directive.
+/// Represents C++ using-directive.
///
/// For example:
/// \code
@@ -2841,16 +2919,16 @@ public:
/// artificial names for all using-directives in order to store
/// them in DeclContext effectively.
class UsingDirectiveDecl : public NamedDecl {
- /// \brief The location of the \c using keyword.
+ /// The location of the \c using keyword.
SourceLocation UsingLoc;
- /// \brief The location of the \c namespace keyword.
+ /// The location of the \c namespace keyword.
SourceLocation NamespaceLoc;
- /// \brief The nested-name-specifier that precedes the namespace.
+ /// The nested-name-specifier that precedes the namespace.
NestedNameSpecifierLoc QualifierLoc;
- /// \brief The namespace nominated by this using-directive.
+ /// The namespace nominated by this using-directive.
NamedDecl *NominatedNamespace;
/// Enclosing context containing both using-directive and nominated
@@ -2867,7 +2945,7 @@ class UsingDirectiveDecl : public NamedDecl {
NamespaceLoc(NamespcLoc), QualifierLoc(QualifierLoc),
NominatedNamespace(Nominated), CommonAncestor(CommonAncestor) {}
- /// \brief Returns special DeclarationName used by using-directives.
+ /// Returns special DeclarationName used by using-directives.
///
/// This is only used by DeclContext for storing UsingDirectiveDecls in
/// its lookup structure.
@@ -2883,11 +2961,11 @@ public:
// Friend for getUsingDirectiveName.
friend class DeclContext;
- /// \brief Retrieve the nested-name-specifier that qualifies the
+ /// Retrieve the nested-name-specifier that qualifies the
/// name of the namespace, with source-location information.
NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
- /// \brief Retrieve the nested-name-specifier that qualifies the
+ /// Retrieve the nested-name-specifier that qualifies the
/// name of the namespace.
NestedNameSpecifier *getQualifier() const {
return QualifierLoc.getNestedNameSpecifier();
@@ -2898,26 +2976,26 @@ public:
return NominatedNamespace;
}
- /// \brief Returns the namespace nominated by this using-directive.
+ /// Returns the namespace nominated by this using-directive.
NamespaceDecl *getNominatedNamespace();
const NamespaceDecl *getNominatedNamespace() const {
return const_cast<UsingDirectiveDecl*>(this)->getNominatedNamespace();
}
- /// \brief Returns the common ancestor context of this using-directive and
+ /// Returns the common ancestor context of this using-directive and
/// its nominated namespace.
DeclContext *getCommonAncestor() { return CommonAncestor; }
const DeclContext *getCommonAncestor() const { return CommonAncestor; }
- /// \brief Return the location of the \c using keyword.
+ /// Return the location of the \c using keyword.
SourceLocation getUsingLoc() const { return UsingLoc; }
// FIXME: Could omit 'Key' in name.
- /// \brief Returns the location of the \c namespace keyword.
+ /// Returns the location of the \c namespace keyword.
SourceLocation getNamespaceKeyLocation() const { return NamespaceLoc; }
- /// \brief Returns the location of this using declaration's identifier.
+ /// Returns the location of this using declaration's identifier.
SourceLocation getIdentLocation() const { return getLocation(); }
static UsingDirectiveDecl *Create(ASTContext &C, DeclContext *DC,
@@ -2937,7 +3015,7 @@ public:
static bool classofKind(Kind K) { return K == UsingDirective; }
};
-/// \brief Represents a C++ namespace alias.
+/// Represents a C++ namespace alias.
///
/// For example:
///
@@ -2948,18 +3026,18 @@ class NamespaceAliasDecl : public NamedDecl,
public Redeclarable<NamespaceAliasDecl> {
friend class ASTDeclReader;
- /// \brief The location of the \c namespace keyword.
+ /// The location of the \c namespace keyword.
SourceLocation NamespaceLoc;
- /// \brief The location of the namespace's identifier.
+ /// The location of the namespace's identifier.
///
/// This is accessed by TargetNameLoc.
SourceLocation IdentLoc;
- /// \brief The nested-name-specifier that precedes the namespace.
+ /// The nested-name-specifier that precedes the namespace.
NestedNameSpecifierLoc QualifierLoc;
- /// \brief The Decl that this alias points to, either a NamespaceDecl or
+ /// The Decl that this alias points to, either a NamespaceDecl or
/// a NamespaceAliasDecl.
NamedDecl *Namespace;
@@ -3006,26 +3084,26 @@ public:
return getFirstDecl();
}
- /// \brief Retrieve the nested-name-specifier that qualifies the
+ /// Retrieve the nested-name-specifier that qualifies the
/// name of the namespace, with source-location information.
NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
- /// \brief Retrieve the nested-name-specifier that qualifies the
+ /// Retrieve the nested-name-specifier that qualifies the
/// name of the namespace.
NestedNameSpecifier *getQualifier() const {
return QualifierLoc.getNestedNameSpecifier();
}
- /// \brief Retrieve the namespace declaration aliased by this directive.
+ /// Retrieve the namespace declaration aliased by this directive.
NamespaceDecl *getNamespace() {
- if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(Namespace))
+ if (auto *AD = dyn_cast<NamespaceAliasDecl>(Namespace))
return AD->getNamespace();
return cast<NamespaceDecl>(Namespace);
}
const NamespaceDecl *getNamespace() const {
- return const_cast<NamespaceAliasDecl*>(this)->getNamespace();
+ return const_cast<NamespaceAliasDecl *>(this)->getNamespace();
}
/// Returns the location of the alias name, i.e. 'foo' in
@@ -3038,7 +3116,7 @@ public:
/// Returns the location of the identifier in the named namespace.
SourceLocation getTargetNameLoc() const { return IdentLoc; }
- /// \brief Retrieve the namespace that this alias refers to, which
+ /// Retrieve the namespace that this alias refers to, which
/// may either be a NamespaceDecl or a NamespaceAliasDecl.
NamedDecl *getAliasedNamespace() const { return Namespace; }
@@ -3050,7 +3128,7 @@ public:
static bool classofKind(Kind K) { return K == NamespaceAlias; }
};
-/// \brief Represents a shadow declaration introduced into a scope by a
+/// Represents a shadow declaration introduced into a scope by a
/// (resolved) using declaration.
///
/// For example,
@@ -3069,7 +3147,7 @@ class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
/// The referenced declaration.
NamedDecl *Underlying = nullptr;
- /// \brief The using declaration which introduced this decl or the next using
+ /// The using declaration which introduced this decl or the next using
/// shadow declaration contained in the aforementioned using declaration.
NamedDecl *UsingOrNextShadow = nullptr;
@@ -3123,22 +3201,26 @@ public:
return getFirstDecl();
}
- /// \brief Gets the underlying declaration which has been brought into the
+ /// Gets the underlying declaration which has been brought into the
/// local scope.
NamedDecl *getTargetDecl() const { return Underlying; }
- /// \brief Sets the underlying declaration which has been brought into the
+ /// Sets the underlying declaration which has been brought into the
/// local scope.
- void setTargetDecl(NamedDecl* ND) {
+ void setTargetDecl(NamedDecl *ND) {
assert(ND && "Target decl is null!");
Underlying = ND;
- IdentifierNamespace = ND->getIdentifierNamespace();
+ // A UsingShadowDecl is never a friend or local extern declaration, even
+ // if it is a shadow declaration for one.
+ IdentifierNamespace =
+ ND->getIdentifierNamespace() &
+ ~(IDNS_OrdinaryFriend | IDNS_TagFriend | IDNS_LocalExtern);
}
- /// \brief Gets the using declaration to which this declaration is tied.
+ /// Gets the using declaration to which this declaration is tied.
UsingDecl *getUsingDecl() const;
- /// \brief The next using shadow declaration contained in the shadow decl
+ /// The next using shadow declaration contained in the shadow decl
/// chain of the using declaration which introduced this decl.
UsingShadowDecl *getNextUsingShadowDecl() const {
return dyn_cast_or_null<UsingShadowDecl>(UsingOrNextShadow);
@@ -3150,7 +3232,7 @@ public:
}
};
-/// \brief Represents a shadow constructor declaration introduced into a
+/// Represents a shadow constructor declaration introduced into a
/// class by a C++11 using-declaration that names a constructor.
///
/// For example:
@@ -3161,18 +3243,18 @@ public:
/// };
/// \endcode
class ConstructorUsingShadowDecl final : public UsingShadowDecl {
- /// \brief If this constructor using declaration inherted the constructor
+ /// If this constructor using declaration inherted the constructor
/// from an indirect base class, this is the ConstructorUsingShadowDecl
/// in the named direct base class from which the declaration was inherited.
ConstructorUsingShadowDecl *NominatedBaseClassShadowDecl = nullptr;
- /// \brief If this constructor using declaration inherted the constructor
+ /// If this constructor using declaration inherted the constructor
/// from an indirect base class, this is the ConstructorUsingShadowDecl
/// that will be used to construct the unique direct or virtual base class
/// that receives the constructor arguments.
ConstructorUsingShadowDecl *ConstructedBaseClassShadowDecl = nullptr;
- /// \brief \c true if the constructor ultimately named by this using shadow
+ /// \c true if the constructor ultimately named by this using shadow
/// declaration is within a virtual base class subobject of the class that
/// contains this declaration.
unsigned IsVirtual : 1;
@@ -3224,24 +3306,24 @@ public:
}
//@}
- /// \brief Get the inheriting constructor declaration for the direct base
+ /// Get the inheriting constructor declaration for the direct base
/// class from which this using shadow declaration was inherited, if there is
/// one. This can be different for each redeclaration of the same shadow decl.
ConstructorUsingShadowDecl *getNominatedBaseClassShadowDecl() const {
return NominatedBaseClassShadowDecl;
}
- /// \brief Get the inheriting constructor declaration for the base class
+ /// Get the inheriting constructor declaration for the base class
/// for which we don't have an explicit initializer, if there is one.
ConstructorUsingShadowDecl *getConstructedBaseClassShadowDecl() const {
return ConstructedBaseClassShadowDecl;
}
- /// \brief Get the base class that was named in the using declaration. This
+ /// Get the base class that was named in the using declaration. This
/// can be different for each redeclaration of this same shadow decl.
CXXRecordDecl *getNominatedBaseClass() const;
- /// \brief Get the base class whose constructor or constructor shadow
+ /// Get the base class whose constructor or constructor shadow
/// declaration is passed the constructor arguments.
CXXRecordDecl *getConstructedBaseClass() const {
return cast<CXXRecordDecl>((ConstructedBaseClassShadowDecl
@@ -3250,13 +3332,13 @@ public:
->getDeclContext());
}
- /// \brief Returns \c true if the constructed base class is a virtual base
+ /// Returns \c true if the constructed base class is a virtual base
/// class subobject of this declaration's class.
bool constructsVirtualBase() const {
return IsVirtual;
}
- /// \brief Get the constructor or constructor template in the derived class
+ /// Get the constructor or constructor template in the derived class
/// correspnding to this using shadow declaration, if it has been implicitly
/// declared already.
CXXConstructorDecl *getConstructor() const;
@@ -3266,24 +3348,24 @@ public:
static bool classofKind(Kind K) { return K == ConstructorUsingShadow; }
};
-/// \brief Represents a C++ using-declaration.
+/// Represents a C++ using-declaration.
///
/// For example:
/// \code
/// using someNameSpace::someIdentifier;
/// \endcode
class UsingDecl : public NamedDecl, public Mergeable<UsingDecl> {
- /// \brief The source location of the 'using' keyword itself.
+ /// The source location of the 'using' keyword itself.
SourceLocation UsingLocation;
- /// \brief The nested-name-specifier that precedes the name.
+ /// The nested-name-specifier that precedes the name.
NestedNameSpecifierLoc QualifierLoc;
- /// \brief Provides source/type location info for the declaration name
+ /// Provides source/type location info for the declaration name
/// embedded in the ValueDecl base class.
DeclarationNameLoc DNLoc;
- /// \brief The first shadow declaration of the shadow decl chain associated
+ /// The first shadow declaration of the shadow decl chain associated
/// with this using declaration.
///
/// The bool member of the pair store whether this decl has the \c typename
@@ -3304,17 +3386,17 @@ public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
- /// \brief Return the source location of the 'using' keyword.
+ /// Return the source location of the 'using' keyword.
SourceLocation getUsingLoc() const { return UsingLocation; }
- /// \brief Set the source location of the 'using' keyword.
+ /// Set the source location of the 'using' keyword.
void setUsingLoc(SourceLocation L) { UsingLocation = L; }
- /// \brief Retrieve the nested-name-specifier that qualifies the name,
+ /// Retrieve the nested-name-specifier that qualifies the name,
/// with source-location information.
NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
- /// \brief Retrieve the nested-name-specifier that qualifies the name.
+ /// Retrieve the nested-name-specifier that qualifies the name.
NestedNameSpecifier *getQualifier() const {
return QualifierLoc.getNestedNameSpecifier();
}
@@ -3323,19 +3405,19 @@ public:
return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
}
- /// \brief Return true if it is a C++03 access declaration (no 'using').
+ /// Return true if it is a C++03 access declaration (no 'using').
bool isAccessDeclaration() const { return UsingLocation.isInvalid(); }
- /// \brief Return true if the using declaration has 'typename'.
+ /// Return true if the using declaration has 'typename'.
bool hasTypename() const { return FirstUsingShadow.getInt(); }
- /// \brief Sets whether the using declaration has 'typename'.
+ /// Sets whether the using declaration has 'typename'.
void setTypename(bool TN) { FirstUsingShadow.setInt(TN); }
- /// \brief Iterates through the using shadow declarations associated with
+ /// Iterates through the using shadow declarations associated with
/// this using declaration.
class shadow_iterator {
- /// \brief The current using shadow declaration.
+ /// The current using shadow declaration.
UsingShadowDecl *Current = nullptr;
public:
@@ -3382,7 +3464,7 @@ public:
shadow_iterator shadow_end() const { return shadow_iterator(); }
- /// \brief Return the number of shadowed declarations associated with this
+ /// Return the number of shadowed declarations associated with this
/// using declaration.
unsigned shadow_size() const {
return std::distance(shadow_begin(), shadow_end());
@@ -3480,7 +3562,7 @@ public:
static bool classofKind(Kind K) { return K == UsingPack; }
};
-/// \brief Represents a dependent using declaration which was not marked with
+/// Represents a dependent using declaration which was not marked with
/// \c typename.
///
/// Unlike non-dependent using declarations, these *only* bring through
@@ -3493,16 +3575,16 @@ public:
/// \endcode
class UnresolvedUsingValueDecl : public ValueDecl,
public Mergeable<UnresolvedUsingValueDecl> {
- /// \brief The source location of the 'using' keyword
+ /// The source location of the 'using' keyword
SourceLocation UsingLocation;
- /// \brief If this is a pack expansion, the location of the '...'.
+ /// If this is a pack expansion, the location of the '...'.
SourceLocation EllipsisLoc;
- /// \brief The nested-name-specifier that precedes the name.
+ /// The nested-name-specifier that precedes the name.
NestedNameSpecifierLoc QualifierLoc;
- /// \brief Provides source/type location info for the declaration name
+ /// Provides source/type location info for the declaration name
/// embedded in the ValueDecl base class.
DeclarationNameLoc DNLoc;
@@ -3522,20 +3604,20 @@ public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
- /// \brief Returns the source location of the 'using' keyword.
+ /// Returns the source location of the 'using' keyword.
SourceLocation getUsingLoc() const { return UsingLocation; }
- /// \brief Set the source location of the 'using' keyword.
+ /// Set the source location of the 'using' keyword.
void setUsingLoc(SourceLocation L) { UsingLocation = L; }
- /// \brief Return true if it is a C++03 access declaration (no 'using').
+ /// Return true if it is a C++03 access declaration (no 'using').
bool isAccessDeclaration() const { return UsingLocation.isInvalid(); }
- /// \brief Retrieve the nested-name-specifier that qualifies the name,
+ /// Retrieve the nested-name-specifier that qualifies the name,
/// with source-location information.
NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
- /// \brief Retrieve the nested-name-specifier that qualifies the name.
+ /// Retrieve the nested-name-specifier that qualifies the name.
NestedNameSpecifier *getQualifier() const {
return QualifierLoc.getNestedNameSpecifier();
}
@@ -3544,12 +3626,12 @@ public:
return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
}
- /// \brief Determine whether this is a pack expansion.
+ /// Determine whether this is a pack expansion.
bool isPackExpansion() const {
return EllipsisLoc.isValid();
}
- /// \brief Get the location of the ellipsis if this is a pack expansion.
+ /// Get the location of the ellipsis if this is a pack expansion.
SourceLocation getEllipsisLoc() const {
return EllipsisLoc;
}
@@ -3576,7 +3658,7 @@ public:
static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
};
-/// \brief Represents a dependent using declaration which was marked with
+/// Represents a dependent using declaration which was marked with
/// \c typename.
///
/// \code
@@ -3592,13 +3674,13 @@ class UnresolvedUsingTypenameDecl
public Mergeable<UnresolvedUsingTypenameDecl> {
friend class ASTDeclReader;
- /// \brief The source location of the 'typename' keyword
+ /// The source location of the 'typename' keyword
SourceLocation TypenameLocation;
- /// \brief If this is a pack expansion, the location of the '...'.
+ /// If this is a pack expansion, the location of the '...'.
SourceLocation EllipsisLoc;
- /// \brief The nested-name-specifier that precedes the name.
+ /// The nested-name-specifier that precedes the name.
NestedNameSpecifierLoc QualifierLoc;
UnresolvedUsingTypenameDecl(DeclContext *DC, SourceLocation UsingLoc,
@@ -3615,17 +3697,17 @@ class UnresolvedUsingTypenameDecl
void anchor() override;
public:
- /// \brief Returns the source location of the 'using' keyword.
+ /// Returns the source location of the 'using' keyword.
SourceLocation getUsingLoc() const { return getLocStart(); }
- /// \brief Returns the source location of the 'typename' keyword.
+ /// Returns the source location of the 'typename' keyword.
SourceLocation getTypenameLoc() const { return TypenameLocation; }
- /// \brief Retrieve the nested-name-specifier that qualifies the name,
+ /// Retrieve the nested-name-specifier that qualifies the name,
/// with source-location information.
NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
- /// \brief Retrieve the nested-name-specifier that qualifies the name.
+ /// Retrieve the nested-name-specifier that qualifies the name.
NestedNameSpecifier *getQualifier() const {
return QualifierLoc.getNestedNameSpecifier();
}
@@ -3634,12 +3716,12 @@ public:
return DeclarationNameInfo(getDeclName(), getLocation());
}
- /// \brief Determine whether this is a pack expansion.
+ /// Determine whether this is a pack expansion.
bool isPackExpansion() const {
return EllipsisLoc.isValid();
}
- /// \brief Get the location of the ellipsis if this is a pack expansion.
+ /// Get the location of the ellipsis if this is a pack expansion.
SourceLocation getEllipsisLoc() const {
return EllipsisLoc;
}
@@ -3665,7 +3747,7 @@ public:
static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; }
};
-/// \brief Represents a C++11 static_assert declaration.
+/// Represents a C++11 static_assert declaration.
class StaticAssertDecl : public Decl {
llvm::PointerIntPair<Expr *, 1, bool> AssertExprAndFailed;
StringLiteral *Message;
diff --git a/include/clang/AST/DeclContextInternals.h b/include/clang/AST/DeclContextInternals.h
index 6545f70f70b5..ccd82d2cf0d2 100644
--- a/include/clang/AST/DeclContextInternals.h
+++ b/include/clang/AST/DeclContextInternals.h
@@ -30,17 +30,17 @@ namespace clang {
class DependentDiagnostic;
-/// \brief An array of decls optimized for the common case of only containing
+/// An array of decls optimized for the common case of only containing
/// one entry.
struct StoredDeclsList {
- /// \brief When in vector form, this is what the Data pointer points to.
+ /// When in vector form, this is what the Data pointer points to.
using DeclsTy = SmallVector<NamedDecl *, 4>;
- /// \brief A collection of declarations, with a flag to indicate if we have
+ /// A collection of declarations, with a flag to indicate if we have
/// further external declarations.
using DeclsAndHasExternalTy = llvm::PointerIntPair<DeclsTy *, 1, bool>;
- /// \brief The stored data, which will be either a pointer to a NamedDecl,
+ /// The stored data, which will be either a pointer to a NamedDecl,
/// or a pointer to a vector with a flag to indicate if there are further
/// external declarations.
llvm::PointerUnion<NamedDecl *, DeclsAndHasExternalTy> Data;
@@ -122,7 +122,7 @@ public:
== Vec.end() && "list still contains decl");
}
- /// \brief Remove any declarations which were imported from an external
+ /// Remove any declarations which were imported from an external
/// AST source.
void removeExternalDecls() {
if (isNull()) {
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h
index 5d1c6b86fe11..47fb68bf42d3 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -148,13 +148,13 @@ public:
/// Retrieves the source range for the friend declaration.
SourceRange getSourceRange() const override LLVM_READONLY {
if (NamedDecl *ND = getFriendDecl()) {
- if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND))
+ if (const auto *FD = dyn_cast<FunctionDecl>(ND))
return FD->getSourceRange();
- if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(ND))
+ if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
return FTD->getSourceRange();
- if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(ND))
+ if (const auto *CTD = dyn_cast<ClassTemplateDecl>(ND))
return CTD->getSourceRange();
- if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(ND)) {
+ if (const auto *DD = dyn_cast<DeclaratorDecl>(ND)) {
if (DD->getOuterLocStart() != DD->getInnerLocStart())
return DD->getSourceRange();
}
diff --git a/include/clang/AST/DeclLookups.h b/include/clang/AST/DeclLookups.h
index 2fff05582563..64eb3f24b370 100644
--- a/include/clang/AST/DeclLookups.h
+++ b/include/clang/AST/DeclLookups.h
@@ -86,16 +86,11 @@ inline DeclContext::lookups_range DeclContext::lookups() const {
return lookups_range(all_lookups_iterator(), all_lookups_iterator());
}
-inline DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
- return lookups().begin();
-}
-
-inline DeclContext::all_lookups_iterator DeclContext::lookups_end() const {
- return lookups().end();
-}
-
-inline DeclContext::lookups_range DeclContext::noload_lookups() const {
+inline DeclContext::lookups_range
+DeclContext::noload_lookups(bool PreserveInternalState) const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
+ if (!PreserveInternalState)
+ Primary->loadLazyLocalLexicalLookups();
if (StoredDeclsMap *Map = Primary->getLookupPtr())
return lookups_range(all_lookups_iterator(Map->begin(), Map->end()),
all_lookups_iterator(Map->end(), Map->end()));
@@ -105,16 +100,6 @@ inline DeclContext::lookups_range DeclContext::noload_lookups() const {
return lookups_range(all_lookups_iterator(), all_lookups_iterator());
}
-inline
-DeclContext::all_lookups_iterator DeclContext::noload_lookups_begin() const {
- return noload_lookups().begin();
-}
-
-inline
-DeclContext::all_lookups_iterator DeclContext::noload_lookups_end() const {
- return noload_lookups().end();
-}
-
} // namespace clang
#endif // LLVM_CLANG_AST_DECLLOOKUPS_H
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index cef7d935370a..c81a5f805fc0 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -97,7 +97,7 @@ public:
}
};
-/// \brief A list of Objective-C protocols, along with the source
+/// A list of Objective-C protocols, along with the source
/// locations at which they were referenced.
class ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
SourceLocation *Locations = nullptr;
@@ -156,10 +156,10 @@ private:
// Method has a definition.
unsigned IsDefined : 1;
- /// \brief Method redeclaration in the same interface.
+ /// Method redeclaration in the same interface.
unsigned IsRedeclaration : 1;
- /// \brief Is redeclared in the same interface.
+ /// Is redeclared in the same interface.
mutable unsigned HasRedeclaration : 1;
// NOTE: VC++ treats enums as signed, avoid using ImplementationControl enum
@@ -170,14 +170,14 @@ private:
/// in, inout, etc.
unsigned objcDeclQualifier : 7;
- /// \brief Indicates whether this method has a related result type.
+ /// Indicates whether this method has a related result type.
unsigned RelatedResultType : 1;
- /// \brief Whether the locations of the selector identifiers are in a
+ /// Whether the locations of the selector identifiers are in a
/// "standard" position, a enum SelectorLocationsKind.
unsigned SelLocsKind : 2;
- /// \brief Whether this method overrides any other in the class hierarchy.
+ /// Whether this method overrides any other in the class hierarchy.
///
/// A method is said to override any method in the class's
/// base classes, its protocols, or its categories' protocols, that has
@@ -186,7 +186,7 @@ private:
/// method in the interface or its categories.
unsigned IsOverriding : 1;
- /// \brief Indicates if the method was a definition but its body was skipped.
+ /// Indicates if the method was a definition but its body was skipped.
unsigned HasSkippedBody : 1;
// Return type of this method.
@@ -195,7 +195,7 @@ private:
// Type source information for the return type.
TypeSourceInfo *ReturnTInfo;
- /// \brief Array of ParmVarDecls for the formal parameters of this method
+ /// Array of ParmVarDecls for the formal parameters of this method
/// and optionally followed by selector locations.
void *ParamsAndSelLocs = nullptr;
unsigned NumParams = 0;
@@ -241,7 +241,7 @@ private:
return getSelLocsKind() != SelLoc_NonStandard;
}
- /// \brief Get a pointer to the stored selector identifiers locations array.
+ /// Get a pointer to the stored selector identifiers locations array.
/// No locations will be stored if HasStandardSelLocs is true.
SourceLocation *getStoredSelLocs() {
return reinterpret_cast<SourceLocation*>(getParams() + NumParams);
@@ -250,7 +250,7 @@ private:
return reinterpret_cast<const SourceLocation*>(getParams() + NumParams);
}
- /// \brief Get a pointer to the stored selector identifiers locations array.
+ /// Get a pointer to the stored selector identifiers locations array.
/// No locations will be stored if HasStandardSelLocs is true.
ParmVarDecl **getParams() {
return reinterpret_cast<ParmVarDecl **>(ParamsAndSelLocs);
@@ -259,7 +259,7 @@ private:
return reinterpret_cast<const ParmVarDecl *const *>(ParamsAndSelLocs);
}
- /// \brief Get the number of stored selector identifiers locations.
+ /// Get the number of stored selector identifiers locations.
/// No locations will be stored if HasStandardSelLocs is true.
unsigned getNumStoredSelLocs() const {
if (hasStandardSelLocs())
@@ -271,7 +271,7 @@ private:
ArrayRef<ParmVarDecl*> Params,
ArrayRef<SourceLocation> SelLocs);
- /// \brief A definition will return its interface declaration.
+ /// A definition will return its interface declaration.
/// An interface declaration will return its definition.
/// Otherwise it will return itself.
ObjCMethodDecl *getNextRedeclarationImpl() override;
@@ -301,18 +301,18 @@ public:
}
void setObjCDeclQualifier(ObjCDeclQualifier QV) { objcDeclQualifier = QV; }
- /// \brief Determine whether this method has a result type that is related
+ /// Determine whether this method has a result type that is related
/// to the message receiver's type.
bool hasRelatedResultType() const { return RelatedResultType; }
- /// \brief Note whether this method has a related result type.
+ /// Note whether this method has a related result type.
void SetRelatedResultType(bool RRT = true) { RelatedResultType = RRT; }
- /// \brief True if this is a method redeclaration in the same interface.
+ /// True if this is a method redeclaration in the same interface.
bool isRedeclaration() const { return IsRedeclaration; }
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod);
- /// \brief Returns the location where the declarator ends. It will be
+ /// Returns the location where the declarator ends. It will be
/// the location of ';' for a method declaration and the location of '{'
/// for a method definition.
SourceLocation getDeclaratorEndLoc() const { return DeclEndLoc; }
@@ -362,7 +362,7 @@ public:
void setReturnType(QualType T) { MethodDeclType = T; }
SourceRange getReturnTypeSourceRange() const;
- /// \brief Determine the type of an expression that sends a message to this
+ /// Determine the type of an expression that sends a message to this
/// function. This replaces the type parameters with the types they would
/// get if the receiver was parameterless (e.g. it may replace the type
/// parameter with 'id').
@@ -407,7 +407,7 @@ public:
NumParams);
}
- /// \brief Sets the method's parameters and selector source locations.
+ /// Sets the method's parameters and selector source locations.
/// If the method is implicit (not coming from source) \p SelLocs is
/// ignored.
void setMethodParams(ASTContext &C,
@@ -462,7 +462,7 @@ public:
bool isDefined() const { return IsDefined; }
void setDefined(bool isDefined) { IsDefined = isDefined; }
- /// \brief Whether this method overrides any other in the class hierarchy.
+ /// Whether this method overrides any other in the class hierarchy.
///
/// A method is said to override any method in the class's
/// base classes, its protocols, or its categories' protocols, that has
@@ -472,7 +472,7 @@ public:
bool isOverriding() const { return IsOverriding; }
void setOverriding(bool isOverriding) { IsOverriding = isOverriding; }
- /// \brief Return overridden methods for the given \p Method.
+ /// Return overridden methods for the given \p Method.
///
/// An ObjC method is considered to override any method in the class's
/// base classes (and base's categories), its protocols, or its categories'
@@ -483,11 +483,11 @@ public:
void getOverriddenMethods(
SmallVectorImpl<const ObjCMethodDecl *> &Overridden) const;
- /// \brief True if the method was a definition but its body was skipped.
+ /// True if the method was a definition but its body was skipped.
bool hasSkippedBody() const { return HasSkippedBody; }
void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
- /// \brief Returns the property associated with this method's selector.
+ /// Returns the property associated with this method's selector.
///
/// Note that even if this particular method is not marked as a property
/// accessor, it is still possible for it to match a property declared in a
@@ -520,10 +520,10 @@ public:
bool isDesignatedInitializerForTheInterface(
const ObjCMethodDecl **InitMethod = nullptr) const;
- /// \brief Determine whether this method has a body.
+ /// Determine whether this method has a body.
bool hasBody() const override { return Body.isValid(); }
- /// \brief Retrieve the body of this method, if it has one.
+ /// Retrieve the body of this method, if it has one.
Stmt *getBody() const override;
void setLazyBody(uint64_t Offset) { Body = Offset; }
@@ -531,7 +531,7 @@ public:
CompoundStmt *getCompoundBody() { return (CompoundStmt*)getBody(); }
void setBody(Stmt *B) { Body = B; }
- /// \brief Returns whether this specific method is a definition.
+ /// Returns whether this specific method is a definition.
bool isThisDeclarationADefinition() const { return hasBody(); }
// Implement isa/cast/dyncast/etc.
@@ -737,7 +737,7 @@ enum class ObjCPropertyQueryKind : uint8_t {
OBJC_PR_query_class
};
-/// \brief Represents one property declaration in an Objective-C interface.
+/// Represents one property declaration in an Objective-C interface.
///
/// For example:
/// \code{.mm}
@@ -770,7 +770,7 @@ public:
};
enum {
- /// \brief Number of bits fitting all the property attributes.
+ /// Number of bits fitting all the property attributes.
NumPropertyAttrsBits = 15
};
@@ -1163,7 +1163,7 @@ public:
}
};
-/// \brief Represents an ObjC class declaration.
+/// Represents an ObjC class declaration.
///
/// For example:
///
@@ -1197,7 +1197,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
mutable const Type *TypeForDecl = nullptr;
struct DefinitionData {
- /// \brief The definition of this class, for quick access from any
+ /// The definition of this class, for quick access from any
/// declaration.
ObjCInterfaceDecl *Definition = nullptr;
@@ -1210,7 +1210,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
/// Protocols reference in both the \@interface and class extensions.
ObjCList<ObjCProtocolDecl> AllReferencedProtocols;
- /// \brief List of categories and class extensions defined for this class.
+ /// List of categories and class extensions defined for this class.
///
/// Categories are stored as a linked list in the AST, since the categories
/// and class extensions come long after the initial interface declaration,
@@ -1221,11 +1221,11 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
/// extensions and implementation. This list is built lazily.
ObjCIvarDecl *IvarList = nullptr;
- /// \brief Indicates that the contents of this Objective-C class will be
+ /// Indicates that the contents of this Objective-C class will be
/// completed by the external AST source when required.
mutable unsigned ExternallyCompleted : 1;
- /// \brief Indicates that the ivar cache does not yet include ivars
+ /// Indicates that the ivar cache does not yet include ivars
/// declared in the implementation.
mutable unsigned IvarListMissingImplementation : 1;
@@ -1248,7 +1248,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
/// One of the \c InheritedDesignatedInitializersState enumeratos.
mutable unsigned InheritedDesignatedInitializers : 2;
- /// \brief The location of the last location in this declaration, before
+ /// The location of the last location in this declaration, before
/// the properties/methods. For example, this will be the '>', '}', or
/// identifier,
SourceLocation EndLoc;
@@ -1262,7 +1262,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
/// The type parameters associated with this class, if any.
ObjCTypeParamList *TypeParamList = nullptr;
- /// \brief Contains a pointer to the data associated with this class,
+ /// Contains a pointer to the data associated with this class,
/// which will be NULL if this class has not yet been defined.
///
/// The bit indicates when we don't need to check for out-of-date
@@ -1283,7 +1283,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
return *Data.getPointer();
}
- /// \brief Allocate the definition data for this class.
+ /// Allocate the definition data for this class.
void allocateDefinitionData();
using redeclarable_base = Redeclarable<ObjCInterfaceDecl>;
@@ -1338,7 +1338,7 @@ public:
return SourceRange(getAtStartLoc(), getLocation());
}
- /// \brief Indicate that this Objective-C class is complete, but that
+ /// Indicate that this Objective-C class is complete, but that
/// the external AST source will be responsible for filling in its contents
/// when a complete class is required.
void setExternallyCompleted();
@@ -1544,13 +1544,13 @@ public:
isDesignatedInitializer(Selector Sel,
const ObjCMethodDecl **InitMethod = nullptr) const;
- /// \brief Determine whether this particular declaration of this class is
+ /// Determine whether this particular declaration of this class is
/// actually also a definition.
bool isThisDeclarationADefinition() const {
return getDefinition() == this;
}
- /// \brief Determine whether this class has been defined.
+ /// Determine whether this class has been defined.
bool hasDefinition() const {
// If the name of this class is out-of-date, bring it up-to-date, which
// might bring in a definition.
@@ -1562,21 +1562,21 @@ public:
return Data.getPointer();
}
- /// \brief Retrieve the definition of this class, or NULL if this class
+ /// Retrieve the definition of this class, or NULL if this class
/// has been forward-declared (with \@class) but not yet defined (with
/// \@interface).
ObjCInterfaceDecl *getDefinition() {
return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
- /// \brief Retrieve the definition of this class, or NULL if this class
+ /// Retrieve the definition of this class, or NULL if this class
/// has been forward-declared (with \@class) but not yet defined (with
/// \@interface).
const ObjCInterfaceDecl *getDefinition() const {
return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
- /// \brief Starts the definition of this Objective-C class, taking it from
+ /// Starts the definition of this Objective-C class, taking it from
/// a forward declaration (\@class) to a definition (\@interface).
void startDefinition();
@@ -1608,7 +1608,7 @@ public:
data().SuperClassTInfo = superClass;
}
- /// \brief Iterator that walks over the list of categories, filtering out
+ /// Iterator that walks over the list of categories, filtering out
/// those that do not meet specific criteria.
///
/// This class template is used for the various permutations of category
@@ -1655,13 +1655,13 @@ public:
};
private:
- /// \brief Test whether the given category is visible.
+ /// Test whether the given category is visible.
///
/// Used in the \c visible_categories_iterator.
static bool isVisibleCategory(ObjCCategoryDecl *Cat);
public:
- /// \brief Iterator that walks over the list of categories and extensions
+ /// Iterator that walks over the list of categories and extensions
/// that are visible, i.e., not hidden in a non-imported submodule.
using visible_categories_iterator =
filtered_category_iterator<isVisibleCategory>;
@@ -1674,30 +1674,30 @@ public:
visible_categories_end());
}
- /// \brief Retrieve an iterator to the beginning of the visible-categories
+ /// Retrieve an iterator to the beginning of the visible-categories
/// list.
visible_categories_iterator visible_categories_begin() const {
return visible_categories_iterator(getCategoryListRaw());
}
- /// \brief Retrieve an iterator to the end of the visible-categories list.
+ /// Retrieve an iterator to the end of the visible-categories list.
visible_categories_iterator visible_categories_end() const {
return visible_categories_iterator();
}
- /// \brief Determine whether the visible-categories list is empty.
+ /// Determine whether the visible-categories list is empty.
bool visible_categories_empty() const {
return visible_categories_begin() == visible_categories_end();
}
private:
- /// \brief Test whether the given category... is a category.
+ /// Test whether the given category... is a category.
///
/// Used in the \c known_categories_iterator.
static bool isKnownCategory(ObjCCategoryDecl *) { return true; }
public:
- /// \brief Iterator that walks over all of the known categories and
+ /// Iterator that walks over all of the known categories and
/// extensions, including those that are hidden.
using known_categories_iterator = filtered_category_iterator<isKnownCategory>;
using known_categories_range =
@@ -1708,30 +1708,30 @@ public:
known_categories_end());
}
- /// \brief Retrieve an iterator to the beginning of the known-categories
+ /// Retrieve an iterator to the beginning of the known-categories
/// list.
known_categories_iterator known_categories_begin() const {
return known_categories_iterator(getCategoryListRaw());
}
- /// \brief Retrieve an iterator to the end of the known-categories list.
+ /// Retrieve an iterator to the end of the known-categories list.
known_categories_iterator known_categories_end() const {
return known_categories_iterator();
}
- /// \brief Determine whether the known-categories list is empty.
+ /// Determine whether the known-categories list is empty.
bool known_categories_empty() const {
return known_categories_begin() == known_categories_end();
}
private:
- /// \brief Test whether the given category is a visible extension.
+ /// Test whether the given category is a visible extension.
///
/// Used in the \c visible_extensions_iterator.
static bool isVisibleExtension(ObjCCategoryDecl *Cat);
public:
- /// \brief Iterator that walks over all of the visible extensions, skipping
+ /// Iterator that walks over all of the visible extensions, skipping
/// any that are known but hidden.
using visible_extensions_iterator =
filtered_category_iterator<isVisibleExtension>;
@@ -1744,24 +1744,24 @@ public:
visible_extensions_end());
}
- /// \brief Retrieve an iterator to the beginning of the visible-extensions
+ /// Retrieve an iterator to the beginning of the visible-extensions
/// list.
visible_extensions_iterator visible_extensions_begin() const {
return visible_extensions_iterator(getCategoryListRaw());
}
- /// \brief Retrieve an iterator to the end of the visible-extensions list.
+ /// Retrieve an iterator to the end of the visible-extensions list.
visible_extensions_iterator visible_extensions_end() const {
return visible_extensions_iterator();
}
- /// \brief Determine whether the visible-extensions list is empty.
+ /// Determine whether the visible-extensions list is empty.
bool visible_extensions_empty() const {
return visible_extensions_begin() == visible_extensions_end();
}
private:
- /// \brief Test whether the given category is an extension.
+ /// Test whether the given category is an extension.
///
/// Used in the \c known_extensions_iterator.
static bool isKnownExtension(ObjCCategoryDecl *Cat);
@@ -1771,7 +1771,7 @@ public:
friend class ASTDeclWriter;
friend class ASTReader;
- /// \brief Iterator that walks over all of the known extensions.
+ /// Iterator that walks over all of the known extensions.
using known_extensions_iterator =
filtered_category_iterator<isKnownExtension>;
using known_extensions_range =
@@ -1782,23 +1782,23 @@ public:
known_extensions_end());
}
- /// \brief Retrieve an iterator to the beginning of the known-extensions
+ /// Retrieve an iterator to the beginning of the known-extensions
/// list.
known_extensions_iterator known_extensions_begin() const {
return known_extensions_iterator(getCategoryListRaw());
}
- /// \brief Retrieve an iterator to the end of the known-extensions list.
+ /// Retrieve an iterator to the end of the known-extensions list.
known_extensions_iterator known_extensions_end() const {
return known_extensions_iterator();
}
- /// \brief Determine whether the known-extensions list is empty.
+ /// Determine whether the known-extensions list is empty.
bool known_extensions_empty() const {
return known_extensions_begin() == known_extensions_end();
}
- /// \brief Retrieve the raw pointer to the start of the category/extension
+ /// Retrieve the raw pointer to the start of the category/extension
/// list.
ObjCCategoryDecl* getCategoryListRaw() const {
// FIXME: Should make sure no callers ever do this.
@@ -1811,7 +1811,7 @@ public:
return data().CategoryList;
}
- /// \brief Set the raw pointer to the start of the category/extension
+ /// Set the raw pointer to the start of the category/extension
/// list.
void setCategoryListRaw(ObjCCategoryDecl *category) {
data().CategoryList = category;
@@ -1874,7 +1874,7 @@ public:
ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
- /// \brief Lookup a method in the classes implementation hierarchy.
+ /// Lookup a method in the classes implementation hierarchy.
ObjCMethodDecl *lookupPrivateMethod(const Selector &Sel,
bool Instance=true) const;
@@ -1882,7 +1882,7 @@ public:
return lookupPrivateMethod(Sel, false);
}
- /// \brief Lookup a setter or getter in the class hierarchy,
+ /// Lookup a setter or getter in the class hierarchy,
/// including in all categories except for category passed
/// as argument.
ObjCMethodDecl *lookupPropertyAccessor(const Selector Sel,
@@ -1988,7 +1988,7 @@ public:
static ObjCIvarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
- /// \brief Return the class interface that this ivar is logically contained
+ /// Return the class interface that this ivar is logically contained
/// in; this is either the interface where the ivar was declared, or the
/// interface the ivar is conceptually a part of in the case of synthesized
/// ivars.
@@ -2027,7 +2027,7 @@ private:
unsigned Synthesized : 1;
};
-/// \brief Represents a field declaration created by an \@defs(...).
+/// Represents a field declaration created by an \@defs(...).
class ObjCAtDefsFieldDecl : public FieldDecl {
ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation StartLoc,
SourceLocation IdLoc, IdentifierInfo *Id,
@@ -2051,7 +2051,7 @@ public:
static bool classofKind(Kind K) { return K == ObjCAtDefsField; }
};
-/// \brief Represents an Objective-C protocol declaration.
+/// Represents an Objective-C protocol declaration.
///
/// Objective-C protocols declare a pure abstract type (i.e., no instance
/// variables are permitted). Protocols originally drew inspiration from
@@ -2083,14 +2083,14 @@ public:
class ObjCProtocolDecl : public ObjCContainerDecl,
public Redeclarable<ObjCProtocolDecl> {
struct DefinitionData {
- // \brief The declaration that defines this protocol.
+ // The declaration that defines this protocol.
ObjCProtocolDecl *Definition;
- /// \brief Referenced protocols
+ /// Referenced protocols
ObjCProtocolList ReferencedProtocols;
};
- /// \brief Contains a pointer to the data associated with this class,
+ /// Contains a pointer to the data associated with this class,
/// which will be NULL if this class has not yet been defined.
///
/// The bit indicates when we don't need to check for out-of-date
@@ -2213,7 +2213,7 @@ public:
return lookupMethod(Sel, false/*isInstance*/);
}
- /// \brief Determine whether this protocol has a definition.
+ /// Determine whether this protocol has a definition.
bool hasDefinition() const {
// If the name of this protocol is out-of-date, bring it up-to-date, which
// might bring in a definition.
@@ -2225,23 +2225,23 @@ public:
return Data.getPointer();
}
- /// \brief Retrieve the definition of this protocol, if any.
+ /// Retrieve the definition of this protocol, if any.
ObjCProtocolDecl *getDefinition() {
return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
- /// \brief Retrieve the definition of this protocol, if any.
+ /// Retrieve the definition of this protocol, if any.
const ObjCProtocolDecl *getDefinition() const {
return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
- /// \brief Determine whether this particular declaration is also the
+ /// Determine whether this particular declaration is also the
/// definition.
bool isThisDeclarationADefinition() const {
return getDefinition() == this;
}
- /// \brief Starts the definition of this Objective-C protocol.
+ /// Starts the definition of this Objective-C protocol.
void startDefinition();
/// Produce a name to be used for protocol's metadata. It comes either via
@@ -2310,7 +2310,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl {
/// FIXME: this should not be a singly-linked list. Move storage elsewhere.
ObjCCategoryDecl *NextClassCategory = nullptr;
- /// \brief The location of the category name in this declaration.
+ /// The location of the category name in this declaration.
SourceLocation CategoryNameLoc;
/// class extension may have private ivars.
@@ -2400,7 +2400,7 @@ public:
ObjCCategoryDecl *getNextClassCategory() const { return NextClassCategory; }
- /// \brief Retrieve the pointer to the next stored category (or extension),
+ /// Retrieve the pointer to the next stored category (or extension),
/// which may be hidden.
ObjCCategoryDecl *getNextClassCategoryRaw() const {
return NextClassCategory;
@@ -2578,7 +2578,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
SourceLocation IvarRBraceLoc;
/// Support for ivar initialization.
- /// \brief The arguments used to initialize the ivars
+ /// The arguments used to initialize the ivars
LazyCXXCtorInitializersPtr IvarInitializers;
unsigned NumIvarInitializers = 0;
@@ -2694,7 +2694,7 @@ public:
return getIdentifier()->getName();
}
- /// @brief Get the name of the class associated with this interface.
+ /// Get the name of the class associated with this interface.
//
// FIXME: Move to StringRef API.
std::string getNameAsString() const {
@@ -2785,7 +2785,7 @@ public:
private:
SourceLocation AtLoc; // location of \@synthesize or \@dynamic
- /// \brief For \@synthesize, the location of the ivar, if it was written in
+ /// For \@synthesize, the location of the ivar, if it was written in
/// the source code.
///
/// \code
@@ -2854,7 +2854,7 @@ public:
this->IvarLoc = IvarLoc;
}
- /// \brief For \@synthesize, returns true if an ivar name was explicitly
+ /// For \@synthesize, returns true if an ivar name was explicitly
/// specified.
///
/// \code
diff --git a/include/clang/AST/DeclOpenMP.h b/include/clang/AST/DeclOpenMP.h
index 2a329c3732cb..bec3acffc433 100644
--- a/include/clang/AST/DeclOpenMP.h
+++ b/include/clang/AST/DeclOpenMP.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief This file defines OpenMP nodes for declarative directives.
+/// This file defines OpenMP nodes for declarative directives.
///
//===----------------------------------------------------------------------===//
@@ -24,7 +24,7 @@
namespace clang {
-/// \brief This represents '#pragma omp threadprivate ...' directive.
+/// This represents '#pragma omp threadprivate ...' directive.
/// For example, in the following, both 'a' and 'A::b' are threadprivate:
///
/// \code
@@ -89,7 +89,7 @@ public:
static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
};
-/// \brief This represents '#pragma omp declare reduction ...' directive.
+/// This represents '#pragma omp declare reduction ...' directive.
/// For example, in the following, declared reduction 'foo' for types 'int' and
/// 'float':
///
@@ -109,14 +109,14 @@ public:
private:
friend class ASTDeclReader;
- /// \brief Combiner for declare reduction construct.
+ /// Combiner for declare reduction construct.
Expr *Combiner;
- /// \brief Initializer for declare reduction construct.
+ /// Initializer for declare reduction construct.
Expr *Initializer;
/// Kind of initializer - function call or omp_priv<init_expr> initializtion.
InitKind InitializerKind = CallInit;
- /// \brief Reference to the previous declare reduction construct in the same
+ /// Reference to the previous declare reduction construct in the same
/// scope with the same name. Required for proper templates instantiation if
/// the declare reduction construct is declared inside compound statement.
LazyDeclPtr PrevDeclInScope;
@@ -135,33 +135,33 @@ private:
}
public:
- /// \brief Create declare reduction node.
+ /// Create declare reduction node.
static OMPDeclareReductionDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name,
QualType T, OMPDeclareReductionDecl *PrevDeclInScope);
- /// \brief Create deserialized declare reduction node.
+ /// Create deserialized declare reduction node.
static OMPDeclareReductionDecl *CreateDeserialized(ASTContext &C,
unsigned ID);
- /// \brief Get combiner expression of the declare reduction construct.
+ /// Get combiner expression of the declare reduction construct.
Expr *getCombiner() { return Combiner; }
const Expr *getCombiner() const { return Combiner; }
- /// \brief Set combiner expression for the declare reduction construct.
+ /// Set combiner expression for the declare reduction construct.
void setCombiner(Expr *E) { Combiner = E; }
- /// \brief Get initializer expression (if specified) of the declare reduction
+ /// Get initializer expression (if specified) of the declare reduction
/// construct.
Expr *getInitializer() { return Initializer; }
const Expr *getInitializer() const { return Initializer; }
/// Get initializer kind.
InitKind getInitializerKind() const { return InitializerKind; }
- /// \brief Set initializer expression for the declare reduction construct.
+ /// Set initializer expression for the declare reduction construct.
void setInitializer(Expr *E, InitKind IK) {
Initializer = E;
InitializerKind = IK;
}
- /// \brief Get reference to previous declare reduction construct in the same
+ /// Get reference to previous declare reduction construct in the same
/// scope with the same name.
OMPDeclareReductionDecl *getPrevDeclInScope();
const OMPDeclareReductionDecl *getPrevDeclInScope() const;
@@ -189,9 +189,10 @@ class OMPCapturedExprDecl final : public VarDecl {
void anchor() override;
OMPCapturedExprDecl(ASTContext &C, DeclContext *DC, IdentifierInfo *Id,
- QualType Type, SourceLocation StartLoc)
- : VarDecl(OMPCapturedExpr, C, DC, StartLoc, SourceLocation(), Id, Type,
- nullptr, SC_None) {
+ QualType Type, TypeSourceInfo *TInfo,
+ SourceLocation StartLoc)
+ : VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
+ SC_None) {
setImplicit();
}
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index 7842d7097174..a2f00ec9ffa2 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
/// \file
-/// \brief Defines the C++ template declaration subclasses.
+/// Defines the C++ template declaration subclasses.
//
//===----------------------------------------------------------------------===//
@@ -56,14 +56,14 @@ class UnresolvedSetImpl;
class VarTemplateDecl;
class VarTemplatePartialSpecializationDecl;
-/// \brief Stores a template parameter of any kind.
+/// Stores a template parameter of any kind.
using TemplateParameter =
llvm::PointerUnion3<TemplateTypeParmDecl *, NonTypeTemplateParmDecl *,
TemplateTemplateParmDecl *>;
NamedDecl *getAsNamedDecl(TemplateParameter P);
-/// \brief Stores a list of template parameters for a TemplateDecl and its
+/// Stores a list of template parameters for a TemplateDecl and its
/// derived classes.
class TemplateParameterList final
: private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
@@ -110,10 +110,10 @@ public:
SourceLocation RAngleLoc,
Expr *RequiresClause);
- /// \brief Iterates through the template parameters in this list.
+ /// Iterates through the template parameters in this list.
using iterator = NamedDecl **;
- /// \brief Iterates through the template parameters in this list.
+ /// Iterates through the template parameters in this list.
using const_iterator = NamedDecl * const *;
iterator begin() { return getTrailingObjects<NamedDecl *>(); }
@@ -139,32 +139,32 @@ public:
return begin()[Idx];
}
- /// \brief Returns the minimum number of arguments needed to form a
+ /// Returns the minimum number of arguments needed to form a
/// template specialization.
///
/// This may be fewer than the number of template parameters, if some of
/// the parameters have default arguments or if there is a parameter pack.
unsigned getMinRequiredArguments() const;
- /// \brief Get the depth of this template parameter list in the set of
+ /// Get the depth of this template parameter list in the set of
/// template parameter lists.
///
/// The first template parameter list in a declaration will have depth 0,
/// the second template parameter list will have depth 1, etc.
unsigned getDepth() const;
- /// \brief Determine whether this template parameter list contains an
+ /// Determine whether this template parameter list contains an
/// unexpanded parameter pack.
bool containsUnexpandedParameterPack() const {
return ContainsUnexpandedParameterPack;
}
- /// \brief The constraint-expression of the associated requires-clause.
+ /// The constraint-expression of the associated requires-clause.
Expr *getRequiresClause() {
return HasRequiresClause ? *getTrailingObjects<Expr *>() : nullptr;
}
- /// \brief The constraint-expression of the associated requires-clause.
+ /// The constraint-expression of the associated requires-clause.
const Expr *getRequiresClause() const {
return HasRequiresClause ? *getTrailingObjects<Expr *>() : nullptr;
}
@@ -182,7 +182,7 @@ public:
using FixedSizeStorageOwner = TrailingObjects::FixedSizeStorageOwner;
};
-/// \brief Stores a list of template parameters and the associated
+/// Stores a list of template parameters and the associated
/// requires-clause (if any) for a TemplateDecl and its derived classes.
/// Suitable for creating on the stack.
template <size_t N, bool HasRequiresClause>
@@ -206,13 +206,13 @@ public:
TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}
};
-/// \brief A template argument list.
+/// A template argument list.
class TemplateArgumentList final
: private llvm::TrailingObjects<TemplateArgumentList, TemplateArgument> {
- /// \brief The template argument list.
+ /// The template argument list.
const TemplateArgument *Arguments;
- /// \brief The number of template arguments in this template
+ /// The number of template arguments in this template
/// argument list.
unsigned NumArguments;
@@ -226,23 +226,23 @@ public:
TemplateArgumentList(const TemplateArgumentList &) = delete;
TemplateArgumentList &operator=(const TemplateArgumentList &) = delete;
- /// \brief Type used to indicate that the template argument list itself is a
+ /// Type used to indicate that the template argument list itself is a
/// stack object. It does not own its template arguments.
enum OnStackType { OnStack };
- /// \brief Create a new template argument list that copies the given set of
+ /// Create a new template argument list that copies the given set of
/// template arguments.
static TemplateArgumentList *CreateCopy(ASTContext &Context,
ArrayRef<TemplateArgument> Args);
- /// \brief Construct a new, temporary template argument list on the stack.
+ /// Construct a new, temporary template argument list on the stack.
///
/// The template argument list does not own the template arguments
/// provided.
explicit TemplateArgumentList(OnStackType, ArrayRef<TemplateArgument> Args)
: Arguments(Args.data()), NumArguments(Args.size()) {}
- /// \brief Produces a shallow copy of the given template argument list.
+ /// Produces a shallow copy of the given template argument list.
///
/// This operation assumes that the input argument list outlives it.
/// This takes the list as a pointer to avoid looking like a copy
@@ -251,25 +251,25 @@ public:
explicit TemplateArgumentList(const TemplateArgumentList *Other)
: Arguments(Other->data()), NumArguments(Other->size()) {}
- /// \brief Retrieve the template argument at a given index.
+ /// Retrieve the template argument at a given index.
const TemplateArgument &get(unsigned Idx) const {
assert(Idx < NumArguments && "Invalid template argument index");
return data()[Idx];
}
- /// \brief Retrieve the template argument at a given index.
+ /// Retrieve the template argument at a given index.
const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); }
- /// \brief Produce this as an array ref.
+ /// Produce this as an array ref.
ArrayRef<TemplateArgument> asArray() const {
return llvm::makeArrayRef(data(), size());
}
- /// \brief Retrieve the number of template arguments in this
+ /// Retrieve the number of template arguments in this
/// template argument list.
unsigned size() const { return NumArguments; }
- /// \brief Retrieve a pointer to the template argument list.
+ /// Retrieve a pointer to the template argument list.
const TemplateArgument *data() const { return Arguments; }
};
@@ -299,7 +299,7 @@ class DefaultArgStorage {
static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
const DefaultArgStorage &Storage = Parm->getDefaultArgStorage();
- if (auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl*>())
+ if (auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl *>())
Parm = Prev;
assert(!Parm->getDefaultArgStorage()
.ValueOrInherited.template is<ParmDecl *>() &&
@@ -321,9 +321,9 @@ public:
/// default argument is visible.
ArgType get() const {
const DefaultArgStorage *Storage = this;
- if (auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl*>())
+ if (const auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl *>())
Storage = &Prev->getDefaultArgStorage();
- if (auto *C = Storage->ValueOrInherited.template dyn_cast<Chain*>())
+ if (const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>())
return C->Value;
return Storage->ValueOrInherited.template get<ArgType>();
}
@@ -331,9 +331,9 @@ public:
/// Get the parameter from which we inherit the default argument, if any.
/// This is the parameter on which the default argument was actually written.
const ParmDecl *getInheritedFrom() const {
- if (auto *D = ValueOrInherited.template dyn_cast<ParmDecl*>())
+ if (const auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>())
return D;
- if (auto *C = ValueOrInherited.template dyn_cast<Chain*>())
+ if (const auto *C = ValueOrInherited.template dyn_cast<Chain *>())
return C->PrevDeclWithDefaultArg;
return nullptr;
}
@@ -365,7 +365,7 @@ public:
// Kinds of Templates
//===----------------------------------------------------------------------===//
-/// \brief Stores the template parameter list and associated constraints for
+/// Stores the template parameter list and associated constraints for
/// \c TemplateDecl objects that track associated constraints.
class ConstrainedTemplateDeclInfo {
friend TemplateDecl;
@@ -391,7 +391,7 @@ protected:
};
-/// \brief The base class of all kinds of template declarations (e.g.,
+/// The base class of all kinds of template declarations (e.g.,
/// class, function, etc.).
///
/// The TemplateDecl class stores the list of template parameters and a
@@ -443,7 +443,7 @@ public:
}
Expr *getAssociatedConstraints() const {
- const TemplateDecl *const C = cast<TemplateDecl>(getCanonicalDecl());
+ const auto *const C = cast<TemplateDecl>(getCanonicalDecl());
const auto *const CTDI =
C->TemplateParams.dyn_cast<ConstrainedTemplateDeclInfo *>();
return CTDI ? CTDI->getAssociatedConstraints() : nullptr;
@@ -466,7 +466,8 @@ public:
protected:
NamedDecl *TemplatedDecl;
- /// \brief The template parameter list and optional requires-clause
+
+ /// The template parameter list and optional requires-clause
/// associated with this declaration; alternatively, a
/// \c ConstrainedTemplateDeclInfo if the associated constraints of the
/// template are being tracked by this particular declaration.
@@ -491,7 +492,7 @@ protected:
}
public:
- /// \brief Initialize the underlying templated declaration and
+ /// Initialize the underlying templated declaration and
/// template parameters.
void init(NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
assert(!TemplatedDecl && "TemplatedDecl already set!");
@@ -501,7 +502,7 @@ public:
}
};
-/// \brief Provides information about a function template specialization,
+/// Provides information about a function template specialization,
/// which is a FunctionDecl that has been explicitly specialization or
/// instantiated from a function template.
class FunctionTemplateSpecializationInfo : public llvm::FoldingSetNode {
@@ -524,31 +525,31 @@ public:
const TemplateArgumentListInfo *TemplateArgsAsWritten,
SourceLocation POI);
- /// \brief The function template specialization that this structure
+ /// The function template specialization that this structure
/// describes.
FunctionDecl *Function;
- /// \brief The function template from which this function template
+ /// The function template from which this function template
/// specialization was generated.
///
/// The two bits contain the top 4 values of TemplateSpecializationKind.
llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
- /// \brief The template arguments used to produce the function template
+ /// The template arguments used to produce the function template
/// specialization from the function template.
const TemplateArgumentList *TemplateArguments;
- /// \brief The template arguments as written in the sources, if provided.
+ /// The template arguments as written in the sources, if provided.
const ASTTemplateArgumentListInfo *TemplateArgumentsAsWritten;
- /// \brief The point at which this function template specialization was
+ /// The point at which this function template specialization was
/// first instantiated.
SourceLocation PointOfInstantiation;
- /// \brief Retrieve the template from which this function was specialized.
+ /// Retrieve the template from which this function was specialized.
FunctionTemplateDecl *getTemplate() const { return Template.getPointer(); }
- /// \brief Determine what kind of template specialization this is.
+ /// Determine what kind of template specialization this is.
TemplateSpecializationKind getTemplateSpecializationKind() const {
return (TemplateSpecializationKind)(Template.getInt() + 1);
}
@@ -557,7 +558,7 @@ public:
return getTemplateSpecializationKind() == TSK_ExplicitSpecialization;
}
- /// \brief True if this declaration is an explicit specialization,
+ /// True if this declaration is an explicit specialization,
/// explicit instantiation declaration, or explicit instantiation
/// definition.
bool isExplicitInstantiationOrSpecialization() const {
@@ -565,14 +566,14 @@ public:
getTemplateSpecializationKind());
}
- /// \brief Set the template specialization kind.
+ /// Set the template specialization kind.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
assert(TSK != TSK_Undeclared &&
"Cannot encode TSK_Undeclared for a function template specialization");
Template.setInt(TSK - 1);
}
- /// \brief Retrieve the first point of instantiation of this function
+ /// Retrieve the first point of instantiation of this function
/// template specialization.
///
/// The point of instantiation may be an invalid source location if this
@@ -581,7 +582,7 @@ public:
return PointOfInstantiation;
}
- /// \brief Set the (first) point of instantiation of this function template
+ /// Set the (first) point of instantiation of this function template
/// specialization.
void setPointOfInstantiation(SourceLocation POI) {
PointOfInstantiation = POI;
@@ -601,7 +602,7 @@ public:
}
};
-/// \brief Provides information a specialization of a member of a class
+/// Provides information a specialization of a member of a class
/// template, which may be a member function, static data member,
/// member class or member enumeration.
class MemberSpecializationInfo {
@@ -621,11 +622,11 @@ public:
"Cannot encode undeclared template specializations for members");
}
- /// \brief Retrieve the member declaration from which this member was
+ /// Retrieve the member declaration from which this member was
/// instantiated.
NamedDecl *getInstantiatedFrom() const { return MemberAndTSK.getPointer(); }
- /// \brief Determine what kind of template specialization this is.
+ /// Determine what kind of template specialization this is.
TemplateSpecializationKind getTemplateSpecializationKind() const {
return (TemplateSpecializationKind)(MemberAndTSK.getInt() + 1);
}
@@ -634,27 +635,27 @@ public:
return getTemplateSpecializationKind() == TSK_ExplicitSpecialization;
}
- /// \brief Set the template specialization kind.
+ /// Set the template specialization kind.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
assert(TSK != TSK_Undeclared &&
"Cannot encode undeclared template specializations for members");
MemberAndTSK.setInt(TSK - 1);
}
- /// \brief Retrieve the first point of instantiation of this member.
+ /// Retrieve the first point of instantiation of this member.
/// If the point of instantiation is an invalid location, then this member
/// has not yet been instantiated.
SourceLocation getPointOfInstantiation() const {
return PointOfInstantiation;
}
- /// \brief Set the first point of instantiation.
+ /// Set the first point of instantiation.
void setPointOfInstantiation(SourceLocation POI) {
PointOfInstantiation = POI;
}
};
-/// \brief Provides information about a dependent function-template
+/// Provides information about a dependent function-template
/// specialization declaration.
///
/// Since explicit function template specialization and instantiation
@@ -699,25 +700,25 @@ public:
Create(ASTContext &Context, const UnresolvedSetImpl &Templates,
const TemplateArgumentListInfo &TemplateArgs);
- /// \brief Returns the number of function templates that this might
+ /// Returns the number of function templates that this might
/// be a specialization of.
unsigned getNumTemplates() const { return NumTemplates; }
- /// \brief Returns the i'th template candidate.
+ /// Returns the i'th template candidate.
FunctionTemplateDecl *getTemplate(unsigned I) const {
assert(I < getNumTemplates() && "template index out of range");
return getTrailingObjects<FunctionTemplateDecl *>()[I];
}
- /// \brief Returns the explicit template arguments that were given.
+ /// Returns the explicit template arguments that were given.
const TemplateArgumentLoc *getTemplateArgs() const {
return getTrailingObjects<TemplateArgumentLoc>();
}
- /// \brief Returns the number of explicit template arguments that were given.
+ /// Returns the number of explicit template arguments that were given.
unsigned getNumTemplateArgs() const { return NumArgs; }
- /// \brief Returns the nth template argument.
+ /// Returns the nth template argument.
const TemplateArgumentLoc &getTemplateArg(unsigned I) const {
assert(I < getNumTemplateArgs() && "template arg index out of range");
return getTemplateArgs()[I];
@@ -803,7 +804,7 @@ protected:
struct CommonBase {
CommonBase() : InstantiatedFromMember(nullptr, false) {}
- /// \brief The template from which this was most
+ /// The template from which this was most
/// directly instantiated (or null).
///
/// The boolean value indicates whether this template
@@ -811,7 +812,7 @@ protected:
llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
InstantiatedFromMember;
- /// \brief If non-null, points to an array of specializations (including
+ /// If non-null, points to an array of specializations (including
/// partial specializations) known only by their external declaration IDs.
///
/// The first value in the array is the number of specializations/partial
@@ -819,11 +820,11 @@ protected:
uint32_t *LazySpecializations = nullptr;
};
- /// \brief Pointer to the common data shared by all declarations of this
+ /// Pointer to the common data shared by all declarations of this
/// template.
mutable CommonBase *Common = nullptr;
- /// \brief Retrieves the "common" pointer shared by all (re-)declarations of
+ /// Retrieves the "common" pointer shared by all (re-)declarations of
/// the same template. Calling this routine may implicitly allocate memory
/// for the common pointer.
CommonBase *getCommonPtr() const;
@@ -849,7 +850,7 @@ public:
friend class ASTReader;
template <class decl_type> friend class RedeclarableTemplate;
- /// \brief Retrieves the canonical declaration of this template.
+ /// Retrieves the canonical declaration of this template.
RedeclarableTemplateDecl *getCanonicalDecl() override {
return getFirstDecl();
}
@@ -857,7 +858,7 @@ public:
return getFirstDecl();
}
- /// \brief Determines whether this template was a specialization of a
+ /// Determines whether this template was a specialization of a
/// member template.
///
/// In the following example, the function template \c X<int>::f and the
@@ -879,14 +880,14 @@ public:
return getCommonPtr()->InstantiatedFromMember.getInt();
}
- /// \brief Note that this member template is a specialization.
+ /// Note that this member template is a specialization.
void setMemberSpecialization() {
assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
"Only member templates can be member template specializations");
getCommonPtr()->InstantiatedFromMember.setInt(true);
}
- /// \brief Retrieve the member template from which this template was
+ /// Retrieve the member template from which this template was
/// instantiated, or nullptr if this template was not instantiated from a
/// member template.
///
@@ -968,14 +969,14 @@ class FunctionTemplateDecl : public RedeclarableTemplateDecl {
protected:
friend class FunctionDecl;
- /// \brief Data that is common to all of the declarations of a given
+ /// Data that is common to all of the declarations of a given
/// function template.
struct Common : CommonBase {
- /// \brief The function template specializations for this function
+ /// The function template specializations for this function
/// template, including explicit specializations and instantiations.
llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> Specializations;
- /// \brief The set of "injected" template arguments used within this
+ /// The set of "injected" template arguments used within this
/// function template.
///
/// This pointer refers to the template arguments (there are as
@@ -999,12 +1000,12 @@ protected:
return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
}
- /// \brief Retrieve the set of function template specializations of this
+ /// Retrieve the set of function template specializations of this
/// function template.
llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
getSpecializations() const;
- /// \brief Add a specialization of this function template.
+ /// Add a specialization of this function template.
///
/// \param InsertPos Insert position in the FoldingSetVector, must have been
/// retrieved by an earlier call to findSpecialization().
@@ -1015,7 +1016,7 @@ public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
- /// \brief Load any lazily-loaded specializations from the external source.
+ /// Load any lazily-loaded specializations from the external source.
void LoadLazySpecializations() const;
/// Get the underlying function declaration of the template.
@@ -1029,7 +1030,7 @@ public:
return getTemplatedDecl()->isThisDeclarationADefinition();
}
- /// \brief Return the specialization with the provided arguments if it exists,
+ /// Return the specialization with the provided arguments if it exists,
/// otherwise return the insertion point.
FunctionDecl *findSpecialization(ArrayRef<TemplateArgument> Args,
void *&InsertPos);
@@ -1043,7 +1044,7 @@ public:
RedeclarableTemplateDecl::getCanonicalDecl());
}
- /// \brief Retrieve the previous declaration of this function template, or
+ /// Retrieve the previous declaration of this function template, or
/// nullptr if no such declaration exists.
FunctionTemplateDecl *getPreviousDecl() {
return cast_or_null<FunctionTemplateDecl>(
@@ -1083,7 +1084,7 @@ public:
return makeSpecIterator(getSpecializations(), true);
}
- /// \brief Retrieve the "injected" template arguments that correspond to the
+ /// Retrieve the "injected" template arguments that correspond to the
/// template parameters of this function template.
///
/// Although the C++ standard has no notion of the "injected" template
@@ -1092,14 +1093,14 @@ public:
/// template.
ArrayRef<TemplateArgument> getInjectedTemplateArgs();
- /// \brief Create a function template node.
+ /// Create a function template node.
static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
DeclarationName Name,
TemplateParameterList *Params,
NamedDecl *Decl);
- /// \brief Create an empty function template node.
+ /// Create an empty function template node.
static FunctionTemplateDecl *CreateDeserialized(ASTContext &C, unsigned ID);
// Implement isa/cast/dyncast support
@@ -1111,7 +1112,7 @@ public:
// Kinds of Template Parameters
//===----------------------------------------------------------------------===//
-/// \brief Defines the position of a template parameter within a template
+/// Defines the position of a template parameter within a template
/// parameter list.
///
/// Because template parameter can be listed
@@ -1144,7 +1145,7 @@ public:
unsigned getIndex() const { return Position; }
};
-/// \brief Declaration of a template type parameter.
+/// Declaration of a template type parameter.
///
/// For example, "T" in
/// \code
@@ -1154,13 +1155,13 @@ class TemplateTypeParmDecl : public TypeDecl {
/// Sema creates these on the stack during auto type deduction.
friend class Sema;
- /// \brief Whether this template type parameter was declaration with
+ /// Whether this template type parameter was declaration with
/// the 'typename' keyword.
///
/// If false, it was declared with the 'class' keyword.
bool Typename : 1;
- /// \brief The default template argument, if any.
+ /// The default template argument, if any.
using DefArgStorage =
DefaultArgStorage<TemplateTypeParmDecl, TypeSourceInfo *>;
DefArgStorage DefaultArgument;
@@ -1180,7 +1181,7 @@ public:
static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
unsigned ID);
- /// \brief Whether this template type parameter was declared with
+ /// Whether this template type parameter was declared with
/// the 'typename' keyword.
///
/// If not, it was declared with the 'class' keyword.
@@ -1188,57 +1189,57 @@ public:
const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
- /// \brief Determine whether this template parameter has a default
+ /// Determine whether this template parameter has a default
/// argument.
bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
- /// \brief Retrieve the default argument, if any.
+ /// Retrieve the default argument, if any.
QualType getDefaultArgument() const {
return DefaultArgument.get()->getType();
}
- /// \brief Retrieves the default argument's source information, if any.
+ /// Retrieves the default argument's source information, if any.
TypeSourceInfo *getDefaultArgumentInfo() const {
return DefaultArgument.get();
}
- /// \brief Retrieves the location of the default argument declaration.
+ /// Retrieves the location of the default argument declaration.
SourceLocation getDefaultArgumentLoc() const;
- /// \brief Determines whether the default argument was inherited
+ /// Determines whether the default argument was inherited
/// from a previous declaration of this template.
bool defaultArgumentWasInherited() const {
return DefaultArgument.isInherited();
}
- /// \brief Set the default argument for this template parameter.
+ /// Set the default argument for this template parameter.
void setDefaultArgument(TypeSourceInfo *DefArg) {
DefaultArgument.set(DefArg);
}
- /// \brief Set that this default argument was inherited from another
+ /// Set that this default argument was inherited from another
/// parameter.
void setInheritedDefaultArgument(const ASTContext &C,
TemplateTypeParmDecl *Prev) {
DefaultArgument.setInherited(C, Prev);
}
- /// \brief Removes the default argument of this template parameter.
+ /// Removes the default argument of this template parameter.
void removeDefaultArgument() {
DefaultArgument.clear();
}
- /// \brief Set whether this template type parameter was declared with
+ /// Set whether this template type parameter was declared with
/// the 'typename' or 'class' keyword.
void setDeclaredWithTypename(bool withTypename) { Typename = withTypename; }
- /// \brief Retrieve the depth of the template parameter.
+ /// Retrieve the depth of the template parameter.
unsigned getDepth() const;
- /// \brief Retrieve the index of the template parameter.
+ /// Retrieve the index of the template parameter.
unsigned getIndex() const;
- /// \brief Returns whether this is a parameter pack.
+ /// Returns whether this is a parameter pack.
bool isParameterPack() const;
SourceRange getSourceRange() const override LLVM_READONLY;
@@ -1261,7 +1262,7 @@ class NonTypeTemplateParmDecl final
friend class ASTDeclReader;
friend TrailingObjects;
- /// \brief The default template argument, if any, and whether or not
+ /// The default template argument, if any, and whether or not
/// it was inherited.
using DefArgStorage = DefaultArgStorage<NonTypeTemplateParmDecl, Expr *>;
DefArgStorage DefaultArgument;
@@ -1269,15 +1270,15 @@ class NonTypeTemplateParmDecl final
// FIXME: Collapse this into TemplateParamPosition; or, just move depth/index
// down here to save memory.
- /// \brief Whether this non-type template parameter is a parameter pack.
+ /// Whether this non-type template parameter is a parameter pack.
bool ParameterPack;
- /// \brief Whether this non-type template parameter is an "expanded"
+ /// Whether this non-type template parameter is an "expanded"
/// parameter pack, meaning that its type is a pack expansion and we
/// already know the set of types that expansion expands to.
bool ExpandedParameterPack = false;
- /// \brief The number of types in an expanded parameter pack.
+ /// The number of types in an expanded parameter pack.
unsigned NumExpandedTypes = 0;
size_t numTrailingObjects(
@@ -1327,23 +1328,23 @@ public:
const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
- /// \brief Determine whether this template parameter has a default
+ /// Determine whether this template parameter has a default
/// argument.
bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
- /// \brief Retrieve the default argument, if any.
+ /// Retrieve the default argument, if any.
Expr *getDefaultArgument() const { return DefaultArgument.get(); }
- /// \brief Retrieve the location of the default argument, if any.
+ /// Retrieve the location of the default argument, if any.
SourceLocation getDefaultArgumentLoc() const;
- /// \brief Determines whether the default argument was inherited
+ /// Determines whether the default argument was inherited
/// from a previous declaration of this template.
bool defaultArgumentWasInherited() const {
return DefaultArgument.isInherited();
}
- /// \brief Set the default argument for this template parameter, and
+ /// Set the default argument for this template parameter, and
/// whether that default argument was inherited from another
/// declaration.
void setDefaultArgument(Expr *DefArg) { DefaultArgument.set(DefArg); }
@@ -1352,10 +1353,10 @@ public:
DefaultArgument.setInherited(C, Parm);
}
- /// \brief Removes the default argument of this template parameter.
+ /// Removes the default argument of this template parameter.
void removeDefaultArgument() { DefaultArgument.clear(); }
- /// \brief Whether this parameter is a non-type template parameter pack.
+ /// Whether this parameter is a non-type template parameter pack.
///
/// If the parameter is a parameter pack, the type may be a
/// \c PackExpansionType. In the following example, the \c Dims parameter
@@ -1366,7 +1367,7 @@ public:
/// \endcode
bool isParameterPack() const { return ParameterPack; }
- /// \brief Whether this parameter pack is a pack expansion.
+ /// Whether this parameter pack is a pack expansion.
///
/// A non-type template parameter pack is a pack expansion if its type
/// contains an unexpanded parameter pack. In this case, we will have
@@ -1375,7 +1376,7 @@ public:
return ParameterPack && getType()->getAs<PackExpansionType>();
}
- /// \brief Whether this parameter is a non-type template parameter pack
+ /// Whether this parameter is a non-type template parameter pack
/// that has a known list of different types at different positions.
///
/// A parameter pack is an expanded parameter pack when the original
@@ -1401,14 +1402,14 @@ public:
/// return the expansion types.
bool isExpandedParameterPack() const { return ExpandedParameterPack; }
- /// \brief Retrieves the number of expansion types in an expanded parameter
+ /// Retrieves the number of expansion types in an expanded parameter
/// pack.
unsigned getNumExpansionTypes() const {
assert(ExpandedParameterPack && "Not an expansion parameter pack");
return NumExpandedTypes;
}
- /// \brief Retrieve a particular expansion type within an expanded parameter
+ /// Retrieve a particular expansion type within an expanded parameter
/// pack.
QualType getExpansionType(unsigned I) const {
assert(I < NumExpandedTypes && "Out-of-range expansion type index");
@@ -1417,7 +1418,7 @@ public:
return TypesAndInfos[I].first;
}
- /// \brief Retrieve a particular expansion type source info within an
+ /// Retrieve a particular expansion type source info within an
/// expanded parameter pack.
TypeSourceInfo *getExpansionTypeSourceInfo(unsigned I) const {
assert(I < NumExpandedTypes && "Out-of-range expansion type index");
@@ -1443,20 +1444,20 @@ class TemplateTemplateParmDecl final
protected TemplateParmPosition,
private llvm::TrailingObjects<TemplateTemplateParmDecl,
TemplateParameterList *> {
- /// \brief The default template argument, if any.
+ /// The default template argument, if any.
using DefArgStorage =
DefaultArgStorage<TemplateTemplateParmDecl, TemplateArgumentLoc *>;
DefArgStorage DefaultArgument;
- /// \brief Whether this parameter is a parameter pack.
+ /// Whether this parameter is a parameter pack.
bool ParameterPack;
- /// \brief Whether this template template parameter is an "expanded"
+ /// Whether this template template parameter is an "expanded"
/// parameter pack, meaning that it is a pack expansion and we
/// already know the set of template parameters that expansion expands to.
bool ExpandedParameterPack = false;
- /// \brief The number of parameters in an expanded parameter pack.
+ /// The number of parameters in an expanded parameter pack.
unsigned NumExpandedParams = 0;
TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L,
@@ -1501,7 +1502,7 @@ public:
using TemplateParmPosition::setPosition;
using TemplateParmPosition::getIndex;
- /// \brief Whether this template template parameter is a template
+ /// Whether this template template parameter is a template
/// parameter pack.
///
/// \code
@@ -1509,7 +1510,7 @@ public:
/// \endcode
bool isParameterPack() const { return ParameterPack; }
- /// \brief Whether this parameter pack is a pack expansion.
+ /// Whether this parameter pack is a pack expansion.
///
/// A template template parameter pack is a pack expansion if its template
/// parameter list contains an unexpanded parameter pack.
@@ -1518,7 +1519,7 @@ public:
getTemplateParameters()->containsUnexpandedParameterPack();
}
- /// \brief Whether this parameter is a template template parameter pack that
+ /// Whether this parameter is a template template parameter pack that
/// has a known list of different template parameter lists at different
/// positions.
///
@@ -1538,14 +1539,14 @@ public:
/// parameter pack.
bool isExpandedParameterPack() const { return ExpandedParameterPack; }
- /// \brief Retrieves the number of expansion template parameters in
+ /// Retrieves the number of expansion template parameters in
/// an expanded parameter pack.
unsigned getNumExpansionTemplateParameters() const {
assert(ExpandedParameterPack && "Not an expansion parameter pack");
return NumExpandedParams;
}
- /// \brief Retrieve a particular expansion type within an expanded parameter
+ /// Retrieve a particular expansion type within an expanded parameter
/// pack.
TemplateParameterList *getExpansionTemplateParameters(unsigned I) const {
assert(I < NumExpandedParams && "Out-of-range expansion type index");
@@ -1554,26 +1555,26 @@ public:
const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
- /// \brief Determine whether this template parameter has a default
+ /// Determine whether this template parameter has a default
/// argument.
bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
- /// \brief Retrieve the default argument, if any.
+ /// Retrieve the default argument, if any.
const TemplateArgumentLoc &getDefaultArgument() const {
static const TemplateArgumentLoc None;
return DefaultArgument.isSet() ? *DefaultArgument.get() : None;
}
- /// \brief Retrieve the location of the default argument, if any.
+ /// Retrieve the location of the default argument, if any.
SourceLocation getDefaultArgumentLoc() const;
- /// \brief Determines whether the default argument was inherited
+ /// Determines whether the default argument was inherited
/// from a previous declaration of this template.
bool defaultArgumentWasInherited() const {
return DefaultArgument.isInherited();
}
- /// \brief Set the default argument for this template parameter, and
+ /// Set the default argument for this template parameter, and
/// whether that default argument was inherited from another
/// declaration.
void setDefaultArgument(const ASTContext &C,
@@ -1583,7 +1584,7 @@ public:
DefaultArgument.setInherited(C, Prev);
}
- /// \brief Removes the default argument of this template parameter.
+ /// Removes the default argument of this template parameter.
void removeDefaultArgument() { DefaultArgument.clear(); }
SourceRange getSourceRange() const override LLVM_READONLY {
@@ -1598,7 +1599,7 @@ public:
static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
};
-/// \brief Represents the builtin template declaration which is used to
+/// Represents the builtin template declaration which is used to
/// implement __make_integer_seq and other builtin templates. It serves
/// no real purpose beyond existing as a place to hold template parameters.
class BuiltinTemplateDecl : public TemplateDecl {
@@ -1621,13 +1622,13 @@ public:
}
SourceRange getSourceRange() const override LLVM_READONLY {
- return SourceRange();
+ return {};
}
BuiltinTemplateKind getBuiltinTemplateKind() const { return BTK; }
};
-/// \brief Represents a class template specialization, which refers to
+/// Represents a class template specialization, which refers to
/// a class template with a given set of template arguments.
///
/// Class template specializations represent both explicit
@@ -1642,48 +1643,48 @@ public:
/// \endcode
class ClassTemplateSpecializationDecl
: public CXXRecordDecl, public llvm::FoldingSetNode {
- /// \brief Structure that stores information about a class template
+ /// Structure that stores information about a class template
/// specialization that was instantiated from a class template partial
/// specialization.
struct SpecializedPartialSpecialization {
- /// \brief The class template partial specialization from which this
+ /// The class template partial specialization from which this
/// class template specialization was instantiated.
ClassTemplatePartialSpecializationDecl *PartialSpecialization;
- /// \brief The template argument list deduced for the class template
+ /// The template argument list deduced for the class template
/// partial specialization itself.
const TemplateArgumentList *TemplateArgs;
};
- /// \brief The template that this specialization specializes
+ /// The template that this specialization specializes
llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
SpecializedTemplate;
- /// \brief Further info for explicit template specialization/instantiation.
+ /// Further info for explicit template specialization/instantiation.
struct ExplicitSpecializationInfo {
- /// \brief The type-as-written.
+ /// The type-as-written.
TypeSourceInfo *TypeAsWritten = nullptr;
- /// \brief The location of the extern keyword.
+ /// The location of the extern keyword.
SourceLocation ExternLoc;
- /// \brief The location of the template keyword.
+ /// The location of the template keyword.
SourceLocation TemplateKeywordLoc;
ExplicitSpecializationInfo() = default;
};
- /// \brief Further info for explicit template specialization/instantiation.
+ /// Further info for explicit template specialization/instantiation.
/// Does not apply to implicit specializations.
ExplicitSpecializationInfo *ExplicitInfo = nullptr;
- /// \brief The template arguments used to describe this specialization.
+ /// The template arguments used to describe this specialization.
const TemplateArgumentList *TemplateArgs;
- /// \brief The point where this template was instantiated (if any)
+ /// The point where this template was instantiated (if any)
SourceLocation PointOfInstantiation;
- /// \brief The kind of specialization this declaration refers to.
+ /// The kind of specialization this declaration refers to.
/// Really a value of type TemplateSpecializationKind.
unsigned SpecializationKind : 3;
@@ -1719,26 +1720,20 @@ public:
// it's not clear that we should override that, because the most recent
// declaration as a CXXRecordDecl sometimes is the injected-class-name.
ClassTemplateSpecializationDecl *getMostRecentDecl() {
- CXXRecordDecl *Recent = static_cast<CXXRecordDecl *>(
- this)->getMostRecentDecl();
- while (!isa<ClassTemplateSpecializationDecl>(Recent)) {
- // FIXME: Does injected class name need to be in the redeclarations chain?
- assert(Recent->isInjectedClassName() && Recent->getPreviousDecl());
- Recent = Recent->getPreviousDecl();
- }
- return cast<ClassTemplateSpecializationDecl>(Recent);
+ return cast<ClassTemplateSpecializationDecl>(
+ getMostRecentNonInjectedDecl());
}
- /// \brief Retrieve the template that this specialization specializes.
+ /// Retrieve the template that this specialization specializes.
ClassTemplateDecl *getSpecializedTemplate() const;
- /// \brief Retrieve the template arguments of the class template
+ /// Retrieve the template arguments of the class template
/// specialization.
const TemplateArgumentList &getTemplateArgs() const {
return *TemplateArgs;
}
- /// \brief Determine the kind of specialization that this
+ /// Determine the kind of specialization that this
/// declaration represents.
TemplateSpecializationKind getSpecializationKind() const {
return static_cast<TemplateSpecializationKind>(SpecializationKind);
@@ -1748,7 +1743,7 @@ public:
return getSpecializationKind() == TSK_ExplicitSpecialization;
}
- /// \brief True if this declaration is an explicit specialization,
+ /// True if this declaration is an explicit specialization,
/// explicit instantiation declaration, or explicit instantiation
/// definition.
bool isExplicitInstantiationOrSpecialization() const {
@@ -1760,7 +1755,7 @@ public:
SpecializationKind = TSK;
}
- /// \brief Get the point of instantiation (if any), or null if none.
+ /// Get the point of instantiation (if any), or null if none.
SourceLocation getPointOfInstantiation() const {
return PointOfInstantiation;
}
@@ -1770,7 +1765,7 @@ public:
PointOfInstantiation = Loc;
}
- /// \brief If this class template specialization is an instantiation of
+ /// If this class template specialization is an instantiation of
/// a template (rather than an explicit specialization), return the
/// class template or class template partial specialization from which it
/// was instantiated.
@@ -1784,19 +1779,19 @@ public:
return getSpecializedTemplateOrPartial();
}
- /// \brief Retrieve the class template or class template partial
+ /// Retrieve the class template or class template partial
/// specialization which was specialized by this.
llvm::PointerUnion<ClassTemplateDecl *,
ClassTemplatePartialSpecializationDecl *>
getSpecializedTemplateOrPartial() const {
- if (SpecializedPartialSpecialization *PartialSpec
- = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
+ if (const auto *PartialSpec =
+ SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
return PartialSpec->PartialSpecialization;
return SpecializedTemplate.get<ClassTemplateDecl*>();
}
- /// \brief Retrieve the set of template arguments that should be used
+ /// Retrieve the set of template arguments that should be used
/// to instantiate members of the class template or class template partial
/// specialization from which this class template specialization was
/// instantiated.
@@ -1808,28 +1803,27 @@ public:
/// deduced template arguments for the class template partial specialization
/// itself.
const TemplateArgumentList &getTemplateInstantiationArgs() const {
- if (SpecializedPartialSpecialization *PartialSpec
- = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
+ if (const auto *PartialSpec =
+ SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
return *PartialSpec->TemplateArgs;
return getTemplateArgs();
}
- /// \brief Note that this class template specialization is actually an
+ /// Note that this class template specialization is actually an
/// instantiation of the given class template partial specialization whose
/// template arguments have been deduced.
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
const TemplateArgumentList *TemplateArgs) {
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
"Already set to a class template partial specialization!");
- SpecializedPartialSpecialization *PS
- = new (getASTContext()) SpecializedPartialSpecialization();
+ auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
PS->PartialSpecialization = PartialSpec;
PS->TemplateArgs = TemplateArgs;
SpecializedTemplate = PS;
}
- /// \brief Note that this class template specialization is an instantiation
+ /// Note that this class template specialization is an instantiation
/// of the given class template.
void setInstantiationOf(ClassTemplateDecl *TemplDecl) {
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
@@ -1837,7 +1831,7 @@ public:
SpecializedTemplate = TemplDecl;
}
- /// \brief Sets the type of this specialization as it was written by
+ /// Sets the type of this specialization as it was written by
/// the user. This will be a class template specialization type.
void setTypeAsWritten(TypeSourceInfo *T) {
if (!ExplicitInfo)
@@ -1845,32 +1839,32 @@ public:
ExplicitInfo->TypeAsWritten = T;
}
- /// \brief Gets the type of this specialization as it was written by
+ /// Gets the type of this specialization as it was written by
/// the user, if it was so written.
TypeSourceInfo *getTypeAsWritten() const {
return ExplicitInfo ? ExplicitInfo->TypeAsWritten : nullptr;
}
- /// \brief Gets the location of the extern keyword, if present.
+ /// Gets the location of the extern keyword, if present.
SourceLocation getExternLoc() const {
return ExplicitInfo ? ExplicitInfo->ExternLoc : SourceLocation();
}
- /// \brief Sets the location of the extern keyword.
+ /// Sets the location of the extern keyword.
void setExternLoc(SourceLocation Loc) {
if (!ExplicitInfo)
ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
ExplicitInfo->ExternLoc = Loc;
}
- /// \brief Sets the location of the template keyword.
+ /// Sets the location of the template keyword.
void setTemplateKeywordLoc(SourceLocation Loc) {
if (!ExplicitInfo)
ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
ExplicitInfo->TemplateKeywordLoc = Loc;
}
- /// \brief Gets the location of the template keyword, if present.
+ /// Gets the location of the template keyword, if present.
SourceLocation getTemplateKeywordLoc() const {
return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
}
@@ -1899,14 +1893,14 @@ public:
class ClassTemplatePartialSpecializationDecl
: public ClassTemplateSpecializationDecl {
- /// \brief The list of template parameters
+ /// The list of template parameters
TemplateParameterList* TemplateParams = nullptr;
- /// \brief The source info for the template arguments as written.
+ /// The source info for the template arguments as written.
/// FIXME: redundant with TypeAsWritten?
const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
- /// \brief The class template partial specialization from which this
+ /// The class template partial specialization from which this
/// class template partial specialization was instantiated.
///
/// The boolean value will be true to indicate that this class template
@@ -1963,7 +1957,7 @@ public:
return ArgsAsWritten;
}
- /// \brief Retrieve the member class template partial specialization from
+ /// Retrieve the member class template partial specialization from
/// which this particular class template partial specialization was
/// instantiated.
///
@@ -1984,7 +1978,7 @@ public:
/// \c Outer<float>::Inner<U*>, this function would return
/// \c Outer<T>::Inner<U*>.
ClassTemplatePartialSpecializationDecl *getInstantiatedFromMember() const {
- const ClassTemplatePartialSpecializationDecl *First =
+ const auto *First =
cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
return First->InstantiatedFromMember.getPointer();
}
@@ -1995,12 +1989,11 @@ public:
void setInstantiatedFromMember(
ClassTemplatePartialSpecializationDecl *PartialSpec) {
- ClassTemplatePartialSpecializationDecl *First =
- cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
+ auto *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
First->InstantiatedFromMember.setPointer(PartialSpec);
}
- /// \brief Determines whether this class template partial specialization
+ /// Determines whether this class template partial specialization
/// template was a specialization of a member partial specialization.
///
/// In the following example, the member template partial specialization
@@ -2017,15 +2010,14 @@ public:
/// struct X<int>::Inner<T*> { /* ... */ };
/// \endcode
bool isMemberSpecialization() {
- ClassTemplatePartialSpecializationDecl *First =
+ const auto *First =
cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
return First->InstantiatedFromMember.getInt();
}
- /// \brief Note that this member template is a specialization.
+ /// Note that this member template is a specialization.
void setMemberSpecialization() {
- ClassTemplatePartialSpecializationDecl *First =
- cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
+ auto *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
assert(First->InstantiatedFromMember.getPointer() &&
"Only member templates can be member template specializations");
return First->InstantiatedFromMember.setInt(true);
@@ -2052,29 +2044,29 @@ public:
/// Declaration of a class template.
class ClassTemplateDecl : public RedeclarableTemplateDecl {
protected:
- /// \brief Data that is common to all of the declarations of a given
+ /// Data that is common to all of the declarations of a given
/// class template.
struct Common : CommonBase {
- /// \brief The class template specializations for this class
+ /// The class template specializations for this class
/// template, including explicit specializations and instantiations.
llvm::FoldingSetVector<ClassTemplateSpecializationDecl> Specializations;
- /// \brief The class template partial specializations for this class
+ /// The class template partial specializations for this class
/// template.
llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
PartialSpecializations;
- /// \brief The injected-class-name type for this class template.
+ /// The injected-class-name type for this class template.
QualType InjectedClassNameType;
Common() = default;
};
- /// \brief Retrieve the set of specializations of this class template.
+ /// Retrieve the set of specializations of this class template.
llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
getSpecializations() const;
- /// \brief Retrieve the set of partial specializations of this class
+ /// Retrieve the set of partial specializations of this class
/// template.
llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
getPartialSpecializations();
@@ -2100,22 +2092,22 @@ public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
- /// \brief Load any lazily-loaded specializations from the external source.
+ /// Load any lazily-loaded specializations from the external source.
void LoadLazySpecializations() const;
- /// \brief Get the underlying class declarations of the template.
+ /// Get the underlying class declarations of the template.
CXXRecordDecl *getTemplatedDecl() const {
return static_cast<CXXRecordDecl *>(TemplatedDecl);
}
- /// \brief Returns whether this template declaration defines the primary
+ /// Returns whether this template declaration defines the primary
/// class pattern.
bool isThisDeclarationADefinition() const {
return getTemplatedDecl()->isThisDeclarationADefinition();
}
// FIXME: remove default argument for AssociatedConstraints
- /// \brief Create a class template node.
+ /// Create a class template node.
static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
DeclarationName Name,
@@ -2123,15 +2115,15 @@ public:
NamedDecl *Decl,
Expr *AssociatedConstraints = nullptr);
- /// \brief Create an empty class template node.
+ /// Create an empty class template node.
static ClassTemplateDecl *CreateDeserialized(ASTContext &C, unsigned ID);
- /// \brief Return the specialization with the provided arguments if it exists,
+ /// Return the specialization with the provided arguments if it exists,
/// otherwise return the insertion point.
ClassTemplateSpecializationDecl *
findSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
- /// \brief Insert the specified specialization knowing that it is not already
+ /// Insert the specified specialization knowing that it is not already
/// in. InsertPos must be obtained from findSpecialization.
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos);
@@ -2144,7 +2136,7 @@ public:
RedeclarableTemplateDecl::getCanonicalDecl());
}
- /// \brief Retrieve the previous declaration of this class template, or
+ /// Retrieve the previous declaration of this class template, or
/// nullptr if no such declaration exists.
ClassTemplateDecl *getPreviousDecl() {
return cast_or_null<ClassTemplateDecl>(
@@ -2169,21 +2161,21 @@ public:
RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate());
}
- /// \brief Return the partial specialization with the provided arguments if it
+ /// Return the partial specialization with the provided arguments if it
/// exists, otherwise return the insertion point.
ClassTemplatePartialSpecializationDecl *
findPartialSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
- /// \brief Insert the specified partial specialization knowing that it is not
+ /// Insert the specified partial specialization knowing that it is not
/// already in. InsertPos must be obtained from findPartialSpecialization.
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D,
void *InsertPos);
- /// \brief Retrieve the partial specializations as an ordered list.
+ /// Retrieve the partial specializations as an ordered list.
void getPartialSpecializations(
SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS);
- /// \brief Find a class template partial specialization with the given
+ /// Find a class template partial specialization with the given
/// type T.
///
/// \param T a dependent type that names a specialization of this class
@@ -2193,7 +2185,7 @@ public:
/// the type \p T, or nullptr if no such partial specialization exists.
ClassTemplatePartialSpecializationDecl *findPartialSpecialization(QualType T);
- /// \brief Find a class template partial specialization which was instantiated
+ /// Find a class template partial specialization which was instantiated
/// from the given member partial specialization.
///
/// \param D a member class template partial specialization.
@@ -2205,7 +2197,7 @@ public:
findPartialSpecInstantiatedFromMember(
ClassTemplatePartialSpecializationDecl *D);
- /// \brief Retrieve the template specialization type of the
+ /// Retrieve the template specialization type of the
/// injected-class-name for this class template.
///
/// The injected-class-name for a class template \c X is \c
@@ -2241,7 +2233,7 @@ public:
static bool classofKind(Kind K) { return K == ClassTemplate; }
};
-/// \brief Declaration of a friend template.
+/// Declaration of a friend template.
///
/// For example:
/// \code
@@ -2305,7 +2297,7 @@ public:
return Friend.dyn_cast<NamedDecl*>();
}
- /// \brief Retrieves the location of the 'friend' keyword.
+ /// Retrieves the location of the 'friend' keyword.
SourceLocation getFriendLoc() const {
return FriendLoc;
}
@@ -2324,7 +2316,7 @@ public:
static bool classofKind(Kind K) { return K == Decl::FriendTemplate; }
};
-/// \brief Declaration of an alias template.
+/// Declaration of an alias template.
///
/// For example:
/// \code
@@ -2365,7 +2357,7 @@ public:
RedeclarableTemplateDecl::getCanonicalDecl());
}
- /// \brief Retrieve the previous declaration of this function template, or
+ /// Retrieve the previous declaration of this function template, or
/// nullptr if no such declaration exists.
TypeAliasTemplateDecl *getPreviousDecl() {
return cast_or_null<TypeAliasTemplateDecl>(
@@ -2382,14 +2374,14 @@ public:
RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate());
}
- /// \brief Create a function template node.
+ /// Create a function template node.
static TypeAliasTemplateDecl *Create(ASTContext &C, DeclContext *DC,