| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | #ifndef LLVM_CLANG_SEMA_SEMA_H |
| 15 | #define LLVM_CLANG_SEMA_SEMA_H |
| 16 | |
| 17 | #include "clang/AST/Attr.h" |
| 18 | #include "clang/AST/Availability.h" |
| 19 | #include "clang/AST/ComparisonCategories.h" |
| 20 | #include "clang/AST/DeclTemplate.h" |
| 21 | #include "clang/AST/DeclarationName.h" |
| 22 | #include "clang/AST/Expr.h" |
| 23 | #include "clang/AST/ExprCXX.h" |
| 24 | #include "clang/AST/ExprObjC.h" |
| 25 | #include "clang/AST/ExternalASTSource.h" |
| 26 | #include "clang/AST/LocInfoType.h" |
| 27 | #include "clang/AST/MangleNumberingContext.h" |
| 28 | #include "clang/AST/NSAPI.h" |
| 29 | #include "clang/AST/PrettyPrinter.h" |
| 30 | #include "clang/AST/StmtCXX.h" |
| 31 | #include "clang/AST/TypeLoc.h" |
| 32 | #include "clang/AST/TypeOrdering.h" |
| 33 | #include "clang/Basic/ExpressionTraits.h" |
| 34 | #include "clang/Basic/Module.h" |
| 35 | #include "clang/Basic/OpenMPKinds.h" |
| 36 | #include "clang/Basic/PragmaKinds.h" |
| 37 | #include "clang/Basic/Specifiers.h" |
| 38 | #include "clang/Basic/TemplateKinds.h" |
| 39 | #include "clang/Basic/TypeTraits.h" |
| 40 | #include "clang/Sema/AnalysisBasedWarnings.h" |
| 41 | #include "clang/Sema/CleanupInfo.h" |
| 42 | #include "clang/Sema/DeclSpec.h" |
| 43 | #include "clang/Sema/ExternalSemaSource.h" |
| 44 | #include "clang/Sema/IdentifierResolver.h" |
| 45 | #include "clang/Sema/ObjCMethodList.h" |
| 46 | #include "clang/Sema/Ownership.h" |
| 47 | #include "clang/Sema/Scope.h" |
| 48 | #include "clang/Sema/TypoCorrection.h" |
| 49 | #include "clang/Sema/Weak.h" |
| 50 | #include "llvm/ADT/ArrayRef.h" |
| 51 | #include "llvm/ADT/Optional.h" |
| 52 | #include "llvm/ADT/SetVector.h" |
| 53 | #include "llvm/ADT/SmallBitVector.h" |
| 54 | #include "llvm/ADT/SmallPtrSet.h" |
| 55 | #include "llvm/ADT/SmallVector.h" |
| 56 | #include "llvm/ADT/TinyPtrVector.h" |
| 57 | #include <deque> |
| 58 | #include <memory> |
| 59 | #include <string> |
| 60 | #include <vector> |
| 61 | |
| 62 | namespace llvm { |
| 63 | class APSInt; |
| 64 | template <typename ValueT> struct DenseMapInfo; |
| 65 | template <typename ValueT, typename ValueInfoT> class DenseSet; |
| 66 | class SmallBitVector; |
| 67 | struct InlineAsmIdentifierInfo; |
| 68 | } |
| 69 | |
| 70 | namespace clang { |
| 71 | class ADLResult; |
| 72 | class ASTConsumer; |
| 73 | class ASTContext; |
| 74 | class ASTMutationListener; |
| 75 | class ASTReader; |
| 76 | class ASTWriter; |
| 77 | class ArrayType; |
| 78 | class ParsedAttr; |
| 79 | class BindingDecl; |
| 80 | class BlockDecl; |
| 81 | class CapturedDecl; |
| 82 | class CXXBasePath; |
| 83 | class CXXBasePaths; |
| 84 | class CXXBindTemporaryExpr; |
| 85 | typedef SmallVector<CXXBaseSpecifier*, 4> CXXCastPath; |
| 86 | class CXXConstructorDecl; |
| 87 | class CXXConversionDecl; |
| 88 | class CXXDeleteExpr; |
| 89 | class CXXDestructorDecl; |
| 90 | class CXXFieldCollector; |
| 91 | class CXXMemberCallExpr; |
| 92 | class CXXMethodDecl; |
| 93 | class CXXScopeSpec; |
| 94 | class CXXTemporary; |
| 95 | class CXXTryStmt; |
| 96 | class CallExpr; |
| 97 | class ClassTemplateDecl; |
| 98 | class ClassTemplatePartialSpecializationDecl; |
| 99 | class ClassTemplateSpecializationDecl; |
| 100 | class VarTemplatePartialSpecializationDecl; |
| 101 | class CodeCompleteConsumer; |
| 102 | class CodeCompletionAllocator; |
| 103 | class CodeCompletionTUInfo; |
| 104 | class CodeCompletionResult; |
| 105 | class CoroutineBodyStmt; |
| 106 | class Decl; |
| 107 | class DeclAccessPair; |
| 108 | class DeclContext; |
| 109 | class DeclRefExpr; |
| 110 | class DeclaratorDecl; |
| 111 | class DeducedTemplateArgument; |
| 112 | class DependentDiagnostic; |
| 113 | class DesignatedInitExpr; |
| 114 | class Designation; |
| 115 | class EnableIfAttr; |
| 116 | class EnumConstantDecl; |
| 117 | class Expr; |
| 118 | class ExtVectorType; |
| 119 | class FormatAttr; |
| 120 | class FriendDecl; |
| 121 | class FunctionDecl; |
| 122 | class FunctionProtoType; |
| 123 | class FunctionTemplateDecl; |
| 124 | class ImplicitConversionSequence; |
| 125 | typedef MutableArrayRef<ImplicitConversionSequence> ConversionSequenceList; |
| 126 | class InitListExpr; |
| 127 | class InitializationKind; |
| 128 | class InitializationSequence; |
| 129 | class InitializedEntity; |
| 130 | class IntegerLiteral; |
| 131 | class LabelStmt; |
| 132 | class LambdaExpr; |
| 133 | class LangOptions; |
| 134 | class LocalInstantiationScope; |
| 135 | class LookupResult; |
| 136 | class MacroInfo; |
| 137 | typedef ArrayRef<std::pair<IdentifierInfo *, SourceLocation>> ModuleIdPath; |
| 138 | class ModuleLoader; |
| 139 | class MultiLevelTemplateArgumentList; |
| 140 | class NamedDecl; |
| 141 | class ObjCCategoryDecl; |
| 142 | class ObjCCategoryImplDecl; |
| 143 | class ObjCCompatibleAliasDecl; |
| 144 | class ObjCContainerDecl; |
| 145 | class ObjCImplDecl; |
| 146 | class ObjCImplementationDecl; |
| 147 | class ObjCInterfaceDecl; |
| 148 | class ObjCIvarDecl; |
| 149 | template <class T> class ObjCList; |
| 150 | class ObjCMessageExpr; |
| 151 | class ObjCMethodDecl; |
| 152 | class ObjCPropertyDecl; |
| 153 | class ObjCProtocolDecl; |
| 154 | class OMPThreadPrivateDecl; |
| 155 | class OMPRequiresDecl; |
| 156 | class OMPDeclareReductionDecl; |
| 157 | class OMPDeclareSimdDecl; |
| 158 | class OMPClause; |
| 159 | struct OMPVarListLocTy; |
| 160 | struct OverloadCandidate; |
| 161 | class OverloadCandidateSet; |
| 162 | class OverloadExpr; |
| 163 | class ParenListExpr; |
| 164 | class ParmVarDecl; |
| 165 | class Preprocessor; |
| 166 | class PseudoDestructorTypeStorage; |
| 167 | class PseudoObjectExpr; |
| 168 | class QualType; |
| 169 | class StandardConversionSequence; |
| 170 | class Stmt; |
| 171 | class StringLiteral; |
| 172 | class SwitchStmt; |
| 173 | class TemplateArgument; |
| 174 | class TemplateArgumentList; |
| 175 | class TemplateArgumentLoc; |
| 176 | class TemplateDecl; |
| 177 | class TemplateInstantiationCallback; |
| 178 | class TemplateParameterList; |
| 179 | class TemplatePartialOrderingContext; |
| 180 | class TemplateTemplateParmDecl; |
| 181 | class Token; |
| 182 | class TypeAliasDecl; |
| 183 | class TypedefDecl; |
| 184 | class TypedefNameDecl; |
| 185 | class TypeLoc; |
| 186 | class TypoCorrectionConsumer; |
| 187 | class UnqualifiedId; |
| 188 | class UnresolvedLookupExpr; |
| 189 | class UnresolvedMemberExpr; |
| 190 | class UnresolvedSetImpl; |
| 191 | class UnresolvedSetIterator; |
| 192 | class UsingDecl; |
| 193 | class UsingShadowDecl; |
| 194 | class ValueDecl; |
| 195 | class VarDecl; |
| 196 | class VarTemplateSpecializationDecl; |
| 197 | class VisibilityAttr; |
| 198 | class VisibleDeclConsumer; |
| 199 | class IndirectFieldDecl; |
| 200 | struct DeductionFailureInfo; |
| 201 | class TemplateSpecCandidateSet; |
| 202 | |
| 203 | namespace sema { |
| 204 | class AccessedEntity; |
| 205 | class BlockScopeInfo; |
| 206 | class Capture; |
| 207 | class CapturedRegionScopeInfo; |
| 208 | class CapturingScopeInfo; |
| 209 | class CompoundScopeInfo; |
| 210 | class DelayedDiagnostic; |
| 211 | class DelayedDiagnosticPool; |
| 212 | class FunctionScopeInfo; |
| 213 | class LambdaScopeInfo; |
| 214 | class PossiblyUnreachableDiag; |
| 215 | class SemaPPCallbacks; |
| 216 | class TemplateDeductionInfo; |
| 217 | } |
| 218 | |
| 219 | namespace threadSafety { |
| 220 | class BeforeSet; |
| 221 | void threadSafetyCleanup(BeforeSet* Cache); |
| 222 | } |
| 223 | |
| 224 | |
| 225 | |
| 226 | typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>, |
| 227 | SourceLocation> UnexpandedParameterPack; |
| 228 | |
| 229 | |
| 230 | |
| 231 | struct FileNullability { |
| 232 | |
| 233 | |
| 234 | SourceLocation PointerLoc; |
| 235 | |
| 236 | |
| 237 | |
| 238 | SourceLocation PointerEndLoc; |
| 239 | |
| 240 | |
| 241 | uint8_t PointerKind; |
| 242 | |
| 243 | |
| 244 | bool SawTypeNullability = false; |
| 245 | }; |
| 246 | |
| 247 | |
| 248 | |
| 249 | class FileNullabilityMap { |
| 250 | |
| 251 | llvm::DenseMap<FileID, FileNullability> Map; |
| 252 | |
| 253 | |
| 254 | struct { |
| 255 | FileID File; |
| 256 | FileNullability Nullability; |
| 257 | } Cache; |
| 258 | |
| 259 | public: |
| 260 | FileNullability &operator[](FileID file) { |
| 261 | |
| 262 | if (file == Cache.File) |
| 263 | return Cache.Nullability; |
| 264 | |
| 265 | |
| 266 | if (!Cache.File.isInvalid()) { |
| 267 | Map[Cache.File] = Cache.Nullability; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | Cache.File = file; |
| 272 | Cache.Nullability = Map[file]; |
| 273 | return Cache.Nullability; |
| 274 | } |
| 275 | }; |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | class PreferredTypeBuilder { |
| 282 | public: |
| 283 | PreferredTypeBuilder() = default; |
| 284 | explicit PreferredTypeBuilder(QualType Type) : Type(Type) {} |
| 285 | |
| 286 | void enterCondition(Sema &S, SourceLocation Tok); |
| 287 | void enterReturn(Sema &S, SourceLocation Tok); |
| 288 | void enterVariableInit(SourceLocation Tok, Decl *D); |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | void enterFunctionArgument(SourceLocation Tok, |
| 296 | llvm::function_ref<QualType()> ComputeType); |
| 297 | |
| 298 | void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc); |
| 299 | void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, |
| 300 | SourceLocation OpLoc); |
| 301 | void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op); |
| 302 | void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base); |
| 303 | void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS); |
| 304 | |
| 305 | void enterTypeCast(SourceLocation Tok, QualType CastType); |
| 306 | |
| 307 | QualType get(SourceLocation Tok) const { |
| 308 | if (Tok != ExpectedLoc) |
| 309 | return QualType(); |
| 310 | if (!Type.isNull()) |
| 311 | return Type; |
| 312 | if (ComputeType) |
| 313 | return ComputeType(); |
| 314 | return QualType(); |
| 315 | } |
| 316 | |
| 317 | private: |
| 318 | |
| 319 | SourceLocation ExpectedLoc; |
| 320 | |
| 321 | QualType Type; |
| 322 | |
| 323 | |
| 324 | llvm::function_ref<QualType()> ComputeType; |
| 325 | }; |
| 326 | |
| 327 | |
| 328 | class Sema { |
| 329 | Sema(const Sema &) = delete; |
| 330 | void operator=(const Sema &) = delete; |
| 331 | |
| 332 | |
| 333 | ExternalSemaSource *ExternalSource; |
| 334 | |
| 335 | |
| 336 | bool isMultiplexExternalSource; |
| 337 | |
| 338 | static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD); |
| 339 | |
| 340 | bool isVisibleSlow(const NamedDecl *D); |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old, |
| 346 | const NamedDecl *New) { |
| 347 | if (isVisible(Old)) |
| 348 | return true; |
| 349 | |
| 350 | |
| 351 | if (New->isExternallyDeclarable()) { |
| 352 | (0) . __assert_fail ("Old->isExternallyDeclarable() && \"should not have found a non-externally-declarable previous decl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 353, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Old->isExternallyDeclarable() && |
| 353 | (0) . __assert_fail ("Old->isExternallyDeclarable() && \"should not have found a non-externally-declarable previous decl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 353, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "should not have found a non-externally-declarable previous decl"); |
| 354 | return true; |
| 355 | } |
| 356 | return false; |
| 357 | } |
| 358 | bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New); |
| 359 | |
| 360 | void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem, |
| 361 | QualType ResultTy, |
| 362 | ArrayRef<QualType> Args); |
| 363 | |
| 364 | public: |
| 365 | typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy; |
| 366 | typedef OpaquePtr<TemplateName> TemplateTy; |
| 367 | typedef OpaquePtr<QualType> TypeTy; |
| 368 | |
| 369 | OpenCLOptions OpenCLFeatures; |
| 370 | FPOptions FPFeatures; |
| 371 | |
| 372 | const LangOptions &LangOpts; |
| 373 | Preprocessor &PP; |
| 374 | ASTContext &Context; |
| 375 | ASTConsumer &Consumer; |
| 376 | DiagnosticsEngine &Diags; |
| 377 | SourceManager &SourceMgr; |
| 378 | |
| 379 | |
| 380 | bool CollectStats; |
| 381 | |
| 382 | |
| 383 | CodeCompleteConsumer *CodeCompleter; |
| 384 | |
| 385 | |
| 386 | DeclContext *CurContext; |
| 387 | |
| 388 | |
| 389 | |
| 390 | DeclContext *OriginalLexicalContext; |
| 391 | |
| 392 | |
| 393 | |
| 394 | DeclarationName VAListTagName; |
| 395 | |
| 396 | bool MSStructPragmaOn; |
| 397 | |
| 398 | |
| 399 | LangOptions::PragmaMSPointersToMembersKind |
| 400 | MSPointerToMemberRepresentationMethod; |
| 401 | |
| 402 | |
| 403 | SmallVector<Scope*, 2> CurrentSEHFinally; |
| 404 | |
| 405 | |
| 406 | SourceLocation ImplicitMSInheritanceAttrLoc; |
| 407 | |
| 408 | |
| 409 | enum PragmaClangSectionKind { |
| 410 | PCSK_Invalid = 0, |
| 411 | PCSK_BSS = 1, |
| 412 | PCSK_Data = 2, |
| 413 | PCSK_Rodata = 3, |
| 414 | PCSK_Text = 4 |
| 415 | }; |
| 416 | |
| 417 | enum PragmaClangSectionAction { |
| 418 | PCSA_Set = 0, |
| 419 | PCSA_Clear = 1 |
| 420 | }; |
| 421 | |
| 422 | struct PragmaClangSection { |
| 423 | std::string SectionName; |
| 424 | bool Valid = false; |
| 425 | SourceLocation PragmaLocation; |
| 426 | |
| 427 | void Act(SourceLocation PragmaLocation, |
| 428 | PragmaClangSectionAction Action, |
| 429 | StringLiteral* Name); |
| 430 | }; |
| 431 | |
| 432 | PragmaClangSection PragmaClangBSSSection; |
| 433 | PragmaClangSection PragmaClangDataSection; |
| 434 | PragmaClangSection PragmaClangRodataSection; |
| 435 | PragmaClangSection PragmaClangTextSection; |
| 436 | |
| 437 | enum PragmaMsStackAction { |
| 438 | PSK_Reset = 0x0, |
| 439 | PSK_Set = 0x1, |
| 440 | PSK_Push = 0x2, |
| 441 | PSK_Pop = 0x4, |
| 442 | PSK_Show = 0x8, |
| 443 | PSK_Push_Set = PSK_Push | PSK_Set, |
| 444 | PSK_Pop_Set = PSK_Pop | PSK_Set, |
| 445 | }; |
| 446 | |
| 447 | template<typename ValueType> |
| 448 | struct PragmaStack { |
| 449 | struct Slot { |
| 450 | llvm::StringRef StackSlotLabel; |
| 451 | ValueType Value; |
| 452 | SourceLocation PragmaLocation; |
| 453 | SourceLocation PragmaPushLocation; |
| 454 | Slot(llvm::StringRef StackSlotLabel, ValueType Value, |
| 455 | SourceLocation PragmaLocation, SourceLocation PragmaPushLocation) |
| 456 | : StackSlotLabel(StackSlotLabel), Value(Value), |
| 457 | PragmaLocation(PragmaLocation), |
| 458 | PragmaPushLocation(PragmaPushLocation) {} |
| 459 | }; |
| 460 | void Act(SourceLocation PragmaLocation, |
| 461 | PragmaMsStackAction Action, |
| 462 | llvm::StringRef StackSlotLabel, |
| 463 | ValueType Value); |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | void SentinelAction(PragmaMsStackAction Action, StringRef Label) { |
| 480 | (0) . __assert_fail ("(Action == PSK_Push || Action == PSK_Pop) && \"Can only push / pop #pragma stack sentinels!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 481, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Action == PSK_Push || Action == PSK_Pop) && |
| 481 | (0) . __assert_fail ("(Action == PSK_Push || Action == PSK_Pop) && \"Can only push / pop #pragma stack sentinels!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 481, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Can only push / pop #pragma stack sentinels!"); |
| 482 | Act(CurrentPragmaLocation, Action, Label, CurrentValue); |
| 483 | } |
| 484 | |
| 485 | |
| 486 | explicit PragmaStack(const ValueType &Default) |
| 487 | : DefaultValue(Default), CurrentValue(Default) {} |
| 488 | |
| 489 | bool hasValue() const { return CurrentValue != DefaultValue; } |
| 490 | |
| 491 | SmallVector<Slot, 2> Stack; |
| 492 | ValueType DefaultValue; |
| 493 | ValueType CurrentValue; |
| 494 | SourceLocation CurrentPragmaLocation; |
| 495 | }; |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | PragmaStack<MSVtorDispAttr::Mode> VtorDispStack; |
| 508 | |
| 509 | |
| 510 | static const unsigned kMac68kAlignmentSentinel = ~0U; |
| 511 | PragmaStack<unsigned> PackStack; |
| 512 | |
| 513 | struct PackIncludeState { |
| 514 | unsigned CurrentValue; |
| 515 | SourceLocation CurrentPragmaLocation; |
| 516 | bool HasNonDefaultValue, ShouldWarnOnInclude; |
| 517 | }; |
| 518 | SmallVector<PackIncludeState, 8> PackIncludeStack; |
| 519 | |
| 520 | PragmaStack<StringLiteral *> DataSegStack; |
| 521 | PragmaStack<StringLiteral *> BSSSegStack; |
| 522 | PragmaStack<StringLiteral *> ConstSegStack; |
| 523 | PragmaStack<StringLiteral *> CodeSegStack; |
| 524 | |
| 525 | |
| 526 | |
| 527 | class PragmaStackSentinelRAII { |
| 528 | public: |
| 529 | PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct); |
| 530 | ~PragmaStackSentinelRAII(); |
| 531 | |
| 532 | private: |
| 533 | Sema &S; |
| 534 | StringRef SlotLabel; |
| 535 | bool ShouldAct; |
| 536 | }; |
| 537 | |
| 538 | |
| 539 | FileNullabilityMap NullabilityMap; |
| 540 | |
| 541 | |
| 542 | StringLiteral *CurInitSeg; |
| 543 | SourceLocation CurInitSegLoc; |
| 544 | |
| 545 | |
| 546 | void *VisContext; |
| 547 | |
| 548 | |
| 549 | struct PragmaAttributeEntry { |
| 550 | SourceLocation Loc; |
| 551 | ParsedAttr *Attribute; |
| 552 | SmallVector<attr::SubjectMatchRule, 4> MatchRules; |
| 553 | bool IsUsed; |
| 554 | }; |
| 555 | |
| 556 | |
| 557 | struct PragmaAttributeGroup { |
| 558 | |
| 559 | SourceLocation Loc; |
| 560 | |
| 561 | const IdentifierInfo *Namespace; |
| 562 | SmallVector<PragmaAttributeEntry, 2> Entries; |
| 563 | }; |
| 564 | |
| 565 | SmallVector<PragmaAttributeGroup, 2> PragmaAttributeStack; |
| 566 | |
| 567 | |
| 568 | |
| 569 | const Decl *PragmaAttributeCurrentTargetDecl; |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | SourceLocation OptimizeOffPragmaLocation; |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | bool IsBuildingRecoveryCallExpr; |
| 581 | |
| 582 | |
| 583 | CleanupInfo Cleanup; |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | SmallVector<BlockDecl*, 8> ExprCleanupObjects; |
| 589 | |
| 590 | |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | using MaybeODRUseExprSet = llvm::SmallPtrSet<Expr *, 2>; |
| 596 | MaybeODRUseExprSet MaybeODRUseExprs; |
| 597 | |
| 598 | std::unique_ptr<sema::FunctionScopeInfo> PreallocatedFunctionScope; |
| 599 | |
| 600 | |
| 601 | |
| 602 | SmallVector<sema::FunctionScopeInfo *, 4> FunctionScopes; |
| 603 | |
| 604 | typedef LazyVector<TypedefNameDecl *, ExternalSemaSource, |
| 605 | &ExternalSemaSource::ReadExtVectorDecls, 2, 2> |
| 606 | ExtVectorDeclsType; |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | ExtVectorDeclsType ExtVectorDecls; |
| 612 | |
| 613 | |
| 614 | std::unique_ptr<CXXFieldCollector> FieldCollector; |
| 615 | |
| 616 | typedef llvm::SmallSetVector<NamedDecl *, 16> NamedDeclSetType; |
| 617 | |
| 618 | |
| 619 | NamedDeclSetType UnusedPrivateFields; |
| 620 | |
| 621 | |
| 622 | llvm::SmallSetVector<const TypedefNameDecl *, 4> |
| 623 | UnusedLocalTypedefNameCandidates; |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | |
| 630 | typedef std::pair<SourceLocation, bool> DeleteExprLoc; |
| 631 | typedef llvm::SmallVector<DeleteExprLoc, 4> DeleteLocs; |
| 632 | llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs; |
| 633 | |
| 634 | typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy; |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet; |
| 640 | |
| 641 | |
| 642 | |
| 643 | llvm::SmallPtrSet<const Decl*, 4> ParsingInitForAutoVars; |
| 644 | |
| 645 | |
| 646 | NamedDecl *findLocallyScopedExternCDecl(DeclarationName Name); |
| 647 | |
| 648 | typedef LazyVector<VarDecl *, ExternalSemaSource, |
| 649 | &ExternalSemaSource::ReadTentativeDefinitions, 2, 2> |
| 650 | TentativeDefinitionsType; |
| 651 | |
| 652 | |
| 653 | TentativeDefinitionsType TentativeDefinitions; |
| 654 | |
| 655 | typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource, |
| 656 | &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2> |
| 657 | UnusedFileScopedDeclsType; |
| 658 | |
| 659 | |
| 660 | |
| 661 | UnusedFileScopedDeclsType UnusedFileScopedDecls; |
| 662 | |
| 663 | typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource, |
| 664 | &ExternalSemaSource::ReadDelegatingConstructors, 2, 2> |
| 665 | DelegatingCtorDeclsType; |
| 666 | |
| 667 | |
| 668 | |
| 669 | DelegatingCtorDeclsType DelegatingCtorDecls; |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | SmallVector<std::pair<const CXXMethodDecl*, const CXXMethodDecl*>, 2> |
| 675 | DelayedOverridingExceptionSpecChecks; |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | SmallVector<std::pair<FunctionDecl*, FunctionDecl*>, 2> |
| 683 | DelayedEquivalentExceptionSpecChecks; |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | SmallVector<std::pair<CXXMethodDecl*, const FunctionProtoType*>, 2> |
| 693 | DelayedDefaultedMemberExceptionSpecs; |
| 694 | |
| 695 | typedef llvm::MapVector<const FunctionDecl *, |
| 696 | std::unique_ptr<LateParsedTemplate>> |
| 697 | LateParsedTemplateMapT; |
| 698 | LateParsedTemplateMapT LateParsedTemplateMap; |
| 699 | |
| 700 | |
| 701 | typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT); |
| 702 | typedef void LateTemplateParserCleanupCB(void *P); |
| 703 | LateTemplateParserCB *LateTemplateParser; |
| 704 | LateTemplateParserCleanupCB *LateTemplateParserCleanup; |
| 705 | void *OpaqueParser; |
| 706 | |
| 707 | void SetLateTemplateParser(LateTemplateParserCB *LTP, |
| 708 | LateTemplateParserCleanupCB *LTPCleanup, |
| 709 | void *P) { |
| 710 | LateTemplateParser = LTP; |
| 711 | LateTemplateParserCleanup = LTPCleanup; |
| 712 | OpaqueParser = P; |
| 713 | } |
| 714 | |
| 715 | class DelayedDiagnostics; |
| 716 | |
| 717 | class DelayedDiagnosticsState { |
| 718 | sema::DelayedDiagnosticPool *SavedPool; |
| 719 | friend class Sema::DelayedDiagnostics; |
| 720 | }; |
| 721 | typedef DelayedDiagnosticsState ParsingDeclState; |
| 722 | typedef DelayedDiagnosticsState ProcessingContextState; |
| 723 | |
| 724 | |
| 725 | |
| 726 | class DelayedDiagnostics { |
| 727 | |
| 728 | |
| 729 | sema::DelayedDiagnosticPool *CurPool; |
| 730 | |
| 731 | public: |
| 732 | DelayedDiagnostics() : CurPool(nullptr) {} |
| 733 | |
| 734 | |
| 735 | void add(const sema::DelayedDiagnostic &diag); |
| 736 | |
| 737 | |
| 738 | bool shouldDelayDiagnostics() { return CurPool != nullptr; } |
| 739 | |
| 740 | |
| 741 | sema::DelayedDiagnosticPool *getCurrentPool() const { |
| 742 | return CurPool; |
| 743 | } |
| 744 | |
| 745 | |
| 746 | |
| 747 | DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool) { |
| 748 | DelayedDiagnosticsState state; |
| 749 | state.SavedPool = CurPool; |
| 750 | CurPool = &pool; |
| 751 | return state; |
| 752 | } |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | void popWithoutEmitting(DelayedDiagnosticsState state) { |
| 758 | CurPool = state.SavedPool; |
| 759 | } |
| 760 | |
| 761 | |
| 762 | |
| 763 | DelayedDiagnosticsState pushUndelayed() { |
| 764 | DelayedDiagnosticsState state; |
| 765 | state.SavedPool = CurPool; |
| 766 | CurPool = nullptr; |
| 767 | return state; |
| 768 | } |
| 769 | |
| 770 | |
| 771 | void popUndelayed(DelayedDiagnosticsState state) { |
| 772 | assert(CurPool == nullptr); |
| 773 | CurPool = state.SavedPool; |
| 774 | } |
| 775 | } DelayedDiagnostics; |
| 776 | |
| 777 | |
| 778 | class { |
| 779 | private: |
| 780 | Sema &; |
| 781 | DeclContext *; |
| 782 | ProcessingContextState ; |
| 783 | QualType ; |
| 784 | |
| 785 | public: |
| 786 | ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true) |
| 787 | : S(S), SavedContext(S.CurContext), |
| 788 | SavedContextState(S.DelayedDiagnostics.pushUndelayed()), |
| 789 | SavedCXXThisTypeOverride(S.CXXThisTypeOverride) |
| 790 | { |
| 791 | (0) . __assert_fail ("ContextToPush && \"pushing null context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 791, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(ContextToPush && "pushing null context"); |
| 792 | S.CurContext = ContextToPush; |
| 793 | if (NewThisContext) |
| 794 | S.CXXThisTypeOverride = QualType(); |
| 795 | } |
| 796 | |
| 797 | void () { |
| 798 | if (!SavedContext) return; |
| 799 | S.CurContext = SavedContext; |
| 800 | S.DelayedDiagnostics.popUndelayed(SavedContextState); |
| 801 | S.CXXThisTypeOverride = SavedCXXThisTypeOverride; |
| 802 | SavedContext = nullptr; |
| 803 | } |
| 804 | |
| 805 | ~ContextRAII() { |
| 806 | pop(); |
| 807 | } |
| 808 | }; |
| 809 | |
| 810 | |
| 811 | |
| 812 | class SynthesizedFunctionScope { |
| 813 | Sema &S; |
| 814 | Sema::ContextRAII SavedContext; |
| 815 | bool PushedCodeSynthesisContext = false; |
| 816 | |
| 817 | public: |
| 818 | SynthesizedFunctionScope(Sema &S, DeclContext *DC) |
| 819 | : S(S), SavedContext(S, DC) { |
| 820 | S.PushFunctionScope(); |
| 821 | S.PushExpressionEvaluationContext( |
| 822 | Sema::ExpressionEvaluationContext::PotentiallyEvaluated); |
| 823 | if (auto *FD = dyn_cast<FunctionDecl>(DC)) |
| 824 | FD->setWillHaveBody(true); |
| 825 | else |
| 826 | (DC)", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 826, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<ObjCMethodDecl>(DC)); |
| 827 | } |
| 828 | |
| 829 | void addContextNote(SourceLocation UseLoc) { |
| 830 | assert(!PushedCodeSynthesisContext); |
| 831 | |
| 832 | Sema::CodeSynthesisContext Ctx; |
| 833 | Ctx.Kind = Sema::CodeSynthesisContext::DefiningSynthesizedFunction; |
| 834 | Ctx.PointOfInstantiation = UseLoc; |
| 835 | Ctx.Entity = cast<Decl>(S.CurContext); |
| 836 | S.pushCodeSynthesisContext(Ctx); |
| 837 | |
| 838 | PushedCodeSynthesisContext = true; |
| 839 | } |
| 840 | |
| 841 | ~SynthesizedFunctionScope() { |
| 842 | if (PushedCodeSynthesisContext) |
| 843 | S.popCodeSynthesisContext(); |
| 844 | if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext)) |
| 845 | FD->setWillHaveBody(false); |
| 846 | S.PopExpressionEvaluationContext(); |
| 847 | S.PopFunctionScopeInfo(); |
| 848 | } |
| 849 | }; |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers; |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers; |
| 861 | |
| 862 | |
| 863 | |
| 864 | void LoadExternalWeakUndeclaredIdentifiers(); |
| 865 | |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | SmallVector<Decl*,2> WeakTopLevelDecl; |
| 872 | |
| 873 | IdentifierResolver IdResolver; |
| 874 | |
| 875 | |
| 876 | |
| 877 | |
| 878 | Scope *TUScope; |
| 879 | |
| 880 | |
| 881 | LazyDeclPtr StdNamespace; |
| 882 | |
| 883 | |
| 884 | |
| 885 | LazyDeclPtr StdBadAlloc; |
| 886 | |
| 887 | |
| 888 | |
| 889 | LazyDeclPtr StdAlignValT; |
| 890 | |
| 891 | |
| 892 | |
| 893 | NamespaceDecl *StdExperimentalNamespaceCache; |
| 894 | |
| 895 | |
| 896 | |
| 897 | ClassTemplateDecl *StdInitializerList; |
| 898 | |
| 899 | |
| 900 | |
| 901 | ClassTemplateDecl *StdCoroutineTraitsCache; |
| 902 | |
| 903 | |
| 904 | RecordDecl *CXXTypeInfoDecl; |
| 905 | |
| 906 | |
| 907 | RecordDecl *MSVCGuidDecl; |
| 908 | |
| 909 | |
| 910 | std::unique_ptr<NSAPI> NSAPIObj; |
| 911 | |
| 912 | |
| 913 | ObjCInterfaceDecl *NSNumberDecl; |
| 914 | |
| 915 | |
| 916 | ObjCInterfaceDecl *NSValueDecl; |
| 917 | |
| 918 | |
| 919 | QualType NSNumberPointer; |
| 920 | |
| 921 | |
| 922 | QualType NSValuePointer; |
| 923 | |
| 924 | |
| 925 | ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]; |
| 926 | |
| 927 | |
| 928 | ObjCInterfaceDecl *NSStringDecl; |
| 929 | |
| 930 | |
| 931 | QualType NSStringPointer; |
| 932 | |
| 933 | |
| 934 | ObjCMethodDecl *StringWithUTF8StringMethod; |
| 935 | |
| 936 | |
| 937 | ObjCMethodDecl *ValueWithBytesObjCTypeMethod; |
| 938 | |
| 939 | |
| 940 | ObjCInterfaceDecl *NSArrayDecl; |
| 941 | |
| 942 | |
| 943 | ObjCMethodDecl *ArrayWithObjectsMethod; |
| 944 | |
| 945 | |
| 946 | ObjCInterfaceDecl *NSDictionaryDecl; |
| 947 | |
| 948 | |
| 949 | ObjCMethodDecl *DictionaryWithObjectsMethod; |
| 950 | |
| 951 | |
| 952 | QualType QIDNSCopying; |
| 953 | |
| 954 | |
| 955 | Selector RespondsToSelectorSel; |
| 956 | |
| 957 | |
| 958 | |
| 959 | bool GlobalNewDeleteDeclared; |
| 960 | |
| 961 | |
| 962 | |
| 963 | bool AllowAbstractFieldReference; |
| 964 | |
| 965 | |
| 966 | |
| 967 | enum class ExpressionEvaluationContext { |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | Unevaluated, |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | UnevaluatedList, |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | DiscardedStatement, |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | UnevaluatedAbstract, |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | ConstantEvaluated, |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | PotentiallyEvaluated, |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | PotentiallyEvaluatedIfUsed |
| 1010 | }; |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | struct ExpressionEvaluationContextRecord { |
| 1015 | |
| 1016 | ExpressionEvaluationContext Context; |
| 1017 | |
| 1018 | |
| 1019 | CleanupInfo ParentCleanup; |
| 1020 | |
| 1021 | |
| 1022 | bool IsDecltype; |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | unsigned NumCleanupObjects; |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | unsigned NumTypos; |
| 1031 | |
| 1032 | MaybeODRUseExprSet SavedMaybeODRUseExprs; |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | SmallVector<LambdaExpr *, 2> Lambdas; |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | Decl *ManglingContextDecl; |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | std::unique_ptr<MangleNumberingContext> MangleNumbering; |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | SmallVector<CallExpr *, 8> DelayedDecltypeCalls; |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | SmallVector<CXXBindTemporaryExpr *, 8> DelayedDecltypeBinds; |
| 1057 | |
| 1058 | llvm::SmallPtrSet<const Expr *, 8> PossibleDerefs; |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | enum ExpressionKind { |
| 1063 | EK_Decltype, EK_TemplateArgument, EK_Other |
| 1064 | } ExprContext; |
| 1065 | |
| 1066 | ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, |
| 1067 | unsigned NumCleanupObjects, |
| 1068 | CleanupInfo ParentCleanup, |
| 1069 | Decl *ManglingContextDecl, |
| 1070 | ExpressionKind ExprContext) |
| 1071 | : Context(Context), ParentCleanup(ParentCleanup), |
| 1072 | NumCleanupObjects(NumCleanupObjects), NumTypos(0), |
| 1073 | ManglingContextDecl(ManglingContextDecl), MangleNumbering(), |
| 1074 | ExprContext(ExprContext) {} |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | MangleNumberingContext &getMangleNumberingContext(ASTContext &Ctx); |
| 1079 | |
| 1080 | bool isUnevaluated() const { |
| 1081 | return Context == ExpressionEvaluationContext::Unevaluated || |
| 1082 | Context == ExpressionEvaluationContext::UnevaluatedAbstract || |
| 1083 | Context == ExpressionEvaluationContext::UnevaluatedList; |
| 1084 | } |
| 1085 | bool isConstantEvaluated() const { |
| 1086 | return Context == ExpressionEvaluationContext::ConstantEvaluated; |
| 1087 | } |
| 1088 | }; |
| 1089 | |
| 1090 | |
| 1091 | SmallVector<ExpressionEvaluationContextRecord, 8> ExprEvalContexts; |
| 1092 | |
| 1093 | |
| 1094 | void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec); |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | MangleNumberingContext *getCurrentMangleNumberContext( |
| 1104 | const DeclContext *DC, |
| 1105 | Decl *&ManglingContextDecl); |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | class SpecialMemberOverloadResult { |
| 1114 | public: |
| 1115 | enum Kind { |
| 1116 | NoMemberOrDeleted, |
| 1117 | Ambiguous, |
| 1118 | Success |
| 1119 | }; |
| 1120 | |
| 1121 | private: |
| 1122 | llvm::PointerIntPair<CXXMethodDecl*, 2> Pair; |
| 1123 | |
| 1124 | public: |
| 1125 | SpecialMemberOverloadResult() : Pair() {} |
| 1126 | SpecialMemberOverloadResult(CXXMethodDecl *MD) |
| 1127 | : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {} |
| 1128 | |
| 1129 | CXXMethodDecl *getMethod() const { return Pair.getPointer(); } |
| 1130 | void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); } |
| 1131 | |
| 1132 | Kind getKind() const { return static_cast<Kind>(Pair.getInt()); } |
| 1133 | void setKind(Kind K) { Pair.setInt(K); } |
| 1134 | }; |
| 1135 | |
| 1136 | class SpecialMemberOverloadResultEntry |
| 1137 | : public llvm::FastFoldingSetNode, |
| 1138 | public SpecialMemberOverloadResult { |
| 1139 | public: |
| 1140 | SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID) |
| 1141 | : FastFoldingSetNode(ID) |
| 1142 | {} |
| 1143 | }; |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache; |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache; |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | TranslationUnitKind TUKind; |
| 1161 | |
| 1162 | llvm::BumpPtrAllocator BumpAlloc; |
| 1163 | |
| 1164 | |
| 1165 | unsigned NumSFINAEErrors; |
| 1166 | |
| 1167 | typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>> |
| 1168 | UnparsedDefaultArgInstantiationsMap; |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations; |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs; |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed; |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | bool isExternalWithNoLinkageType(ValueDecl *VD); |
| 1191 | |
| 1192 | |
| 1193 | void getUndefinedButUsed( |
| 1194 | SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined); |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | const llvm::MapVector<FieldDecl *, DeleteLocs> & |
| 1199 | getMismatchingDeleteExpressions() const; |
| 1200 | |
| 1201 | typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods; |
| 1202 | typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool; |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | GlobalMethodPool MethodPool; |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | llvm::MapVector<Selector, SourceLocation> ReferencedSelectors; |
| 1215 | |
| 1216 | |
| 1217 | enum CXXSpecialMember { |
| 1218 | CXXDefaultConstructor, |
| 1219 | CXXCopyConstructor, |
| 1220 | CXXMoveConstructor, |
| 1221 | CXXCopyAssignment, |
| 1222 | CXXMoveAssignment, |
| 1223 | CXXDestructor, |
| 1224 | CXXInvalid |
| 1225 | }; |
| 1226 | |
| 1227 | typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember> |
| 1228 | SpecialMemberDecl; |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | llvm::SmallPtrSet<SpecialMemberDecl, 4> SpecialMembersBeingDeclared; |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | llvm::SmallPtrSet<const NamedDecl *, 4> TypoCorrectedFunctionDefinitions; |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | llvm::SmallVector<QualType, 4> CurrentParameterCopyTypes; |
| 1244 | |
| 1245 | void ReadMethodPool(Selector Sel); |
| 1246 | void updateOutOfDateSelector(Selector Sel); |
| 1247 | |
| 1248 | |
| 1249 | bool isSelfExpr(Expr *RExpr); |
| 1250 | bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method); |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | void EmitCurrentDiagnostic(unsigned DiagID); |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | class FPContractStateRAII { |
| 1260 | public: |
| 1261 | FPContractStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.FPFeatures) {} |
| 1262 | ~FPContractStateRAII() { S.FPFeatures = OldFPFeaturesState; } |
| 1263 | |
| 1264 | private: |
| 1265 | Sema& S; |
| 1266 | FPOptions OldFPFeaturesState; |
| 1267 | }; |
| 1268 | |
| 1269 | void addImplicitTypedef(StringRef Name, QualType T); |
| 1270 | |
| 1271 | public: |
| 1272 | Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, |
| 1273 | TranslationUnitKind TUKind = TU_Complete, |
| 1274 | CodeCompleteConsumer *CompletionConsumer = nullptr); |
| 1275 | ~Sema(); |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | void Initialize(); |
| 1280 | |
| 1281 | const LangOptions &getLangOpts() const { return LangOpts; } |
| 1282 | OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; } |
| 1283 | FPOptions &getFPOptions() { return FPFeatures; } |
| 1284 | |
| 1285 | DiagnosticsEngine &getDiagnostics() const { return Diags; } |
| 1286 | SourceManager &getSourceManager() const { return SourceMgr; } |
| 1287 | Preprocessor &getPreprocessor() const { return PP; } |
| 1288 | ASTContext &getASTContext() const { return Context; } |
| 1289 | ASTConsumer &getASTConsumer() const { return Consumer; } |
| 1290 | ASTMutationListener *getASTMutationListener() const; |
| 1291 | ExternalSemaSource* getExternalSource() const { return ExternalSource; } |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | void addExternalSource(ExternalSemaSource *E); |
| 1299 | |
| 1300 | void PrintStats() const; |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | class SemaDiagnosticBuilder : public DiagnosticBuilder { |
| 1312 | Sema &SemaRef; |
| 1313 | unsigned DiagID; |
| 1314 | |
| 1315 | public: |
| 1316 | SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID) |
| 1317 | : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { } |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default; |
| 1326 | |
| 1327 | ~SemaDiagnosticBuilder() { |
| 1328 | |
| 1329 | if (!isActive()) return; |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | FlushCounts(); |
| 1341 | Clear(); |
| 1342 | |
| 1343 | |
| 1344 | SemaRef.EmitCurrentDiagnostic(DiagID); |
| 1345 | } |
| 1346 | |
| 1347 | |
| 1348 | template<typename T> |
| 1349 | friend const SemaDiagnosticBuilder &operator<<( |
| 1350 | const SemaDiagnosticBuilder &Diag, const T &Value) { |
| 1351 | const DiagnosticBuilder &BaseDiag = Diag; |
| 1352 | BaseDiag << Value; |
| 1353 | return Diag; |
| 1354 | } |
| 1355 | }; |
| 1356 | |
| 1357 | |
| 1358 | SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) { |
| 1359 | DiagnosticBuilder DB = Diags.Report(Loc, DiagID); |
| 1360 | return SemaDiagnosticBuilder(DB, *this, DiagID); |
| 1361 | } |
| 1362 | |
| 1363 | |
| 1364 | SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic& PD); |
| 1365 | |
| 1366 | |
| 1367 | PartialDiagnostic PDiag(unsigned DiagID = 0); |
| 1368 | |
| 1369 | bool findMacroSpelling(SourceLocation &loc, StringRef name); |
| 1370 | |
| 1371 | |
| 1372 | std::string |
| 1373 | getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const; |
| 1374 | std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const; |
| 1375 | |
| 1376 | |
| 1377 | SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset = 0); |
| 1378 | |
| 1379 | |
| 1380 | ModuleLoader &getModuleLoader() const; |
| 1381 | |
| 1382 | void emitAndClearUnusedLocalTypedefWarnings(); |
| 1383 | |
| 1384 | void ActOnStartOfTranslationUnit(); |
| 1385 | void ActOnEndOfTranslationUnit(); |
| 1386 | |
| 1387 | void CheckDelegatingCtorCycles(); |
| 1388 | |
| 1389 | Scope *getScopeForContext(DeclContext *Ctx); |
| 1390 | |
| 1391 | void PushFunctionScope(); |
| 1392 | void PushBlockScope(Scope *BlockScope, BlockDecl *Block); |
| 1393 | sema::LambdaScopeInfo *PushLambdaScope(); |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | |
| 1398 | void RecordParsingTemplateParameterDepth(unsigned Depth); |
| 1399 | |
| 1400 | void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, |
| 1401 | RecordDecl *RD, |
| 1402 | CapturedRegionKind K); |
| 1403 | void |
| 1404 | PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP = nullptr, |
| 1405 | const Decl *D = nullptr, |
| 1406 | const BlockExpr *blkExpr = nullptr); |
| 1407 | |
| 1408 | sema::FunctionScopeInfo *getCurFunction() const { |
| 1409 | return FunctionScopes.empty() ? nullptr : FunctionScopes.back(); |
| 1410 | } |
| 1411 | |
| 1412 | sema::FunctionScopeInfo *getEnclosingFunction() const; |
| 1413 | |
| 1414 | void setFunctionHasBranchIntoScope(); |
| 1415 | void setFunctionHasBranchProtectedScope(); |
| 1416 | void setFunctionHasIndirectGoto(); |
| 1417 | |
| 1418 | void PushCompoundScope(bool IsStmtExpr); |
| 1419 | void PopCompoundScope(); |
| 1420 | |
| 1421 | sema::CompoundScopeInfo &getCurCompoundScope() const; |
| 1422 | |
| 1423 | bool hasAnyUnrecoverableErrorsInThisFunction() const; |
| 1424 | |
| 1425 | |
| 1426 | sema::BlockScopeInfo *getCurBlock(); |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | sema::LambdaScopeInfo * |
| 1433 | getCurLambda(bool IgnoreNonLambdaCapturingScope = false); |
| 1434 | |
| 1435 | |
| 1436 | sema::LambdaScopeInfo *getCurGenericLambda(); |
| 1437 | |
| 1438 | |
| 1439 | sema::CapturedRegionScopeInfo *getCurCapturedRegion(); |
| 1440 | |
| 1441 | |
| 1442 | SmallVectorImpl<Decl *> &WeakTopLevelDecls() { return WeakTopLevelDecl; } |
| 1443 | |
| 1444 | void (SourceRange ); |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, |
| 1451 | const DeclSpec *DS = nullptr); |
| 1452 | QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA, |
| 1453 | const DeclSpec *DS = nullptr); |
| 1454 | QualType BuildPointerType(QualType T, |
| 1455 | SourceLocation Loc, DeclarationName Entity); |
| 1456 | QualType BuildReferenceType(QualType T, bool LValueRef, |
| 1457 | SourceLocation Loc, DeclarationName Entity); |
| 1458 | QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, |
| 1459 | Expr *ArraySize, unsigned Quals, |
| 1460 | SourceRange Brackets, DeclarationName Entity); |
| 1461 | QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc); |
| 1462 | QualType BuildExtVectorType(QualType T, Expr *ArraySize, |
| 1463 | SourceLocation AttrLoc); |
| 1464 | QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, |
| 1465 | SourceLocation AttrLoc); |
| 1466 | |
| 1467 | |
| 1468 | QualType BuildAddressSpaceAttr(QualType &T, Expr *AddrSpace, |
| 1469 | SourceLocation AttrLoc); |
| 1470 | |
| 1471 | bool CheckFunctionReturnType(QualType T, SourceLocation Loc); |
| 1472 | |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | |
| 1482 | |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | |
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | |
| 1500 | QualType BuildFunctionType(QualType T, |
| 1501 | MutableArrayRef<QualType> ParamTypes, |
| 1502 | SourceLocation Loc, DeclarationName Entity, |
| 1503 | const FunctionProtoType::ExtProtoInfo &EPI); |
| 1504 | |
| 1505 | QualType BuildMemberPointerType(QualType T, QualType Class, |
| 1506 | SourceLocation Loc, |
| 1507 | DeclarationName Entity); |
| 1508 | QualType BuildBlockPointerType(QualType T, |
| 1509 | SourceLocation Loc, DeclarationName Entity); |
| 1510 | QualType BuildParenType(QualType T); |
| 1511 | QualType BuildAtomicType(QualType T, SourceLocation Loc); |
| 1512 | QualType BuildReadPipeType(QualType T, |
| 1513 | SourceLocation Loc); |
| 1514 | QualType BuildWritePipeType(QualType T, |
| 1515 | SourceLocation Loc); |
| 1516 | |
| 1517 | TypeSourceInfo *GetTypeForDeclarator(Declarator &D, Scope *S); |
| 1518 | TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &D, QualType FromTy); |
| 1519 | |
| 1520 | |
| 1521 | ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo); |
| 1522 | DeclarationNameInfo GetNameForDeclarator(Declarator &D); |
| 1523 | DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name); |
| 1524 | static QualType GetTypeFromParser(ParsedType Ty, |
| 1525 | TypeSourceInfo **TInfo = nullptr); |
| 1526 | CanThrowResult canThrow(const Expr *E); |
| 1527 | const FunctionProtoType *ResolveExceptionSpec(SourceLocation Loc, |
| 1528 | const FunctionProtoType *FPT); |
| 1529 | void UpdateExceptionSpec(FunctionDecl *FD, |
| 1530 | const FunctionProtoType::ExceptionSpecInfo &ESI); |
| 1531 | bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range); |
| 1532 | bool CheckDistantExceptionSpec(QualType T); |
| 1533 | bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New); |
| 1534 | bool CheckEquivalentExceptionSpec( |
| 1535 | const FunctionProtoType *Old, SourceLocation OldLoc, |
| 1536 | const FunctionProtoType *New, SourceLocation NewLoc); |
| 1537 | bool CheckEquivalentExceptionSpec( |
| 1538 | const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID, |
| 1539 | const FunctionProtoType *Old, SourceLocation OldLoc, |
| 1540 | const FunctionProtoType *New, SourceLocation NewLoc); |
| 1541 | bool handlerCanCatch(QualType HandlerType, QualType ExceptionType); |
| 1542 | bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, |
| 1543 | const PartialDiagnostic &NestedDiagID, |
| 1544 | const PartialDiagnostic &NoteID, |
| 1545 | const FunctionProtoType *Superset, |
| 1546 | SourceLocation SuperLoc, |
| 1547 | const FunctionProtoType *Subset, |
| 1548 | SourceLocation SubLoc); |
| 1549 | bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, |
| 1550 | const PartialDiagnostic &NoteID, |
| 1551 | const FunctionProtoType *Target, |
| 1552 | SourceLocation TargetLoc, |
| 1553 | const FunctionProtoType *Source, |
| 1554 | SourceLocation SourceLoc); |
| 1555 | |
| 1556 | TypeResult ActOnTypeName(Scope *S, Declarator &D); |
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | ParsedType ActOnObjCInstanceType(SourceLocation Loc); |
| 1561 | |
| 1562 | |
| 1563 | struct TypeDiagnoser { |
| 1564 | TypeDiagnoser() {} |
| 1565 | |
| 1566 | virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0; |
| 1567 | virtual ~TypeDiagnoser() {} |
| 1568 | }; |
| 1569 | |
| 1570 | static int getPrintable(int I) { return I; } |
| 1571 | static unsigned getPrintable(unsigned I) { return I; } |
| 1572 | static bool getPrintable(bool B) { return B; } |
| 1573 | static const char * getPrintable(const char *S) { return S; } |
| 1574 | static StringRef getPrintable(StringRef S) { return S; } |
| 1575 | static const std::string &getPrintable(const std::string &S) { return S; } |
| 1576 | static const IdentifierInfo *getPrintable(const IdentifierInfo *II) { |
| 1577 | return II; |
| 1578 | } |
| 1579 | static DeclarationName getPrintable(DeclarationName N) { return N; } |
| 1580 | static QualType getPrintable(QualType T) { return T; } |
| 1581 | static SourceRange getPrintable(SourceRange R) { return R; } |
| 1582 | static SourceRange getPrintable(SourceLocation L) { return L; } |
| 1583 | static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); } |
| 1584 | static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();} |
| 1585 | |
| 1586 | template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser { |
| 1587 | unsigned DiagID; |
| 1588 | std::tuple<const Ts &...> Args; |
| 1589 | |
| 1590 | template <std::size_t... Is> |
| 1591 | void emit(const SemaDiagnosticBuilder &DB, |
| 1592 | llvm::index_sequence<Is...>) const { |
| 1593 | |
| 1594 | bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...}; |
| 1595 | (void)Dummy; |
| 1596 | } |
| 1597 | |
| 1598 | public: |
| 1599 | BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args) |
| 1600 | : TypeDiagnoser(), DiagID(DiagID), Args(Args...) { |
| 1601 | (0) . __assert_fail ("DiagID != 0 && \"no diagnostic for type diagnoser\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 1601, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DiagID != 0 && "no diagnostic for type diagnoser"); |
| 1602 | } |
| 1603 | |
| 1604 | void diagnose(Sema &S, SourceLocation Loc, QualType T) override { |
| 1605 | const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID); |
| 1606 | emit(DB, llvm::index_sequence_for<Ts...>()); |
| 1607 | DB << T; |
| 1608 | } |
| 1609 | }; |
| 1610 | |
| 1611 | private: |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 | |
| 1617 | |
| 1618 | |
| 1619 | void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E); |
| 1620 | void CheckAddressOfNoDeref(const Expr *E); |
| 1621 | void CheckMemberAccessOfNoDeref(const MemberExpr *E); |
| 1622 | |
| 1623 | bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T, |
| 1624 | TypeDiagnoser *Diagnoser); |
| 1625 | |
| 1626 | struct ModuleScope { |
| 1627 | clang::Module *Module = nullptr; |
| 1628 | bool ModuleInterface = false; |
| 1629 | VisibleModuleSet OuterVisibleModules; |
| 1630 | }; |
| 1631 | |
| 1632 | llvm::SmallVector<ModuleScope, 16> ModuleScopes; |
| 1633 | |
| 1634 | |
| 1635 | Module *getCurrentModule() const { |
| 1636 | return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module; |
| 1637 | } |
| 1638 | |
| 1639 | VisibleModuleSet VisibleModules; |
| 1640 | |
| 1641 | public: |
| 1642 | |
| 1643 | Module *getOwningModule(Decl *Entity) { return Entity->getOwningModule(); } |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | void makeMergedDefinitionVisible(NamedDecl *ND); |
| 1648 | |
| 1649 | bool isModuleVisible(const Module *M, bool ModulePrivate = false); |
| 1650 | |
| 1651 | |
| 1652 | bool isVisible(const NamedDecl *D) { |
| 1653 | return !D->isHidden() || isVisibleSlow(D); |
| 1654 | } |
| 1655 | |
| 1656 | |
| 1657 | bool |
| 1658 | hasVisibleDeclaration(const NamedDecl *D, |
| 1659 | llvm::SmallVectorImpl<Module *> *Modules = nullptr) { |
| 1660 | return isVisible(D) || hasVisibleDeclarationSlow(D, Modules); |
| 1661 | } |
| 1662 | bool hasVisibleDeclarationSlow(const NamedDecl *D, |
| 1663 | llvm::SmallVectorImpl<Module *> *Modules); |
| 1664 | |
| 1665 | bool hasVisibleMergedDefinition(NamedDecl *Def); |
| 1666 | bool hasMergedDefinitionInCurrentModule(NamedDecl *Def); |
| 1667 | |
| 1668 | |
| 1669 | |
| 1670 | bool hasStructuralCompatLayout(Decl *D, Decl *Suggested); |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, |
| 1675 | bool OnlyNeedComplete = false); |
| 1676 | bool hasVisibleDefinition(const NamedDecl *D) { |
| 1677 | NamedDecl *Hidden; |
| 1678 | return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden); |
| 1679 | } |
| 1680 | |
| 1681 | |
| 1682 | bool |
| 1683 | hasVisibleDefaultArgument(const NamedDecl *D, |
| 1684 | llvm::SmallVectorImpl<Module *> *Modules = nullptr); |
| 1685 | |
| 1686 | |
| 1687 | |
| 1688 | |
| 1689 | bool hasVisibleExplicitSpecialization( |
| 1690 | const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr); |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | bool hasVisibleMemberSpecialization( |
| 1695 | const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr); |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, |
| 1701 | const NamedDecl *B); |
| 1702 | void diagnoseEquivalentInternalLinkageDeclarations( |
| 1703 | SourceLocation Loc, const NamedDecl *D, |
| 1704 | ArrayRef<const NamedDecl *> Equiv); |
| 1705 | |
| 1706 | bool isUsualDeallocationFunction(const CXXMethodDecl *FD); |
| 1707 | |
| 1708 | bool isCompleteType(SourceLocation Loc, QualType T) { |
| 1709 | return !RequireCompleteTypeImpl(Loc, T, nullptr); |
| 1710 | } |
| 1711 | bool RequireCompleteType(SourceLocation Loc, QualType T, |
| 1712 | TypeDiagnoser &Diagnoser); |
| 1713 | bool RequireCompleteType(SourceLocation Loc, QualType T, |
| 1714 | unsigned DiagID); |
| 1715 | |
| 1716 | template <typename... Ts> |
| 1717 | bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, |
| 1718 | const Ts &...Args) { |
| 1719 | BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...); |
| 1720 | return RequireCompleteType(Loc, T, Diagnoser); |
| 1721 | } |
| 1722 | |
| 1723 | void completeExprArrayBound(Expr *E); |
| 1724 | bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser); |
| 1725 | bool RequireCompleteExprType(Expr *E, unsigned DiagID); |
| 1726 | |
| 1727 | template <typename... Ts> |
| 1728 | bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) { |
| 1729 | BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...); |
| 1730 | return RequireCompleteExprType(E, Diagnoser); |
| 1731 | } |
| 1732 | |
| 1733 | bool RequireLiteralType(SourceLocation Loc, QualType T, |
| 1734 | TypeDiagnoser &Diagnoser); |
| 1735 | bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID); |
| 1736 | |
| 1737 | template <typename... Ts> |
| 1738 | bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, |
| 1739 | const Ts &...Args) { |
| 1740 | BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...); |
| 1741 | return RequireLiteralType(Loc, T, Diagnoser); |
| 1742 | } |
| 1743 | |
| 1744 | QualType getElaboratedType(ElaboratedTypeKeyword Keyword, |
| 1745 | const CXXScopeSpec &SS, QualType T, |
| 1746 | TagDecl *OwnedTagDecl = nullptr); |
| 1747 | |
| 1748 | QualType BuildTypeofExprType(Expr *E, SourceLocation Loc); |
| 1749 | |
| 1750 | |
| 1751 | QualType BuildDecltypeType(Expr *E, SourceLocation Loc, |
| 1752 | bool AsUnevaluated = true); |
| 1753 | QualType BuildUnaryTransformType(QualType BaseType, |
| 1754 | UnaryTransformType::UTTKind UKind, |
| 1755 | SourceLocation Loc); |
| 1756 | |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | |
| 1761 | struct SkipBodyInfo { |
| 1762 | SkipBodyInfo() |
| 1763 | : ShouldSkip(false), CheckSameAsPrevious(false), Previous(nullptr), |
| 1764 | New(nullptr) {} |
| 1765 | bool ShouldSkip; |
| 1766 | bool CheckSameAsPrevious; |
| 1767 | NamedDecl *Previous; |
| 1768 | NamedDecl *New; |
| 1769 | }; |
| 1770 | |
| 1771 | DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr); |
| 1772 | |
| 1773 | void DiagnoseUseOfUnimplementedSelectors(); |
| 1774 | |
| 1775 | bool isSimpleTypeSpecifier(tok::TokenKind Kind) const; |
| 1776 | |
| 1777 | ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, |
| 1778 | Scope *S, CXXScopeSpec *SS = nullptr, |
| 1779 | bool isClassName = false, bool HasTrailingDot = false, |
| 1780 | ParsedType ObjectType = nullptr, |
| 1781 | bool IsCtorOrDtorName = false, |
| 1782 | bool WantNontrivialTypeSourceInfo = false, |
| 1783 | bool IsClassTemplateDeductionContext = true, |
| 1784 | IdentifierInfo **CorrectedII = nullptr); |
| 1785 | TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S); |
| 1786 | bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S); |
| 1787 | void DiagnoseUnknownTypeName(IdentifierInfo *&II, |
| 1788 | SourceLocation IILoc, |
| 1789 | Scope *S, |
| 1790 | CXXScopeSpec *SS, |
| 1791 | ParsedType &SuggestedType, |
| 1792 | bool IsTemplateName = false); |
| 1793 | |
| 1794 | |
| 1795 | |
| 1796 | |
| 1797 | |
| 1798 | ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, |
| 1799 | SourceLocation NameLoc, |
| 1800 | bool IsTemplateTypeArg); |
| 1801 | |
| 1802 | |
| 1803 | |
| 1804 | enum NameClassificationKind { |
| 1805 | NC_Unknown, |
| 1806 | NC_Error, |
| 1807 | NC_Keyword, |
| 1808 | NC_Type, |
| 1809 | NC_Expression, |
| 1810 | NC_NestedNameSpecifier, |
| 1811 | NC_TypeTemplate, |
| 1812 | NC_VarTemplate, |
| 1813 | NC_FunctionTemplate |
| 1814 | }; |
| 1815 | |
| 1816 | class NameClassification { |
| 1817 | NameClassificationKind Kind; |
| 1818 | ExprResult Expr; |
| 1819 | TemplateName Template; |
| 1820 | ParsedType Type; |
| 1821 | |
| 1822 | explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {} |
| 1823 | |
| 1824 | public: |
| 1825 | NameClassification(ExprResult Expr) : Kind(NC_Expression), Expr(Expr) {} |
| 1826 | |
| 1827 | NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {} |
| 1828 | |
| 1829 | NameClassification(const IdentifierInfo *Keyword) : Kind(NC_Keyword) {} |
| 1830 | |
| 1831 | static NameClassification Error() { |
| 1832 | return NameClassification(NC_Error); |
| 1833 | } |
| 1834 | |
| 1835 | static NameClassification Unknown() { |
| 1836 | return NameClassification(NC_Unknown); |
| 1837 | } |
| 1838 | |
| 1839 | static NameClassification NestedNameSpecifier() { |
| 1840 | return NameClassification(NC_NestedNameSpecifier); |
| 1841 | } |
| 1842 | |
| 1843 | static NameClassification TypeTemplate(TemplateName Name) { |
| 1844 | NameClassification Result(NC_TypeTemplate); |
| 1845 | Result.Template = Name; |
| 1846 | return Result; |
| 1847 | } |
| 1848 | |
| 1849 | static NameClassification VarTemplate(TemplateName Name) { |
| 1850 | NameClassification Result(NC_VarTemplate); |
| 1851 | Result.Template = Name; |
| 1852 | return Result; |
| 1853 | } |
| 1854 | |
| 1855 | static NameClassification FunctionTemplate(TemplateName Name) { |
| 1856 | NameClassification Result(NC_FunctionTemplate); |
| 1857 | Result.Template = Name; |
| 1858 | return Result; |
| 1859 | } |
| 1860 | |
| 1861 | NameClassificationKind getKind() const { return Kind; } |
| 1862 | |
| 1863 | ParsedType getType() const { |
| 1864 | assert(Kind == NC_Type); |
| 1865 | return Type; |
| 1866 | } |
| 1867 | |
| 1868 | ExprResult getExpression() const { |
| 1869 | assert(Kind == NC_Expression); |
| 1870 | return Expr; |
| 1871 | } |
| 1872 | |
| 1873 | TemplateName getTemplateName() const { |
| 1874 | assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate || |
| 1875 | Kind == NC_VarTemplate); |
| 1876 | return Template; |
| 1877 | } |
| 1878 | |
| 1879 | TemplateNameKind getTemplateNameKind() const { |
| 1880 | switch (Kind) { |
| 1881 | case NC_TypeTemplate: |
| 1882 | return TNK_Type_template; |
| 1883 | case NC_FunctionTemplate: |
| 1884 | return TNK_Function_template; |
| 1885 | case NC_VarTemplate: |
| 1886 | return TNK_Var_template; |
| 1887 | default: |
| 1888 | llvm_unreachable("unsupported name classification."); |
| 1889 | } |
| 1890 | } |
| 1891 | }; |
| 1892 | |
| 1893 | |
| 1894 | |
| 1895 | |
| 1896 | |
| 1897 | |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | |
| 1908 | |
| 1909 | |
| 1910 | |
| 1911 | |
| 1912 | |
| 1913 | |
| 1914 | |
| 1915 | |
| 1916 | |
| 1917 | NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, |
| 1918 | IdentifierInfo *&Name, SourceLocation NameLoc, |
| 1919 | const Token &NextToken, |
| 1920 | bool IsAddressOfOperand, |
| 1921 | CorrectionCandidateCallback *CCC = nullptr); |
| 1922 | |
| 1923 | |
| 1924 | enum class TemplateNameKindForDiagnostics { |
| 1925 | ClassTemplate, |
| 1926 | FunctionTemplate, |
| 1927 | VarTemplate, |
| 1928 | AliasTemplate, |
| 1929 | TemplateTemplateParam, |
| 1930 | DependentTemplate |
| 1931 | }; |
| 1932 | TemplateNameKindForDiagnostics |
| 1933 | getTemplateNameKindForDiagnostics(TemplateName Name); |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent) { |
| 1938 | if (!getLangOpts().CPlusPlus || E.isInvalid()) |
| 1939 | return false; |
| 1940 | Dependent = false; |
| 1941 | if (auto *DRE = dyn_cast<DeclRefExpr>(E.get())) |
| 1942 | return !DRE->hasExplicitTemplateArgs(); |
| 1943 | if (auto *ME = dyn_cast<MemberExpr>(E.get())) |
| 1944 | return !ME->hasExplicitTemplateArgs(); |
| 1945 | Dependent = true; |
| 1946 | if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get())) |
| 1947 | return !DSDRE->hasExplicitTemplateArgs(); |
| 1948 | if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get())) |
| 1949 | return !DSME->hasExplicitTemplateArgs(); |
| 1950 | |
| 1951 | |
| 1952 | return false; |
| 1953 | } |
| 1954 | void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, |
| 1955 | SourceLocation Less, |
| 1956 | SourceLocation Greater); |
| 1957 | |
| 1958 | Decl *ActOnDeclarator(Scope *S, Declarator &D); |
| 1959 | |
| 1960 | NamedDecl *HandleDeclarator(Scope *S, Declarator &D, |
| 1961 | MultiTemplateParamsArg TemplateParameterLists); |
| 1962 | void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S); |
| 1963 | bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info); |
| 1964 | bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, |
| 1965 | DeclarationName Name, SourceLocation Loc, |
| 1966 | bool IsTemplateId); |
| 1967 | void |
| 1968 | diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, |
| 1969 | SourceLocation FallbackLoc, |
| 1970 | SourceLocation ConstQualLoc = SourceLocation(), |
| 1971 | SourceLocation VolatileQualLoc = SourceLocation(), |
| 1972 | SourceLocation RestrictQualLoc = SourceLocation(), |
| 1973 | SourceLocation AtomicQualLoc = SourceLocation(), |
| 1974 | SourceLocation UnalignedQualLoc = SourceLocation()); |
| 1975 | |
| 1976 | static bool adjustContextForLocalExternDecl(DeclContext *&DC); |
| 1977 | void DiagnoseFunctionSpecifiers(const DeclSpec &DS); |
| 1978 | NamedDecl *getShadowedDeclaration(const TypedefNameDecl *D, |
| 1979 | const LookupResult &R); |
| 1980 | NamedDecl *getShadowedDeclaration(const VarDecl *D, const LookupResult &R); |
| 1981 | void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, |
| 1982 | const LookupResult &R); |
| 1983 | void CheckShadow(Scope *S, VarDecl *D); |
| 1984 | |
| 1985 | |
| 1986 | |
| 1987 | void CheckShadowingDeclModification(Expr *E, SourceLocation Loc); |
| 1988 | |
| 1989 | void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI); |
| 1990 | |
| 1991 | private: |
| 1992 | |
| 1993 | |
| 1994 | llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls; |
| 1995 | |
| 1996 | public: |
| 1997 | void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange); |
| 1998 | void handleTagNumbering(const TagDecl *Tag, Scope *TagScope); |
| 1999 | void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, |
| 2000 | TypedefNameDecl *NewTD); |
| 2001 | void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D); |
| 2002 | NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, |
| 2003 | TypeSourceInfo *TInfo, |
| 2004 | LookupResult &Previous); |
| 2005 | NamedDecl* ActOnTypedefNameDecl(Scope* S, DeclContext* DC, TypedefNameDecl *D, |
| 2006 | LookupResult &Previous, bool &Redeclaration); |
| 2007 | NamedDecl *ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, |
| 2008 | TypeSourceInfo *TInfo, |
| 2009 | LookupResult &Previous, |
| 2010 | MultiTemplateParamsArg TemplateParamLists, |
| 2011 | bool &AddToScope, |
| 2012 | ArrayRef<BindingDecl *> Bindings = None); |
| 2013 | NamedDecl * |
| 2014 | ActOnDecompositionDeclarator(Scope *S, Declarator &D, |
| 2015 | MultiTemplateParamsArg TemplateParamLists); |
| 2016 | |
| 2017 | bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous); |
| 2018 | void CheckVariableDeclarationType(VarDecl *NewVD); |
| 2019 | bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, |
| 2020 | Expr *&Init); |
| 2021 | void CheckCompleteVariableDeclaration(VarDecl *VD); |
| 2022 | void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD); |
| 2023 | void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D); |
| 2024 | |
| 2025 | NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, |
| 2026 | TypeSourceInfo *TInfo, |
| 2027 | LookupResult &Previous, |
| 2028 | MultiTemplateParamsArg TemplateParamLists, |
| 2029 | bool &AddToScope); |
| 2030 | bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); |
| 2031 | |
| 2032 | bool CheckConstexprFunctionDecl(const FunctionDecl *FD); |
| 2033 | bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body); |
| 2034 | |
| 2035 | void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD); |
| 2036 | void FindHiddenVirtualMethods(CXXMethodDecl *MD, |
| 2037 | SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods); |
| 2038 | void NoteHiddenVirtualMethods(CXXMethodDecl *MD, |
| 2039 | SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods); |
| 2040 | |
| 2041 | bool CheckFunctionDeclaration(Scope *S, |
| 2042 | FunctionDecl *NewFD, LookupResult &Previous, |
| 2043 | bool IsMemberSpecialization); |
| 2044 | bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl); |
| 2045 | bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, |
| 2046 | QualType NewT, QualType OldT); |
| 2047 | void CheckMain(FunctionDecl *FD, const DeclSpec &D); |
| 2048 | void CheckMSVCRTEntryPoint(FunctionDecl *FD); |
| 2049 | Attr *getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition); |
| 2050 | Decl *ActOnParamDeclarator(Scope *S, Declarator &D); |
| 2051 | ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC, |
| 2052 | SourceLocation Loc, |
| 2053 | QualType T); |
| 2054 | ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc, |
| 2055 | SourceLocation NameLoc, IdentifierInfo *Name, |
| 2056 | QualType T, TypeSourceInfo *TSInfo, |
| 2057 | StorageClass SC); |
| 2058 | void ActOnParamDefaultArgument(Decl *param, |
| 2059 | SourceLocation EqualLoc, |
| 2060 | Expr *defarg); |
| 2061 | void ActOnParamUnparsedDefaultArgument(Decl *param, |
| 2062 | SourceLocation EqualLoc, |
| 2063 | SourceLocation ArgLoc); |
| 2064 | void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc); |
| 2065 | bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, |
| 2066 | SourceLocation EqualLoc); |
| 2067 | |
| 2068 | void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit); |
| 2069 | void ActOnUninitializedDecl(Decl *dcl); |
| 2070 | void ActOnInitializerError(Decl *Dcl); |
| 2071 | |
| 2072 | void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc); |
| 2073 | void ActOnCXXForRangeDecl(Decl *D); |
| 2074 | StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, |
| 2075 | IdentifierInfo *Ident, |
| 2076 | ParsedAttributes &Attrs, |
| 2077 | SourceLocation AttrEnd); |
| 2078 | void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc); |
| 2079 | void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc); |
| 2080 | void CheckStaticLocalForDllExport(VarDecl *VD); |
| 2081 | void FinalizeDeclaration(Decl *D); |
| 2082 | DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, |
| 2083 | ArrayRef<Decl *> Group); |
| 2084 | DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef<Decl *> Group); |
| 2085 | |
| 2086 | |
| 2087 | |
| 2088 | void ActOnDocumentableDecl(Decl *D); |
| 2089 | void ActOnDocumentableDecls(ArrayRef<Decl *> Group); |
| 2090 | |
| 2091 | void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, |
| 2092 | SourceLocation LocAfterDecls); |
| 2093 | void CheckForFunctionRedefinition( |
| 2094 | FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr, |
| 2095 | SkipBodyInfo *SkipBody = nullptr); |
| 2096 | Decl *ActOnStartOfFunctionDef(Scope *S, Declarator &D, |
| 2097 | MultiTemplateParamsArg TemplateParamLists, |
| 2098 | SkipBodyInfo *SkipBody = nullptr); |
| 2099 | Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D, |
| 2100 | SkipBodyInfo *SkipBody = nullptr); |
| 2101 | void ActOnStartOfObjCMethodDef(Scope *S, Decl *D); |
| 2102 | bool isObjCMethodDecl(Decl *D) { |
| 2103 | return D && isa<ObjCMethodDecl>(D); |
| 2104 | } |
| 2105 | |
| 2106 | |
| 2107 | |
| 2108 | |
| 2109 | |
| 2110 | |
| 2111 | |
| 2112 | |
| 2113 | |
| 2114 | bool canDelayFunctionBody(const Declarator &D); |
| 2115 | |
| 2116 | |
| 2117 | |
| 2118 | |
| 2119 | |
| 2120 | |
| 2121 | |
| 2122 | |
| 2123 | bool canSkipFunctionBody(Decl *D); |
| 2124 | |
| 2125 | void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope); |
| 2126 | Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body); |
| 2127 | Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation); |
| 2128 | Decl *ActOnSkippedFunctionBody(Decl *Decl); |
| 2129 | void ActOnFinishInlineFunctionDef(FunctionDecl *D); |
| 2130 | |
| 2131 | |
| 2132 | |
| 2133 | void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs); |
| 2134 | |
| 2135 | |
| 2136 | |
| 2137 | void DiagnoseUnusedParameters(ArrayRef<ParmVarDecl *> Parameters); |
| 2138 | |
| 2139 | |
| 2140 | |
| 2141 | |
| 2142 | void |
| 2143 | DiagnoseSizeOfParametersAndReturnValue(ArrayRef<ParmVarDecl *> Parameters, |
| 2144 | QualType ReturnTy, NamedDecl *D); |
| 2145 | |
| 2146 | void DiagnoseInvalidJumps(Stmt *Body); |
| 2147 | Decl *ActOnFileScopeAsmDecl(Expr *expr, |
| 2148 | SourceLocation AsmLoc, |
| 2149 | SourceLocation RParenLoc); |
| 2150 | |
| 2151 | |
| 2152 | Decl *ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, |
| 2153 | SourceLocation SemiLoc); |
| 2154 | |
| 2155 | enum class ModuleDeclKind { |
| 2156 | Interface, |
| 2157 | Implementation, |
| 2158 | Partition, |
| 2159 | }; |
| 2160 | |
| 2161 | |
| 2162 | |
| 2163 | DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, |
| 2164 | SourceLocation ModuleLoc, ModuleDeclKind MDK, |
| 2165 | ModuleIdPath Path); |
| 2166 | |
| 2167 | |
| 2168 | |
| 2169 | |
| 2170 | |
| 2171 | |
| 2172 | |
| 2173 | |
| 2174 | DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc, |
| 2175 | ModuleIdPath Path); |
| 2176 | |
| 2177 | |
| 2178 | |
| 2179 | void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod); |
| 2180 | void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod); |
| 2181 | |
| 2182 | |
| 2183 | void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod); |
| 2184 | |
| 2185 | void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod); |
| 2186 | |
| 2187 | |
| 2188 | |
| 2189 | |
| 2190 | |
| 2191 | |
| 2192 | |
| 2193 | void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, |
| 2194 | Module *Mod); |
| 2195 | |
| 2196 | |
| 2197 | |
| 2198 | enum class MissingImportKind { |
| 2199 | Declaration, |
| 2200 | Definition, |
| 2201 | DefaultArgument, |
| 2202 | ExplicitSpecialization, |
| 2203 | PartialSpecialization |
| 2204 | }; |
| 2205 | |
| 2206 | |
| 2207 | |
| 2208 | void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, |
| 2209 | MissingImportKind MIK, bool Recover = true); |
| 2210 | void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, |
| 2211 | SourceLocation DeclLoc, ArrayRef<Module *> Modules, |
| 2212 | MissingImportKind MIK, bool Recover); |
| 2213 | |
| 2214 | Decl *ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, |
| 2215 | SourceLocation LBraceLoc); |
| 2216 | Decl *ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, |
| 2217 | SourceLocation RBraceLoc); |
| 2218 | |
| 2219 | |
| 2220 | |
| 2221 | |
| 2222 | void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec); |
| 2223 | |
| 2224 | |
| 2225 | |
| 2226 | |
| 2227 | void checkPartialSpecializationVisibility(SourceLocation Loc, |
| 2228 | NamedDecl *Spec); |
| 2229 | |
| 2230 | |
| 2231 | PrintingPolicy getPrintingPolicy() const { |
| 2232 | return getPrintingPolicy(Context, PP); |
| 2233 | } |
| 2234 | |
| 2235 | |
| 2236 | static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx, |
| 2237 | const Preprocessor &PP); |
| 2238 | |
| 2239 | |
| 2240 | void ActOnPopScope(SourceLocation Loc, Scope *S); |
| 2241 | void ActOnTranslationUnitScope(Scope *S); |
| 2242 | |
| 2243 | Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, |
| 2244 | RecordDecl *&AnonRecord); |
| 2245 | Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, |
| 2246 | MultiTemplateParamsArg TemplateParams, |
| 2247 | bool IsExplicitInstantiation, |
| 2248 | RecordDecl *&AnonRecord); |
| 2249 | |
| 2250 | Decl *BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, |
| 2251 | AccessSpecifier AS, |
| 2252 | RecordDecl *Record, |
| 2253 | const PrintingPolicy &Policy); |
| 2254 | |
| 2255 | Decl *BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, |
| 2256 | RecordDecl *Record); |
| 2257 | |
| 2258 | |
| 2259 | |
| 2260 | enum NonTagKind { |
| 2261 | NTK_NonStruct, |
| 2262 | NTK_NonClass, |
| 2263 | NTK_NonUnion, |
| 2264 | NTK_NonEnum, |
| 2265 | NTK_Typedef, |
| 2266 | NTK_TypeAlias, |
| 2267 | NTK_Template, |
| 2268 | NTK_TypeAliasTemplate, |
| 2269 | NTK_TemplateTemplateArgument, |
| 2270 | }; |
| 2271 | |
| 2272 | |
| 2273 | |
| 2274 | NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK); |
| 2275 | |
| 2276 | bool isAcceptableTagRedeclaration(const TagDecl *Previous, |
| 2277 | TagTypeKind NewTag, bool isDefinition, |
| 2278 | SourceLocation NewTagLoc, |
| 2279 | const IdentifierInfo *Name); |
| 2280 | |
| 2281 | enum TagUseKind { |
| 2282 | TUK_Reference, |
| 2283 | TUK_Declaration, |
| 2284 | TUK_Definition, |
| 2285 | TUK_Friend |
| 2286 | }; |
| 2287 | |
| 2288 | Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, |
| 2289 | SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, |
| 2290 | SourceLocation NameLoc, const ParsedAttributesView &Attr, |
| 2291 | AccessSpecifier AS, SourceLocation ModulePrivateLoc, |
| 2292 | MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, |
| 2293 | bool &IsDependent, SourceLocation ScopedEnumKWLoc, |
| 2294 | bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, |
| 2295 | bool IsTypeSpecifier, bool IsTemplateParamOrArg, |
| 2296 | SkipBodyInfo *SkipBody = nullptr); |
| 2297 | |
| 2298 | Decl *ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, |
| 2299 | unsigned TagSpec, SourceLocation TagLoc, |
| 2300 | CXXScopeSpec &SS, IdentifierInfo *Name, |
| 2301 | SourceLocation NameLoc, |
| 2302 | const ParsedAttributesView &Attr, |
| 2303 | MultiTemplateParamsArg TempParamLists); |
| 2304 | |
| 2305 | TypeResult ActOnDependentTag(Scope *S, |
| 2306 | unsigned TagSpec, |
| 2307 | TagUseKind TUK, |
| 2308 | const CXXScopeSpec &SS, |
| 2309 | IdentifierInfo *Name, |
| 2310 | SourceLocation TagLoc, |
| 2311 | SourceLocation NameLoc); |
| 2312 | |
| 2313 | void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, |
| 2314 | IdentifierInfo *ClassName, |
| 2315 | SmallVectorImpl<Decl *> &Decls); |
| 2316 | Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, |
| 2317 | Declarator &D, Expr *BitfieldWidth); |
| 2318 | |
| 2319 | FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, |
| 2320 | Declarator &D, Expr *BitfieldWidth, |
| 2321 | InClassInitStyle InitStyle, |
| 2322 | AccessSpecifier AS); |
| 2323 | MSPropertyDecl *HandleMSProperty(Scope *S, RecordDecl *TagD, |
| 2324 | SourceLocation DeclStart, Declarator &D, |
| 2325 | Expr *BitfieldWidth, |
| 2326 | InClassInitStyle InitStyle, |
| 2327 | AccessSpecifier AS, |
| 2328 | const ParsedAttr &MSPropertyAttr); |
| 2329 | |
| 2330 | FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T, |
| 2331 | TypeSourceInfo *TInfo, |
| 2332 | RecordDecl *Record, SourceLocation Loc, |
| 2333 | bool Mutable, Expr *BitfieldWidth, |
| 2334 | InClassInitStyle InitStyle, |
| 2335 | SourceLocation TSSL, |
| 2336 | AccessSpecifier AS, NamedDecl *PrevDecl, |
| 2337 | Declarator *D = nullptr); |
| 2338 | |
| 2339 | bool CheckNontrivialField(FieldDecl *FD); |
| 2340 | void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM); |
| 2341 | |
| 2342 | enum TrivialABIHandling { |
| 2343 | |
| 2344 | TAH_IgnoreTrivialABI, |
| 2345 | |
| 2346 | |
| 2347 | TAH_ConsiderTrivialABI |
| 2348 | }; |
| 2349 | |
| 2350 | bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, |
| 2351 | TrivialABIHandling TAH = TAH_IgnoreTrivialABI, |
| 2352 | bool Diagnose = false); |
| 2353 | CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD); |
| 2354 | void ActOnLastBitfield(SourceLocation DeclStart, |
| 2355 | SmallVectorImpl<Decl *> &AllIvarDecls); |
| 2356 | Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, |
| 2357 | Declarator &D, Expr *BitfieldWidth, |
| 2358 | tok::ObjCKeywordKind visibility); |
| 2359 | |
| 2360 | |
| 2361 | void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, |
| 2362 | ArrayRef<Decl *> Fields, SourceLocation LBrac, |
| 2363 | SourceLocation RBrac, const ParsedAttributesView &AttrList); |
| 2364 | |
| 2365 | |
| 2366 | |
| 2367 | |
| 2368 | void ActOnTagStartDefinition(Scope *S, Decl *TagDecl); |
| 2369 | |
| 2370 | |
| 2371 | |
| 2372 | |
| 2373 | bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev, |
| 2374 | SkipBodyInfo &SkipBody); |
| 2375 | |
| 2376 | typedef void *SkippedDefinitionContext; |
| 2377 | |
| 2378 | |
| 2379 | SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD); |
| 2380 | |
| 2381 | Decl *ActOnObjCContainerStartDefinition(Decl *IDecl); |
| 2382 | |
| 2383 | |
| 2384 | |
| 2385 | |
| 2386 | void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, |
| 2387 | SourceLocation FinalLoc, |
| 2388 | bool IsFinalSpelledSealed, |
| 2389 | SourceLocation LBraceLoc); |
| 2390 | |
| 2391 | |
| 2392 | |
| 2393 | void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, |
| 2394 | SourceRange BraceRange); |
| 2395 | |
| 2396 | void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context); |
| 2397 | |
| 2398 | void ActOnObjCContainerFinishDefinition(); |
| 2399 | |
| 2400 | |
| 2401 | |
| 2402 | |
| 2403 | |
| 2404 | void ActOnObjCTemporaryExitContainerContext(DeclContext *DC); |
| 2405 | void ActOnObjCReenterContainerContext(DeclContext *DC); |
| 2406 | |
| 2407 | |
| 2408 | |
| 2409 | void ActOnTagDefinitionError(Scope *S, Decl *TagDecl); |
| 2410 | |
| 2411 | EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum, |
| 2412 | EnumConstantDecl *LastEnumConst, |
| 2413 | SourceLocation IdLoc, |
| 2414 | IdentifierInfo *Id, |
| 2415 | Expr *val); |
| 2416 | bool CheckEnumUnderlyingType(TypeSourceInfo *TI); |
| 2417 | bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, |
| 2418 | QualType EnumUnderlyingTy, bool IsFixed, |
| 2419 | const EnumDecl *Prev); |
| 2420 | |
| 2421 | |
| 2422 | |
| 2423 | SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, |
| 2424 | SourceLocation IILoc); |
| 2425 | |
| 2426 | Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, |
| 2427 | SourceLocation IdLoc, IdentifierInfo *Id, |
| 2428 | const ParsedAttributesView &Attrs, |
| 2429 | SourceLocation EqualLoc, Expr *Val); |
| 2430 | void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, |
| 2431 | Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S, |
| 2432 | const ParsedAttributesView &Attr); |
| 2433 | |
| 2434 | DeclContext *getContainingDC(DeclContext *DC); |
| 2435 | |
| 2436 | |
| 2437 | void PushDeclContext(Scope *S, DeclContext *DC); |
| 2438 | void PopDeclContext(); |
| 2439 | |
| 2440 | |
| 2441 | |
| 2442 | void EnterDeclaratorContext(Scope *S, DeclContext *DC); |
| 2443 | void ExitDeclaratorContext(Scope *S); |
| 2444 | |
| 2445 | |
| 2446 | void ActOnReenterFunctionContext(Scope* S, Decl* D); |
| 2447 | void ActOnExitFunctionContext(); |
| 2448 | |
| 2449 | DeclContext *getFunctionLevelDeclContext(); |
| 2450 | |
| 2451 | |
| 2452 | |
| 2453 | |
| 2454 | FunctionDecl *getCurFunctionDecl(); |
| 2455 | |
| 2456 | |
| 2457 | |
| 2458 | |
| 2459 | ObjCMethodDecl *getCurMethodDecl(); |
| 2460 | |
| 2461 | |
| 2462 | |
| 2463 | |
| 2464 | NamedDecl *getCurFunctionOrMethodDecl(); |
| 2465 | |
| 2466 | |
| 2467 | void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true); |
| 2468 | |
| 2469 | |
| 2470 | |
| 2471 | |
| 2472 | |
| 2473 | |
| 2474 | |
| 2475 | void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name); |
| 2476 | |
| 2477 | |
| 2478 | |
| 2479 | |
| 2480 | |
| 2481 | |
| 2482 | |
| 2483 | |
| 2484 | bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr, |
| 2485 | bool AllowInlineNamespace = false); |
| 2486 | |
| 2487 | |
| 2488 | |
| 2489 | static Scope *getScopeForDeclContext(Scope *S, DeclContext *DC); |
| 2490 | |
| 2491 | |
| 2492 | TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T, |
| 2493 | TypeSourceInfo *TInfo); |
| 2494 | bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New); |
| 2495 | |
| 2496 | |
| 2497 | |
| 2498 | enum AvailabilityMergeKind { |
| 2499 | |
| 2500 | AMK_None, |
| 2501 | |
| 2502 | |
| 2503 | AMK_Redeclaration, |
| 2504 | |
| 2505 | |
| 2506 | AMK_Override, |
| 2507 | |
| 2508 | |
| 2509 | AMK_ProtocolImplementation, |
| 2510 | }; |
| 2511 | |
| 2512 | |
| 2513 | |
| 2514 | |
| 2515 | |
| 2516 | |
| 2517 | |
| 2518 | |
| 2519 | |
| 2520 | |
| 2521 | |
| 2522 | |
| 2523 | |
| 2524 | enum AvailabilityPriority : int { |
| 2525 | |
| 2526 | |
| 2527 | AP_Explicit = 0, |
| 2528 | |
| 2529 | |
| 2530 | AP_PragmaClangAttribute = 1, |
| 2531 | |
| 2532 | |
| 2533 | |
| 2534 | AP_InferredFromOtherPlatform = 2 |
| 2535 | }; |
| 2536 | |
| 2537 | |
| 2538 | AvailabilityAttr *mergeAvailabilityAttr( |
| 2539 | NamedDecl *D, SourceRange Range, IdentifierInfo *Platform, bool Implicit, |
| 2540 | VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, |
| 2541 | bool IsUnavailable, StringRef Message, bool IsStrict, |
| 2542 | StringRef Replacement, AvailabilityMergeKind AMK, int Priority, |
| 2543 | unsigned AttrSpellingListIndex); |
| 2544 | TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range, |
| 2545 | TypeVisibilityAttr::VisibilityType Vis, |
| 2546 | unsigned AttrSpellingListIndex); |
| 2547 | VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range, |
| 2548 | VisibilityAttr::VisibilityType Vis, |
| 2549 | unsigned AttrSpellingListIndex); |
| 2550 | UuidAttr *mergeUuidAttr(Decl *D, SourceRange Range, |
| 2551 | unsigned AttrSpellingListIndex, StringRef Uuid); |
| 2552 | DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range, |
| 2553 | unsigned AttrSpellingListIndex); |
| 2554 | DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range, |
| 2555 | unsigned AttrSpellingListIndex); |
| 2556 | MSInheritanceAttr * |
| 2557 | mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase, |
| 2558 | unsigned AttrSpellingListIndex, |
| 2559 | MSInheritanceAttr::Spelling SemanticSpelling); |
| 2560 | FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range, |
| 2561 | IdentifierInfo *Format, int FormatIdx, |
| 2562 | int FirstArg, unsigned AttrSpellingListIndex); |
| 2563 | SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name, |
| 2564 | unsigned AttrSpellingListIndex); |
| 2565 | CodeSegAttr *mergeCodeSegAttr(Decl *D, SourceRange Range, StringRef Name, |
| 2566 | unsigned AttrSpellingListIndex); |
| 2567 | AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range, |
| 2568 | IdentifierInfo *Ident, |
| 2569 | unsigned AttrSpellingListIndex); |
| 2570 | MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range, |
| 2571 | unsigned AttrSpellingListIndex); |
| 2572 | NoSpeculativeLoadHardeningAttr * |
| 2573 | mergeNoSpeculativeLoadHardeningAttr(Decl *D, |
| 2574 | const NoSpeculativeLoadHardeningAttr &AL); |
| 2575 | SpeculativeLoadHardeningAttr * |
| 2576 | mergeSpeculativeLoadHardeningAttr(Decl *D, |
| 2577 | const SpeculativeLoadHardeningAttr &AL); |
| 2578 | OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range, |
| 2579 | unsigned AttrSpellingListIndex); |
| 2580 | InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL); |
| 2581 | InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, |
| 2582 | const InternalLinkageAttr &AL); |
| 2583 | CommonAttr *mergeCommonAttr(Decl *D, const ParsedAttr &AL); |
| 2584 | CommonAttr *mergeCommonAttr(Decl *D, const CommonAttr &AL); |
| 2585 | |
| 2586 | void mergeDeclAttributes(NamedDecl *New, Decl *Old, |
| 2587 | AvailabilityMergeKind AMK = AMK_Redeclaration); |
| 2588 | void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, |
| 2589 | LookupResult &OldDecls); |
| 2590 | bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, |
| 2591 | bool MergeTypeWithOld); |
| 2592 | bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, |
| 2593 | Scope *S, bool MergeTypeWithOld); |
| 2594 | void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old); |
| 2595 | void MergeVarDecl(VarDecl *New, LookupResult &Previous); |
| 2596 | void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld); |
| 2597 | void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old); |
| 2598 | bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn); |
| 2599 | void notePreviousDefinition(const NamedDecl *Old, SourceLocation New); |
| 2600 | bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S); |
| 2601 | |
| 2602 | |
| 2603 | |
| 2604 | enum AssignmentAction { |
| 2605 | AA_Assigning, |
| 2606 | AA_Passing, |
| 2607 | AA_Returning, |
| 2608 | AA_Converting, |
| 2609 | AA_Initializing, |
| 2610 | AA_Sending, |
| 2611 | AA_Casting, |
| 2612 | AA_Passing_CFAudited |
| 2613 | }; |
| 2614 | |
| 2615 | |
| 2616 | enum OverloadKind { |
| 2617 | |
| 2618 | |
| 2619 | Ovl_Overload, |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | Ovl_Match, |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | Ovl_NonFunction |
| 2628 | }; |
| 2629 | OverloadKind CheckOverload(Scope *S, |
| 2630 | FunctionDecl *New, |
| 2631 | const LookupResult &OldDecls, |
| 2632 | NamedDecl *&OldDecl, |
| 2633 | bool IsForUsingDecl); |
| 2634 | bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl, |
| 2635 | bool ConsiderCudaAttrs = true); |
| 2636 | |
| 2637 | ImplicitConversionSequence |
| 2638 | TryImplicitConversion(Expr *From, QualType ToType, |
| 2639 | bool SuppressUserConversions, |
| 2640 | bool AllowExplicit, |
| 2641 | bool InOverloadResolution, |
| 2642 | bool CStyle, |
| 2643 | bool AllowObjCWritebackConversion); |
| 2644 | |
| 2645 | bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType); |
| 2646 | bool IsFloatingPointPromotion(QualType FromType, QualType ToType); |
| 2647 | bool IsComplexPromotion(QualType FromType, QualType ToType); |
| 2648 | bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, |
| 2649 | bool InOverloadResolution, |
| 2650 | QualType& ConvertedType, bool &IncompatibleObjC); |
| 2651 | bool isObjCPointerConversion(QualType FromType, QualType ToType, |
| 2652 | QualType& ConvertedType, bool &IncompatibleObjC); |
| 2653 | bool isObjCWritebackConversion(QualType FromType, QualType ToType, |
| 2654 | QualType &ConvertedType); |
| 2655 | bool IsBlockPointerConversion(QualType FromType, QualType ToType, |
| 2656 | QualType& ConvertedType); |
| 2657 | bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, |
| 2658 | const FunctionProtoType *NewType, |
| 2659 | unsigned *ArgPos = nullptr); |
| 2660 | void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, |
| 2661 | QualType FromType, QualType ToType); |
| 2662 | |
| 2663 | void maybeExtendBlockObject(ExprResult &E); |
| 2664 | CastKind PrepareCastToObjCObjectPointer(ExprResult &E); |
| 2665 | bool CheckPointerConversion(Expr *From, QualType ToType, |
| 2666 | CastKind &Kind, |
| 2667 | CXXCastPath& BasePath, |
| 2668 | bool IgnoreBaseAccess, |
| 2669 | bool Diagnose = true); |
| 2670 | bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, |
| 2671 | bool InOverloadResolution, |
| 2672 | QualType &ConvertedType); |
| 2673 | bool CheckMemberPointerConversion(Expr *From, QualType ToType, |
| 2674 | CastKind &Kind, |
| 2675 | CXXCastPath &BasePath, |
| 2676 | bool IgnoreBaseAccess); |
| 2677 | bool IsQualificationConversion(QualType FromType, QualType ToType, |
| 2678 | bool CStyle, bool &ObjCLifetimeConversion); |
| 2679 | bool IsFunctionConversion(QualType FromType, QualType ToType, |
| 2680 | QualType &ResultTy); |
| 2681 | bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType); |
| 2682 | bool isSameOrCompatibleFunctionType(CanQualType Param, CanQualType Arg); |
| 2683 | |
| 2684 | ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, |
| 2685 | const VarDecl *NRVOCandidate, |
| 2686 | QualType ResultType, |
| 2687 | Expr *Value, |
| 2688 | bool AllowNRVO = true); |
| 2689 | |
| 2690 | bool CanPerformCopyInitialization(const InitializedEntity &Entity, |
| 2691 | ExprResult Init); |
| 2692 | ExprResult PerformCopyInitialization(const InitializedEntity &Entity, |
| 2693 | SourceLocation EqualLoc, |
| 2694 | ExprResult Init, |
| 2695 | bool TopLevelOfInitList = false, |
| 2696 | bool AllowExplicit = false); |
| 2697 | ExprResult PerformObjectArgumentInitialization(Expr *From, |
| 2698 | NestedNameSpecifier *Qualifier, |
| 2699 | NamedDecl *FoundDecl, |
| 2700 | CXXMethodDecl *Method); |
| 2701 | |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init); |
| 2706 | |
| 2707 | ExprResult PerformContextuallyConvertToBool(Expr *From); |
| 2708 | ExprResult PerformContextuallyConvertToObjCPointer(Expr *From); |
| 2709 | |
| 2710 | |
| 2711 | enum CCEKind { |
| 2712 | CCEK_CaseValue, |
| 2713 | CCEK_Enumerator, |
| 2714 | CCEK_TemplateArg, |
| 2715 | CCEK_NewExpr, |
| 2716 | CCEK_ConstexprIf |
| 2717 | }; |
| 2718 | ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, |
| 2719 | llvm::APSInt &Value, CCEKind CCE); |
| 2720 | ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, |
| 2721 | APValue &Value, CCEKind CCE); |
| 2722 | |
| 2723 | |
| 2724 | |
| 2725 | class ContextualImplicitConverter { |
| 2726 | public: |
| 2727 | bool Suppress; |
| 2728 | bool SuppressConversion; |
| 2729 | |
| 2730 | ContextualImplicitConverter(bool Suppress = false, |
| 2731 | bool SuppressConversion = false) |
| 2732 | : Suppress(Suppress), SuppressConversion(SuppressConversion) {} |
| 2733 | |
| 2734 | |
| 2735 | |
| 2736 | virtual bool match(QualType T) = 0; |
| 2737 | |
| 2738 | |
| 2739 | |
| 2740 | virtual SemaDiagnosticBuilder |
| 2741 | diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) = 0; |
| 2742 | |
| 2743 | |
| 2744 | virtual SemaDiagnosticBuilder |
| 2745 | diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0; |
| 2746 | |
| 2747 | |
| 2748 | |
| 2749 | virtual SemaDiagnosticBuilder diagnoseExplicitConv( |
| 2750 | Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0; |
| 2751 | |
| 2752 | |
| 2753 | virtual SemaDiagnosticBuilder |
| 2754 | noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0; |
| 2755 | |
| 2756 | |
| 2757 | |
| 2758 | virtual SemaDiagnosticBuilder |
| 2759 | diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) = 0; |
| 2760 | |
| 2761 | |
| 2762 | virtual SemaDiagnosticBuilder |
| 2763 | noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) = 0; |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | virtual SemaDiagnosticBuilder diagnoseConversion( |
| 2768 | Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0; |
| 2769 | |
| 2770 | virtual ~ContextualImplicitConverter() {} |
| 2771 | }; |
| 2772 | |
| 2773 | class ICEConvertDiagnoser : public ContextualImplicitConverter { |
| 2774 | bool AllowScopedEnumerations; |
| 2775 | |
| 2776 | public: |
| 2777 | ICEConvertDiagnoser(bool AllowScopedEnumerations, |
| 2778 | bool Suppress, bool SuppressConversion) |
| 2779 | : ContextualImplicitConverter(Suppress, SuppressConversion), |
| 2780 | AllowScopedEnumerations(AllowScopedEnumerations) {} |
| 2781 | |
| 2782 | |
| 2783 | bool match(QualType T) override; |
| 2784 | |
| 2785 | SemaDiagnosticBuilder |
| 2786 | diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override { |
| 2787 | return diagnoseNotInt(S, Loc, T); |
| 2788 | } |
| 2789 | |
| 2790 | |
| 2791 | |
| 2792 | virtual SemaDiagnosticBuilder |
| 2793 | diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0; |
| 2794 | }; |
| 2795 | |
| 2796 | |
| 2797 | ExprResult PerformContextualImplicitConversion( |
| 2798 | SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter); |
| 2799 | |
| 2800 | |
| 2801 | enum ObjCSubscriptKind { |
| 2802 | OS_Array, |
| 2803 | OS_Dictionary, |
| 2804 | OS_Error |
| 2805 | }; |
| 2806 | ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE); |
| 2807 | |
| 2808 | |
| 2809 | |
| 2810 | enum ObjCLiteralKind { |
| 2811 | LK_Array, |
| 2812 | LK_Dictionary, |
| 2813 | LK_Numeric, |
| 2814 | LK_Boxed, |
| 2815 | LK_String, |
| 2816 | LK_Block, |
| 2817 | LK_None |
| 2818 | }; |
| 2819 | ObjCLiteralKind CheckLiteralKind(Expr *FromE); |
| 2820 | |
| 2821 | ExprResult PerformObjectMemberConversion(Expr *From, |
| 2822 | NestedNameSpecifier *Qualifier, |
| 2823 | NamedDecl *FoundDecl, |
| 2824 | NamedDecl *Member); |
| 2825 | |
| 2826 | |
| 2827 | |
| 2828 | typedef llvm::SmallSetVector<DeclContext *, 16> AssociatedNamespaceSet; |
| 2829 | typedef llvm::SmallSetVector<CXXRecordDecl *, 16> AssociatedClassSet; |
| 2830 | |
| 2831 | using ADLCallKind = CallExpr::ADLCallKind; |
| 2832 | |
| 2833 | void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, |
| 2834 | ArrayRef<Expr *> Args, |
| 2835 | OverloadCandidateSet &CandidateSet, |
| 2836 | bool SuppressUserConversions = false, |
| 2837 | bool PartialOverloading = false, |
| 2838 | bool AllowExplicit = false, |
| 2839 | ADLCallKind IsADLCandidate = ADLCallKind::NotADL, |
| 2840 | ConversionSequenceList EarlyConversions = None); |
| 2841 | void AddFunctionCandidates(const UnresolvedSetImpl &Functions, |
| 2842 | ArrayRef<Expr *> Args, |
| 2843 | OverloadCandidateSet &CandidateSet, |
| 2844 | TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr, |
| 2845 | bool SuppressUserConversions = false, |
| 2846 | bool PartialOverloading = false, |
| 2847 | bool FirstArgumentIsBase = false); |
| 2848 | void AddMethodCandidate(DeclAccessPair FoundDecl, |
| 2849 | QualType ObjectType, |
| 2850 | Expr::Classification ObjectClassification, |
| 2851 | ArrayRef<Expr *> Args, |
| 2852 | OverloadCandidateSet& CandidateSet, |
| 2853 | bool SuppressUserConversion = false); |
| 2854 | void AddMethodCandidate(CXXMethodDecl *Method, |
| 2855 | DeclAccessPair FoundDecl, |
| 2856 | CXXRecordDecl *ActingContext, QualType ObjectType, |
| 2857 | Expr::Classification ObjectClassification, |
| 2858 | ArrayRef<Expr *> Args, |
| 2859 | OverloadCandidateSet& CandidateSet, |
| 2860 | bool SuppressUserConversions = false, |
| 2861 | bool PartialOverloading = false, |
| 2862 | ConversionSequenceList EarlyConversions = None); |
| 2863 | void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, |
| 2864 | DeclAccessPair FoundDecl, |
| 2865 | CXXRecordDecl *ActingContext, |
| 2866 | TemplateArgumentListInfo *ExplicitTemplateArgs, |
| 2867 | QualType ObjectType, |
| 2868 | Expr::Classification ObjectClassification, |
| 2869 | ArrayRef<Expr *> Args, |
| 2870 | OverloadCandidateSet& CandidateSet, |
| 2871 | bool SuppressUserConversions = false, |
| 2872 | bool PartialOverloading = false); |
| 2873 | void AddTemplateOverloadCandidate( |
| 2874 | FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, |
| 2875 | TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args, |
| 2876 | OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false, |
| 2877 | bool PartialOverloading = false, |
| 2878 | ADLCallKind IsADLCandidate = ADLCallKind::NotADL); |
| 2879 | bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, |
| 2880 | ArrayRef<QualType> ParamTypes, |
| 2881 | ArrayRef<Expr *> Args, |
| 2882 | OverloadCandidateSet &CandidateSet, |
| 2883 | ConversionSequenceList &Conversions, |
| 2884 | bool SuppressUserConversions, |
| 2885 | CXXRecordDecl *ActingContext = nullptr, |
| 2886 | QualType ObjectType = QualType(), |
| 2887 | Expr::Classification |
| 2888 | ObjectClassification = {}); |
| 2889 | void AddConversionCandidate(CXXConversionDecl *Conversion, |
| 2890 | DeclAccessPair FoundDecl, |
| 2891 | CXXRecordDecl *ActingContext, |
| 2892 | Expr *From, QualType ToType, |
| 2893 | OverloadCandidateSet& CandidateSet, |
| 2894 | bool AllowObjCConversionOnExplicit, |
| 2895 | bool AllowResultConversion = true); |
| 2896 | void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, |
| 2897 | DeclAccessPair FoundDecl, |
| 2898 | CXXRecordDecl *ActingContext, |
| 2899 | Expr *From, QualType ToType, |
| 2900 | OverloadCandidateSet &CandidateSet, |
| 2901 | bool AllowObjCConversionOnExplicit, |
| 2902 | bool AllowResultConversion = true); |
| 2903 | void AddSurrogateCandidate(CXXConversionDecl *Conversion, |
| 2904 | DeclAccessPair FoundDecl, |
| 2905 | CXXRecordDecl *ActingContext, |
| 2906 | const FunctionProtoType *Proto, |
| 2907 | Expr *Object, ArrayRef<Expr *> Args, |
| 2908 | OverloadCandidateSet& CandidateSet); |
| 2909 | void AddMemberOperatorCandidates(OverloadedOperatorKind Op, |
| 2910 | SourceLocation OpLoc, ArrayRef<Expr *> Args, |
| 2911 | OverloadCandidateSet& CandidateSet, |
| 2912 | SourceRange OpRange = SourceRange()); |
| 2913 | void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args, |
| 2914 | OverloadCandidateSet& CandidateSet, |
| 2915 | bool IsAssignmentOperator = false, |
| 2916 | unsigned NumContextualBoolArguments = 0); |
| 2917 | void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, |
| 2918 | SourceLocation OpLoc, ArrayRef<Expr *> Args, |
| 2919 | OverloadCandidateSet& CandidateSet); |
| 2920 | void AddArgumentDependentLookupCandidates(DeclarationName Name, |
| 2921 | SourceLocation Loc, |
| 2922 | ArrayRef<Expr *> Args, |
| 2923 | TemplateArgumentListInfo *ExplicitTemplateArgs, |
| 2924 | OverloadCandidateSet& CandidateSet, |
| 2925 | bool PartialOverloading = false); |
| 2926 | |
| 2927 | |
| 2928 | void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn, |
| 2929 | QualType DestType = QualType(), |
| 2930 | bool TakingAddress = false); |
| 2931 | |
| 2932 | |
| 2933 | |
| 2934 | void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(), |
| 2935 | bool TakingAddress = false); |
| 2936 | |
| 2937 | |
| 2938 | |
| 2939 | EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args, |
| 2940 | bool MissingImplicitThis = false); |
| 2941 | |
| 2942 | |
| 2943 | |
| 2944 | std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond); |
| 2945 | |
| 2946 | |
| 2947 | |
| 2948 | |
| 2949 | |
| 2950 | |
| 2951 | |
| 2952 | |
| 2953 | bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, |
| 2954 | const Expr *ThisArg, |
| 2955 | ArrayRef<const Expr *> Args, |
| 2956 | SourceLocation Loc); |
| 2957 | |
| 2958 | |
| 2959 | |
| 2960 | |
| 2961 | |
| 2962 | |
| 2963 | |
| 2964 | |
| 2965 | bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, |
| 2966 | SourceLocation Loc); |
| 2967 | |
| 2968 | |
| 2969 | |
| 2970 | |
| 2971 | |
| 2972 | bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, |
| 2973 | bool Complain = false, |
| 2974 | SourceLocation Loc = SourceLocation()); |
| 2975 | |
| 2976 | |
| 2977 | |
| 2978 | |
| 2979 | |
| 2980 | |
| 2981 | |
| 2982 | QualType (QualType PossiblyAFunctionType); |
| 2983 | |
| 2984 | FunctionDecl * |
| 2985 | ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, |
| 2986 | QualType TargetType, |
| 2987 | bool Complain, |
| 2988 | DeclAccessPair &Found, |
| 2989 | bool *pHadMultipleCandidates = nullptr); |
| 2990 | |
| 2991 | FunctionDecl * |
| 2992 | resolveAddressOfOnlyViableOverloadCandidate(Expr *E, |
| 2993 | DeclAccessPair &FoundResult); |
| 2994 | |
| 2995 | bool resolveAndFixAddressOfOnlyViableOverloadCandidate( |
| 2996 | ExprResult &SrcExpr, bool DoFunctionPointerConversion = false); |
| 2997 | |
| 2998 | FunctionDecl * |
| 2999 | ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, |
| 3000 | bool Complain = false, |
| 3001 | DeclAccessPair *Found = nullptr); |
| 3002 | |
| 3003 | bool ResolveAndFixSingleFunctionTemplateSpecialization( |
| 3004 | ExprResult &SrcExpr, |
| 3005 | bool DoFunctionPointerConverion = false, |
| 3006 | bool Complain = false, |
| 3007 | SourceRange OpRangeForComplaining = SourceRange(), |
| 3008 | QualType DestTypeForComplaining = QualType(), |
| 3009 | unsigned DiagIDForComplaining = 0); |
| 3010 | |
| 3011 | |
| 3012 | Expr *FixOverloadedFunctionReference(Expr *E, |
| 3013 | DeclAccessPair FoundDecl, |
| 3014 | FunctionDecl *Fn); |
| 3015 | ExprResult FixOverloadedFunctionReference(ExprResult, |
| 3016 | DeclAccessPair FoundDecl, |
| 3017 | FunctionDecl *Fn); |
| 3018 | |
| 3019 | void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, |
| 3020 | ArrayRef<Expr *> Args, |
| 3021 | OverloadCandidateSet &CandidateSet, |
| 3022 | bool PartialOverloading = false); |
| 3023 | |
| 3024 | |
| 3025 | |
| 3026 | enum ForRangeStatus { |
| 3027 | FRS_Success, |
| 3028 | FRS_NoViableFunction, |
| 3029 | FRS_DiagnosticIssued |
| 3030 | }; |
| 3031 | |
| 3032 | ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, |
| 3033 | SourceLocation RangeLoc, |
| 3034 | const DeclarationNameInfo &NameInfo, |
| 3035 | LookupResult &MemberLookup, |
| 3036 | OverloadCandidateSet *CandidateSet, |
| 3037 | Expr *Range, ExprResult *CallExpr); |
| 3038 | |
| 3039 | ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, |
| 3040 | UnresolvedLookupExpr *ULE, |
| 3041 | SourceLocation LParenLoc, |
| 3042 | MultiExprArg Args, |
| 3043 | SourceLocation RParenLoc, |
| 3044 | Expr *ExecConfig, |
| 3045 | bool AllowTypoCorrection=true, |
| 3046 | bool CalleesAddressIsTaken=false); |
| 3047 | |
| 3048 | bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, |
| 3049 | MultiExprArg Args, SourceLocation RParenLoc, |
| 3050 | OverloadCandidateSet *CandidateSet, |
| 3051 | ExprResult *Result); |
| 3052 | |
| 3053 | ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, |
| 3054 | UnaryOperatorKind Opc, |
| 3055 | const UnresolvedSetImpl &Fns, |
| 3056 | Expr *input, bool RequiresADL = true); |
| 3057 | |
| 3058 | ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, |
| 3059 | BinaryOperatorKind Opc, |
| 3060 | const UnresolvedSetImpl &Fns, |
| 3061 | Expr *LHS, Expr *RHS, |
| 3062 | bool RequiresADL = true); |
| 3063 | |
| 3064 | ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, |
| 3065 | SourceLocation RLoc, |
| 3066 | Expr *Base,Expr *Idx); |
| 3067 | |
| 3068 | ExprResult |
| 3069 | BuildCallToMemberFunction(Scope *S, Expr *MemExpr, |
| 3070 | SourceLocation LParenLoc, |
| 3071 | MultiExprArg Args, |
| 3072 | SourceLocation RParenLoc); |
| 3073 | ExprResult |
| 3074 | BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, |
| 3075 | MultiExprArg Args, |
| 3076 | SourceLocation RParenLoc); |
| 3077 | |
| 3078 | ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, |
| 3079 | SourceLocation OpLoc, |
| 3080 | bool *NoArrowOperatorFound = nullptr); |
| 3081 | |
| 3082 | |
| 3083 | |
| 3084 | |
| 3085 | bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, |
| 3086 | CallExpr *CE, FunctionDecl *FD); |
| 3087 | |
| 3088 | |
| 3089 | bool CheckParmsForFunctionDef(ArrayRef<ParmVarDecl *> Parameters, |
| 3090 | bool CheckParameterNames); |
| 3091 | void CheckCXXDefaultArguments(FunctionDecl *FD); |
| 3092 | void (Declarator &D); |
| 3093 | Scope *getNonFieldDeclScope(Scope *S); |
| 3094 | |
| 3095 | |
| 3096 | |
| 3097 | |
| 3098 | |
| 3099 | |
| 3100 | |
| 3101 | |
| 3102 | |
| 3103 | |
| 3104 | |
| 3105 | |
| 3106 | |
| 3107 | |
| 3108 | |
| 3109 | |
| 3110 | |
| 3111 | |
| 3112 | |
| 3113 | |
| 3114 | |
| 3115 | |
| 3116 | |
| 3117 | |
| 3118 | |
| 3119 | |
| 3120 | |
| 3121 | |
| 3122 | |
| 3123 | enum LookupNameKind { |
| 3124 | |
| 3125 | |
| 3126 | |
| 3127 | LookupOrdinaryName = 0, |
| 3128 | |
| 3129 | |
| 3130 | LookupTagName, |
| 3131 | |
| 3132 | LookupLabel, |
| 3133 | |
| 3134 | |
| 3135 | LookupMemberName, |
| 3136 | |
| 3137 | |
| 3138 | |
| 3139 | LookupOperatorName, |
| 3140 | |
| 3141 | |
| 3142 | |
| 3143 | LookupNestedNameSpecifierName, |
| 3144 | |
| 3145 | |
| 3146 | |
| 3147 | LookupNamespaceName, |
| 3148 | |
| 3149 | |
| 3150 | |
| 3151 | LookupUsingDeclName, |
| 3152 | |
| 3153 | |
| 3154 | |
| 3155 | |
| 3156 | LookupRedeclarationWithLinkage, |
| 3157 | |
| 3158 | |
| 3159 | LookupLocalFriendName, |
| 3160 | |
| 3161 | LookupObjCProtocolName, |
| 3162 | |
| 3163 | LookupObjCImplicitSelfParam, |
| 3164 | |
| 3165 | LookupOMPReductionName, |
| 3166 | |
| 3167 | LookupOMPMapperName, |
| 3168 | |
| 3169 | LookupAnyName |
| 3170 | }; |
| 3171 | |
| 3172 | |
| 3173 | |
| 3174 | enum RedeclarationKind { |
| 3175 | |
| 3176 | |
| 3177 | NotForRedeclaration = 0, |
| 3178 | |
| 3179 | |
| 3180 | ForVisibleRedeclaration, |
| 3181 | |
| 3182 | |
| 3183 | |
| 3184 | ForExternalRedeclaration |
| 3185 | }; |
| 3186 | |
| 3187 | RedeclarationKind forRedeclarationInCurContext() { |
| 3188 | |
| 3189 | |
| 3190 | |
| 3191 | |
| 3192 | if (cast<Decl>(CurContext) |
| 3193 | ->getOwningModuleForLinkage()) |
| 3194 | return ForVisibleRedeclaration; |
| 3195 | return ForExternalRedeclaration; |
| 3196 | } |
| 3197 | |
| 3198 | |
| 3199 | enum LiteralOperatorLookupResult { |
| 3200 | |
| 3201 | LOLR_Error, |
| 3202 | |
| 3203 | LOLR_ErrorNoDiagnostic, |
| 3204 | |
| 3205 | |
| 3206 | LOLR_Cooked, |
| 3207 | |
| 3208 | |
| 3209 | LOLR_Raw, |
| 3210 | |
| 3211 | |
| 3212 | |
| 3213 | LOLR_Template, |
| 3214 | |
| 3215 | |
| 3216 | |
| 3217 | LOLR_StringTemplate |
| 3218 | }; |
| 3219 | |
| 3220 | SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, |
| 3221 | CXXSpecialMember SM, |
| 3222 | bool ConstArg, |
| 3223 | bool VolatileArg, |
| 3224 | bool RValueThis, |
| 3225 | bool ConstThis, |
| 3226 | bool VolatileThis); |
| 3227 | |
| 3228 | typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator; |
| 3229 | typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)> |
| 3230 | TypoRecoveryCallback; |
| 3231 | |
| 3232 | private: |
| 3233 | bool CppLookupName(LookupResult &R, Scope *S); |
| 3234 | |
| 3235 | struct TypoExprState { |
| 3236 | std::unique_ptr<TypoCorrectionConsumer> Consumer; |
| 3237 | TypoDiagnosticGenerator DiagHandler; |
| 3238 | TypoRecoveryCallback RecoveryHandler; |
| 3239 | TypoExprState(); |
| 3240 | TypoExprState(TypoExprState &&other) noexcept; |
| 3241 | TypoExprState &operator=(TypoExprState &&other) noexcept; |
| 3242 | }; |
| 3243 | |
| 3244 | |
| 3245 | llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos; |
| 3246 | |
| 3247 | |
| 3248 | TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC, |
| 3249 | TypoDiagnosticGenerator TDG, |
| 3250 | TypoRecoveryCallback TRC); |
| 3251 | |
| 3252 | |
| 3253 | |
| 3254 | |
| 3255 | |
| 3256 | llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces; |
| 3257 | |
| 3258 | |
| 3259 | |
| 3260 | bool LoadedExternalKnownNamespaces; |
| 3261 | |
| 3262 | |
| 3263 | |
| 3264 | |
| 3265 | std::unique_ptr<TypoCorrectionConsumer> |
| 3266 | makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo, |
| 3267 | Sema::LookupNameKind LookupKind, Scope *S, |
| 3268 | CXXScopeSpec *SS, |
| 3269 | CorrectionCandidateCallback &CCC, |
| 3270 | DeclContext *MemberContext, bool EnteringContext, |
| 3271 | const ObjCObjectPointerType *OPT, |
| 3272 | bool ErrorRecovery); |
| 3273 | |
| 3274 | public: |
| 3275 | const TypoExprState &getTypoExprState(TypoExpr *TE) const; |
| 3276 | |
| 3277 | |
| 3278 | void clearDelayedTypo(TypoExpr *TE); |
| 3279 | |
| 3280 | |
| 3281 | |
| 3282 | |
| 3283 | |
| 3284 | |
| 3285 | NamedDecl *LookupSingleName(Scope *S, DeclarationName Name, |
| 3286 | SourceLocation Loc, |
| 3287 | LookupNameKind NameKind, |
| 3288 | RedeclarationKind Redecl |
| 3289 | = NotForRedeclaration); |
| 3290 | bool LookupName(LookupResult &R, Scope *S, |
| 3291 | bool AllowBuiltinCreation = false); |
| 3292 | bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, |
| 3293 | bool InUnqualifiedLookup = false); |
| 3294 | bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, |
| 3295 | CXXScopeSpec &SS); |
| 3296 | bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, |
| 3297 | bool AllowBuiltinCreation = false, |
| 3298 | bool EnteringContext = false); |
| 3299 | ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, |
| 3300 | RedeclarationKind Redecl |
| 3301 | = NotForRedeclaration); |
| 3302 | bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class); |
| 3303 | |
| 3304 | void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, |
| 3305 | QualType T1, QualType T2, |
| 3306 | UnresolvedSetImpl &Functions); |
| 3307 | |
| 3308 | LabelDecl *LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, |
| 3309 | SourceLocation GnuLabelLoc = SourceLocation()); |
| 3310 | |
| 3311 | DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class); |
| 3312 | CXXConstructorDecl *LookupDefaultConstructor(CXXRecordDecl *Class); |
| 3313 | CXXConstructorDecl *LookupCopyingConstructor(CXXRecordDecl *Class, |
| 3314 | unsigned Quals); |
| 3315 | CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, |
| 3316 | bool RValueThis, unsigned ThisQuals); |
| 3317 | CXXConstructorDecl *LookupMovingConstructor(CXXRecordDecl *Class, |
| 3318 | unsigned Quals); |
| 3319 | CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, |
| 3320 | bool RValueThis, unsigned ThisQuals); |
| 3321 | CXXDestructorDecl *LookupDestructor(CXXRecordDecl *Class); |
| 3322 | |
| 3323 | bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id); |
| 3324 | LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, |
| 3325 | ArrayRef<QualType> ArgTys, |
| 3326 | bool AllowRaw, |
| 3327 | bool AllowTemplate, |
| 3328 | bool AllowStringTemplate, |
| 3329 | bool DiagnoseMissing); |
| 3330 | bool isKnownName(StringRef name); |
| 3331 | |
| 3332 | void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, |
| 3333 | ArrayRef<Expr *> Args, ADLResult &Functions); |
| 3334 | |
| 3335 | void LookupVisibleDecls(Scope *S, LookupNameKind Kind, |
| 3336 | VisibleDeclConsumer &Consumer, |
| 3337 | bool IncludeGlobalScope = true, |
| 3338 | bool LoadExternal = true); |
| 3339 | void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind, |
| 3340 | VisibleDeclConsumer &Consumer, |
| 3341 | bool IncludeGlobalScope = true, |
| 3342 | bool IncludeDependentBases = false, |
| 3343 | bool LoadExternal = true); |
| 3344 | |
| 3345 | enum CorrectTypoKind { |
| 3346 | CTK_NonError, |
| 3347 | CTK_ErrorRecovery |
| 3348 | }; |
| 3349 | |
| 3350 | TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, |
| 3351 | Sema::LookupNameKind LookupKind, |
| 3352 | Scope *S, CXXScopeSpec *SS, |
| 3353 | CorrectionCandidateCallback &CCC, |
| 3354 | CorrectTypoKind Mode, |
| 3355 | DeclContext *MemberContext = nullptr, |
| 3356 | bool EnteringContext = false, |
| 3357 | const ObjCObjectPointerType *OPT = nullptr, |
| 3358 | bool RecordFailure = true); |
| 3359 | |
| 3360 | TypoExpr *CorrectTypoDelayed(const DeclarationNameInfo &Typo, |
| 3361 | Sema::LookupNameKind LookupKind, Scope *S, |
| 3362 | CXXScopeSpec *SS, |
| 3363 | CorrectionCandidateCallback &CCC, |
| 3364 | TypoDiagnosticGenerator TDG, |
| 3365 | TypoRecoveryCallback TRC, CorrectTypoKind Mode, |
| 3366 | DeclContext *MemberContext = nullptr, |
| 3367 | bool EnteringContext = false, |
| 3368 | const ObjCObjectPointerType *OPT = nullptr); |
| 3369 | |
| 3370 | |
| 3371 | |
| 3372 | |
| 3373 | |
| 3374 | |
| 3375 | |
| 3376 | |
| 3377 | |
| 3378 | |
| 3379 | |
| 3380 | |
| 3381 | |
| 3382 | |
| 3383 | |
| 3384 | ExprResult |
| 3385 | CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl = nullptr, |
| 3386 | llvm::function_ref<ExprResult(Expr *)> Filter = |
| 3387 | [](Expr *E) -> ExprResult { return E; }); |
| 3388 | |
| 3389 | ExprResult |
| 3390 | CorrectDelayedTyposInExpr(Expr *E, |
| 3391 | llvm::function_ref<ExprResult(Expr *)> Filter) { |
| 3392 | return CorrectDelayedTyposInExpr(E, nullptr, Filter); |
| 3393 | } |
| 3394 | |
| 3395 | ExprResult |
| 3396 | CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl = nullptr, |
| 3397 | llvm::function_ref<ExprResult(Expr *)> Filter = |
| 3398 | [](Expr *E) -> ExprResult { return E; }) { |
| 3399 | return ER.isInvalid() ? ER : CorrectDelayedTyposInExpr(ER.get(), Filter); |
| 3400 | } |
| 3401 | |
| 3402 | ExprResult |
| 3403 | CorrectDelayedTyposInExpr(ExprResult ER, |
| 3404 | llvm::function_ref<ExprResult(Expr *)> Filter) { |
| 3405 | return CorrectDelayedTyposInExpr(ER, nullptr, Filter); |
| 3406 | } |
| 3407 | |
| 3408 | void diagnoseTypo(const TypoCorrection &Correction, |
| 3409 | const PartialDiagnostic &TypoDiag, |
| 3410 | bool ErrorRecovery = true); |
| 3411 | |
| 3412 | void diagnoseTypo(const TypoCorrection &Correction, |
| 3413 | const PartialDiagnostic &TypoDiag, |
| 3414 | const PartialDiagnostic &PrevNote, |
| 3415 | bool ErrorRecovery = true); |
| 3416 | |
| 3417 | void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F); |
| 3418 | |
| 3419 | void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, |
| 3420 | ArrayRef<Expr *> Args, |
| 3421 | AssociatedNamespaceSet &AssociatedNamespaces, |
| 3422 | AssociatedClassSet &AssociatedClasses); |
| 3423 | |
| 3424 | void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, |
| 3425 | bool ConsiderLinkage, bool AllowInlineNamespace); |
| 3426 | |
| 3427 | bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old); |
| 3428 | |
| 3429 | void DiagnoseAmbiguousLookup(LookupResult &Result); |
| 3430 | |
| 3431 | |
| 3432 | ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id, |
| 3433 | SourceLocation IdLoc, |
| 3434 | bool TypoCorrection = false); |
| 3435 | NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, |
| 3436 | Scope *S, bool ForRedeclaration, |
| 3437 | SourceLocation Loc); |
| 3438 | NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, |
| 3439 | Scope *S); |
| 3440 | void AddKnownFunctionAttributes(FunctionDecl *FD); |
| 3441 | |
| 3442 | |
| 3443 | |
| 3444 | void ProcessPragmaWeak(Scope *S, Decl *D); |
| 3445 | |
| 3446 | void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD); |
| 3447 | |
| 3448 | void ProcessDeclAttributeDelayed(Decl *D, |
| 3449 | const ParsedAttributesView &AttrList); |
| 3450 | void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AL, |
| 3451 | bool IncludeCXX11Attributes = true); |
| 3452 | bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, |
| 3453 | const ParsedAttributesView &AttrList); |
| 3454 | |
| 3455 | void checkUnusedDeclAttributes(Declarator &D); |
| 3456 | |
| 3457 | |
| 3458 | |
| 3459 | |
| 3460 | |
| 3461 | bool isValidPointerAttrType(QualType T, bool RefOkay = false); |
| 3462 | |
| 3463 | bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value); |
| 3464 | bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, |
| 3465 | const FunctionDecl *FD = nullptr); |
| 3466 | bool CheckAttrTarget(const ParsedAttr &CurrAttr); |
| 3467 | bool CheckAttrNoArgs(const ParsedAttr &CurrAttr); |
| 3468 | bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum, |
| 3469 | StringRef &Str, |
| 3470 | SourceLocation *ArgLocation = nullptr); |
| 3471 | bool checkSectionName(SourceLocation LiteralLoc, StringRef Str); |
| 3472 | bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str); |
| 3473 | bool checkMSInheritanceAttrOnDefinition( |
| 3474 | CXXRecordDecl *RD, SourceRange Range, bool BestCase, |
| 3475 | MSInheritanceAttr::Spelling SemanticSpelling); |
| 3476 | |
| 3477 | void CheckAlignasUnderalignment(Decl *D); |
| 3478 | |
| 3479 | |
| 3480 | |
| 3481 | |
| 3482 | void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, |
| 3483 | SourceLocation Loc); |
| 3484 | |
| 3485 | |
| 3486 | |
| 3487 | |
| 3488 | bool hasExplicitCallingConv(QualType &T); |
| 3489 | |
| 3490 | |
| 3491 | |
| 3492 | const AttributedType *getCallingConvAttributedType(QualType T) const; |
| 3493 | |
| 3494 | |
| 3495 | StmtResult ProcessStmtAttributes(Stmt *Stmt, |
| 3496 | const ParsedAttributesView &Attrs, |
| 3497 | SourceRange Range); |
| 3498 | |
| 3499 | void WarnConflictingTypedMethods(ObjCMethodDecl *Method, |
| 3500 | ObjCMethodDecl *MethodDecl, |
| 3501 | bool IsProtocolMethodDecl); |
| 3502 | |
| 3503 | void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, |
| 3504 | ObjCMethodDecl *Overridden, |
| 3505 | bool IsProtocolMethodDecl); |
| 3506 | |
| 3507 | |
| 3508 | |
| 3509 | void WarnExactTypedMethods(ObjCMethodDecl *Method, |
| 3510 | ObjCMethodDecl *MethodDecl, |
| 3511 | bool IsProtocolMethodDecl); |
| 3512 | |
| 3513 | typedef llvm::SmallPtrSet<Selector, 8> SelectorSet; |
| 3514 | |
| 3515 | |
| 3516 | |
| 3517 | void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, |
| 3518 | ObjCIvarDecl **Fields, unsigned nIvars, |
| 3519 | SourceLocation Loc); |
| 3520 | |
| 3521 | |
| 3522 | |
| 3523 | void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl, |
| 3524 | ObjCContainerDecl* IDecl, |
| 3525 | bool IncompleteImpl = false); |
| 3526 | |
| 3527 | |
| 3528 | |
| 3529 | void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl, |
| 3530 | ObjCContainerDecl *CDecl, |
| 3531 | bool SynthesizeProperties); |
| 3532 | |
| 3533 | |
| 3534 | void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl); |
| 3535 | |
| 3536 | |
| 3537 | |
| 3538 | void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, |
| 3539 | ObjCInterfaceDecl *IDecl, |
| 3540 | SourceLocation AtEnd); |
| 3541 | void DefaultSynthesizeProperties(Scope *S, Decl *D, SourceLocation AtEnd); |
| 3542 | |
| 3543 | |
| 3544 | |
| 3545 | |
| 3546 | bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, |
| 3547 | ObjCMethodDecl *Method, ObjCIvarDecl *IV); |
| 3548 | |
| 3549 | |
| 3550 | |
| 3551 | void DiagnoseUnusedBackingIvarInAccessor(Scope *S, |
| 3552 | const ObjCImplementationDecl *ImplD); |
| 3553 | |
| 3554 | |
| 3555 | |
| 3556 | |
| 3557 | ObjCIvarDecl *GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, |
| 3558 | const ObjCPropertyDecl *&PDecl) const; |
| 3559 | |
| 3560 | |
| 3561 | |
| 3562 | ObjCPropertyDecl *HandlePropertyInClassExtension(Scope *S, |
| 3563 | SourceLocation AtLoc, |
| 3564 | SourceLocation LParenLoc, |
| 3565 | FieldDeclarator &FD, |
| 3566 | Selector GetterSel, |
| 3567 | SourceLocation GetterNameLoc, |
| 3568 | Selector SetterSel, |
| 3569 | SourceLocation SetterNameLoc, |
| 3570 | const bool isReadWrite, |
| 3571 | unsigned &Attributes, |
| 3572 | const unsigned AttributesAsWritten, |
| 3573 | QualType T, |
| 3574 | TypeSourceInfo *TSI, |
| 3575 | tok::ObjCKeywordKind MethodImplKind); |
| 3576 | |
| 3577 | |
| 3578 | |
| 3579 | ObjCPropertyDecl *CreatePropertyDecl(Scope *S, |
| 3580 | ObjCContainerDecl *CDecl, |
| 3581 | SourceLocation AtLoc, |
| 3582 | SourceLocation LParenLoc, |
| 3583 | FieldDeclarator &FD, |
| 3584 | Selector GetterSel, |
| 3585 | SourceLocation GetterNameLoc, |
| 3586 | Selector SetterSel, |
| 3587 | SourceLocation SetterNameLoc, |
| 3588 | const bool isReadWrite, |
| 3589 | const unsigned Attributes, |
| 3590 | const unsigned AttributesAsWritten, |
| 3591 | QualType T, |
| 3592 | TypeSourceInfo *TSI, |
| 3593 | tok::ObjCKeywordKind MethodImplKind, |
| 3594 | DeclContext *lexicalDC = nullptr); |
| 3595 | |
| 3596 | |
| 3597 | |
| 3598 | |
| 3599 | void AtomicPropertySetterGetterRules(ObjCImplDecl* IMPDecl, |
| 3600 | ObjCInterfaceDecl* IDecl); |
| 3601 | |
| 3602 | void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D); |
| 3603 | |
| 3604 | void DiagnoseMissingDesignatedInitOverrides( |
| 3605 | const ObjCImplementationDecl *ImplD, |
| 3606 | const ObjCInterfaceDecl *IFD); |
| 3607 | |
| 3608 | void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID); |
| 3609 | |
| 3610 | enum MethodMatchStrategy { |
| 3611 | MMS_loose, |
| 3612 | MMS_strict |
| 3613 | }; |
| 3614 | |
| 3615 | |
| 3616 | |
| 3617 | bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, |
| 3618 | const ObjCMethodDecl *PrevMethod, |
| 3619 | MethodMatchStrategy strategy = MMS_strict); |
| 3620 | |
| 3621 | |
| 3622 | |
| 3623 | void MatchAllMethodDeclarations(const SelectorSet &InsMap, |
| 3624 | const SelectorSet &ClsMap, |
| 3625 | SelectorSet &InsMapSeen, |
| 3626 | SelectorSet &ClsMapSeen, |
| 3627 | ObjCImplDecl* IMPDecl, |
| 3628 | ObjCContainerDecl* IDecl, |
| 3629 | bool &IncompleteImpl, |
| 3630 | bool ImmediateClass, |
| 3631 | bool WarnCategoryMethodImpl=false); |
| 3632 | |
| 3633 | |
| 3634 | |
| 3635 | |
| 3636 | void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP); |
| 3637 | |
| 3638 | |
| 3639 | void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method); |
| 3640 | |
| 3641 | private: |
| 3642 | |
| 3643 | |
| 3644 | void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance); |
| 3645 | |
| 3646 | |
| 3647 | |
| 3648 | ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R, |
| 3649 | bool receiverIdOrClass, |
| 3650 | bool instance); |
| 3651 | |
| 3652 | public: |
| 3653 | |
| 3654 | |
| 3655 | |
| 3656 | |
| 3657 | |
| 3658 | bool |
| 3659 | CollectMultipleMethodsInGlobalPool(Selector Sel, |
| 3660 | SmallVectorImpl<ObjCMethodDecl*>& Methods, |
| 3661 | bool InstanceFirst, bool CheckTheOther, |
| 3662 | const ObjCObjectType *TypeBound = nullptr); |
| 3663 | |
| 3664 | bool |
| 3665 | AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, |
| 3666 | SourceRange R, bool receiverIdOrClass, |
| 3667 | SmallVectorImpl<ObjCMethodDecl*>& Methods); |
| 3668 | |
| 3669 | void |
| 3670 | DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl<ObjCMethodDecl*> &Methods, |
| 3671 | Selector Sel, SourceRange R, |
| 3672 | bool receiverIdOrClass); |
| 3673 | |
| 3674 | private: |
| 3675 | |
| 3676 | |
| 3677 | ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args, |
| 3678 | bool IsInstance, |
| 3679 | SmallVectorImpl<ObjCMethodDecl*>& Methods); |
| 3680 | |
| 3681 | |
| 3682 | |
| 3683 | TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc, |
| 3684 | bool RecordFailure = true) { |
| 3685 | if (RecordFailure) |
| 3686 | TypoCorrectionFailures[Typo].insert(TypoLoc); |
| 3687 | return TypoCorrection(); |
| 3688 | } |
| 3689 | |
| 3690 | public: |
| 3691 | |
| 3692 | |
| 3693 | |
| 3694 | |
| 3695 | void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) { |
| 3696 | AddMethodToGlobalPool(Method, impl, ); |
| 3697 | } |
| 3698 | |
| 3699 | |
| 3700 | void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) { |
| 3701 | AddMethodToGlobalPool(Method, impl, ); |
| 3702 | } |
| 3703 | |
| 3704 | |
| 3705 | |
| 3706 | void AddAnyMethodToGlobalPool(Decl *D); |
| 3707 | |
| 3708 | |
| 3709 | |
| 3710 | ObjCMethodDecl *LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, |
| 3711 | bool receiverIdOrClass=false) { |
| 3712 | return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass, |
| 3713 | ); |
| 3714 | } |
| 3715 | |
| 3716 | |
| 3717 | |
| 3718 | ObjCMethodDecl *LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, |
| 3719 | bool receiverIdOrClass=false) { |
| 3720 | return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass, |
| 3721 | ); |
| 3722 | } |
| 3723 | |
| 3724 | const ObjCMethodDecl *SelectorsForTypoCorrection(Selector Sel, |
| 3725 | QualType ObjectType=QualType()); |
| 3726 | |
| 3727 | |
| 3728 | ObjCMethodDecl *LookupImplementedMethodInGlobalPool(Selector Sel); |
| 3729 | |
| 3730 | |
| 3731 | |
| 3732 | void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, |
| 3733 | SmallVectorImpl<ObjCIvarDecl*> &Ivars); |
| 3734 | |
| 3735 | |
| 3736 | |
| 3737 | public: |
| 3738 | class FullExprArg { |
| 3739 | public: |
| 3740 | FullExprArg() : E(nullptr) { } |
| 3741 | FullExprArg(Sema &actions) : E(nullptr) { } |
| 3742 | |
| 3743 | ExprResult release() { |
| 3744 | return E; |
| 3745 | } |
| 3746 | |
| 3747 | Expr *get() const { return E; } |
| 3748 | |
| 3749 | Expr *operator->() { |
| 3750 | return E; |
| 3751 | } |
| 3752 | |
| 3753 | private: |
| 3754 | |
| 3755 | |
| 3756 | friend class Sema; |
| 3757 | |
| 3758 | explicit FullExprArg(Expr *expr) : E(expr) {} |
| 3759 | |
| 3760 | Expr *E; |
| 3761 | }; |
| 3762 | |
| 3763 | FullExprArg MakeFullExpr(Expr *Arg) { |
| 3764 | return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation()); |
| 3765 | } |
| 3766 | FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC) { |
| 3767 | return FullExprArg( |
| 3768 | ActOnFinishFullExpr(Arg, CC, false).get()); |
| 3769 | } |
| 3770 | FullExprArg MakeFullDiscardedValueExpr(Expr *Arg) { |
| 3771 | ExprResult FE = |
| 3772 | ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(), |
| 3773 | true); |
| 3774 | return FullExprArg(FE.get()); |
| 3775 | } |
| 3776 | |
| 3777 | StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true); |
| 3778 | StmtResult ActOnExprStmtError(); |
| 3779 | |
| 3780 | StmtResult ActOnNullStmt(SourceLocation SemiLoc, |
| 3781 | bool HasLeadingEmptyMacro = false); |
| 3782 | |
| 3783 | void ActOnStartOfCompoundStmt(bool IsStmtExpr); |
| 3784 | void ActOnFinishOfCompoundStmt(); |
| 3785 | StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, |
| 3786 | ArrayRef<Stmt *> Elts, bool isStmtExpr); |
| 3787 | |
| 3788 | |
| 3789 | class CompoundScopeRAII { |
| 3790 | public: |
| 3791 | CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) { |
| 3792 | S.ActOnStartOfCompoundStmt(IsStmtExpr); |
| 3793 | } |
| 3794 | |
| 3795 | ~CompoundScopeRAII() { |
| 3796 | S.ActOnFinishOfCompoundStmt(); |
| 3797 | } |
| 3798 | |
| 3799 | private: |
| 3800 | Sema &S; |
| 3801 | }; |
| 3802 | |
| 3803 | |
| 3804 | struct FunctionScopeRAII { |
| 3805 | Sema &S; |
| 3806 | bool Active; |
| 3807 | FunctionScopeRAII(Sema &S) : S(S), Active(true) {} |
| 3808 | ~FunctionScopeRAII() { |
| 3809 | if (Active) |
| 3810 | S.PopFunctionScopeInfo(); |
| 3811 | } |
| 3812 | void disable() { Active = false; } |
| 3813 | }; |
| 3814 | |
| 3815 | StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, |
| 3816 | SourceLocation StartLoc, |
| 3817 | SourceLocation EndLoc); |
| 3818 | void ActOnForEachDeclStmt(DeclGroupPtrTy Decl); |
| 3819 | StmtResult ActOnForEachLValueExpr(Expr *E); |
| 3820 | ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val); |
| 3821 | StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, |
| 3822 | SourceLocation DotDotDotLoc, ExprResult RHS, |
| 3823 | SourceLocation ColonLoc); |
| 3824 | void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt); |
| 3825 | |
| 3826 | StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, |
| 3827 | SourceLocation ColonLoc, |
| 3828 | Stmt *SubStmt, Scope *CurScope); |
| 3829 | StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, |
| 3830 | SourceLocation ColonLoc, Stmt *SubStmt); |
| 3831 | |
| 3832 | StmtResult ActOnAttributedStmt(SourceLocation AttrLoc, |
| 3833 | ArrayRef<const Attr*> Attrs, |
| 3834 | Stmt *SubStmt); |
| 3835 | |
| 3836 | class ConditionResult; |
| 3837 | StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr, |
| 3838 | Stmt *InitStmt, |
| 3839 | ConditionResult Cond, Stmt *ThenVal, |
| 3840 | SourceLocation ElseLoc, Stmt *ElseVal); |
| 3841 | StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, |
| 3842 | Stmt *InitStmt, |
| 3843 | ConditionResult Cond, Stmt *ThenVal, |
| 3844 | SourceLocation ElseLoc, Stmt *ElseVal); |
| 3845 | StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, |
| 3846 | Stmt *InitStmt, |
| 3847 | ConditionResult Cond); |
| 3848 | StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, |
| 3849 | Stmt *Switch, Stmt *Body); |
| 3850 | StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond, |
| 3851 | Stmt *Body); |
| 3852 | StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, |
| 3853 | SourceLocation WhileLoc, SourceLocation CondLParen, |
| 3854 | Expr *Cond, SourceLocation CondRParen); |
| 3855 | |
| 3856 | StmtResult ActOnForStmt(SourceLocation ForLoc, |
| 3857 | SourceLocation LParenLoc, |
| 3858 | Stmt *First, |
| 3859 | ConditionResult Second, |
| 3860 | FullExprArg Third, |
| 3861 | SourceLocation RParenLoc, |
| 3862 | Stmt *Body); |
| 3863 | ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, |
| 3864 | Expr *collection); |
| 3865 | StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, |
| 3866 | Stmt *First, Expr *collection, |
| 3867 | SourceLocation RParenLoc); |
| 3868 | StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body); |
| 3869 | |
| 3870 | enum BuildForRangeKind { |
| 3871 | |
| 3872 | BFRK_Build, |
| 3873 | |
| 3874 | |
| 3875 | BFRK_Rebuild, |
| 3876 | |
| 3877 | |
| 3878 | BFRK_Check |
| 3879 | }; |
| 3880 | |
| 3881 | StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, |
| 3882 | SourceLocation CoawaitLoc, |
| 3883 | Stmt *InitStmt, |
| 3884 | Stmt *LoopVar, |
| 3885 | SourceLocation ColonLoc, Expr *Collection, |
| 3886 | SourceLocation RParenLoc, |
| 3887 | BuildForRangeKind Kind); |
| 3888 | StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, |
| 3889 | SourceLocation CoawaitLoc, |
| 3890 | Stmt *InitStmt, |
| 3891 | SourceLocation ColonLoc, |
| 3892 | Stmt *RangeDecl, Stmt *Begin, Stmt *End, |
| 3893 | Expr *Cond, Expr *Inc, |
| 3894 | Stmt *LoopVarDecl, |
| 3895 | SourceLocation RParenLoc, |
| 3896 | BuildForRangeKind Kind); |
| 3897 | StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body); |
| 3898 | |
| 3899 | StmtResult ActOnGotoStmt(SourceLocation GotoLoc, |
| 3900 | SourceLocation LabelLoc, |
| 3901 | LabelDecl *TheDecl); |
| 3902 | StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, |
| 3903 | SourceLocation StarLoc, |
| 3904 | Expr *DestExp); |
| 3905 | StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope); |
| 3906 | StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope); |
| 3907 | |
| 3908 | void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, |
| 3909 | CapturedRegionKind Kind, unsigned NumParams); |
| 3910 | typedef std::pair<StringRef, QualType> CapturedParamNameType; |
| 3911 | void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, |
| 3912 | CapturedRegionKind Kind, |
| 3913 | ArrayRef<CapturedParamNameType> Params); |
| 3914 | StmtResult ActOnCapturedRegionEnd(Stmt *S); |
| 3915 | void ActOnCapturedRegionError(); |
| 3916 | RecordDecl *CreateCapturedStmtRecordDecl(CapturedDecl *&CD, |
| 3917 | SourceLocation Loc, |
| 3918 | unsigned NumParams); |
| 3919 | |
| 3920 | enum CopyElisionSemanticsKind { |
| 3921 | CES_Strict = 0, |
| 3922 | CES_AllowParameters = 1, |
| 3923 | CES_AllowDifferentTypes = 2, |
| 3924 | CES_AllowExceptionVariables = 4, |
| 3925 | CES_FormerDefault = (CES_AllowParameters), |
| 3926 | CES_Default = (CES_AllowParameters | CES_AllowDifferentTypes), |
| 3927 | CES_AsIfByStdMove = (CES_AllowParameters | CES_AllowDifferentTypes | |
| 3928 | CES_AllowExceptionVariables), |
| 3929 | }; |
| 3930 | |
| 3931 | VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E, |
| 3932 | CopyElisionSemanticsKind CESK); |
| 3933 | bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, |
| 3934 | CopyElisionSemanticsKind CESK); |
| 3935 | |
| 3936 | StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, |
| 3937 | Scope *CurScope); |
| 3938 | StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); |
| 3939 | StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); |
| 3940 | |
| 3941 | StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, |
| 3942 | bool IsVolatile, unsigned NumOutputs, |
| 3943 | unsigned NumInputs, IdentifierInfo **Names, |
| 3944 | MultiExprArg Constraints, MultiExprArg Exprs, |
| 3945 | Expr *AsmString, MultiExprArg Clobbers, |
| 3946 | SourceLocation RParenLoc); |
| 3947 | |
| 3948 | void FillInlineAsmIdentifierInfo(Expr *Res, |
| 3949 | llvm::InlineAsmIdentifierInfo &Info); |
| 3950 | ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, |
| 3951 | SourceLocation TemplateKWLoc, |
| 3952 | UnqualifiedId &Id, |
| 3953 | bool IsUnevaluatedContext); |
| 3954 | bool LookupInlineAsmField(StringRef Base, StringRef Member, |
| 3955 | unsigned &Offset, SourceLocation AsmLoc); |
| 3956 | ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, |
| 3957 | SourceLocation AsmLoc); |
| 3958 | StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, |
| 3959 | ArrayRef<Token> AsmToks, |
| 3960 | StringRef AsmString, |
| 3961 | unsigned NumOutputs, unsigned NumInputs, |
| 3962 | ArrayRef<StringRef> Constraints, |
| 3963 | ArrayRef<StringRef> Clobbers, |
| 3964 | ArrayRef<Expr*> Exprs, |
| 3965 | SourceLocation EndLoc); |
| 3966 | LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName, |
| 3967 | SourceLocation Location, |
| 3968 | bool AlwaysCreate); |
| 3969 | |
| 3970 | VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, |
| 3971 | SourceLocation StartLoc, |
| 3972 | SourceLocation IdLoc, IdentifierInfo *Id, |
| 3973 | bool Invalid = false); |
| 3974 | |
| 3975 | Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D); |
| 3976 | |
| 3977 | StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, |
| 3978 | Decl *Parm, Stmt *Body); |
| 3979 | |
| 3980 | StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body); |
| 3981 | |
| 3982 | StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, |
| 3983 | MultiStmtArg Catch, Stmt *Finally); |
| 3984 | |
| 3985 | StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw); |
| 3986 | StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, |
| 3987 | Scope *CurScope); |
| 3988 | ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, |
| 3989 | Expr *operand); |
| 3990 | StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, |
| 3991 | Expr *SynchExpr, |
| 3992 | Stmt *SynchBody); |
| 3993 | |
| 3994 | StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body); |
| 3995 | |
| 3996 | VarDecl *BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, |
| 3997 | SourceLocation StartLoc, |
| 3998 | SourceLocation IdLoc, |
| 3999 | IdentifierInfo *Id); |
| 4000 | |
| 4001 | Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D); |
| 4002 | |
| 4003 | StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, |
| 4004 | Decl *ExDecl, Stmt *HandlerBlock); |
| 4005 | StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, |
| 4006 | ArrayRef<Stmt *> Handlers); |
| 4007 | |
| 4008 | StmtResult ActOnSEHTryBlock(bool IsCXXTry, |
| 4009 | SourceLocation TryLoc, Stmt *TryBlock, |
| 4010 | Stmt *Handler); |
| 4011 | StmtResult ActOnSEHExceptBlock(SourceLocation Loc, |
| 4012 | Expr *FilterExpr, |
| 4013 | Stmt *Block); |
| 4014 | void ActOnStartSEHFinallyBlock(); |
| 4015 | void ActOnAbortSEHFinallyBlock(); |
| 4016 | StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block); |
| 4017 | StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope); |
| 4018 | |
| 4019 | void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock); |
| 4020 | |
| 4021 | bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const; |
| 4022 | |
| 4023 | |
| 4024 | |
| 4025 | void MarkUnusedFileScopedDecl(const DeclaratorDecl *D); |
| 4026 | |
| 4027 | |
| 4028 | |
| 4029 | void DiagnoseUnusedExprResult(const Stmt *S); |
| 4030 | void DiagnoseUnusedNestedTypedefs(const RecordDecl *D); |
| 4031 | void DiagnoseUnusedDecl(const NamedDecl *ND); |
| 4032 | |
| 4033 | |
| 4034 | |
| 4035 | |
| 4036 | |
| 4037 | |
| 4038 | |
| 4039 | void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, |
| 4040 | const Stmt *Body, |
| 4041 | unsigned DiagID); |
| 4042 | |
| 4043 | |
| 4044 | |
| 4045 | void DiagnoseEmptyLoopBody(const Stmt *S, |
| 4046 | const Stmt *PossibleBody); |
| 4047 | |
| 4048 | |
| 4049 | void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, |
| 4050 | SourceLocation OpLoc); |
| 4051 | |
| 4052 | |
| 4053 | |
| 4054 | void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, |
| 4055 | SourceLocation Loc); |
| 4056 | |
| 4057 | |
| 4058 | void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E); |
| 4059 | |
| 4060 | ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool) { |
| 4061 | return DelayedDiagnostics.push(pool); |
| 4062 | } |
| 4063 | void PopParsingDeclaration(ParsingDeclState state, Decl *decl); |
| 4064 | |
| 4065 | typedef ProcessingContextState ParsingClassState; |
| 4066 | ParsingClassState PushParsingClass() { |
| 4067 | return DelayedDiagnostics.pushUndelayed(); |
| 4068 | } |
| 4069 | void PopParsingClass(ParsingClassState state) { |
| 4070 | DelayedDiagnostics.popUndelayed(state); |
| 4071 | } |
| 4072 | |
| 4073 | void redelayDiagnostics(sema::DelayedDiagnosticPool &pool); |
| 4074 | |
| 4075 | void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs, |
| 4076 | const ObjCInterfaceDecl *UnknownObjCClass, |
| 4077 | bool ObjCPropertyAccess, |
| 4078 | bool AvoidPartialAvailabilityChecks = false, |
| 4079 | ObjCInterfaceDecl *ClassReceiver = nullptr); |
| 4080 | |
| 4081 | bool (SourceLocation loc, |
| 4082 | UnavailableAttr::ImplicitReason reason); |
| 4083 | |
| 4084 | |
| 4085 | void DiagnoseUnguardedAvailabilityViolations(Decl *FD); |
| 4086 | |
| 4087 | |
| 4088 | |
| 4089 | |
| 4090 | bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid); |
| 4091 | bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs, |
| 4092 | const ObjCInterfaceDecl *UnknownObjCClass = nullptr, |
| 4093 | bool ObjCPropertyAccess = false, |
| 4094 | bool AvoidPartialAvailabilityChecks = false, |
| 4095 | ObjCInterfaceDecl *ClassReciever = nullptr); |
| 4096 | void NoteDeletedFunction(FunctionDecl *FD); |
| 4097 | void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD); |
| 4098 | bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, |
| 4099 | ObjCMethodDecl *Getter, |
| 4100 | SourceLocation Loc); |
| 4101 | void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, |
| 4102 | ArrayRef<Expr *> Args); |
| 4103 | |
| 4104 | void PushExpressionEvaluationContext( |
| 4105 | ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr, |
| 4106 | ExpressionEvaluationContextRecord::ExpressionKind Type = |
| 4107 | ExpressionEvaluationContextRecord::EK_Other); |
| 4108 | enum ReuseLambdaContextDecl_t { ReuseLambdaContextDecl }; |
| 4109 | void PushExpressionEvaluationContext( |
| 4110 | ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t, |
| 4111 | ExpressionEvaluationContextRecord::ExpressionKind Type = |
| 4112 | ExpressionEvaluationContextRecord::EK_Other); |
| 4113 | void PopExpressionEvaluationContext(); |
| 4114 | |
| 4115 | void DiscardCleanupsInEvaluationContext(); |
| 4116 | |
| 4117 | ExprResult TransformToPotentiallyEvaluated(Expr *E); |
| 4118 | ExprResult HandleExprEvaluationContextForTypeof(Expr *E); |
| 4119 | |
| 4120 | ExprResult ActOnConstantExpression(ExprResult Res); |
| 4121 | |
| 4122 | |
| 4123 | |
| 4124 | |
| 4125 | |
| 4126 | |
| 4127 | |
| 4128 | |
| 4129 | |
| 4130 | |
| 4131 | |
| 4132 | |
| 4133 | |
| 4134 | void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse); |
| 4135 | void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, |
| 4136 | bool MightBeOdrUse = true); |
| 4137 | void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var); |
| 4138 | void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr); |
| 4139 | void MarkMemberReferenced(MemberExpr *E); |
| 4140 | |
| 4141 | void UpdateMarkingForLValueToRValue(Expr *E); |
| 4142 | void CleanupVarDeclMarking(); |
| 4143 | |
| 4144 | enum TryCaptureKind { |
| 4145 | TryCapture_Implicit, TryCapture_ExplicitByVal, TryCapture_ExplicitByRef |
| 4146 | }; |
| 4147 | |
| 4148 | |
| 4149 | |
| 4150 | |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | |
| 4156 | |
| 4157 | |
| 4158 | |
| 4159 | |
| 4160 | |
| 4161 | |
| 4162 | |
| 4163 | |
| 4164 | |
| 4165 | |
| 4166 | |
| 4167 | |
| 4168 | |
| 4169 | |
| 4170 | |
| 4171 | |
| 4172 | |
| 4173 | |
| 4174 | |
| 4175 | |
| 4176 | |
| 4177 | |
| 4178 | |
| 4179 | |
| 4180 | |
| 4181 | bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, |
| 4182 | SourceLocation EllipsisLoc, bool BuildAndDiagnose, |
| 4183 | QualType &CaptureType, |
| 4184 | QualType &DeclRefType, |
| 4185 | const unsigned *const FunctionScopeIndexToStopAt); |
| 4186 | |
| 4187 | |
| 4188 | bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, |
| 4189 | TryCaptureKind Kind = TryCapture_Implicit, |
| 4190 | SourceLocation EllipsisLoc = SourceLocation()); |
| 4191 | |
| 4192 | |
| 4193 | bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc); |
| 4194 | |
| 4195 | |
| 4196 | |
| 4197 | QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc); |
| 4198 | |
| 4199 | |
| 4200 | |
| 4201 | |
| 4202 | void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T); |
| 4203 | void MarkDeclarationsReferencedInExpr(Expr *E, |
| 4204 | bool SkipLocalVariables = false); |
| 4205 | |
| 4206 | |
| 4207 | |
| 4208 | |
| 4209 | bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, |
| 4210 | bool ForceComplain = false, |
| 4211 | bool (*IsPlausibleResult)(QualType) = nullptr); |
| 4212 | |
| 4213 | |
| 4214 | bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, |
| 4215 | UnresolvedSetImpl &NonTemplateOverloads); |
| 4216 | |
| 4217 | |
| 4218 | |
| 4219 | |
| 4220 | |
| 4221 | |
| 4222 | |
| 4223 | |
| 4224 | bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, |
| 4225 | const PartialDiagnostic &PD); |
| 4226 | |
| 4227 | |
| 4228 | SourceRange getExprRange(Expr *E) const; |
| 4229 | |
| 4230 | ExprResult ActOnIdExpression( |
| 4231 | Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, |
| 4232 | UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, |
| 4233 | CorrectionCandidateCallback *CCC = nullptr, |
| 4234 | bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr); |
| 4235 | |
| 4236 | void DecomposeUnqualifiedId(const UnqualifiedId &Id, |
| 4237 | TemplateArgumentListInfo &Buffer, |
| 4238 | DeclarationNameInfo &NameInfo, |
| 4239 | const TemplateArgumentListInfo *&TemplateArgs); |
| 4240 | |
| 4241 | bool |
| 4242 | DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, |
| 4243 | CorrectionCandidateCallback &CCC, |
| 4244 | TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr, |
| 4245 | ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr); |
| 4246 | |
| 4247 | ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, |
| 4248 | IdentifierInfo *II, |
| 4249 | bool AllowBuiltinCreation=false); |
| 4250 | |
| 4251 | ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, |
| 4252 | SourceLocation TemplateKWLoc, |
| 4253 | const DeclarationNameInfo &NameInfo, |
| 4254 | bool isAddressOfOperand, |
| 4255 | const TemplateArgumentListInfo *TemplateArgs); |
| 4256 | |
| 4257 | ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty, |
| 4258 | ExprValueKind VK, |
| 4259 | SourceLocation Loc, |
| 4260 | const CXXScopeSpec *SS = nullptr); |
| 4261 | ExprResult |
| 4262 | BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, |
| 4263 | const DeclarationNameInfo &NameInfo, |
| 4264 | const CXXScopeSpec *SS = nullptr, |
| 4265 | NamedDecl *FoundD = nullptr, |
| 4266 | const TemplateArgumentListInfo *TemplateArgs = nullptr); |
| 4267 | ExprResult |
| 4268 | BuildAnonymousStructUnionMemberReference( |
| 4269 | const CXXScopeSpec &SS, |
| 4270 | SourceLocation nameLoc, |
| 4271 | IndirectFieldDecl *indirectField, |
| 4272 | DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none), |
| 4273 | Expr *baseObjectExpr = nullptr, |
| 4274 | SourceLocation opLoc = SourceLocation()); |
| 4275 | |
| 4276 | ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, |
| 4277 | SourceLocation TemplateKWLoc, |
| 4278 | LookupResult &R, |
| 4279 | const TemplateArgumentListInfo *TemplateArgs, |
| 4280 | const Scope *S); |
| 4281 | ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, |
| 4282 | SourceLocation TemplateKWLoc, |
| 4283 | LookupResult &R, |
| 4284 | const TemplateArgumentListInfo *TemplateArgs, |
| 4285 | bool IsDefiniteInstance, |
| 4286 | const Scope *S); |
| 4287 | bool UseArgumentDependentLookup(const CXXScopeSpec &SS, |
| 4288 | const LookupResult &R, |
| 4289 | bool HasTrailingLParen); |
| 4290 | |
| 4291 | ExprResult |
| 4292 | BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, |
| 4293 | const DeclarationNameInfo &NameInfo, |
| 4294 | bool IsAddressOfOperand, const Scope *S, |
| 4295 | TypeSourceInfo **RecoveryTSI = nullptr); |
| 4296 | |
| 4297 | ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, |
| 4298 | SourceLocation TemplateKWLoc, |
| 4299 | const DeclarationNameInfo &NameInfo, |
| 4300 | const TemplateArgumentListInfo *TemplateArgs); |
| 4301 | |
| 4302 | ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, |
| 4303 | LookupResult &R, |
| 4304 | bool NeedsADL, |
| 4305 | bool AcceptInvalidDecl = false); |
| 4306 | ExprResult BuildDeclarationNameExpr( |
| 4307 | const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D, |
| 4308 | NamedDecl *FoundD = nullptr, |
| 4309 | const TemplateArgumentListInfo *TemplateArgs = nullptr, |
| 4310 | bool AcceptInvalidDecl = false); |
| 4311 | |
| 4312 | ExprResult BuildLiteralOperatorCall(LookupResult &R, |
| 4313 | DeclarationNameInfo &SuffixInfo, |
| 4314 | ArrayRef<Expr *> Args, |
| 4315 | SourceLocation LitEndLoc, |
| 4316 | TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr); |
| 4317 | |
| 4318 | ExprResult BuildPredefinedExpr(SourceLocation Loc, |
| 4319 | PredefinedExpr::IdentKind IK); |
| 4320 | ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind); |
| 4321 | ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val); |
| 4322 | |
| 4323 | bool CheckLoopHintExpr(Expr *E, SourceLocation Loc); |
| 4324 | |
| 4325 | ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr); |
| 4326 | ExprResult ActOnCharacterConstant(const Token &Tok, |
| 4327 | Scope *UDLScope = nullptr); |
| 4328 | ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E); |
| 4329 | ExprResult ActOnParenListExpr(SourceLocation L, |
| 4330 | SourceLocation R, |
| 4331 | MultiExprArg Val); |
| 4332 | |
| 4333 | |
| 4334 | |
| 4335 | ExprResult ActOnStringLiteral(ArrayRef<Token> StringToks, |
| 4336 | Scope *UDLScope = nullptr); |
| 4337 | |
| 4338 | ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, |
| 4339 | SourceLocation DefaultLoc, |
| 4340 | SourceLocation RParenLoc, |
| 4341 | Expr *ControllingExpr, |
| 4342 | ArrayRef<ParsedType> ArgTypes, |
| 4343 | ArrayRef<Expr *> ArgExprs); |
| 4344 | ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, |
| 4345 | SourceLocation DefaultLoc, |
| 4346 | SourceLocation RParenLoc, |
| 4347 | Expr *ControllingExpr, |
| 4348 | ArrayRef<TypeSourceInfo *> Types, |
| 4349 | ArrayRef<Expr *> Exprs); |
| 4350 | |
| 4351 | |
| 4352 | ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, |
| 4353 | Expr *InputExpr); |
| 4354 | ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, |
| 4355 | UnaryOperatorKind Opc, Expr *Input); |
| 4356 | ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, |
| 4357 | tok::TokenKind Op, Expr *Input); |
| 4358 | |
| 4359 | bool isQualifiedMemberAccess(Expr *E); |
| 4360 | QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc); |
| 4361 | |
| 4362 | ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, |
| 4363 | SourceLocation OpLoc, |
| 4364 | UnaryExprOrTypeTrait ExprKind, |
| 4365 | SourceRange R); |
| 4366 | ExprResult CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc, |
| 4367 | UnaryExprOrTypeTrait ExprKind); |
| 4368 | ExprResult |
| 4369 | ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, |
| 4370 | UnaryExprOrTypeTrait ExprKind, |
| 4371 | bool IsType, void *TyOrEx, |
| 4372 | SourceRange ArgRange); |
| 4373 | |
| 4374 | ExprResult CheckPlaceholderExpr(Expr *E); |
| 4375 | bool CheckVecStepExpr(Expr *E); |
| 4376 | |
| 4377 | bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind); |
| 4378 | bool CheckUnaryExprOrTypeTraitOperand(QualType ExprType, SourceLocation OpLoc, |
| 4379 | SourceRange ExprRange, |
| 4380 | UnaryExprOrTypeTrait ExprKind); |
| 4381 | ExprResult ActOnSizeofParameterPackExpr(Scope *S, |
| 4382 | SourceLocation OpLoc, |
| 4383 | IdentifierInfo &Name, |
| 4384 | SourceLocation NameLoc, |
| 4385 | SourceLocation RParenLoc); |
| 4386 | ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, |
| 4387 | tok::TokenKind Kind, Expr *Input); |
| 4388 | |
| 4389 | ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, |
| 4390 | Expr *Idx, SourceLocation RLoc); |
| 4391 | ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, |
| 4392 | Expr *Idx, SourceLocation RLoc); |
| 4393 | ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, |
| 4394 | Expr *LowerBound, SourceLocation ColonLoc, |
| 4395 | Expr *Length, SourceLocation RBLoc); |
| 4396 | |
| 4397 | |
| 4398 | |
| 4399 | |
| 4400 | |
| 4401 | |
| 4402 | struct { |
| 4403 | Scope *; |
| 4404 | UnqualifiedId &; |
| 4405 | Decl *; |
| 4406 | }; |
| 4407 | |
| 4408 | ExprResult ( |
| 4409 | Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, |
| 4410 | CXXScopeSpec &SS, SourceLocation TemplateKWLoc, |
| 4411 | NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, |
| 4412 | const TemplateArgumentListInfo *TemplateArgs, |
| 4413 | const Scope *S, |
| 4414 | ActOnMemberAccessExtraArgs * = nullptr); |
| 4415 | |
| 4416 | ExprResult |
| 4417 | (Expr *Base, QualType BaseType, SourceLocation OpLoc, |
| 4418 | bool IsArrow, const CXXScopeSpec &SS, |
| 4419 | SourceLocation TemplateKWLoc, |
| 4420 | NamedDecl *FirstQualifierInScope, LookupResult &R, |
| 4421 | const TemplateArgumentListInfo *TemplateArgs, |
| 4422 | const Scope *S, |
| 4423 | bool SuppressQualifierCheck = false, |
| 4424 | ActOnMemberAccessExtraArgs * = nullptr); |
| 4425 | |
| 4426 | ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, |
| 4427 | SourceLocation OpLoc, |
| 4428 | const CXXScopeSpec &SS, FieldDecl *Field, |
| 4429 | DeclAccessPair FoundDecl, |
| 4430 | const DeclarationNameInfo &MemberNameInfo); |
| 4431 | |
| 4432 | ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow); |
| 4433 | |
| 4434 | bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, |
| 4435 | const CXXScopeSpec &SS, |
| 4436 | const LookupResult &R); |
| 4437 | |
| 4438 | ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, |
| 4439 | bool IsArrow, SourceLocation OpLoc, |
| 4440 | const CXXScopeSpec &SS, |
| 4441 | SourceLocation TemplateKWLoc, |
| 4442 | NamedDecl *FirstQualifierInScope, |
| 4443 | const DeclarationNameInfo &NameInfo, |
| 4444 | const TemplateArgumentListInfo *TemplateArgs); |
| 4445 | |
| 4446 | ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, |
| 4447 | SourceLocation OpLoc, |
| 4448 | tok::TokenKind OpKind, |
| 4449 | CXXScopeSpec &SS, |
| 4450 | SourceLocation TemplateKWLoc, |
| 4451 | UnqualifiedId &Member, |
| 4452 | Decl *ObjCImpDecl); |
| 4453 | |
| 4454 | void ActOnDefaultCtorInitializers(Decl *CDtorDecl); |
| 4455 | bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, |
| 4456 | FunctionDecl *FDecl, |
| 4457 | const FunctionProtoType *Proto, |
| 4458 | ArrayRef<Expr *> Args, |
| 4459 | SourceLocation RParenLoc, |
| 4460 | bool ExecConfig = false); |
| 4461 | void CheckStaticArrayArgument(SourceLocation CallLoc, |
| 4462 | ParmVarDecl *Param, |
| 4463 | const Expr *ArgExpr); |
| 4464 | |
| 4465 | |
| 4466 | |
| 4467 | |
| 4468 | ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, |
| 4469 | MultiExprArg ArgExprs, SourceLocation RParenLoc, |
| 4470 | Expr *ExecConfig = nullptr, |
| 4471 | bool IsExecConfig = false); |
| 4472 | ExprResult |
| 4473 | BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, |
| 4474 | ArrayRef<Expr *> Arg, SourceLocation RParenLoc, |
| 4475 | Expr *Config = nullptr, bool IsExecConfig = false, |
| 4476 | ADLCallKind UsesADL = ADLCallKind::NotADL); |
| 4477 | |
| 4478 | ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, |
| 4479 | MultiExprArg ExecConfig, |
| 4480 | SourceLocation GGGLoc); |
| 4481 | |
| 4482 | ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, |
| 4483 | Declarator &D, ParsedType &Ty, |
| 4484 | SourceLocation RParenLoc, Expr *CastExpr); |
| 4485 | ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, |
| 4486 | TypeSourceInfo *Ty, |
| 4487 | SourceLocation RParenLoc, |
| 4488 | Expr *Op); |
| 4489 | CastKind PrepareScalarCast(ExprResult &src, QualType destType); |
| 4490 | |
| 4491 | |
| 4492 | ExprResult BuildVectorLiteral(SourceLocation LParenLoc, |
| 4493 | SourceLocation RParenLoc, Expr *E, |
| 4494 | TypeSourceInfo *TInfo); |
| 4495 | |
| 4496 | ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME); |
| 4497 | |
| 4498 | ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, |
| 4499 | ParsedType Ty, |
| 4500 | SourceLocation RParenLoc, |
| 4501 | Expr *InitExpr); |
| 4502 | |
| 4503 | ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, |
| 4504 | TypeSourceInfo *TInfo, |
| 4505 | SourceLocation RParenLoc, |
| 4506 | Expr *LiteralExpr); |
| 4507 | |
| 4508 | ExprResult ActOnInitList(SourceLocation LBraceLoc, |
| 4509 | MultiExprArg InitArgList, |
| 4510 | SourceLocation RBraceLoc); |
| 4511 | |
| 4512 | ExprResult ActOnDesignatedInitializer(Designation &Desig, |
| 4513 | SourceLocation Loc, |
| 4514 | bool GNUSyntax, |
| 4515 | ExprResult Init); |
| 4516 | |
| 4517 | private: |
| 4518 | static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind); |
| 4519 | |
| 4520 | public: |
| 4521 | ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, |
| 4522 | tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr); |
| 4523 | ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, |
| 4524 | BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr); |
| 4525 | ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, |
| 4526 | Expr *LHSExpr, Expr *RHSExpr); |
| 4527 | |
| 4528 | void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc); |
| 4529 | |
| 4530 | |
| 4531 | |
| 4532 | ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, |
| 4533 | SourceLocation ColonLoc, |
| 4534 | Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr); |
| 4535 | |
| 4536 | |
| 4537 | ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, |
| 4538 | LabelDecl *TheDecl); |
| 4539 | |
| 4540 | void ActOnStartStmtExpr(); |
| 4541 | ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, |
| 4542 | SourceLocation RPLoc); |
| 4543 | |
| 4544 | ExprResult ActOnStmtExprResult(ExprResult E); |
| 4545 | void ActOnStmtExprError(); |
| 4546 | |
| 4547 | |
| 4548 | struct OffsetOfComponent { |
| 4549 | SourceLocation LocStart, LocEnd; |
| 4550 | bool isBrackets; |
| 4551 | union { |
| 4552 | IdentifierInfo *IdentInfo; |
| 4553 | Expr *E; |
| 4554 | } U; |
| 4555 | }; |
| 4556 | |
| 4557 | |
| 4558 | ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, |
| 4559 | TypeSourceInfo *TInfo, |
| 4560 | ArrayRef<OffsetOfComponent> Components, |
| 4561 | SourceLocation RParenLoc); |
| 4562 | ExprResult ActOnBuiltinOffsetOf(Scope *S, |
| 4563 | SourceLocation BuiltinLoc, |
| 4564 | SourceLocation TypeLoc, |
| 4565 | ParsedType ParsedArgTy, |
| 4566 | ArrayRef<OffsetOfComponent> Components, |
| 4567 | SourceLocation RParenLoc); |
| 4568 | |
| 4569 | |
| 4570 | ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, |
| 4571 | Expr *CondExpr, Expr *LHSExpr, |
| 4572 | Expr *RHSExpr, SourceLocation RPLoc); |
| 4573 | |
| 4574 | |
| 4575 | ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, |
| 4576 | SourceLocation RPLoc); |
| 4577 | ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, |
| 4578 | TypeSourceInfo *TInfo, SourceLocation RPLoc); |
| 4579 | |
| 4580 | |
| 4581 | ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc); |
| 4582 | |
| 4583 | bool CheckCaseExpression(Expr *E); |
| 4584 | |
| 4585 | |
| 4586 | enum IfExistsResult { |
| 4587 | |
| 4588 | IER_Exists, |
| 4589 | |
| 4590 | |
| 4591 | IER_DoesNotExist, |
| 4592 | |
| 4593 | |
| 4594 | |
| 4595 | IER_Dependent, |
| 4596 | |
| 4597 | |
| 4598 | IER_Error |
| 4599 | }; |
| 4600 | |
| 4601 | IfExistsResult |
| 4602 | CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, |
| 4603 | const DeclarationNameInfo &TargetNameInfo); |
| 4604 | |
| 4605 | IfExistsResult |
| 4606 | CheckMicrosoftIfExistsSymbol(Scope *S, SourceLocation KeywordLoc, |
| 4607 | bool IsIfExists, CXXScopeSpec &SS, |
| 4608 | UnqualifiedId &Name); |
| 4609 | |
| 4610 | StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, |
| 4611 | bool IsIfExists, |
| 4612 | NestedNameSpecifierLoc QualifierLoc, |
| 4613 | DeclarationNameInfo NameInfo, |
| 4614 | Stmt *Nested); |
| 4615 | StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, |
| 4616 | bool IsIfExists, |
| 4617 | CXXScopeSpec &SS, UnqualifiedId &Name, |
| 4618 | Stmt *Nested); |
| 4619 | |
| 4620 | |
| 4621 | |
| 4622 | |
| 4623 | |
| 4624 | void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope); |
| 4625 | |
| 4626 | |
| 4627 | |
| 4628 | void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, |
| 4629 | Scope *CurScope); |
| 4630 | |
| 4631 | |
| 4632 | |
| 4633 | void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope); |
| 4634 | |
| 4635 | |
| 4636 | |
| 4637 | ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, |
| 4638 | Scope *CurScope); |
| 4639 | |
| 4640 | |
| 4641 | |
| 4642 | |
| 4643 | ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, |
| 4644 | SourceLocation BuiltinLoc, |
| 4645 | SourceLocation RParenLoc); |
| 4646 | |
| 4647 | |
| 4648 | |
| 4649 | |
| 4650 | ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, |
| 4651 | SourceLocation BuiltinLoc, |
| 4652 | SourceLocation RParenLoc); |
| 4653 | |
| 4654 | |
| 4655 | |
| 4656 | |
| 4657 | Decl *ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, |
| 4658 | SourceLocation NamespaceLoc, |
| 4659 | SourceLocation IdentLoc, IdentifierInfo *Ident, |
| 4660 | SourceLocation LBrace, |
| 4661 | const ParsedAttributesView &AttrList, |
| 4662 | UsingDirectiveDecl *&UsingDecl); |
| 4663 | void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace); |
| 4664 | |
| 4665 | NamespaceDecl *getStdNamespace() const; |
| 4666 | NamespaceDecl *getOrCreateStdNamespace(); |
| 4667 | |
| 4668 | NamespaceDecl *lookupStdExperimentalNamespace(); |
| 4669 | |
| 4670 | CXXRecordDecl *getStdBadAlloc() const; |
| 4671 | EnumDecl *getStdAlignValT() const; |
| 4672 | |
| 4673 | private: |
| 4674 | |
| 4675 | |
| 4676 | |
| 4677 | llvm::SmallBitVector FullyCheckedComparisonCategories; |
| 4678 | |
| 4679 | ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl, |
| 4680 | CXXScopeSpec &SS, |
| 4681 | ParsedType TemplateTypeTy, |
| 4682 | IdentifierInfo *MemberOrBase); |
| 4683 | |
| 4684 | public: |
| 4685 | |
| 4686 | |
| 4687 | |
| 4688 | |
| 4689 | |
| 4690 | |
| 4691 | QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, |
| 4692 | SourceLocation Loc); |
| 4693 | |
| 4694 | |
| 4695 | |
| 4696 | bool isStdInitializerList(QualType Ty, QualType *Element); |
| 4697 | |
| 4698 | |
| 4699 | |
| 4700 | |
| 4701 | |
| 4702 | QualType BuildStdInitializerList(QualType Element, SourceLocation Loc); |
| 4703 | |
| 4704 | |
| 4705 | |
| 4706 | bool isInitListConstructor(const FunctionDecl *Ctor); |
| 4707 | |
| 4708 | Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, |
| 4709 | SourceLocation NamespcLoc, CXXScopeSpec &SS, |
| 4710 | SourceLocation IdentLoc, |
| 4711 | IdentifierInfo *NamespcName, |
| 4712 | const ParsedAttributesView &AttrList); |
| 4713 | |
| 4714 | void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir); |
| 4715 | |
| 4716 | Decl *ActOnNamespaceAliasDef(Scope *CurScope, |
| 4717 | SourceLocation NamespaceLoc, |
| 4718 | SourceLocation AliasLoc, |
| 4719 | IdentifierInfo *Alias, |
| 4720 | CXXScopeSpec &SS, |
| 4721 | SourceLocation IdentLoc, |
| 4722 | IdentifierInfo *Ident); |
| 4723 | |
| 4724 | void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow); |
| 4725 | bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, |
| 4726 | const LookupResult &PreviousDecls, |
| 4727 | UsingShadowDecl *&PrevShadow); |
| 4728 | UsingShadowDecl *BuildUsingShadowDecl(Scope *S, UsingDecl *UD, |
| 4729 | NamedDecl *Target, |
| 4730 | UsingShadowDecl *PrevDecl); |
| 4731 | |
| 4732 | bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, |
| 4733 | bool HasTypenameKeyword, |
| 4734 | const CXXScopeSpec &SS, |
| 4735 | SourceLocation NameLoc, |
| 4736 | const LookupResult &Previous); |
| 4737 | bool CheckUsingDeclQualifier(SourceLocation UsingLoc, |
| 4738 | bool HasTypename, |
| 4739 | const CXXScopeSpec &SS, |
| 4740 | const DeclarationNameInfo &NameInfo, |
| 4741 | SourceLocation NameLoc); |
| 4742 | |
| 4743 | NamedDecl *BuildUsingDeclaration( |
| 4744 | Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, |
| 4745 | bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, |
| 4746 | DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, |
| 4747 | const ParsedAttributesView &AttrList, bool IsInstantiation); |
| 4748 | NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom, |
| 4749 | ArrayRef<NamedDecl *> Expansions); |
| 4750 | |
| 4751 | bool CheckInheritingConstructorUsingDecl(UsingDecl *UD); |
| 4752 | |
| 4753 | |
| 4754 | |
| 4755 | |
| 4756 | CXXConstructorDecl * |
| 4757 | findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, |
| 4758 | ConstructorUsingShadowDecl *DerivedShadow); |
| 4759 | |
| 4760 | Decl *ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, |
| 4761 | SourceLocation UsingLoc, |
| 4762 | SourceLocation TypenameLoc, CXXScopeSpec &SS, |
| 4763 | UnqualifiedId &Name, SourceLocation EllipsisLoc, |
| 4764 | const ParsedAttributesView &AttrList); |
| 4765 | Decl *ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, |
| 4766 | MultiTemplateParamsArg TemplateParams, |
| 4767 | SourceLocation UsingLoc, UnqualifiedId &Name, |
| 4768 | const ParsedAttributesView &AttrList, |
| 4769 | TypeResult Type, Decl *DeclFromDeclSpec); |
| 4770 | |
| 4771 | |
| 4772 | |
| 4773 | |
| 4774 | |
| 4775 | ExprResult |
| 4776 | BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, |
| 4777 | NamedDecl *FoundDecl, |
| 4778 | CXXConstructorDecl *Constructor, MultiExprArg Exprs, |
| 4779 | bool HadMultipleCandidates, bool IsListInitialization, |
| 4780 | bool IsStdInitListInitialization, |
| 4781 | bool RequiresZeroInit, unsigned ConstructKind, |
| 4782 | SourceRange ParenRange); |
| 4783 | |
| 4784 | |
| 4785 | |
| 4786 | ExprResult |
| 4787 | BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, |
| 4788 | CXXConstructorDecl *Constructor, bool Elidable, |
| 4789 | MultiExprArg Exprs, |
| 4790 | bool HadMultipleCandidates, bool IsListInitialization, |
| 4791 | bool IsStdInitListInitialization, |
| 4792 | bool RequiresZeroInit, unsigned ConstructKind, |
| 4793 | SourceRange ParenRange); |
| 4794 | |
| 4795 | |
| 4796 | |
| 4797 | ExprResult |
| 4798 | BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, |
| 4799 | NamedDecl *FoundDecl, |
| 4800 | CXXConstructorDecl *Constructor, bool Elidable, |
| 4801 | MultiExprArg Exprs, bool HadMultipleCandidates, |
| 4802 | bool IsListInitialization, |
| 4803 | bool IsStdInitListInitialization, bool RequiresZeroInit, |
| 4804 | unsigned ConstructKind, SourceRange ParenRange); |
| 4805 | |
| 4806 | ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field); |
| 4807 | |
| 4808 | |
| 4809 | |
| 4810 | |
| 4811 | bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, |
| 4812 | ParmVarDecl *Param); |
| 4813 | |
| 4814 | |
| 4815 | |
| 4816 | ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, |
| 4817 | FunctionDecl *FD, |
| 4818 | ParmVarDecl *Param); |
| 4819 | |
| 4820 | |
| 4821 | |
| 4822 | void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType); |
| 4823 | |
| 4824 | |
| 4825 | |
| 4826 | class ImplicitExceptionSpecification { |
| 4827 | |
| 4828 | Sema *Self; |
| 4829 | |
| 4830 | |
| 4831 | |
| 4832 | |
| 4833 | |
| 4834 | |
| 4835 | ExceptionSpecificationType ComputedEST; |
| 4836 | llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen; |
| 4837 | SmallVector<QualType, 4> Exceptions; |
| 4838 | |
| 4839 | void ClearExceptions() { |
| 4840 | ExceptionsSeen.clear(); |
| 4841 | Exceptions.clear(); |
| 4842 | } |
| 4843 | |
| 4844 | public: |
| 4845 | explicit ImplicitExceptionSpecification(Sema &Self) |
| 4846 | : Self(&Self), ComputedEST(EST_BasicNoexcept) { |
| 4847 | if (!Self.getLangOpts().CPlusPlus11) |
| 4848 | ComputedEST = EST_DynamicNone; |
| 4849 | } |
| 4850 | |
| 4851 | |
| 4852 | ExceptionSpecificationType getExceptionSpecType() const { |
| 4853 | (0) . __assert_fail ("!isComputedNoexcept(ComputedEST) && \"noexcept(expr) should not be a possible result\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 4854, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isComputedNoexcept(ComputedEST) && |
| 4854 | (0) . __assert_fail ("!isComputedNoexcept(ComputedEST) && \"noexcept(expr) should not be a possible result\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 4854, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "noexcept(expr) should not be a possible result"); |
| 4855 | return ComputedEST; |
| 4856 | } |
| 4857 | |
| 4858 | |
| 4859 | unsigned size() const { return Exceptions.size(); } |
| 4860 | |
| 4861 | |
| 4862 | const QualType *data() const { return Exceptions.data(); } |
| 4863 | |
| 4864 | |
| 4865 | void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method); |
| 4866 | |
| 4867 | |
| 4868 | void CalledExpr(Expr *E); |
| 4869 | |
| 4870 | |
| 4871 | |
| 4872 | FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const { |
| 4873 | FunctionProtoType::ExceptionSpecInfo ESI; |
| 4874 | ESI.Type = getExceptionSpecType(); |
| 4875 | if (ESI.Type == EST_Dynamic) { |
| 4876 | ESI.Exceptions = Exceptions; |
| 4877 | } else if (ESI.Type == EST_None) { |
| 4878 | |
| 4879 | |
| 4880 | |
| 4881 | ESI.Type = EST_NoexceptFalse; |
| 4882 | ESI.NoexceptExpr = Self->ActOnCXXBoolLiteral(SourceLocation(), |
| 4883 | tok::kw_false).get(); |
| 4884 | } |
| 4885 | return ESI; |
| 4886 | } |
| 4887 | }; |
| 4888 | |
| 4889 | |
| 4890 | |
| 4891 | ImplicitExceptionSpecification |
| 4892 | ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc, |
| 4893 | CXXMethodDecl *MD); |
| 4894 | |
| 4895 | |
| 4896 | |
| 4897 | |
| 4898 | ImplicitExceptionSpecification |
| 4899 | ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD); |
| 4900 | |
| 4901 | |
| 4902 | |
| 4903 | |
| 4904 | ImplicitExceptionSpecification |
| 4905 | ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD); |
| 4906 | |
| 4907 | |
| 4908 | |
| 4909 | ImplicitExceptionSpecification |
| 4910 | ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD); |
| 4911 | |
| 4912 | |
| 4913 | |
| 4914 | ImplicitExceptionSpecification |
| 4915 | ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD); |
| 4916 | |
| 4917 | |
| 4918 | |
| 4919 | ImplicitExceptionSpecification |
| 4920 | ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD); |
| 4921 | |
| 4922 | |
| 4923 | |
| 4924 | ImplicitExceptionSpecification |
| 4925 | ComputeInheritingCtorExceptionSpec(SourceLocation Loc, |
| 4926 | CXXConstructorDecl *CD); |
| 4927 | |
| 4928 | |
| 4929 | |
| 4930 | void EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD); |
| 4931 | |
| 4932 | |
| 4933 | |
| 4934 | ExprResult ActOnNoexceptSpec(SourceLocation NoexceptLoc, Expr *NoexceptExpr, |
| 4935 | ExceptionSpecificationType &EST); |
| 4936 | |
| 4937 | |
| 4938 | |
| 4939 | void checkExceptionSpecification(bool IsTopLevel, |
| 4940 | ExceptionSpecificationType EST, |
| 4941 | ArrayRef<ParsedType> DynamicExceptions, |
| 4942 | ArrayRef<SourceRange> DynamicExceptionRanges, |
| 4943 | Expr *NoexceptExpr, |
| 4944 | SmallVectorImpl<QualType> &Exceptions, |
| 4945 | FunctionProtoType::ExceptionSpecInfo &ESI); |
| 4946 | |
| 4947 | |
| 4948 | |
| 4949 | bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D); |
| 4950 | |
| 4951 | |
| 4952 | |
| 4953 | |
| 4954 | void actOnDelayedExceptionSpecification(Decl *Method, |
| 4955 | ExceptionSpecificationType EST, |
| 4956 | SourceRange SpecificationRange, |
| 4957 | ArrayRef<ParsedType> DynamicExceptions, |
| 4958 | ArrayRef<SourceRange> DynamicExceptionRanges, |
| 4959 | Expr *NoexceptExpr); |
| 4960 | |
| 4961 | class InheritedConstructorInfo; |
| 4962 | |
| 4963 | |
| 4964 | |
| 4965 | bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, |
| 4966 | InheritedConstructorInfo *ICI = nullptr, |
| 4967 | bool Diagnose = false); |
| 4968 | |
| 4969 | |
| 4970 | |
| 4971 | |
| 4972 | |
| 4973 | |
| 4974 | |
| 4975 | CXXConstructorDecl *DeclareImplicitDefaultConstructor( |
| 4976 | CXXRecordDecl *ClassDecl); |
| 4977 | |
| 4978 | |
| 4979 | |
| 4980 | void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, |
| 4981 | CXXConstructorDecl *Constructor); |
| 4982 | |
| 4983 | |
| 4984 | |
| 4985 | |
| 4986 | |
| 4987 | |
| 4988 | |
| 4989 | CXXDestructorDecl *DeclareImplicitDestructor(CXXRecordDecl *ClassDecl); |
| 4990 | |
| 4991 | |
| 4992 | |
| 4993 | void DefineImplicitDestructor(SourceLocation CurrentLocation, |
| 4994 | CXXDestructorDecl *Destructor); |
| 4995 | |
| 4996 | |
| 4997 | |
| 4998 | |
| 4999 | |
| 5000 | void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor); |
| 5001 | |
| 5002 | |
| 5003 | void DefineInheritingConstructor(SourceLocation UseLoc, |
| 5004 | CXXConstructorDecl *Constructor); |
| 5005 | |
| 5006 | |
| 5007 | |
| 5008 | |
| 5009 | |
| 5010 | |
| 5011 | |
| 5012 | CXXConstructorDecl *DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl); |
| 5013 | |
| 5014 | |
| 5015 | |
| 5016 | void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, |
| 5017 | CXXConstructorDecl *Constructor); |
| 5018 | |
| 5019 | |
| 5020 | |
| 5021 | |
| 5022 | |
| 5023 | |
| 5024 | |
| 5025 | |
| 5026 | CXXConstructorDecl *DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl); |
| 5027 | |
| 5028 | |
| 5029 | |
| 5030 | void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, |
| 5031 | CXXConstructorDecl *Constructor); |
| 5032 | |
| 5033 | |
| 5034 | |
| 5035 | |
| 5036 | |
| 5037 | |
| 5038 | |
| 5039 | CXXMethodDecl *DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl); |
| 5040 | |
| 5041 | |
| 5042 | void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, |
| 5043 | CXXMethodDecl *MethodDecl); |
| 5044 | |
| 5045 | |
| 5046 | |
| 5047 | |
| 5048 | |
| 5049 | |
| 5050 | |
| 5051 | |
| 5052 | CXXMethodDecl *DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl); |
| 5053 | |
| 5054 | |
| 5055 | void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, |
| 5056 | CXXMethodDecl *MethodDecl); |
| 5057 | |
| 5058 | |
| 5059 | |
| 5060 | void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class); |
| 5061 | |
| 5062 | |
| 5063 | void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD); |
| 5064 | |
| 5065 | |
| 5066 | |
| 5067 | bool isImplicitlyDeleted(FunctionDecl *FD); |
| 5068 | |
| 5069 | |
| 5070 | |
| 5071 | |
| 5072 | |
| 5073 | bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method); |
| 5074 | |
| 5075 | |
| 5076 | |
| 5077 | bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method); |
| 5078 | |
| 5079 | |
| 5080 | |
| 5081 | |
| 5082 | |
| 5083 | bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method); |
| 5084 | |
| 5085 | |
| 5086 | |
| 5087 | |
| 5088 | ExprResult MaybeBindToTemporary(Expr *E); |
| 5089 | |
| 5090 | bool CompleteConstructorCall(CXXConstructorDecl *Constructor, |
| 5091 | MultiExprArg ArgsPtr, |
| 5092 | SourceLocation Loc, |
| 5093 | SmallVectorImpl<Expr*> &ConvertedArgs, |
| 5094 | bool AllowExplicit = false, |
| 5095 | bool IsListInitialization = false); |
| 5096 | |
| 5097 | ParsedType getInheritingConstructorName(CXXScopeSpec &SS, |
| 5098 | SourceLocation NameLoc, |
| 5099 | IdentifierInfo &Name); |
| 5100 | |
| 5101 | ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, |
| 5102 | Scope *S, CXXScopeSpec &SS, |
| 5103 | bool EnteringContext); |
| 5104 | ParsedType getDestructorName(SourceLocation TildeLoc, |
| 5105 | IdentifierInfo &II, SourceLocation NameLoc, |
| 5106 | Scope *S, CXXScopeSpec &SS, |
| 5107 | ParsedType ObjectType, |
| 5108 | bool EnteringContext); |
| 5109 | |
| 5110 | ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, |
| 5111 | ParsedType ObjectType); |
| 5112 | |
| 5113 | |
| 5114 | void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, |
| 5115 | bool IsDereference, SourceRange Range); |
| 5116 | |
| 5117 | |
| 5118 | ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, |
| 5119 | tok::TokenKind Kind, |
| 5120 | SourceLocation LAngleBracketLoc, |
| 5121 | Declarator &D, |
| 5122 | SourceLocation RAngleBracketLoc, |
| 5123 | SourceLocation LParenLoc, |
| 5124 | Expr *E, |
| 5125 | SourceLocation RParenLoc); |
| 5126 | |
| 5127 | ExprResult BuildCXXNamedCast(SourceLocation OpLoc, |
| 5128 | tok::TokenKind Kind, |
| 5129 | TypeSourceInfo *Ty, |
| 5130 | Expr *E, |
| 5131 | SourceRange AngleBrackets, |
| 5132 | SourceRange Parens); |
| 5133 | |
| 5134 | ExprResult BuildCXXTypeId(QualType TypeInfoType, |
| 5135 | SourceLocation TypeidLoc, |
| 5136 | TypeSourceInfo *Operand, |
| 5137 | SourceLocation RParenLoc); |
| 5138 | ExprResult BuildCXXTypeId(QualType TypeInfoType, |
| 5139 | SourceLocation TypeidLoc, |
| 5140 | Expr *Operand, |
| 5141 | SourceLocation RParenLoc); |
| 5142 | |
| 5143 | |
| 5144 | ExprResult ActOnCXXTypeid(SourceLocation OpLoc, |
| 5145 | SourceLocation LParenLoc, bool isType, |
| 5146 | void *TyOrExpr, |
| 5147 | SourceLocation RParenLoc); |
| 5148 | |
| 5149 | ExprResult BuildCXXUuidof(QualType TypeInfoType, |
| 5150 | SourceLocation TypeidLoc, |
| 5151 | TypeSourceInfo *Operand, |
| 5152 | SourceLocation RParenLoc); |
| 5153 | ExprResult BuildCXXUuidof(QualType TypeInfoType, |
| 5154 | SourceLocation TypeidLoc, |
| 5155 | Expr *Operand, |
| 5156 | SourceLocation RParenLoc); |
| 5157 | |
| 5158 | |
| 5159 | ExprResult ActOnCXXUuidof(SourceLocation OpLoc, |
| 5160 | SourceLocation LParenLoc, bool isType, |
| 5161 | void *TyOrExpr, |
| 5162 | SourceLocation RParenLoc); |
| 5163 | |
| 5164 | |
| 5165 | ExprResult ActOnCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, |
| 5166 | tok::TokenKind Operator, |
| 5167 | SourceLocation EllipsisLoc, Expr *RHS, |
| 5168 | SourceLocation RParenLoc); |
| 5169 | ExprResult BuildCXXFoldExpr(SourceLocation LParenLoc, Expr *LHS, |
| 5170 | BinaryOperatorKind Operator, |
| 5171 | SourceLocation EllipsisLoc, Expr *RHS, |
| 5172 | SourceLocation RParenLoc); |
| 5173 | ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, |
| 5174 | BinaryOperatorKind Operator); |
| 5175 | |
| 5176 | |
| 5177 | ExprResult ActOnCXXThis(SourceLocation loc); |
| 5178 | |
| 5179 | |
| 5180 | |
| 5181 | |
| 5182 | QualType getCurrentThisType(); |
| 5183 | |
| 5184 | |
| 5185 | |
| 5186 | |
| 5187 | QualType CXXThisTypeOverride; |
| 5188 | |
| 5189 | |
| 5190 | |
| 5191 | class CXXThisScopeRAII { |
| 5192 | Sema &S; |
| 5193 | QualType OldCXXThisTypeOverride; |
| 5194 | bool Enabled; |
| 5195 | |
| 5196 | public: |
| 5197 | |
| 5198 | |
| 5199 | |
| 5200 | |
| 5201 | CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, |
| 5202 | bool Enabled = true); |
| 5203 | |
| 5204 | ~CXXThisScopeRAII(); |
| 5205 | }; |
| 5206 | |
| 5207 | |
| 5208 | |
| 5209 | |
| 5210 | |
| 5211 | |
| 5212 | |
| 5213 | |
| 5214 | |
| 5215 | |
| 5216 | |
| 5217 | |
| 5218 | |
| 5219 | |
| 5220 | |
| 5221 | |
| 5222 | bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false, |
| 5223 | bool BuildAndDiagnose = true, |
| 5224 | const unsigned *const FunctionScopeIndexToStopAt = nullptr, |
| 5225 | bool ByCopy = false); |
| 5226 | |
| 5227 | |
| 5228 | |
| 5229 | |
| 5230 | bool isThisOutsideMemberFunctionBody(QualType BaseType); |
| 5231 | |
| 5232 | |
| 5233 | ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind); |
| 5234 | |
| 5235 | |
| 5236 | |
| 5237 | ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind); |
| 5238 | |
| 5239 | ExprResult |
| 5240 | ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef<AvailabilitySpec> AvailSpecs, |
| 5241 | SourceLocation AtLoc, SourceLocation RParen); |
| 5242 | |
| 5243 | |
| 5244 | ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc); |
| 5245 | |
| 5246 | |
| 5247 | ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr); |
| 5248 | ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, |
| 5249 | bool IsThrownVarInScope); |
| 5250 | bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E); |
| 5251 | |
| 5252 | |
| 5253 | |
| 5254 | |
| 5255 | |
| 5256 | ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, |
| 5257 | SourceLocation LParenOrBraceLoc, |
| 5258 | MultiExprArg Exprs, |
| 5259 | SourceLocation RParenOrBraceLoc, |
| 5260 | bool ListInitialization); |
| 5261 | |
| 5262 | ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, |
| 5263 | SourceLocation LParenLoc, |
| 5264 | MultiExprArg Exprs, |
| 5265 | SourceLocation RParenLoc, |
| 5266 | bool ListInitialization); |
| 5267 | |
| 5268 | |
| 5269 | ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, |
| 5270 | SourceLocation PlacementLParen, |
| 5271 | MultiExprArg PlacementArgs, |
| 5272 | SourceLocation PlacementRParen, |
| 5273 | SourceRange TypeIdParens, Declarator &D, |
| 5274 | Expr *Initializer); |
| 5275 | ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, |
| 5276 | SourceLocation PlacementLParen, |
| 5277 | MultiExprArg PlacementArgs, |
| 5278 | SourceLocation PlacementRParen, |
| 5279 | SourceRange TypeIdParens, |
| 5280 | QualType AllocType, |
| 5281 | TypeSourceInfo *AllocTypeInfo, |
| 5282 | Expr *ArraySize, |
| 5283 | SourceRange DirectInitRange, |
| 5284 | Expr *Initializer); |
| 5285 | |
| 5286 | |
| 5287 | |
| 5288 | bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const; |
| 5289 | |
| 5290 | |
| 5291 | |
| 5292 | void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, |
| 5293 | SourceLocation Loc); |
| 5294 | |
| 5295 | bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, |
| 5296 | SourceRange R); |
| 5297 | |
| 5298 | |
| 5299 | enum AllocationFunctionScope { |
| 5300 | |
| 5301 | AFS_Global, |
| 5302 | |
| 5303 | |
| 5304 | AFS_Class, |
| 5305 | |
| 5306 | |
| 5307 | AFS_Both |
| 5308 | }; |
| 5309 | |
| 5310 | |
| 5311 | |
| 5312 | bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, |
| 5313 | AllocationFunctionScope NewScope, |
| 5314 | AllocationFunctionScope DeleteScope, |
| 5315 | QualType AllocType, bool IsArray, |
| 5316 | bool &PassAlignment, MultiExprArg PlaceArgs, |
| 5317 | FunctionDecl *&OperatorNew, |
| 5318 | FunctionDecl *&OperatorDelete, |
| 5319 | bool Diagnose = true); |
| 5320 | void DeclareGlobalNewDelete(); |
| 5321 | void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, |
| 5322 | ArrayRef<QualType> Params); |
| 5323 | |
| 5324 | bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, |
| 5325 | DeclarationName Name, FunctionDecl* &Operator, |
| 5326 | bool Diagnose = true); |
| 5327 | FunctionDecl *FindUsualDeallocationFunction(SourceLocation StartLoc, |
| 5328 | bool CanProvideSize, |
| 5329 | bool Overaligned, |
| 5330 | DeclarationName Name); |
| 5331 | FunctionDecl *FindDeallocationFunctionForDestructor(SourceLocation StartLoc, |
| 5332 | CXXRecordDecl *RD); |
| 5333 | |
| 5334 | |
| 5335 | ExprResult ActOnCXXDelete(SourceLocation StartLoc, |
| 5336 | bool UseGlobal, bool ArrayForm, |
| 5337 | Expr *Operand); |
| 5338 | void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, |
| 5339 | bool IsDelete, bool CallCanBeVirtual, |
| 5340 | bool WarnOnNonAbstractTypes, |
| 5341 | SourceLocation DtorLoc); |
| 5342 | |
| 5343 | ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, |
| 5344 | Expr *Operand, SourceLocation RParen); |
| 5345 | ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, |
| 5346 | SourceLocation RParen); |
| 5347 | |
| 5348 | |
| 5349 | ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, |
| 5350 | ArrayRef<ParsedType> Args, |
| 5351 | SourceLocation RParenLoc); |
| 5352 | ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, |
| 5353 | ArrayRef<TypeSourceInfo *> Args, |
| 5354 | SourceLocation RParenLoc); |
| 5355 | |
| 5356 | |
| 5357 | |
| 5358 | ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, |
| 5359 | SourceLocation KWLoc, |
| 5360 | ParsedType LhsTy, |
| 5361 | Expr *DimExpr, |
| 5362 | SourceLocation RParen); |
| 5363 | |
| 5364 | ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, |
| 5365 | SourceLocation KWLoc, |
| 5366 | TypeSourceInfo *TSInfo, |
| 5367 | Expr *DimExpr, |
| 5368 | SourceLocation RParen); |
| 5369 | |
| 5370 | |
| 5371 | |
| 5372 | ExprResult ActOnExpressionTrait(ExpressionTrait OET, |
| 5373 | SourceLocation KWLoc, |
| 5374 | Expr *Queried, |
| 5375 | SourceLocation RParen); |
| 5376 | |
| 5377 | ExprResult BuildExpressionTrait(ExpressionTrait OET, |
| 5378 | SourceLocation KWLoc, |
| 5379 | Expr *Queried, |
| 5380 | SourceLocation RParen); |
| 5381 | |
| 5382 | ExprResult ActOnStartCXXMemberReference(Scope *S, |
| 5383 | Expr *Base, |
| 5384 | SourceLocation OpLoc, |
| 5385 | tok::TokenKind OpKind, |
| 5386 | ParsedType &ObjectType, |
| 5387 | bool &MayBePseudoDestructor); |
| 5388 | |
| 5389 | ExprResult BuildPseudoDestructorExpr(Expr *Base, |
| 5390 | SourceLocation OpLoc, |
| 5391 | tok::TokenKind OpKind, |
| 5392 | const CXXScopeSpec &SS, |
| 5393 | TypeSourceInfo *ScopeType, |
| 5394 | SourceLocation CCLoc, |
| 5395 | SourceLocation TildeLoc, |
| 5396 | PseudoDestructorTypeStorage DestroyedType); |
| 5397 | |
| 5398 | ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, |
| 5399 | SourceLocation OpLoc, |
| 5400 | tok::TokenKind OpKind, |
| 5401 | CXXScopeSpec &SS, |
| 5402 | UnqualifiedId &FirstTypeName, |
| 5403 | SourceLocation CCLoc, |
| 5404 | SourceLocation TildeLoc, |
| 5405 | UnqualifiedId &SecondTypeName); |
| 5406 | |
| 5407 | ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, |
| 5408 | SourceLocation OpLoc, |
| 5409 | tok::TokenKind OpKind, |
| 5410 | SourceLocation TildeLoc, |
| 5411 | const DeclSpec& DS); |
| 5412 | |
| 5413 | |
| 5414 | |
| 5415 | |
| 5416 | Expr *MaybeCreateExprWithCleanups(Expr *SubExpr); |
| 5417 | Stmt *MaybeCreateStmtWithCleanups(Stmt *SubStmt); |
| 5418 | ExprResult MaybeCreateExprWithCleanups(ExprResult SubExpr); |
| 5419 | |
| 5420 | MaterializeTemporaryExpr * |
| 5421 | CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, |
| 5422 | bool BoundToLvalueReference); |
| 5423 | |
| 5424 | ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) { |
| 5425 | return ActOnFinishFullExpr( |
| 5426 | Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue); |
| 5427 | } |
| 5428 | ExprResult ActOnFinishFullExpr(Expr *Expr, SourceLocation CC, |
| 5429 | bool DiscardedValue, bool IsConstexpr = false); |
| 5430 | StmtResult ActOnFinishFullStmt(Stmt *Stmt); |
| 5431 | |
| 5432 | |
| 5433 | bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC); |
| 5434 | |
| 5435 | DeclContext *computeDeclContext(QualType T); |
| 5436 | DeclContext *computeDeclContext(const CXXScopeSpec &SS, |
| 5437 | bool EnteringContext = false); |
| 5438 | bool isDependentScopeSpecifier(const CXXScopeSpec &SS); |
| 5439 | CXXRecordDecl *getCurrentInstantiationOf(NestedNameSpecifier *NNS); |
| 5440 | |
| 5441 | |
| 5442 | |
| 5443 | |
| 5444 | |
| 5445 | |
| 5446 | |
| 5447 | |
| 5448 | |
| 5449 | bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS); |
| 5450 | |
| 5451 | |
| 5452 | |
| 5453 | |
| 5454 | |
| 5455 | |
| 5456 | |
| 5457 | |
| 5458 | |
| 5459 | |
| 5460 | |
| 5461 | bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, |
| 5462 | SourceLocation ColonColonLoc, CXXScopeSpec &SS); |
| 5463 | |
| 5464 | bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, |
| 5465 | bool *CanCorrect = nullptr); |
| 5466 | NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS); |
| 5467 | |
| 5468 | |
| 5469 | |
| 5470 | struct NestedNameSpecInfo { |
| 5471 | |
| 5472 | |
| 5473 | ParsedType ObjectType; |
| 5474 | |
| 5475 | |
| 5476 | IdentifierInfo *Identifier; |
| 5477 | |
| 5478 | |
| 5479 | SourceLocation IdentifierLoc; |
| 5480 | |
| 5481 | |
| 5482 | SourceLocation CCLoc; |
| 5483 | |
| 5484 | |
| 5485 | NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, |
| 5486 | SourceLocation ColonColonLoc, ParsedType ObjectType = ParsedType()) |
| 5487 | : ObjectType(ObjectType), Identifier(II), IdentifierLoc(IdLoc), |
| 5488 | CCLoc(ColonColonLoc) { |
| 5489 | } |
| 5490 | |
| 5491 | NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, |
| 5492 | SourceLocation ColonColonLoc, QualType ObjectType) |
| 5493 | : ObjectType(ParsedType::make(ObjectType)), Identifier(II), |
| 5494 | IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) { |
| 5495 | } |
| 5496 | }; |
| 5497 | |
| 5498 | bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, |
| 5499 | NestedNameSpecInfo &IdInfo); |
| 5500 | |
| 5501 | bool BuildCXXNestedNameSpecifier(Scope *S, |
| 5502 | NestedNameSpecInfo &IdInfo, |
| 5503 | bool EnteringContext, |
| 5504 | CXXScopeSpec &SS, |
| 5505 | NamedDecl *ScopeLookupResult, |
| 5506 | bool ErrorRecoveryLookup, |
| 5507 | bool *IsCorrectedToColon = nullptr, |
| 5508 | bool OnlyNamespace = false); |
| 5509 | |
| 5510 | |
| 5511 | |
| 5512 | |
| 5513 | |
| 5514 | |
| 5515 | |
| 5516 | |
| 5517 | |
| 5518 | |
| 5519 | |
| 5520 | |
| 5521 | |
| 5522 | |
| 5523 | |
| 5524 | |
| 5525 | |
| 5526 | |
| 5527 | |
| 5528 | |
| 5529 | |
| 5530 | |
| 5531 | |
| 5532 | |
| 5533 | |
| 5534 | |
| 5535 | bool ActOnCXXNestedNameSpecifier(Scope *S, |
| 5536 | NestedNameSpecInfo &IdInfo, |
| 5537 | bool EnteringContext, |
| 5538 | CXXScopeSpec &SS, |
| 5539 | bool ErrorRecoveryLookup = false, |
| 5540 | bool *IsCorrectedToColon = nullptr, |
| 5541 | bool OnlyNamespace = false); |
| 5542 | |
| 5543 | ExprResult ActOnDecltypeExpression(Expr *E); |
| 5544 | |
| 5545 | bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, |
| 5546 | const DeclSpec &DS, |
| 5547 | SourceLocation ColonColonLoc); |
| 5548 | |
| 5549 | bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, |
| 5550 | NestedNameSpecInfo &IdInfo, |
| 5551 | bool EnteringContext); |
| 5552 | |
| 5553 | |
| 5554 | |
| 5555 | |
| 5556 | |
| 5557 | |
| 5558 | |
| 5559 | |
| 5560 | |
| 5561 | |
| 5562 | |
| 5563 | |
| 5564 | |
| 5565 | |
| 5566 | |
| 5567 | |
| 5568 | |
| 5569 | |
| 5570 | |
| 5571 | |
| 5572 | |
| 5573 | |
| 5574 | |
| 5575 | |
| 5576 | bool ActOnCXXNestedNameSpecifier(Scope *S, |
| 5577 | CXXScopeSpec &SS, |
| 5578 | SourceLocation TemplateKWLoc, |
| 5579 | TemplateTy TemplateName, |
| 5580 | SourceLocation TemplateNameLoc, |
| 5581 | SourceLocation LAngleLoc, |
| 5582 | ASTTemplateArgsPtr TemplateArgs, |
| 5583 | SourceLocation RAngleLoc, |
| 5584 | SourceLocation CCLoc, |
| 5585 | bool EnteringContext); |
| 5586 | |
| 5587 | |
| 5588 | |
| 5589 | |
| 5590 | |
| 5591 | |
| 5592 | |
| 5593 | |
| 5594 | |
| 5595 | void *SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS); |
| 5596 | |
| 5597 | |
| 5598 | |
| 5599 | |
| 5600 | |
| 5601 | |
| 5602 | |
| 5603 | |
| 5604 | |
| 5605 | |
| 5606 | |
| 5607 | void RestoreNestedNameSpecifierAnnotation(void *Annotation, |
| 5608 | SourceRange AnnotationRange, |
| 5609 | CXXScopeSpec &SS); |
| 5610 | |
| 5611 | bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS); |
| 5612 | |
| 5613 | |
| 5614 | |
| 5615 | |
| 5616 | |
| 5617 | |
| 5618 | |
| 5619 | bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS); |
| 5620 | |
| 5621 | |
| 5622 | |
| 5623 | |
| 5624 | |
| 5625 | |
| 5626 | void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS); |
| 5627 | |
| 5628 | |
| 5629 | |
| 5630 | |
| 5631 | |
| 5632 | |
| 5633 | void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl); |
| 5634 | |
| 5635 | |
| 5636 | |
| 5637 | void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl); |
| 5638 | |
| 5639 | |
| 5640 | CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange, |
| 5641 | TypeSourceInfo *Info, |
| 5642 | bool KnownDependent, |
| 5643 | LambdaCaptureDefault CaptureDefault); |
| 5644 | |
| 5645 | |
| 5646 | CXXMethodDecl *startLambdaDefinition(CXXRecordDecl *Class, |
| 5647 | SourceRange IntroducerRange, |
| 5648 | TypeSourceInfo *MethodType, |
| 5649 | SourceLocation EndLoc, |
| 5650 | ArrayRef<ParmVarDecl *> Params, |
| 5651 | bool IsConstexprSpecified); |
| 5652 | |
| 5653 | |
| 5654 | void buildLambdaScope(sema::LambdaScopeInfo *LSI, |
| 5655 | CXXMethodDecl *CallOperator, |
| 5656 | SourceRange IntroducerRange, |
| 5657 | LambdaCaptureDefault CaptureDefault, |
| 5658 | SourceLocation CaptureDefaultLoc, |
| 5659 | bool ExplicitParams, |
| 5660 | bool ExplicitResultType, |
| 5661 | bool Mutable); |
| 5662 | |
| 5663 | |
| 5664 | |
| 5665 | |
| 5666 | ParsedType actOnLambdaInitCaptureInitialization( |
| 5667 | SourceLocation Loc, bool ByRef, IdentifierInfo *Id, |
| 5668 | LambdaCaptureInitKind InitKind, Expr *&Init) { |
| 5669 | return ParsedType::make(buildLambdaInitCaptureInitialization( |
| 5670 | Loc, ByRef, Id, InitKind != LambdaCaptureInitKind::CopyInit, Init)); |
| 5671 | } |
| 5672 | QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, |
| 5673 | IdentifierInfo *Id, |
| 5674 | bool DirectInit, Expr *&Init); |
| 5675 | |
| 5676 | |
| 5677 | |
| 5678 | |
| 5679 | |
| 5680 | |
| 5681 | VarDecl *createLambdaInitCaptureVarDecl(SourceLocation Loc, |
| 5682 | QualType InitCaptureType, |
| 5683 | IdentifierInfo *Id, |
| 5684 | unsigned InitStyle, Expr *Init); |
| 5685 | |
| 5686 | |
| 5687 | FieldDecl *buildInitCaptureField(sema::LambdaScopeInfo *LSI, VarDecl *Var); |
| 5688 | |
| 5689 | |
| 5690 | |
| 5691 | void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI); |
| 5692 | |
| 5693 | |
| 5694 | void addLambdaParameters( |
| 5695 | ArrayRef<LambdaIntroducer::LambdaCapture> Captures, |
| 5696 | CXXMethodDecl *CallOperator, Scope *CurScope); |
| 5697 | |
| 5698 | |
| 5699 | |
| 5700 | void deduceClosureReturnType(sema::CapturingScopeInfo &CSI); |
| 5701 | |
| 5702 | |
| 5703 | |
| 5704 | |
| 5705 | |
| 5706 | void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, |
| 5707 | Declarator &ParamInfo, Scope *CurScope); |
| 5708 | |
| 5709 | |
| 5710 | |
| 5711 | void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, |
| 5712 | bool IsInstantiation = false); |
| 5713 | |
| 5714 | |
| 5715 | |
| 5716 | ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, |
| 5717 | Scope *CurScope); |
| 5718 | |
| 5719 | |
| 5720 | bool CaptureHasSideEffects(const sema::Capture &From); |
| 5721 | |
| 5722 | |
| 5723 | |
| 5724 | bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, |
| 5725 | const sema::Capture &From); |
| 5726 | |
| 5727 | |
| 5728 | |
| 5729 | ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, |
| 5730 | sema::LambdaScopeInfo *LSI); |
| 5731 | |
| 5732 | |
| 5733 | |
| 5734 | QualType |
| 5735 | getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType); |
| 5736 | |
| 5737 | |
| 5738 | |
| 5739 | |
| 5740 | |
| 5741 | |
| 5742 | |
| 5743 | |
| 5744 | void DefineImplicitLambdaToFunctionPointerConversion( |
| 5745 | SourceLocation CurrentLoc, CXXConversionDecl *Conv); |
| 5746 | |
| 5747 | |
| 5748 | |
| 5749 | |
| 5750 | |
| 5751 | |
| 5752 | |
| 5753 | |
| 5754 | void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, |
| 5755 | CXXConversionDecl *Conv); |
| 5756 | |
| 5757 | ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, |
| 5758 | SourceLocation ConvLocation, |
| 5759 | CXXConversionDecl *Conv, |
| 5760 | Expr *Src); |
| 5761 | |
| 5762 | |
| 5763 | ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, |
| 5764 | ArrayRef<Expr *> Strings); |
| 5765 | |
| 5766 | ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S); |
| 5767 | |
| 5768 | |
| 5769 | |
| 5770 | |
| 5771 | ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number); |
| 5772 | ExprResult ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, |
| 5773 | bool Value); |
| 5774 | ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements); |
| 5775 | |
| 5776 | |
| 5777 | |
| 5778 | |
| 5779 | |
| 5780 | |
| 5781 | ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr); |
| 5782 | |
| 5783 | ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, |
| 5784 | Expr *IndexExpr, |
| 5785 | ObjCMethodDecl *getterMethod, |
| 5786 | ObjCMethodDecl *setterMethod); |
| 5787 | |
| 5788 | ExprResult BuildObjCDictionaryLiteral(SourceRange SR, |
| 5789 | MutableArrayRef<ObjCDictionaryElement> Elements); |
| 5790 | |
| 5791 | ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, |
| 5792 | TypeSourceInfo *EncodedTypeInfo, |
| 5793 | SourceLocation RParenLoc); |
| 5794 | ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, |
| 5795 | CXXConversionDecl *Method, |
| 5796 | bool HadMultipleCandidates); |
| 5797 | |
| 5798 | ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, |
| 5799 | SourceLocation EncodeLoc, |
| 5800 | SourceLocation LParenLoc, |
| 5801 | ParsedType Ty, |
| 5802 | SourceLocation RParenLoc); |
| 5803 | |
| 5804 | |
| 5805 | ExprResult ParseObjCSelectorExpression(Selector Sel, |
| 5806 | SourceLocation AtLoc, |
| 5807 | SourceLocation SelLoc, |
| 5808 | SourceLocation LParenLoc, |
| 5809 | SourceLocation RParenLoc, |
| 5810 | bool WarnMultipleSelectors); |
| 5811 | |
| 5812 | |
| 5813 | ExprResult ParseObjCProtocolExpression(IdentifierInfo * ProtocolName, |
| 5814 | SourceLocation AtLoc, |
| 5815 | SourceLocation ProtoLoc, |
| 5816 | SourceLocation LParenLoc, |
| 5817 | SourceLocation ProtoIdLoc, |
| 5818 | SourceLocation RParenLoc); |
| 5819 | |
| 5820 | |
| 5821 | |
| 5822 | |
| 5823 | Decl *ActOnStartLinkageSpecification(Scope *S, |
| 5824 | SourceLocation ExternLoc, |
| 5825 | Expr *LangStr, |
| 5826 | SourceLocation LBraceLoc); |
| 5827 | Decl *ActOnFinishLinkageSpecification(Scope *S, |
| 5828 | Decl *LinkageSpec, |
| 5829 | SourceLocation RBraceLoc); |
| 5830 | |
| 5831 | |
| 5832 | |
| 5833 | |
| 5834 | |
| 5835 | CXXRecordDecl *getCurrentClass(Scope *S, const CXXScopeSpec *SS); |
| 5836 | bool isCurrentClassName(const IdentifierInfo &II, Scope *S, |
| 5837 | const CXXScopeSpec *SS = nullptr); |
| 5838 | bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS); |
| 5839 | |
| 5840 | bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, |
| 5841 | SourceLocation ColonLoc, |
| 5842 | const ParsedAttributesView &Attrs); |
| 5843 | |
| 5844 | NamedDecl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, |
| 5845 | Declarator &D, |
| 5846 | MultiTemplateParamsArg TemplateParameterLists, |
| 5847 | Expr *BitfieldWidth, const VirtSpecifiers &VS, |
| 5848 | InClassInitStyle InitStyle); |
| 5849 | |
| 5850 | void ActOnStartCXXInClassMemberInitializer(); |
| 5851 | void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, |
| 5852 | SourceLocation EqualLoc, |
| 5853 | Expr *Init); |
| 5854 | |
| 5855 | MemInitResult ActOnMemInitializer(Decl *ConstructorD, |
| 5856 | Scope *S, |
| 5857 | CXXScopeSpec &SS, |
| 5858 | IdentifierInfo *MemberOrBase, |
| 5859 | ParsedType TemplateTypeTy, |
| 5860 | const DeclSpec &DS, |
| 5861 | SourceLocation IdLoc, |
| 5862 | SourceLocation LParenLoc, |
| 5863 | ArrayRef<Expr *> Args, |
| 5864 | SourceLocation RParenLoc, |
| 5865 | SourceLocation EllipsisLoc); |
| 5866 | |
| 5867 | MemInitResult ActOnMemInitializer(Decl *ConstructorD, |
| 5868 | Scope *S, |
| 5869 | CXXScopeSpec &SS, |
| 5870 | IdentifierInfo *MemberOrBase, |
| 5871 | ParsedType TemplateTypeTy, |
| 5872 | const DeclSpec &DS, |
| 5873 | SourceLocation IdLoc, |
| 5874 | Expr *InitList, |
| 5875 | SourceLocation EllipsisLoc); |
| 5876 | |
| 5877 | MemInitResult BuildMemInitializer(Decl *ConstructorD, |
| 5878 | Scope *S, |
| 5879 | CXXScopeSpec &SS, |
| 5880 | IdentifierInfo *MemberOrBase, |
| 5881 | ParsedType TemplateTypeTy, |
| 5882 | const DeclSpec &DS, |
| 5883 | SourceLocation IdLoc, |
| 5884 | Expr *Init, |
| 5885 | SourceLocation EllipsisLoc); |
| 5886 | |
| 5887 | MemInitResult BuildMemberInitializer(ValueDecl *Member, |
| 5888 | Expr *Init, |
| 5889 | SourceLocation IdLoc); |
| 5890 | |
| 5891 | MemInitResult BuildBaseInitializer(QualType BaseType, |
| 5892 | TypeSourceInfo *BaseTInfo, |
| 5893 | Expr *Init, |
| 5894 | CXXRecordDecl *ClassDecl, |
| 5895 | SourceLocation EllipsisLoc); |
| 5896 | |
| 5897 | MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, |
| 5898 | Expr *Init, |
| 5899 | CXXRecordDecl *ClassDecl); |
| 5900 | |
| 5901 | bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, |
| 5902 | CXXCtorInitializer *Initializer); |
| 5903 | |
| 5904 | bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, |
| 5905 | ArrayRef<CXXCtorInitializer *> Initializers = None); |
| 5906 | |
| 5907 | void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation); |
| 5908 | |
| 5909 | |
| 5910 | |
| 5911 | |
| 5912 | |
| 5913 | void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, |
| 5914 | CXXRecordDecl *Record); |
| 5915 | |
| 5916 | |
| 5917 | |
| 5918 | |
| 5919 | typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse; |
| 5920 | |
| 5921 | |
| 5922 | |
| 5923 | SmallVector<VTableUse, 16> VTableUses; |
| 5924 | |
| 5925 | |
| 5926 | |
| 5927 | |
| 5928 | |
| 5929 | llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed; |
| 5930 | |
| 5931 | |
| 5932 | void LoadExternalVTableUses(); |
| 5933 | |
| 5934 | |
| 5935 | |
| 5936 | void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, |
| 5937 | bool DefinitionRequired = false); |
| 5938 | |
| 5939 | |
| 5940 | |
| 5941 | void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, |
| 5942 | const CXXRecordDecl *RD); |
| 5943 | |
| 5944 | |
| 5945 | |
| 5946 | void MarkVirtualMembersReferenced(SourceLocation Loc, |
| 5947 | const CXXRecordDecl *RD); |
| 5948 | |
| 5949 | |
| 5950 | |
| 5951 | |
| 5952 | |
| 5953 | |
| 5954 | bool DefineUsedVTables(); |
| 5955 | |
| 5956 | void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl); |
| 5957 | |
| 5958 | void ActOnMemInitializers(Decl *ConstructorDecl, |
| 5959 | SourceLocation ColonLoc, |
| 5960 | ArrayRef<CXXCtorInitializer*> MemInits, |
| 5961 | bool AnyErrors); |
| 5962 | |
| 5963 | |
| 5964 | |
| 5965 | |
| 5966 | void checkClassLevelDLLAttribute(CXXRecordDecl *Class); |
| 5967 | void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class); |
| 5968 | |
| 5969 | void referenceDLLExportedClassMethods(); |
| 5970 | |
| 5971 | void propagateDLLAttrToBaseClassTemplate( |
| 5972 | CXXRecordDecl *Class, Attr *ClassAttr, |
| 5973 | ClassTemplateSpecializationDecl *BaseTemplateSpec, |
| 5974 | SourceLocation BaseLoc); |
| 5975 | |
| 5976 | void CheckCompletedCXXClass(CXXRecordDecl *Record); |
| 5977 | |
| 5978 | |
| 5979 | |
| 5980 | void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD); |
| 5981 | |
| 5982 | void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, |
| 5983 | Decl *TagDecl, SourceLocation LBrac, |
| 5984 | SourceLocation RBrac, |
| 5985 | const ParsedAttributesView &AttrList); |
| 5986 | void ActOnFinishCXXMemberDecls(); |
| 5987 | void ActOnFinishCXXNonNestedClass(Decl *D); |
| 5988 | |
| 5989 | void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param); |
| 5990 | unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template); |
| 5991 | void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record); |
| 5992 | void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method); |
| 5993 | void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param); |
| 5994 | void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record); |
| 5995 | void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method); |
| 5996 | void ActOnFinishDelayedMemberInitializers(Decl *Record); |
| 5997 | void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, |
| 5998 | CachedTokens &Toks); |
| 5999 | void UnmarkAsLateParsedTemplate(FunctionDecl *FD); |
| 6000 | bool IsInsideALocalClassWithinATemplateFunction(); |
| 6001 | |
| 6002 | Decl *ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, |
| 6003 | Expr *AssertExpr, |
| 6004 | Expr *AssertMessageExpr, |
| 6005 | SourceLocation RParenLoc); |
| 6006 | Decl *BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, |
| 6007 | Expr *AssertExpr, |
| 6008 | StringLiteral *AssertMessageExpr, |
| 6009 | SourceLocation RParenLoc, |
| 6010 | bool Failed); |
| 6011 | |
| 6012 | FriendDecl *CheckFriendTypeDecl(SourceLocation LocStart, |
| 6013 | SourceLocation FriendLoc, |
| 6014 | TypeSourceInfo *TSInfo); |
| 6015 | Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, |
| 6016 | MultiTemplateParamsArg TemplateParams); |
| 6017 | NamedDecl *ActOnFriendFunctionDecl(Scope *S, Declarator &D, |
| 6018 | MultiTemplateParamsArg TemplateParams); |
| 6019 | |
| 6020 | QualType CheckConstructorDeclarator(Declarator &D, QualType R, |
| 6021 | StorageClass& SC); |
| 6022 | void CheckConstructor(CXXConstructorDecl *Constructor); |
| 6023 | QualType CheckDestructorDeclarator(Declarator &D, QualType R, |
| 6024 | StorageClass& SC); |
| 6025 | bool CheckDestructor(CXXDestructorDecl *Destructor); |
| 6026 | void CheckConversionDeclarator(Declarator &D, QualType &R, |
| 6027 | StorageClass& SC); |
| 6028 | Decl *ActOnConversionDeclarator(CXXConversionDecl *Conversion); |
| 6029 | void CheckDeductionGuideDeclarator(Declarator &D, QualType &R, |
| 6030 | StorageClass &SC); |
| 6031 | void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD); |
| 6032 | |
| 6033 | void CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD); |
| 6034 | void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD, |
| 6035 | const FunctionProtoType *T); |
| 6036 | void CheckDelayedMemberExceptionSpecs(); |
| 6037 | |
| 6038 | |
| 6039 | |
| 6040 | |
| 6041 | |
| 6042 | |
| 6043 | CXXBaseSpecifier *CheckBaseSpecifier(CXXRecordDecl *Class, |
| 6044 | SourceRange SpecifierRange, |
| 6045 | bool Virtual, AccessSpecifier Access, |
| 6046 | TypeSourceInfo *TInfo, |
| 6047 | SourceLocation EllipsisLoc); |
| 6048 | |
| 6049 | BaseResult ActOnBaseSpecifier(Decl *classdecl, |
| 6050 | SourceRange SpecifierRange, |
| 6051 | ParsedAttributes &Attrs, |
| 6052 | bool Virtual, AccessSpecifier Access, |
| 6053 | ParsedType basetype, |
| 6054 | SourceLocation BaseLoc, |
| 6055 | SourceLocation EllipsisLoc); |
| 6056 | |
| 6057 | bool AttachBaseSpecifiers(CXXRecordDecl *Class, |
| 6058 | MutableArrayRef<CXXBaseSpecifier *> Bases); |
| 6059 | void ActOnBaseSpecifiers(Decl *ClassDecl, |
| 6060 | MutableArrayRef<CXXBaseSpecifier *> Bases); |
| 6061 | |
| 6062 | bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base); |
| 6063 | bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base, |
| 6064 | CXXBasePaths &Paths); |
| 6065 | |
| 6066 | |
| 6067 | void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath); |
| 6068 | |
| 6069 | bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, |
| 6070 | SourceLocation Loc, SourceRange Range, |
| 6071 | CXXCastPath *BasePath = nullptr, |
| 6072 | bool IgnoreAccess = false); |
| 6073 | bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, |
| 6074 | unsigned InaccessibleBaseID, |
| 6075 | unsigned AmbigiousBaseConvID, |
| 6076 | SourceLocation Loc, SourceRange Range, |
| 6077 | DeclarationName Name, |
| 6078 | CXXCastPath *BasePath, |
| 6079 | bool IgnoreAccess = false); |
| 6080 | |
| 6081 | std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths); |
| 6082 | |
| 6083 | bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, |
| 6084 | const CXXMethodDecl *Old); |
| 6085 | |
| 6086 | |
| 6087 | |
| 6088 | bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, |
| 6089 | const CXXMethodDecl *Old); |
| 6090 | |
| 6091 | |
| 6092 | |
| 6093 | bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, |
| 6094 | const CXXMethodDecl *Old); |
| 6095 | |
| 6096 | bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange); |
| 6097 | |
| 6098 | |
| 6099 | void CheckOverrideControl(NamedDecl *D); |
| 6100 | |
| 6101 | |
| 6102 | |
| 6103 | void DiagnoseAbsenceOfOverrideControl(NamedDecl *D); |
| 6104 | |
| 6105 | |
| 6106 | |
| 6107 | |
| 6108 | bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, |
| 6109 | const CXXMethodDecl *Old); |
| 6110 | |
| 6111 | |
| 6112 | |
| 6113 | |
| 6114 | |
| 6115 | |
| 6116 | enum AccessResult { |
| 6117 | AR_accessible, |
| 6118 | AR_inaccessible, |
| 6119 | AR_dependent, |
| 6120 | AR_delayed |
| 6121 | }; |
| 6122 | |
| 6123 | bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, |
| 6124 | NamedDecl *PrevMemberDecl, |
| 6125 | AccessSpecifier LexicalAS); |
| 6126 | |
| 6127 | AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, |
| 6128 | DeclAccessPair FoundDecl); |
| 6129 | AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, |
| 6130 | DeclAccessPair FoundDecl); |
| 6131 | AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, |
| 6132 | SourceRange PlacementRange, |
| 6133 | CXXRecordDecl *NamingClass, |
| 6134 | DeclAccessPair FoundDecl, |
| 6135 | bool Diagnose = true); |
| 6136 | AccessResult CheckConstructorAccess(SourceLocation Loc, |
| 6137 | CXXConstructorDecl *D, |
| 6138 | DeclAccessPair FoundDecl, |
| 6139 | const InitializedEntity &Entity, |
| 6140 | bool IsCopyBindingRefToTemp = false); |
| 6141 | AccessResult CheckConstructorAccess(SourceLocation Loc, |
| 6142 | CXXConstructorDecl *D, |
| 6143 | DeclAccessPair FoundDecl, |
| 6144 | const InitializedEntity &Entity, |
| 6145 | const PartialDiagnostic &PDiag); |
| 6146 | AccessResult CheckDestructorAccess(SourceLocation Loc, |
| 6147 | CXXDestructorDecl *Dtor, |
| 6148 | const PartialDiagnostic &PDiag, |
| 6149 | QualType objectType = QualType()); |
| 6150 | AccessResult CheckFriendAccess(NamedDecl *D); |
| 6151 | AccessResult CheckMemberAccess(SourceLocation UseLoc, |
| 6152 | CXXRecordDecl *NamingClass, |
| 6153 | DeclAccessPair Found); |
| 6154 | AccessResult |
| 6155 | CheckStructuredBindingMemberAccess(SourceLocation UseLoc, |
| 6156 | CXXRecordDecl *DecomposedClass, |
| 6157 | DeclAccessPair Field); |
| 6158 | AccessResult CheckMemberOperatorAccess(SourceLocation Loc, |
| 6159 | Expr *ObjectExpr, |
| 6160 | Expr *ArgExpr, |
| 6161 | DeclAccessPair FoundDecl); |
| 6162 | AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, |
| 6163 | DeclAccessPair FoundDecl); |
| 6164 | AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, |
| 6165 | QualType Base, QualType Derived, |
| 6166 | const CXXBasePath &Path, |
| 6167 | unsigned DiagID, |
| 6168 | bool ForceCheck = false, |
| 6169 | bool ForceUnprivileged = false); |
| 6170 | void CheckLookupAccess(const LookupResult &R); |
| 6171 | bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, |
| 6172 | QualType BaseType); |
| 6173 | bool isSpecialMemberAccessibleForDeletion(CXXMethodDecl *decl, |
| 6174 | AccessSpecifier access, |
| 6175 | QualType objectType); |
| 6176 | |
| 6177 | void HandleDependentAccessCheck(const DependentDiagnostic &DD, |
| 6178 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 6179 | void PerformDependentDiagnostics(const DeclContext *Pattern, |
| 6180 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 6181 | |
| 6182 | void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx); |
| 6183 | |
| 6184 | |
| 6185 | |
| 6186 | bool AccessCheckingSFINAE; |
| 6187 | |
| 6188 | enum AbstractDiagSelID { |
| 6189 | AbstractNone = -1, |
| 6190 | AbstractReturnType, |
| 6191 | AbstractParamType, |
| 6192 | AbstractVariableType, |
| 6193 | AbstractFieldType, |
| 6194 | AbstractIvarType, |
| 6195 | AbstractSynthesizedIvarType, |
| 6196 | AbstractArrayType |
| 6197 | }; |
| 6198 | |
| 6199 | bool isAbstractType(SourceLocation Loc, QualType T); |
| 6200 | bool RequireNonAbstractType(SourceLocation Loc, QualType T, |
| 6201 | TypeDiagnoser &Diagnoser); |
| 6202 | template <typename... Ts> |
| 6203 | bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, |
| 6204 | const Ts &...Args) { |
| 6205 | BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...); |
| 6206 | return RequireNonAbstractType(Loc, T, Diagnoser); |
| 6207 | } |
| 6208 | |
| 6209 | void DiagnoseAbstractType(const CXXRecordDecl *RD); |
| 6210 | |
| 6211 | |
| 6212 | |
| 6213 | |
| 6214 | |
| 6215 | bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl); |
| 6216 | |
| 6217 | bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl); |
| 6218 | |
| 6219 | |
| 6220 | |
| 6221 | |
| 6222 | void FilterAcceptableTemplateNames(LookupResult &R, |
| 6223 | bool AllowFunctionTemplates = true, |
| 6224 | bool AllowDependent = true); |
| 6225 | bool hasAnyAcceptableTemplateNames(LookupResult &R, |
| 6226 | bool AllowFunctionTemplates = true, |
| 6227 | bool AllowDependent = true); |
| 6228 | |
| 6229 | |
| 6230 | |
| 6231 | |
| 6232 | |
| 6233 | |
| 6234 | |
| 6235 | NamedDecl *getAsTemplateNameDecl(NamedDecl *D, |
| 6236 | bool AllowFunctionTemplates = true, |
| 6237 | bool AllowDependent = true); |
| 6238 | |
| 6239 | bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, |
| 6240 | QualType ObjectType, bool EnteringContext, |
| 6241 | bool &MemberOfUnknownSpecialization, |
| 6242 | SourceLocation TemplateKWLoc = SourceLocation()); |
| 6243 | |
| 6244 | TemplateNameKind isTemplateName(Scope *S, |
| 6245 | CXXScopeSpec &SS, |
| 6246 | bool hasTemplateKeyword, |
| 6247 | const UnqualifiedId &Name, |
| 6248 | ParsedType ObjectType, |
| 6249 | bool EnteringContext, |
| 6250 | TemplateTy &Template, |
| 6251 | bool &MemberOfUnknownSpecialization); |
| 6252 | |
| 6253 | |
| 6254 | |
| 6255 | bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, |
| 6256 | SourceLocation NameLoc, |
| 6257 | ParsedTemplateTy *Template = nullptr); |
| 6258 | |
| 6259 | bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, |
| 6260 | SourceLocation IILoc, |
| 6261 | Scope *S, |
| 6262 | const CXXScopeSpec *SS, |
| 6263 | TemplateTy &SuggestedTemplate, |
| 6264 | TemplateNameKind &SuggestedKind); |
| 6265 | |
| 6266 | bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, |
| 6267 | NamedDecl *Instantiation, |
| 6268 | bool InstantiatedFromMember, |
| 6269 | const NamedDecl *Pattern, |
| 6270 | const NamedDecl *PatternDef, |
| 6271 | TemplateSpecializationKind TSK, |
| 6272 | bool Complain = true); |
| 6273 | |
| 6274 | void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl); |
| 6275 | TemplateDecl *AdjustDeclIfTemplate(Decl *&Decl); |
| 6276 | |
| 6277 | NamedDecl *ActOnTypeParameter(Scope *S, bool Typename, |
| 6278 | SourceLocation EllipsisLoc, |
| 6279 | SourceLocation KeyLoc, |
| 6280 | IdentifierInfo *ParamName, |
| 6281 | SourceLocation ParamNameLoc, |
| 6282 | unsigned Depth, unsigned Position, |
| 6283 | SourceLocation EqualLoc, |
| 6284 | ParsedType DefaultArg); |
| 6285 | |
| 6286 | QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, |
| 6287 | SourceLocation Loc); |
| 6288 | QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc); |
| 6289 | |
| 6290 | NamedDecl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, |
| 6291 | unsigned Depth, |
| 6292 | unsigned Position, |
| 6293 | SourceLocation EqualLoc, |
| 6294 | Expr *DefaultArg); |
| 6295 | NamedDecl *ActOnTemplateTemplateParameter(Scope *S, |
| 6296 | SourceLocation TmpLoc, |
| 6297 | TemplateParameterList *Params, |
| 6298 | SourceLocation EllipsisLoc, |
| 6299 | IdentifierInfo *ParamName, |
| 6300 | SourceLocation ParamNameLoc, |
| 6301 | unsigned Depth, |
| 6302 | unsigned Position, |
| 6303 | SourceLocation EqualLoc, |
| 6304 | ParsedTemplateArgument DefaultArg); |
| 6305 | |
| 6306 | TemplateParameterList * |
| 6307 | ActOnTemplateParameterList(unsigned Depth, |
| 6308 | SourceLocation ExportLoc, |
| 6309 | SourceLocation TemplateLoc, |
| 6310 | SourceLocation LAngleLoc, |
| 6311 | ArrayRef<NamedDecl *> Params, |
| 6312 | SourceLocation RAngleLoc, |
| 6313 | Expr *RequiresClause); |
| 6314 | |
| 6315 | |
| 6316 | enum TemplateParamListContext { |
| 6317 | TPC_ClassTemplate, |
| 6318 | TPC_VarTemplate, |
| 6319 | TPC_FunctionTemplate, |
| 6320 | TPC_ClassTemplateMember, |
| 6321 | TPC_FriendClassTemplate, |
| 6322 | TPC_FriendFunctionTemplate, |
| 6323 | TPC_FriendFunctionTemplateDefinition, |
| 6324 | TPC_TypeAliasTemplate |
| 6325 | }; |
| 6326 | |
| 6327 | bool CheckTemplateParameterList(TemplateParameterList *NewParams, |
| 6328 | TemplateParameterList *OldParams, |
| 6329 | TemplateParamListContext TPC, |
| 6330 | SkipBodyInfo *SkipBody = nullptr); |
| 6331 | TemplateParameterList *MatchTemplateParametersToScopeSpecifier( |
| 6332 | SourceLocation DeclStartLoc, SourceLocation DeclLoc, |
| 6333 | const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, |
| 6334 | ArrayRef<TemplateParameterList *> ParamLists, |
| 6335 | bool IsFriend, bool &IsMemberSpecialization, bool &Invalid); |
| 6336 | |
| 6337 | DeclResult CheckClassTemplate( |
| 6338 | Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, |
| 6339 | CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, |
| 6340 | const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, |
| 6341 | AccessSpecifier AS, SourceLocation ModulePrivateLoc, |
| 6342 | SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, |
| 6343 | TemplateParameterList **OuterTemplateParamLists, |
| 6344 | SkipBodyInfo *SkipBody = nullptr); |
| 6345 | |
| 6346 | TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, |
| 6347 | QualType NTTPType, |
| 6348 | SourceLocation Loc); |
| 6349 | |
| 6350 | void translateTemplateArguments(const ASTTemplateArgsPtr &In, |
| 6351 | TemplateArgumentListInfo &Out); |
| 6352 | |
| 6353 | ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType); |
| 6354 | |
| 6355 | void NoteAllFoundTemplates(TemplateName Name); |
| 6356 | |
| 6357 | QualType CheckTemplateIdType(TemplateName Template, |
| 6358 | SourceLocation TemplateLoc, |
| 6359 | TemplateArgumentListInfo &TemplateArgs); |
| 6360 | |
| 6361 | TypeResult |
| 6362 | ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, |
| 6363 | TemplateTy Template, IdentifierInfo *TemplateII, |
| 6364 | SourceLocation TemplateIILoc, |
| 6365 | SourceLocation LAngleLoc, |
| 6366 | ASTTemplateArgsPtr TemplateArgs, |
| 6367 | SourceLocation RAngleLoc, |
| 6368 | bool IsCtorOrDtorName = false, |
| 6369 | bool IsClassName = false); |
| 6370 | |
| 6371 | |
| 6372 | |
| 6373 | TypeResult ActOnTagTemplateIdType(TagUseKind TUK, |
| 6374 | TypeSpecifierType TagSpec, |
| 6375 | SourceLocation TagLoc, |
| 6376 | CXXScopeSpec &SS, |
| 6377 | SourceLocation TemplateKWLoc, |
| 6378 | TemplateTy TemplateD, |
| 6379 | SourceLocation TemplateLoc, |
| 6380 | SourceLocation LAngleLoc, |
| 6381 | ASTTemplateArgsPtr TemplateArgsIn, |
| 6382 | SourceLocation RAngleLoc); |
| 6383 | |
| 6384 | DeclResult ActOnVarTemplateSpecialization( |
| 6385 | Scope *S, Declarator &D, TypeSourceInfo *DI, |
| 6386 | SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, |
| 6387 | StorageClass SC, bool IsPartialSpecialization); |
| 6388 | |
| 6389 | DeclResult CheckVarTemplateId(VarTemplateDecl *Template, |
| 6390 | SourceLocation TemplateLoc, |
| 6391 | SourceLocation TemplateNameLoc, |
| 6392 | const TemplateArgumentListInfo &TemplateArgs); |
| 6393 | |
| 6394 | ExprResult CheckVarTemplateId(const CXXScopeSpec &SS, |
| 6395 | const DeclarationNameInfo &NameInfo, |
| 6396 | VarTemplateDecl *Template, |
| 6397 | SourceLocation TemplateLoc, |
| 6398 | const TemplateArgumentListInfo *TemplateArgs); |
| 6399 | |
| 6400 | void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc); |
| 6401 | |
| 6402 | ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, |
| 6403 | SourceLocation TemplateKWLoc, |
| 6404 | LookupResult &R, |
| 6405 | bool RequiresADL, |
| 6406 | const TemplateArgumentListInfo *TemplateArgs); |
| 6407 | |
| 6408 | ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, |
| 6409 | SourceLocation TemplateKWLoc, |
| 6410 | const DeclarationNameInfo &NameInfo, |
| 6411 | const TemplateArgumentListInfo *TemplateArgs); |
| 6412 | |
| 6413 | TemplateNameKind ActOnDependentTemplateName( |
| 6414 | Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, |
| 6415 | const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, |
| 6416 | TemplateTy &Template, bool AllowInjectedClassName = false); |
| 6417 | |
| 6418 | DeclResult ActOnClassTemplateSpecialization( |
| 6419 | Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, |
| 6420 | SourceLocation ModulePrivateLoc, TemplateIdAnnotation &TemplateId, |
| 6421 | const ParsedAttributesView &Attr, |
| 6422 | MultiTemplateParamsArg TemplateParameterLists, |
| 6423 | SkipBodyInfo *SkipBody = nullptr); |
| 6424 | |
| 6425 | bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, |
| 6426 | TemplateDecl *PrimaryTemplate, |
| 6427 | unsigned NumExplicitArgs, |
| 6428 | ArrayRef<TemplateArgument> Args); |
| 6429 | void CheckTemplatePartialSpecialization( |
| 6430 | ClassTemplatePartialSpecializationDecl *Partial); |
| 6431 | void CheckTemplatePartialSpecialization( |
| 6432 | VarTemplatePartialSpecializationDecl *Partial); |
| 6433 | |
| 6434 | Decl *ActOnTemplateDeclarator(Scope *S, |
| 6435 | MultiTemplateParamsArg TemplateParameterLists, |
| 6436 | Declarator &D); |
| 6437 | |
| 6438 | bool |
| 6439 | CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, |
| 6440 | TemplateSpecializationKind NewTSK, |
| 6441 | NamedDecl *PrevDecl, |
| 6442 | TemplateSpecializationKind PrevTSK, |
| 6443 | SourceLocation PrevPtOfInstantiation, |
| 6444 | bool &SuppressNew); |
| 6445 | |
| 6446 | bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, |
| 6447 | const TemplateArgumentListInfo &ExplicitTemplateArgs, |
| 6448 | LookupResult &Previous); |
| 6449 | |
| 6450 | bool CheckFunctionTemplateSpecialization( |
| 6451 | FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, |
| 6452 | LookupResult &Previous, bool QualifiedFriend = false); |
| 6453 | bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous); |
| 6454 | void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous); |
| 6455 | |
| 6456 | DeclResult ActOnExplicitInstantiation( |
| 6457 | Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, |
| 6458 | unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, |
| 6459 | TemplateTy Template, SourceLocation TemplateNameLoc, |
| 6460 | SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, |
| 6461 | SourceLocation RAngleLoc, const ParsedAttributesView &Attr); |
| 6462 | |
| 6463 | DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, |
| 6464 | SourceLocation TemplateLoc, |
| 6465 | unsigned TagSpec, SourceLocation KWLoc, |
| 6466 | CXXScopeSpec &SS, IdentifierInfo *Name, |
| 6467 | SourceLocation NameLoc, |
| 6468 | const ParsedAttributesView &Attr); |
| 6469 | |
| 6470 | DeclResult ActOnExplicitInstantiation(Scope *S, |
| 6471 | SourceLocation ExternLoc, |
| 6472 | SourceLocation TemplateLoc, |
| 6473 | Declarator &D); |
| 6474 | |
| 6475 | TemplateArgumentLoc |
| 6476 | SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, |
| 6477 | SourceLocation TemplateLoc, |
| 6478 | SourceLocation RAngleLoc, |
| 6479 | Decl *Param, |
| 6480 | SmallVectorImpl<TemplateArgument> |
| 6481 | &Converted, |
| 6482 | bool &HasDefaultArg); |
| 6483 | |
| 6484 | |
| 6485 | |
| 6486 | enum CheckTemplateArgumentKind { |
| 6487 | |
| 6488 | |
| 6489 | CTAK_Specified, |
| 6490 | |
| 6491 | |
| 6492 | |
| 6493 | CTAK_Deduced, |
| 6494 | |
| 6495 | |
| 6496 | |
| 6497 | CTAK_DeducedFromArrayBound |
| 6498 | }; |
| 6499 | |
| 6500 | bool CheckTemplateArgument(NamedDecl *Param, |
| 6501 | TemplateArgumentLoc &Arg, |
| 6502 | NamedDecl *Template, |
| 6503 | SourceLocation TemplateLoc, |
| 6504 | SourceLocation RAngleLoc, |
| 6505 | unsigned ArgumentPackIndex, |
| 6506 | SmallVectorImpl<TemplateArgument> &Converted, |
| 6507 | CheckTemplateArgumentKind CTAK = CTAK_Specified); |
| 6508 | |
| 6509 | |
| 6510 | |
| 6511 | |
| 6512 | |
| 6513 | |
| 6514 | |
| 6515 | |
| 6516 | |
| 6517 | |
| 6518 | |
| 6519 | |
| 6520 | |
| 6521 | |
| 6522 | |
| 6523 | |
| 6524 | |
| 6525 | |
| 6526 | |
| 6527 | |
| 6528 | |
| 6529 | |
| 6530 | |
| 6531 | |
| 6532 | |
| 6533 | |
| 6534 | bool CheckTemplateArgumentList(TemplateDecl *Template, |
| 6535 | SourceLocation TemplateLoc, |
| 6536 | TemplateArgumentListInfo &TemplateArgs, |
| 6537 | bool PartialTemplateArgs, |
| 6538 | SmallVectorImpl<TemplateArgument> &Converted, |
| 6539 | bool UpdateArgsWithConversions = true); |
| 6540 | |
| 6541 | bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, |
| 6542 | TemplateArgumentLoc &Arg, |
| 6543 | SmallVectorImpl<TemplateArgument> &Converted); |
| 6544 | |
| 6545 | bool CheckTemplateArgument(TemplateTypeParmDecl *Param, |
| 6546 | TypeSourceInfo *Arg); |
| 6547 | ExprResult CheckTemplateArgument(NonTypeTemplateParmDecl *Param, |
| 6548 | QualType InstantiatedParamType, Expr *Arg, |
| 6549 | TemplateArgument &Converted, |
| 6550 | CheckTemplateArgumentKind CTAK = CTAK_Specified); |
| 6551 | bool CheckTemplateTemplateArgument(TemplateParameterList *Params, |
| 6552 | TemplateArgumentLoc &Arg); |
| 6553 | |
| 6554 | ExprResult |
| 6555 | BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, |
| 6556 | QualType ParamType, |
| 6557 | SourceLocation Loc); |
| 6558 | ExprResult |
| 6559 | BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, |
| 6560 | SourceLocation Loc); |
| 6561 | |
| 6562 | |
| 6563 | |
| 6564 | enum TemplateParameterListEqualKind { |
| 6565 | |
| 6566 | |
| 6567 | |
| 6568 | |
| 6569 | |
| 6570 | |
| 6571 | |
| 6572 | TPL_TemplateMatch, |
| 6573 | |
| 6574 | |
| 6575 | |
| 6576 | |
| 6577 | |
| 6578 | |
| 6579 | |
| 6580 | |
| 6581 | |
| 6582 | TPL_TemplateTemplateParmMatch, |
| 6583 | |
| 6584 | |
| 6585 | |
| 6586 | |
| 6587 | |
| 6588 | |
| 6589 | |
| 6590 | |
| 6591 | |
| 6592 | |
| 6593 | TPL_TemplateTemplateArgumentMatch |
| 6594 | }; |
| 6595 | |
| 6596 | bool TemplateParameterListsAreEqual(TemplateParameterList *New, |
| 6597 | TemplateParameterList *Old, |
| 6598 | bool Complain, |
| 6599 | TemplateParameterListEqualKind Kind, |
| 6600 | SourceLocation TemplateArgLoc |
| 6601 | = SourceLocation()); |
| 6602 | |
| 6603 | bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams); |
| 6604 | |
| 6605 | |
| 6606 | |
| 6607 | |
| 6608 | |
| 6609 | |
| 6610 | |
| 6611 | |
| 6612 | |
| 6613 | TypeResult |
| 6614 | ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, |
| 6615 | const CXXScopeSpec &SS, const IdentifierInfo &II, |
| 6616 | SourceLocation IdLoc); |
| 6617 | |
| 6618 | |
| 6619 | |
| 6620 | |
| 6621 | |
| 6622 | |
| 6623 | |
| 6624 | |
| 6625 | |
| 6626 | |
| 6627 | |
| 6628 | |
| 6629 | |
| 6630 | |
| 6631 | |
| 6632 | TypeResult |
| 6633 | ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, |
| 6634 | const CXXScopeSpec &SS, |
| 6635 | SourceLocation TemplateLoc, |
| 6636 | TemplateTy TemplateName, |
| 6637 | IdentifierInfo *TemplateII, |
| 6638 | SourceLocation TemplateIILoc, |
| 6639 | SourceLocation LAngleLoc, |
| 6640 | ASTTemplateArgsPtr TemplateArgs, |
| 6641 | SourceLocation RAngleLoc); |
| 6642 | |
| 6643 | QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, |
| 6644 | SourceLocation KeywordLoc, |
| 6645 | NestedNameSpecifierLoc QualifierLoc, |
| 6646 | const IdentifierInfo &II, |
| 6647 | SourceLocation IILoc); |
| 6648 | |
| 6649 | TypeSourceInfo *RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, |
| 6650 | SourceLocation Loc, |
| 6651 | DeclarationName Name); |
| 6652 | bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS); |
| 6653 | |
| 6654 | ExprResult RebuildExprInCurrentInstantiation(Expr *E); |
| 6655 | bool RebuildTemplateParamsInCurrentInstantiation( |
| 6656 | TemplateParameterList *Params); |
| 6657 | |
| 6658 | std::string |
| 6659 | getTemplateArgumentBindingsText(const TemplateParameterList *Params, |
| 6660 | const TemplateArgumentList &Args); |
| 6661 | |
| 6662 | std::string |
| 6663 | getTemplateArgumentBindingsText(const TemplateParameterList *Params, |
| 6664 | const TemplateArgument *Args, |
| 6665 | unsigned NumArgs); |
| 6666 | |
| 6667 | |
| 6668 | |
| 6669 | |
| 6670 | |
| 6671 | |
| 6672 | |
| 6673 | bool isUnexpandedParameterPackPermitted(); |
| 6674 | |
| 6675 | |
| 6676 | |
| 6677 | |
| 6678 | |
| 6679 | |
| 6680 | enum UnexpandedParameterPackContext { |
| 6681 | |
| 6682 | UPPC_Expression = 0, |
| 6683 | |
| 6684 | |
| 6685 | UPPC_BaseType, |
| 6686 | |
| 6687 | |
| 6688 | UPPC_DeclarationType, |
| 6689 | |
| 6690 | |
| 6691 | UPPC_DataMemberType, |
| 6692 | |
| 6693 | |
| 6694 | UPPC_BitFieldWidth, |
| 6695 | |
| 6696 | |
| 6697 | UPPC_StaticAssertExpression, |
| 6698 | |
| 6699 | |
| 6700 | UPPC_FixedUnderlyingType, |
| 6701 | |
| 6702 | |
| 6703 | UPPC_EnumeratorValue, |
| 6704 | |
| 6705 | |
| 6706 | UPPC_UsingDeclaration, |
| 6707 | |
| 6708 | |
| 6709 | UPPC_FriendDeclaration, |
| 6710 | |
| 6711 | |
| 6712 | UPPC_DeclarationQualifier, |
| 6713 | |
| 6714 | |
| 6715 | UPPC_Initializer, |
| 6716 | |
| 6717 | |
| 6718 | UPPC_DefaultArgument, |
| 6719 | |
| 6720 | |
| 6721 | UPPC_NonTypeTemplateParameterType, |
| 6722 | |
| 6723 | |
| 6724 | UPPC_ExceptionType, |
| 6725 | |
| 6726 | |
| 6727 | UPPC_PartialSpecialization, |
| 6728 | |
| 6729 | |
| 6730 | UPPC_IfExists, |
| 6731 | |
| 6732 | |
| 6733 | UPPC_IfNotExists, |
| 6734 | |
| 6735 | |
| 6736 | UPPC_Lambda, |
| 6737 | |
| 6738 | |
| 6739 | UPPC_Block |
| 6740 | }; |
| 6741 | |
| 6742 | |
| 6743 | |
| 6744 | |
| 6745 | |
| 6746 | |
| 6747 | |
| 6748 | |
| 6749 | |
| 6750 | |
| 6751 | |
| 6752 | bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, |
| 6753 | UnexpandedParameterPackContext UPPC, |
| 6754 | ArrayRef<UnexpandedParameterPack> Unexpanded); |
| 6755 | |
| 6756 | |
| 6757 | |
| 6758 | |
| 6759 | |
| 6760 | |
| 6761 | |
| 6762 | |
| 6763 | |
| 6764 | |
| 6765 | bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, |
| 6766 | UnexpandedParameterPackContext UPPC); |
| 6767 | |
| 6768 | |
| 6769 | |
| 6770 | |
| 6771 | |
| 6772 | |
| 6773 | |
| 6774 | |
| 6775 | bool DiagnoseUnexpandedParameterPack(Expr *E, |
| 6776 | UnexpandedParameterPackContext UPPC = UPPC_Expression); |
| 6777 | |
| 6778 | |
| 6779 | |
| 6780 | |
| 6781 | |
| 6782 | |
| 6783 | |
| 6784 | |
| 6785 | bool DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS, |
| 6786 | UnexpandedParameterPackContext UPPC); |
| 6787 | |
| 6788 | |
| 6789 | |
| 6790 | |
| 6791 | |
| 6792 | |
| 6793 | |
| 6794 | |
| 6795 | bool DiagnoseUnexpandedParameterPack(const DeclarationNameInfo &NameInfo, |
| 6796 | UnexpandedParameterPackContext UPPC); |
| 6797 | |
| 6798 | |
| 6799 | |
| 6800 | |
| 6801 | |
| 6802 | |
| 6803 | |
| 6804 | |
| 6805 | |
| 6806 | |
| 6807 | bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, |
| 6808 | TemplateName Template, |
| 6809 | UnexpandedParameterPackContext UPPC); |
| 6810 | |
| 6811 | |
| 6812 | |
| 6813 | |
| 6814 | |
| 6815 | |
| 6816 | |
| 6817 | |
| 6818 | bool DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg, |
| 6819 | UnexpandedParameterPackContext UPPC); |
| 6820 | |
| 6821 | |
| 6822 | |
| 6823 | |
| 6824 | |
| 6825 | |
| 6826 | void collectUnexpandedParameterPacks(TemplateArgument Arg, |
| 6827 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6828 | |
| 6829 | |
| 6830 | |
| 6831 | |
| 6832 | |
| 6833 | |
| 6834 | void collectUnexpandedParameterPacks(TemplateArgumentLoc Arg, |
| 6835 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6836 | |
| 6837 | |
| 6838 | |
| 6839 | |
| 6840 | |
| 6841 | |
| 6842 | void collectUnexpandedParameterPacks(QualType T, |
| 6843 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6844 | |
| 6845 | |
| 6846 | |
| 6847 | |
| 6848 | |
| 6849 | |
| 6850 | void collectUnexpandedParameterPacks(TypeLoc TL, |
| 6851 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6852 | |
| 6853 | |
| 6854 | |
| 6855 | |
| 6856 | |
| 6857 | |
| 6858 | void collectUnexpandedParameterPacks(NestedNameSpecifierLoc NNS, |
| 6859 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6860 | |
| 6861 | |
| 6862 | |
| 6863 | |
| 6864 | |
| 6865 | |
| 6866 | void collectUnexpandedParameterPacks(const DeclarationNameInfo &NameInfo, |
| 6867 | SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); |
| 6868 | |
| 6869 | |
| 6870 | |
| 6871 | |
| 6872 | |
| 6873 | |
| 6874 | |
| 6875 | |
| 6876 | ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, |
| 6877 | SourceLocation EllipsisLoc); |
| 6878 | |
| 6879 | |
| 6880 | |
| 6881 | |
| 6882 | |
| 6883 | |
| 6884 | |
| 6885 | |
| 6886 | TypeResult ActOnPackExpansion(ParsedType Type, SourceLocation EllipsisLoc); |
| 6887 | |
| 6888 | |
| 6889 | |
| 6890 | TypeSourceInfo *CheckPackExpansion(TypeSourceInfo *Pattern, |
| 6891 | SourceLocation EllipsisLoc, |
| 6892 | Optional<unsigned> NumExpansions); |
| 6893 | |
| 6894 | |
| 6895 | |
| 6896 | QualType CheckPackExpansion(QualType Pattern, |
| 6897 | SourceRange PatternRange, |
| 6898 | SourceLocation EllipsisLoc, |
| 6899 | Optional<unsigned> NumExpansions); |
| 6900 | |
| 6901 | |
| 6902 | |
| 6903 | |
| 6904 | |
| 6905 | |
| 6906 | |
| 6907 | |
| 6908 | ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc); |
| 6909 | |
| 6910 | |
| 6911 | |
| 6912 | |
| 6913 | |
| 6914 | |
| 6915 | |
| 6916 | |
| 6917 | ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, |
| 6918 | Optional<unsigned> NumExpansions); |
| 6919 | |
| 6920 | |
| 6921 | |
| 6922 | |
| 6923 | |
| 6924 | |
| 6925 | |
| 6926 | |
| 6927 | |
| 6928 | |
| 6929 | |
| 6930 | |
| 6931 | |
| 6932 | |
| 6933 | |
| 6934 | |
| 6935 | |
| 6936 | |
| 6937 | |
| 6938 | |
| 6939 | |
| 6940 | |
| 6941 | |
| 6942 | |
| 6943 | |
| 6944 | |
| 6945 | |
| 6946 | |
| 6947 | |
| 6948 | |
| 6949 | |
| 6950 | |
| 6951 | |
| 6952 | |
| 6953 | |
| 6954 | bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, |
| 6955 | SourceRange PatternRange, |
| 6956 | ArrayRef<UnexpandedParameterPack> Unexpanded, |
| 6957 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 6958 | bool &ShouldExpand, |
| 6959 | bool &RetainExpansion, |
| 6960 | Optional<unsigned> &NumExpansions); |
| 6961 | |
| 6962 | |
| 6963 | |
| 6964 | |
| 6965 | |
| 6966 | |
| 6967 | |
| 6968 | |
| 6969 | Optional<unsigned> getNumArgumentsInExpansion(QualType T, |
| 6970 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 6971 | |
| 6972 | |
| 6973 | |
| 6974 | |
| 6975 | |
| 6976 | |
| 6977 | |
| 6978 | |
| 6979 | |
| 6980 | |
| 6981 | |
| 6982 | |
| 6983 | |
| 6984 | |
| 6985 | |
| 6986 | |
| 6987 | bool containsUnexpandedParameterPacks(Declarator &D); |
| 6988 | |
| 6989 | |
| 6990 | |
| 6991 | |
| 6992 | |
| 6993 | |
| 6994 | |
| 6995 | |
| 6996 | |
| 6997 | TemplateArgumentLoc getTemplateArgumentPackExpansionPattern( |
| 6998 | TemplateArgumentLoc OrigLoc, |
| 6999 | SourceLocation &Ellipsis, |
| 7000 | Optional<unsigned> &NumExpansions) const; |
| 7001 | |
| 7002 | |
| 7003 | |
| 7004 | |
| 7005 | |
| 7006 | |
| 7007 | |
| 7008 | Optional<unsigned> getFullyPackExpandedSize(TemplateArgument Arg); |
| 7009 | |
| 7010 | |
| 7011 | |
| 7012 | |
| 7013 | |
| 7014 | |
| 7015 | |
| 7016 | |
| 7017 | |
| 7018 | QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, |
| 7019 | bool AdjustExceptionSpec = false); |
| 7020 | |
| 7021 | |
| 7022 | |
| 7023 | |
| 7024 | |
| 7025 | |
| 7026 | |
| 7027 | |
| 7028 | |
| 7029 | |
| 7030 | enum TemplateDeductionResult { |
| 7031 | |
| 7032 | TDK_Success = 0, |
| 7033 | |
| 7034 | TDK_Invalid, |
| 7035 | |
| 7036 | |
| 7037 | TDK_InstantiationDepth, |
| 7038 | |
| 7039 | |
| 7040 | TDK_Incomplete, |
| 7041 | |
| 7042 | |
| 7043 | TDK_IncompletePack, |
| 7044 | |
| 7045 | |
| 7046 | TDK_Inconsistent, |
| 7047 | |
| 7048 | |
| 7049 | |
| 7050 | |
| 7051 | TDK_Underqualified, |
| 7052 | |
| 7053 | |
| 7054 | TDK_SubstitutionFailure, |
| 7055 | |
| 7056 | |
| 7057 | TDK_DeducedMismatch, |
| 7058 | |
| 7059 | |
| 7060 | |
| 7061 | TDK_DeducedMismatchNested, |
| 7062 | |
| 7063 | |
| 7064 | TDK_NonDeducedMismatch, |
| 7065 | |
| 7066 | |
| 7067 | TDK_TooManyArguments, |
| 7068 | |
| 7069 | |
| 7070 | TDK_TooFewArguments, |
| 7071 | |
| 7072 | |
| 7073 | TDK_InvalidExplicitArguments, |
| 7074 | |
| 7075 | TDK_NonDependentConversionFailure, |
| 7076 | |
| 7077 | TDK_MiscellaneousDeductionFailure, |
| 7078 | |
| 7079 | TDK_CUDATargetMismatch |
| 7080 | }; |
| 7081 | |
| 7082 | TemplateDeductionResult |
| 7083 | DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, |
| 7084 | const TemplateArgumentList &TemplateArgs, |
| 7085 | sema::TemplateDeductionInfo &Info); |
| 7086 | |
| 7087 | TemplateDeductionResult |
| 7088 | DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial, |
| 7089 | const TemplateArgumentList &TemplateArgs, |
| 7090 | sema::TemplateDeductionInfo &Info); |
| 7091 | |
| 7092 | TemplateDeductionResult SubstituteExplicitTemplateArguments( |
| 7093 | FunctionTemplateDecl *FunctionTemplate, |
| 7094 | TemplateArgumentListInfo &ExplicitTemplateArgs, |
| 7095 | SmallVectorImpl<DeducedTemplateArgument> &Deduced, |
| 7096 | SmallVectorImpl<QualType> &ParamTypes, QualType *FunctionType, |
| 7097 | sema::TemplateDeductionInfo &Info); |
| 7098 | |
| 7099 | |
| 7100 | |
| 7101 | struct OriginalCallArg { |
| 7102 | OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, |
| 7103 | unsigned ArgIdx, QualType OriginalArgType) |
| 7104 | : OriginalParamType(OriginalParamType), |
| 7105 | DecomposedParam(DecomposedParam), ArgIdx(ArgIdx), |
| 7106 | OriginalArgType(OriginalArgType) {} |
| 7107 | |
| 7108 | QualType OriginalParamType; |
| 7109 | bool DecomposedParam; |
| 7110 | unsigned ArgIdx; |
| 7111 | QualType OriginalArgType; |
| 7112 | }; |
| 7113 | |
| 7114 | TemplateDeductionResult FinishTemplateArgumentDeduction( |
| 7115 | FunctionTemplateDecl *FunctionTemplate, |
| 7116 | SmallVectorImpl<DeducedTemplateArgument> &Deduced, |
| 7117 | unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, |
| 7118 | sema::TemplateDeductionInfo &Info, |
| 7119 | SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr, |
| 7120 | bool PartialOverloading = false, |
| 7121 | llvm::function_ref<bool()> CheckNonDependent = []{ return false; }); |
| 7122 | |
| 7123 | TemplateDeductionResult DeduceTemplateArguments( |
| 7124 | FunctionTemplateDecl *FunctionTemplate, |
| 7125 | TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args, |
| 7126 | FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, |
| 7127 | bool PartialOverloading, |
| 7128 | llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent); |
| 7129 | |
| 7130 | TemplateDeductionResult |
| 7131 | DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, |
| 7132 | TemplateArgumentListInfo *ExplicitTemplateArgs, |
| 7133 | QualType ArgFunctionType, |
| 7134 | FunctionDecl *&Specialization, |
| 7135 | sema::TemplateDeductionInfo &Info, |
| 7136 | bool IsAddressOfFunction = false); |
| 7137 | |
| 7138 | TemplateDeductionResult |
| 7139 | DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, |
| 7140 | QualType ToType, |
| 7141 | CXXConversionDecl *&Specialization, |
| 7142 | sema::TemplateDeductionInfo &Info); |
| 7143 | |
| 7144 | TemplateDeductionResult |
| 7145 | DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, |
| 7146 | TemplateArgumentListInfo *ExplicitTemplateArgs, |
| 7147 | FunctionDecl *&Specialization, |
| 7148 | sema::TemplateDeductionInfo &Info, |
| 7149 | bool IsAddressOfFunction = false); |
| 7150 | |
| 7151 | |
| 7152 | QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement); |
| 7153 | |
| 7154 | TypeSourceInfo* SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, |
| 7155 | QualType Replacement); |
| 7156 | |
| 7157 | |
| 7158 | QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement); |
| 7159 | |
| 7160 | |
| 7161 | enum DeduceAutoResult { |
| 7162 | DAR_Succeeded, |
| 7163 | DAR_Failed, |
| 7164 | DAR_FailedAlreadyDiagnosed |
| 7165 | }; |
| 7166 | |
| 7167 | DeduceAutoResult |
| 7168 | DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, |
| 7169 | Optional<unsigned> DependentDeductionDepth = None); |
| 7170 | DeduceAutoResult |
| 7171 | DeduceAutoType(TypeLoc AutoTypeLoc, Expr *&Initializer, QualType &Result, |
| 7172 | Optional<unsigned> DependentDeductionDepth = None); |
| 7173 | void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init); |
| 7174 | bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, |
| 7175 | bool Diagnose = true); |
| 7176 | |
| 7177 | |
| 7178 | |
| 7179 | void DeclareImplicitDeductionGuides(TemplateDecl *Template, |
| 7180 | SourceLocation Loc); |
| 7181 | |
| 7182 | QualType DeduceTemplateSpecializationFromInitializer( |
| 7183 | TypeSourceInfo *TInfo, const InitializedEntity &Entity, |
| 7184 | const InitializationKind &Kind, MultiExprArg Init); |
| 7185 | |
| 7186 | QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, |
| 7187 | QualType Type, TypeSourceInfo *TSI, |
| 7188 | SourceRange Range, bool DirectInit, |
| 7189 | Expr *&Init); |
| 7190 | |
| 7191 | TypeLoc getReturnTypeLoc(FunctionDecl *FD) const; |
| 7192 | |
| 7193 | bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, |
| 7194 | SourceLocation ReturnLoc, |
| 7195 | Expr *&RetExpr, AutoType *AT); |
| 7196 | |
| 7197 | FunctionTemplateDecl *getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, |
| 7198 | FunctionTemplateDecl *FT2, |
| 7199 | SourceLocation Loc, |
| 7200 | TemplatePartialOrderingContext TPOC, |
| 7201 | unsigned NumCallArguments1, |
| 7202 | unsigned NumCallArguments2); |
| 7203 | UnresolvedSetIterator |
| 7204 | getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, |
| 7205 | TemplateSpecCandidateSet &FailedCandidates, |
| 7206 | SourceLocation Loc, |
| 7207 | const PartialDiagnostic &NoneDiag, |
| 7208 | const PartialDiagnostic &AmbigDiag, |
| 7209 | const PartialDiagnostic &CandidateDiag, |
| 7210 | bool Complain = true, QualType TargetType = QualType()); |
| 7211 | |
| 7212 | ClassTemplatePartialSpecializationDecl * |
| 7213 | getMoreSpecializedPartialSpecialization( |
| 7214 | ClassTemplatePartialSpecializationDecl *PS1, |
| 7215 | ClassTemplatePartialSpecializationDecl *PS2, |
| 7216 | SourceLocation Loc); |
| 7217 | |
| 7218 | bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, |
| 7219 | sema::TemplateDeductionInfo &Info); |
| 7220 | |
| 7221 | VarTemplatePartialSpecializationDecl *getMoreSpecializedPartialSpecialization( |
| 7222 | VarTemplatePartialSpecializationDecl *PS1, |
| 7223 | VarTemplatePartialSpecializationDecl *PS2, SourceLocation Loc); |
| 7224 | |
| 7225 | bool isMoreSpecializedThanPrimary(VarTemplatePartialSpecializationDecl *T, |
| 7226 | sema::TemplateDeductionInfo &Info); |
| 7227 | |
| 7228 | bool isTemplateTemplateParameterAtLeastAsSpecializedAs( |
| 7229 | TemplateParameterList *P, TemplateDecl *AArg, SourceLocation Loc); |
| 7230 | |
| 7231 | void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs, |
| 7232 | bool OnlyDeduced, |
| 7233 | unsigned Depth, |
| 7234 | llvm::SmallBitVector &Used); |
| 7235 | void MarkDeducedTemplateParameters( |
| 7236 | const FunctionTemplateDecl *FunctionTemplate, |
| 7237 | llvm::SmallBitVector &Deduced) { |
| 7238 | return MarkDeducedTemplateParameters(Context, FunctionTemplate, Deduced); |
| 7239 | } |
| 7240 | static void MarkDeducedTemplateParameters(ASTContext &Ctx, |
| 7241 | const FunctionTemplateDecl *FunctionTemplate, |
| 7242 | llvm::SmallBitVector &Deduced); |
| 7243 | |
| 7244 | |
| 7245 | |
| 7246 | |
| 7247 | |
| 7248 | MultiLevelTemplateArgumentList |
| 7249 | getTemplateInstantiationArgs(NamedDecl *D, |
| 7250 | const TemplateArgumentList *Innermost = nullptr, |
| 7251 | bool RelativeToPrimary = false, |
| 7252 | const FunctionDecl *Pattern = nullptr); |
| 7253 | |
| 7254 | |
| 7255 | |
| 7256 | |
| 7257 | struct CodeSynthesisContext { |
| 7258 | |
| 7259 | enum SynthesisKind { |
| 7260 | |
| 7261 | |
| 7262 | TemplateInstantiation, |
| 7263 | |
| 7264 | |
| 7265 | |
| 7266 | |
| 7267 | |
| 7268 | |
| 7269 | DefaultTemplateArgumentInstantiation, |
| 7270 | |
| 7271 | |
| 7272 | |
| 7273 | |
| 7274 | DefaultFunctionArgumentInstantiation, |
| 7275 | |
| 7276 | |
| 7277 | |
| 7278 | ExplicitTemplateArgumentSubstitution, |
| 7279 | |
| 7280 | |
| 7281 | |
| 7282 | |
| 7283 | |
| 7284 | |
| 7285 | DeducedTemplateArgumentSubstitution, |
| 7286 | |
| 7287 | |
| 7288 | |
| 7289 | |
| 7290 | PriorTemplateArgumentSubstitution, |
| 7291 | |
| 7292 | |
| 7293 | |
| 7294 | DefaultTemplateArgumentChecking, |
| 7295 | |
| 7296 | |
| 7297 | |
| 7298 | ExceptionSpecEvaluation, |
| 7299 | |
| 7300 | |
| 7301 | |
| 7302 | ExceptionSpecInstantiation, |
| 7303 | |
| 7304 | |
| 7305 | DeclaringSpecialMember, |
| 7306 | |
| 7307 | |
| 7308 | |
| 7309 | DefiningSynthesizedFunction, |
| 7310 | |
| 7311 | |
| 7312 | |
| 7313 | |
| 7314 | |
| 7315 | Memoization |
| 7316 | } Kind; |
| 7317 | |
| 7318 | |
| 7319 | bool SavedInNonInstantiationSFINAEContext; |
| 7320 | |
| 7321 | |
| 7322 | SourceLocation PointOfInstantiation; |
| 7323 | |
| 7324 | |
| 7325 | Decl *Entity; |
| 7326 | |
| 7327 | |
| 7328 | |
| 7329 | |
| 7330 | NamedDecl *Template; |
| 7331 | |
| 7332 | |
| 7333 | |
| 7334 | const TemplateArgument *TemplateArgs; |
| 7335 | |
| 7336 | |
| 7337 | |
| 7338 | union { |
| 7339 | |
| 7340 | unsigned NumTemplateArgs; |
| 7341 | |
| 7342 | |
| 7343 | CXXSpecialMember SpecialMember; |
| 7344 | }; |
| 7345 | |
| 7346 | ArrayRef<TemplateArgument> template_arguments() const { |
| 7347 | assert(Kind != DeclaringSpecialMember); |
| 7348 | return {TemplateArgs, NumTemplateArgs}; |
| 7349 | } |
| 7350 | |
| 7351 | |
| 7352 | |
| 7353 | sema::TemplateDeductionInfo *DeductionInfo; |
| 7354 | |
| 7355 | |
| 7356 | |
| 7357 | |
| 7358 | SourceRange InstantiationRange; |
| 7359 | |
| 7360 | CodeSynthesisContext() |
| 7361 | : Kind(TemplateInstantiation), Entity(nullptr), Template(nullptr), |
| 7362 | TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {} |
| 7363 | |
| 7364 | |
| 7365 | |
| 7366 | bool isInstantiationRecord() const; |
| 7367 | }; |
| 7368 | |
| 7369 | |
| 7370 | |
| 7371 | |
| 7372 | |
| 7373 | SmallVector<CodeSynthesisContext, 16> CodeSynthesisContexts; |
| 7374 | |
| 7375 | |
| 7376 | llvm::DenseSet<std::pair<Decl *, unsigned>> InstantiatingSpecializations; |
| 7377 | |
| 7378 | |
| 7379 | |
| 7380 | llvm::DenseSet<QualType> InstantiatedNonDependentTypes; |
| 7381 | |
| 7382 | |
| 7383 | |
| 7384 | SmallVector<Module*, 16> CodeSynthesisContextLookupModules; |
| 7385 | |
| 7386 | |
| 7387 | |
| 7388 | |
| 7389 | llvm::DenseSet<Module*> LookupModulesCache; |
| 7390 | |
| 7391 | |
| 7392 | |
| 7393 | |
| 7394 | llvm::DenseSet<Module*> &getLookupModules(); |
| 7395 | |
| 7396 | |
| 7397 | |
| 7398 | llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache; |
| 7399 | |
| 7400 | |
| 7401 | |
| 7402 | |
| 7403 | |
| 7404 | |
| 7405 | bool InNonInstantiationSFINAEContext; |
| 7406 | |
| 7407 | |
| 7408 | |
| 7409 | |
| 7410 | |
| 7411 | |
| 7412 | |
| 7413 | |
| 7414 | unsigned NonInstantiationEntries; |
| 7415 | |
| 7416 | |
| 7417 | |
| 7418 | |
| 7419 | |
| 7420 | |
| 7421 | |
| 7422 | unsigned LastEmittedCodeSynthesisContextDepth = 0; |
| 7423 | |
| 7424 | |
| 7425 | |
| 7426 | |
| 7427 | |
| 7428 | |
| 7429 | std::vector<std::unique_ptr<TemplateInstantiationCallback>> |
| 7430 | TemplateInstCallbacks; |
| 7431 | |
| 7432 | |
| 7433 | |
| 7434 | |
| 7435 | |
| 7436 | |
| 7437 | |
| 7438 | int ArgumentPackSubstitutionIndex; |
| 7439 | |
| 7440 | |
| 7441 | |
| 7442 | |
| 7443 | |
| 7444 | class ArgumentPackSubstitutionIndexRAII { |
| 7445 | Sema &Self; |
| 7446 | int OldSubstitutionIndex; |
| 7447 | |
| 7448 | public: |
| 7449 | ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex) |
| 7450 | : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) { |
| 7451 | Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex; |
| 7452 | } |
| 7453 | |
| 7454 | ~ArgumentPackSubstitutionIndexRAII() { |
| 7455 | Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex; |
| 7456 | } |
| 7457 | }; |
| 7458 | |
| 7459 | friend class ArgumentPackSubstitutionRAII; |
| 7460 | |
| 7461 | |
| 7462 | |
| 7463 | |
| 7464 | |
| 7465 | |
| 7466 | typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> > |
| 7467 | SuppressedDiagnosticsMap; |
| 7468 | SuppressedDiagnosticsMap SuppressedDiagnostics; |
| 7469 | |
| 7470 | |
| 7471 | |
| 7472 | |
| 7473 | |
| 7474 | |
| 7475 | |
| 7476 | |
| 7477 | |
| 7478 | |
| 7479 | |
| 7480 | |
| 7481 | struct InstantiatingTemplate { |
| 7482 | |
| 7483 | |
| 7484 | |
| 7485 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7486 | Decl *Entity, |
| 7487 | SourceRange InstantiationRange = SourceRange()); |
| 7488 | |
| 7489 | struct ExceptionSpecification {}; |
| 7490 | |
| 7491 | |
| 7492 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7493 | FunctionDecl *Entity, ExceptionSpecification, |
| 7494 | SourceRange InstantiationRange = SourceRange()); |
| 7495 | |
| 7496 | |
| 7497 | |
| 7498 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7499 | TemplateParameter Param, TemplateDecl *Template, |
| 7500 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7501 | SourceRange InstantiationRange = SourceRange()); |
| 7502 | |
| 7503 | |
| 7504 | |
| 7505 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7506 | FunctionTemplateDecl *FunctionTemplate, |
| 7507 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7508 | CodeSynthesisContext::SynthesisKind Kind, |
| 7509 | sema::TemplateDeductionInfo &DeductionInfo, |
| 7510 | SourceRange InstantiationRange = SourceRange()); |
| 7511 | |
| 7512 | |
| 7513 | |
| 7514 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7515 | TemplateDecl *Template, |
| 7516 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7517 | sema::TemplateDeductionInfo &DeductionInfo, |
| 7518 | SourceRange InstantiationRange = SourceRange()); |
| 7519 | |
| 7520 | |
| 7521 | |
| 7522 | |
| 7523 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7524 | ClassTemplatePartialSpecializationDecl *PartialSpec, |
| 7525 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7526 | sema::TemplateDeductionInfo &DeductionInfo, |
| 7527 | SourceRange InstantiationRange = SourceRange()); |
| 7528 | |
| 7529 | |
| 7530 | |
| 7531 | |
| 7532 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7533 | VarTemplatePartialSpecializationDecl *PartialSpec, |
| 7534 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7535 | sema::TemplateDeductionInfo &DeductionInfo, |
| 7536 | SourceRange InstantiationRange = SourceRange()); |
| 7537 | |
| 7538 | |
| 7539 | |
| 7540 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7541 | ParmVarDecl *Param, |
| 7542 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7543 | SourceRange InstantiationRange = SourceRange()); |
| 7544 | |
| 7545 | |
| 7546 | |
| 7547 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7548 | NamedDecl *Template, |
| 7549 | NonTypeTemplateParmDecl *Param, |
| 7550 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7551 | SourceRange InstantiationRange); |
| 7552 | |
| 7553 | |
| 7554 | |
| 7555 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7556 | NamedDecl *Template, |
| 7557 | TemplateTemplateParmDecl *Param, |
| 7558 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7559 | SourceRange InstantiationRange); |
| 7560 | |
| 7561 | |
| 7562 | |
| 7563 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, |
| 7564 | TemplateDecl *Template, |
| 7565 | NamedDecl *Param, |
| 7566 | ArrayRef<TemplateArgument> TemplateArgs, |
| 7567 | SourceRange InstantiationRange); |
| 7568 | |
| 7569 | |
| 7570 | |
| 7571 | void Clear(); |
| 7572 | |
| 7573 | ~InstantiatingTemplate() { Clear(); } |
| 7574 | |
| 7575 | |
| 7576 | |
| 7577 | bool isInvalid() const { return Invalid; } |
| 7578 | |
| 7579 | |
| 7580 | |
| 7581 | bool isAlreadyInstantiating() const { return AlreadyInstantiating; } |
| 7582 | |
| 7583 | private: |
| 7584 | Sema &SemaRef; |
| 7585 | bool Invalid; |
| 7586 | bool AlreadyInstantiating; |
| 7587 | bool CheckInstantiationDepth(SourceLocation PointOfInstantiation, |
| 7588 | SourceRange InstantiationRange); |
| 7589 | |
| 7590 | InstantiatingTemplate( |
| 7591 | Sema &SemaRef, CodeSynthesisContext::SynthesisKind Kind, |
| 7592 | SourceLocation PointOfInstantiation, SourceRange InstantiationRange, |
| 7593 | Decl *Entity, NamedDecl *Template = nullptr, |
| 7594 | ArrayRef<TemplateArgument> TemplateArgs = None, |
| 7595 | sema::TemplateDeductionInfo *DeductionInfo = nullptr); |
| 7596 | |
| 7597 | InstantiatingTemplate(const InstantiatingTemplate&) = delete; |
| 7598 | |
| 7599 | InstantiatingTemplate& |
| 7600 | operator=(const InstantiatingTemplate&) = delete; |
| 7601 | }; |
| 7602 | |
| 7603 | void pushCodeSynthesisContext(CodeSynthesisContext Ctx); |
| 7604 | void popCodeSynthesisContext(); |
| 7605 | |
| 7606 | |
| 7607 | bool inTemplateInstantiation() const { |
| 7608 | return CodeSynthesisContexts.size() > NonInstantiationEntries; |
| 7609 | } |
| 7610 | |
| 7611 | void PrintContextStack() { |
| 7612 | if (!CodeSynthesisContexts.empty() && |
| 7613 | CodeSynthesisContexts.size() != LastEmittedCodeSynthesisContextDepth) { |
| 7614 | PrintInstantiationStack(); |
| 7615 | LastEmittedCodeSynthesisContextDepth = CodeSynthesisContexts.size(); |
| 7616 | } |
| 7617 | if (PragmaAttributeCurrentTargetDecl) |
| 7618 | PrintPragmaAttributeInstantiationPoint(); |
| 7619 | } |
| 7620 | void PrintInstantiationStack(); |
| 7621 | |
| 7622 | void PrintPragmaAttributeInstantiationPoint(); |
| 7623 | |
| 7624 | |
| 7625 | |
| 7626 | |
| 7627 | |
| 7628 | |
| 7629 | |
| 7630 | |
| 7631 | |
| 7632 | Optional<sema::TemplateDeductionInfo *> isSFINAEContext() const; |
| 7633 | |
| 7634 | |
| 7635 | |
| 7636 | bool isUnevaluatedContext() const { |
| 7637 | (0) . __assert_fail ("!ExprEvalContexts.empty() && \"Must be in an expression evaluation context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7638, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!ExprEvalContexts.empty() && |
| 7638 | (0) . __assert_fail ("!ExprEvalContexts.empty() && \"Must be in an expression evaluation context\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7638, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Must be in an expression evaluation context"); |
| 7639 | return ExprEvalContexts.back().isUnevaluated(); |
| 7640 | } |
| 7641 | |
| 7642 | |
| 7643 | |
| 7644 | |
| 7645 | class SFINAETrap { |
| 7646 | Sema &SemaRef; |
| 7647 | unsigned PrevSFINAEErrors; |
| 7648 | bool PrevInNonInstantiationSFINAEContext; |
| 7649 | bool PrevAccessCheckingSFINAE; |
| 7650 | bool PrevLastDiagnosticIgnored; |
| 7651 | |
| 7652 | public: |
| 7653 | explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false) |
| 7654 | : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors), |
| 7655 | PrevInNonInstantiationSFINAEContext( |
| 7656 | SemaRef.InNonInstantiationSFINAEContext), |
| 7657 | PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE), |
| 7658 | PrevLastDiagnosticIgnored( |
| 7659 | SemaRef.getDiagnostics().isLastDiagnosticIgnored()) |
| 7660 | { |
| 7661 | if (!SemaRef.isSFINAEContext()) |
| 7662 | SemaRef.InNonInstantiationSFINAEContext = true; |
| 7663 | SemaRef.AccessCheckingSFINAE = AccessCheckingSFINAE; |
| 7664 | } |
| 7665 | |
| 7666 | ~SFINAETrap() { |
| 7667 | SemaRef.NumSFINAEErrors = PrevSFINAEErrors; |
| 7668 | SemaRef.InNonInstantiationSFINAEContext |
| 7669 | = PrevInNonInstantiationSFINAEContext; |
| 7670 | SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE; |
| 7671 | SemaRef.getDiagnostics().setLastDiagnosticIgnored( |
| 7672 | PrevLastDiagnosticIgnored); |
| 7673 | } |
| 7674 | |
| 7675 | |
| 7676 | bool hasErrorOccurred() const { |
| 7677 | return SemaRef.NumSFINAEErrors > PrevSFINAEErrors; |
| 7678 | } |
| 7679 | }; |
| 7680 | |
| 7681 | |
| 7682 | |
| 7683 | |
| 7684 | |
| 7685 | class TentativeAnalysisScope { |
| 7686 | Sema &SemaRef; |
| 7687 | |
| 7688 | SFINAETrap Trap; |
| 7689 | bool PrevDisableTypoCorrection; |
| 7690 | public: |
| 7691 | explicit TentativeAnalysisScope(Sema &SemaRef) |
| 7692 | : SemaRef(SemaRef), Trap(SemaRef, true), |
| 7693 | PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) { |
| 7694 | SemaRef.DisableTypoCorrection = true; |
| 7695 | } |
| 7696 | ~TentativeAnalysisScope() { |
| 7697 | SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection; |
| 7698 | } |
| 7699 | }; |
| 7700 | |
| 7701 | |
| 7702 | |
| 7703 | LocalInstantiationScope *CurrentInstantiationScope; |
| 7704 | |
| 7705 | |
| 7706 | |
| 7707 | bool DisableTypoCorrection; |
| 7708 | |
| 7709 | |
| 7710 | unsigned TyposCorrected; |
| 7711 | |
| 7712 | typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet; |
| 7713 | typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations; |
| 7714 | |
| 7715 | |
| 7716 | |
| 7717 | |
| 7718 | IdentifierSourceLocations TypoCorrectionFailures; |
| 7719 | |
| 7720 | |
| 7721 | sema::AnalysisBasedWarnings AnalysisWarnings; |
| 7722 | threadSafety::BeforeSet *ThreadSafetyDeclCache; |
| 7723 | |
| 7724 | |
| 7725 | |
| 7726 | |
| 7727 | |
| 7728 | |
| 7729 | |
| 7730 | |
| 7731 | |
| 7732 | typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation; |
| 7733 | |
| 7734 | |
| 7735 | |
| 7736 | std::deque<PendingImplicitInstantiation> PendingInstantiations; |
| 7737 | |
| 7738 | |
| 7739 | |
| 7740 | SmallVector<PendingImplicitInstantiation, 1> LateParsedInstantiations; |
| 7741 | |
| 7742 | class GlobalEagerInstantiationScope { |
| 7743 | public: |
| 7744 | GlobalEagerInstantiationScope(Sema &S, bool Enabled) |
| 7745 | : S(S), Enabled(Enabled) { |
| 7746 | if (!Enabled) return; |
| 7747 | |
| 7748 | SavedPendingInstantiations.swap(S.PendingInstantiations); |
| 7749 | SavedVTableUses.swap(S.VTableUses); |
| 7750 | } |
| 7751 | |
| 7752 | void perform() { |
| 7753 | if (Enabled) { |
| 7754 | S.DefineUsedVTables(); |
| 7755 | S.PerformPendingInstantiations(); |
| 7756 | } |
| 7757 | } |
| 7758 | |
| 7759 | ~GlobalEagerInstantiationScope() { |
| 7760 | if (!Enabled) return; |
| 7761 | |
| 7762 | |
| 7763 | (0) . __assert_fail ("S.VTableUses.empty() && \"VTableUses should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7764, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.VTableUses.empty() && |
| 7764 | (0) . __assert_fail ("S.VTableUses.empty() && \"VTableUses should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7764, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "VTableUses should be empty before it is discarded."); |
| 7765 | S.VTableUses.swap(SavedVTableUses); |
| 7766 | |
| 7767 | |
| 7768 | (0) . __assert_fail ("S.PendingInstantiations.empty() && \"PendingInstantiations should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7769, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.PendingInstantiations.empty() && |
| 7769 | (0) . __assert_fail ("S.PendingInstantiations.empty() && \"PendingInstantiations should be empty before it is discarded.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7769, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "PendingInstantiations should be empty before it is discarded."); |
| 7770 | S.PendingInstantiations.swap(SavedPendingInstantiations); |
| 7771 | } |
| 7772 | |
| 7773 | private: |
| 7774 | Sema &S; |
| 7775 | SmallVector<VTableUse, 16> SavedVTableUses; |
| 7776 | std::deque<PendingImplicitInstantiation> SavedPendingInstantiations; |
| 7777 | bool Enabled; |
| 7778 | }; |
| 7779 | |
| 7780 | |
| 7781 | |
| 7782 | |
| 7783 | |
| 7784 | |
| 7785 | |
| 7786 | |
| 7787 | std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations; |
| 7788 | |
| 7789 | class LocalEagerInstantiationScope { |
| 7790 | public: |
| 7791 | LocalEagerInstantiationScope(Sema &S) : S(S) { |
| 7792 | SavedPendingLocalImplicitInstantiations.swap( |
| 7793 | S.PendingLocalImplicitInstantiations); |
| 7794 | } |
| 7795 | |
| 7796 | void perform() { S.PerformPendingInstantiations(); } |
| 7797 | |
| 7798 | ~LocalEagerInstantiationScope() { |
| 7799 | (0) . __assert_fail ("S.PendingLocalImplicitInstantiations.empty() && \"there shouldn't be any pending local implicit instantiations\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7800, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.PendingLocalImplicitInstantiations.empty() && |
| 7800 | (0) . __assert_fail ("S.PendingLocalImplicitInstantiations.empty() && \"there shouldn't be any pending local implicit instantiations\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 7800, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "there shouldn't be any pending local implicit instantiations"); |
| 7801 | SavedPendingLocalImplicitInstantiations.swap( |
| 7802 | S.PendingLocalImplicitInstantiations); |
| 7803 | } |
| 7804 | |
| 7805 | private: |
| 7806 | Sema &S; |
| 7807 | std::deque<PendingImplicitInstantiation> |
| 7808 | SavedPendingLocalImplicitInstantiations; |
| 7809 | }; |
| 7810 | |
| 7811 | |
| 7812 | class ExtParameterInfoBuilder { |
| 7813 | SmallVector<FunctionProtoType::ExtParameterInfo, 16> Infos; |
| 7814 | bool HasInteresting = false; |
| 7815 | |
| 7816 | public: |
| 7817 | |
| 7818 | |
| 7819 | void set(unsigned index, FunctionProtoType::ExtParameterInfo info) { |
| 7820 | assert(Infos.size() <= index); |
| 7821 | Infos.resize(index); |
| 7822 | Infos.push_back(info); |
| 7823 | |
| 7824 | if (!HasInteresting) |
| 7825 | HasInteresting = (info != FunctionProtoType::ExtParameterInfo()); |
| 7826 | } |
| 7827 | |
| 7828 | |
| 7829 | |
| 7830 | const FunctionProtoType::ExtParameterInfo * |
| 7831 | getPointerOrNull(unsigned numParams) { |
| 7832 | if (!HasInteresting) return nullptr; |
| 7833 | Infos.resize(numParams); |
| 7834 | return Infos.data(); |
| 7835 | } |
| 7836 | }; |
| 7837 | |
| 7838 | void PerformPendingInstantiations(bool LocalOnly = false); |
| 7839 | |
| 7840 | TypeSourceInfo *SubstType(TypeSourceInfo *T, |
| 7841 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7842 | SourceLocation Loc, DeclarationName Entity, |
| 7843 | bool AllowDeducedTST = false); |
| 7844 | |
| 7845 | QualType SubstType(QualType T, |
| 7846 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7847 | SourceLocation Loc, DeclarationName Entity); |
| 7848 | |
| 7849 | TypeSourceInfo *SubstType(TypeLoc TL, |
| 7850 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7851 | SourceLocation Loc, DeclarationName Entity); |
| 7852 | |
| 7853 | TypeSourceInfo *SubstFunctionDeclType(TypeSourceInfo *T, |
| 7854 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7855 | SourceLocation Loc, |
| 7856 | DeclarationName Entity, |
| 7857 | CXXRecordDecl *ThisContext, |
| 7858 | Qualifiers ThisTypeQuals); |
| 7859 | void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, |
| 7860 | const MultiLevelTemplateArgumentList &Args); |
| 7861 | bool SubstExceptionSpec(SourceLocation Loc, |
| 7862 | FunctionProtoType::ExceptionSpecInfo &ESI, |
| 7863 | SmallVectorImpl<QualType> &ExceptionStorage, |
| 7864 | const MultiLevelTemplateArgumentList &Args); |
| 7865 | ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D, |
| 7866 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7867 | int indexAdjustment, |
| 7868 | Optional<unsigned> NumExpansions, |
| 7869 | bool ExpectParameterPack); |
| 7870 | bool SubstParmTypes(SourceLocation Loc, ArrayRef<ParmVarDecl *> Params, |
| 7871 | const FunctionProtoType::ExtParameterInfo *ExtParamInfos, |
| 7872 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7873 | SmallVectorImpl<QualType> &ParamTypes, |
| 7874 | SmallVectorImpl<ParmVarDecl *> *OutParams, |
| 7875 | ExtParameterInfoBuilder &ParamInfos); |
| 7876 | ExprResult SubstExpr(Expr *E, |
| 7877 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7878 | |
| 7879 | |
| 7880 | |
| 7881 | |
| 7882 | |
| 7883 | |
| 7884 | |
| 7885 | |
| 7886 | |
| 7887 | |
| 7888 | |
| 7889 | |
| 7890 | |
| 7891 | |
| 7892 | bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall, |
| 7893 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7894 | SmallVectorImpl<Expr *> &Outputs); |
| 7895 | |
| 7896 | StmtResult SubstStmt(Stmt *S, |
| 7897 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7898 | |
| 7899 | TemplateParameterList * |
| 7900 | SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, |
| 7901 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7902 | |
| 7903 | Decl *SubstDecl(Decl *D, DeclContext *Owner, |
| 7904 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7905 | |
| 7906 | ExprResult SubstInitializer(Expr *E, |
| 7907 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7908 | bool CXXDirectInit); |
| 7909 | |
| 7910 | bool |
| 7911 | SubstBaseSpecifiers(CXXRecordDecl *Instantiation, |
| 7912 | CXXRecordDecl *Pattern, |
| 7913 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7914 | |
| 7915 | bool |
| 7916 | InstantiateClass(SourceLocation PointOfInstantiation, |
| 7917 | CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, |
| 7918 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7919 | TemplateSpecializationKind TSK, |
| 7920 | bool Complain = true); |
| 7921 | |
| 7922 | bool InstantiateEnum(SourceLocation PointOfInstantiation, |
| 7923 | EnumDecl *Instantiation, EnumDecl *Pattern, |
| 7924 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7925 | TemplateSpecializationKind TSK); |
| 7926 | |
| 7927 | bool InstantiateInClassInitializer( |
| 7928 | SourceLocation PointOfInstantiation, FieldDecl *Instantiation, |
| 7929 | FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7930 | |
| 7931 | struct LateInstantiatedAttribute { |
| 7932 | const Attr *TmplAttr; |
| 7933 | LocalInstantiationScope *Scope; |
| 7934 | Decl *NewDecl; |
| 7935 | |
| 7936 | LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, |
| 7937 | Decl *D) |
| 7938 | : TmplAttr(A), Scope(S), NewDecl(D) |
| 7939 | { } |
| 7940 | }; |
| 7941 | typedef SmallVector<LateInstantiatedAttribute, 16> LateInstantiatedAttrVec; |
| 7942 | |
| 7943 | void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7944 | const Decl *Pattern, Decl *Inst, |
| 7945 | LateInstantiatedAttrVec *LateAttrs = nullptr, |
| 7946 | LocalInstantiationScope *OuterMostScope = nullptr); |
| 7947 | |
| 7948 | void |
| 7949 | InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7950 | const Decl *Pattern, Decl *Inst, |
| 7951 | LateInstantiatedAttrVec *LateAttrs = nullptr, |
| 7952 | LocalInstantiationScope *OuterMostScope = nullptr); |
| 7953 | |
| 7954 | bool usesPartialOrExplicitSpecialization( |
| 7955 | SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec); |
| 7956 | |
| 7957 | bool |
| 7958 | InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, |
| 7959 | ClassTemplateSpecializationDecl *ClassTemplateSpec, |
| 7960 | TemplateSpecializationKind TSK, |
| 7961 | bool Complain = true); |
| 7962 | |
| 7963 | void InstantiateClassMembers(SourceLocation PointOfInstantiation, |
| 7964 | CXXRecordDecl *Instantiation, |
| 7965 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 7966 | TemplateSpecializationKind TSK); |
| 7967 | |
| 7968 | void InstantiateClassTemplateSpecializationMembers( |
| 7969 | SourceLocation PointOfInstantiation, |
| 7970 | ClassTemplateSpecializationDecl *ClassTemplateSpec, |
| 7971 | TemplateSpecializationKind TSK); |
| 7972 | |
| 7973 | NestedNameSpecifierLoc |
| 7974 | SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, |
| 7975 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7976 | |
| 7977 | DeclarationNameInfo |
| 7978 | SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, |
| 7979 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7980 | TemplateName |
| 7981 | SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, |
| 7982 | SourceLocation Loc, |
| 7983 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7984 | bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, |
| 7985 | TemplateArgumentListInfo &Result, |
| 7986 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 7987 | |
| 7988 | void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, |
| 7989 | FunctionDecl *Function); |
| 7990 | FunctionDecl *InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, |
| 7991 | const TemplateArgumentList *Args, |
| 7992 | SourceLocation Loc); |
| 7993 | void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, |
| 7994 | FunctionDecl *Function, |
| 7995 | bool Recursive = false, |
| 7996 | bool DefinitionRequired = false, |
| 7997 | bool AtEndOfTU = false); |
| 7998 | VarTemplateSpecializationDecl *BuildVarTemplateInstantiation( |
| 7999 | VarTemplateDecl *VarTemplate, VarDecl *FromVar, |
| 8000 | const TemplateArgumentList &TemplateArgList, |
| 8001 | const TemplateArgumentListInfo &TemplateArgsInfo, |
| 8002 | SmallVectorImpl<TemplateArgument> &Converted, |
| 8003 | SourceLocation PointOfInstantiation, void *InsertPos, |
| 8004 | LateInstantiatedAttrVec *LateAttrs = nullptr, |
| 8005 | LocalInstantiationScope *StartingScope = nullptr); |
| 8006 | VarTemplateSpecializationDecl *CompleteVarTemplateSpecializationDecl( |
| 8007 | VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, |
| 8008 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 8009 | void |
| 8010 | BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, |
| 8011 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 8012 | LateInstantiatedAttrVec *LateAttrs, |
| 8013 | DeclContext *Owner, |
| 8014 | LocalInstantiationScope *StartingScope, |
| 8015 | bool InstantiatingVarTemplate = false); |
| 8016 | void InstantiateVariableInitializer( |
| 8017 | VarDecl *Var, VarDecl *OldVar, |
| 8018 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 8019 | void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, |
| 8020 | VarDecl *Var, bool Recursive = false, |
| 8021 | bool DefinitionRequired = false, |
| 8022 | bool AtEndOfTU = false); |
| 8023 | |
| 8024 | void InstantiateMemInitializers(CXXConstructorDecl *New, |
| 8025 | const CXXConstructorDecl *Tmpl, |
| 8026 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 8027 | |
| 8028 | NamedDecl *FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, |
| 8029 | const MultiLevelTemplateArgumentList &TemplateArgs, |
| 8030 | bool FindingInstantiatedContext = false); |
| 8031 | DeclContext *FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, |
| 8032 | const MultiLevelTemplateArgumentList &TemplateArgs); |
| 8033 | |
| 8034 | |
| 8035 | enum ObjCContainerKind { |
| 8036 | OCK_None = -1, |
| 8037 | OCK_Interface = 0, |
| 8038 | OCK_Protocol, |
| 8039 | OCK_Category, |
| 8040 | OCK_ClassExtension, |
| 8041 | OCK_Implementation, |
| 8042 | OCK_CategoryImplementation |
| 8043 | }; |
| 8044 | ObjCContainerKind getObjCContainerKind() const; |
| 8045 | |
| 8046 | DeclResult actOnObjCTypeParam(Scope *S, |
| 8047 | ObjCTypeParamVariance variance, |
| 8048 | SourceLocation varianceLoc, |
| 8049 | unsigned index, |
| 8050 | IdentifierInfo *paramName, |
| 8051 | SourceLocation paramLoc, |
| 8052 | SourceLocation colonLoc, |
| 8053 | ParsedType typeBound); |
| 8054 | |
| 8055 | ObjCTypeParamList *actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, |
| 8056 | ArrayRef<Decl *> typeParams, |
| 8057 | SourceLocation rAngleLoc); |
| 8058 | void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList); |
| 8059 | |
| 8060 | Decl *ActOnStartClassInterface( |
| 8061 | Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, |
| 8062 | SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, |
| 8063 | IdentifierInfo *SuperName, SourceLocation SuperLoc, |
| 8064 | ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange, |
| 8065 | Decl *const *ProtoRefs, unsigned NumProtoRefs, |
| 8066 | const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, |
| 8067 | const ParsedAttributesView &AttrList); |
| 8068 | |
| 8069 | void ActOnSuperClassOfClassInterface(Scope *S, |
| 8070 | SourceLocation AtInterfaceLoc, |
| 8071 | ObjCInterfaceDecl *IDecl, |
| 8072 | IdentifierInfo *ClassName, |
| 8073 | SourceLocation ClassLoc, |
| 8074 | IdentifierInfo *SuperName, |
| 8075 | SourceLocation SuperLoc, |
| 8076 | ArrayRef<ParsedType> SuperTypeArgs, |
| 8077 | SourceRange SuperTypeArgsRange); |
| 8078 | |
| 8079 | void ActOnTypedefedProtocols(SmallVectorImpl<Decl *> &ProtocolRefs, |
| 8080 | SmallVectorImpl<SourceLocation> &ProtocolLocs, |
| 8081 | IdentifierInfo *SuperName, |
| 8082 | SourceLocation SuperLoc); |
| 8083 | |
| 8084 | Decl *ActOnCompatibilityAlias( |
| 8085 | SourceLocation AtCompatibilityAliasLoc, |
| 8086 | IdentifierInfo *AliasName, SourceLocation AliasLocation, |
| 8087 | IdentifierInfo *ClassName, SourceLocation ClassLocation); |
| 8088 | |
| 8089 | bool CheckForwardProtocolDeclarationForCircularDependency( |
| 8090 | IdentifierInfo *PName, |
| 8091 | SourceLocation &PLoc, SourceLocation PrevLoc, |
| 8092 | const ObjCList<ObjCProtocolDecl> &PList); |
| 8093 | |
| 8094 | Decl *ActOnStartProtocolInterface( |
| 8095 | SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, |
| 8096 | SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, |
| 8097 | unsigned NumProtoRefs, const SourceLocation *ProtoLocs, |
| 8098 | SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList); |
| 8099 | |
| 8100 | Decl *ActOnStartCategoryInterface( |
| 8101 | SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, |
| 8102 | SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, |
| 8103 | IdentifierInfo *CategoryName, SourceLocation CategoryLoc, |
| 8104 | Decl *const *ProtoRefs, unsigned NumProtoRefs, |
| 8105 | const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, |
| 8106 | const ParsedAttributesView &AttrList); |
| 8107 | |
| 8108 | Decl *ActOnStartClassImplementation( |
| 8109 | SourceLocation AtClassImplLoc, |
| 8110 | IdentifierInfo *ClassName, SourceLocation ClassLoc, |
| 8111 | IdentifierInfo *SuperClassname, |
| 8112 | SourceLocation SuperClassLoc); |
| 8113 | |
| 8114 | Decl *ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, |
| 8115 | IdentifierInfo *ClassName, |
| 8116 | SourceLocation ClassLoc, |
| 8117 | IdentifierInfo *CatName, |
| 8118 | SourceLocation CatLoc); |
| 8119 | |
| 8120 | DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, |
| 8121 | ArrayRef<Decl *> Decls); |
| 8122 | |
| 8123 | DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, |
| 8124 | IdentifierInfo **IdentList, |
| 8125 | SourceLocation *IdentLocs, |
| 8126 | ArrayRef<ObjCTypeParamList *> TypeParamLists, |
| 8127 | unsigned NumElts); |
| 8128 | |
| 8129 | DeclGroupPtrTy |
| 8130 | ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, |
| 8131 | ArrayRef<IdentifierLocPair> IdentList, |
| 8132 | const ParsedAttributesView &attrList); |
| 8133 | |
| 8134 | void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, |
| 8135 | ArrayRef<IdentifierLocPair> ProtocolId, |
| 8136 | SmallVectorImpl<Decl *> &Protocols); |
| 8137 | |
| 8138 | void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, |
| 8139 | SourceLocation ProtocolLoc, |
| 8140 | IdentifierInfo *TypeArgId, |
| 8141 | SourceLocation TypeArgLoc, |
| 8142 | bool SelectProtocolFirst = false); |
| 8143 | |
| 8144 | |
| 8145 | |
| 8146 | |
| 8147 | void actOnObjCTypeArgsOrProtocolQualifiers( |
| 8148 | Scope *S, |
| 8149 | ParsedType baseType, |
| 8150 | SourceLocation lAngleLoc, |
| 8151 | ArrayRef<IdentifierInfo *> identifiers, |
| 8152 | ArrayRef<SourceLocation> identifierLocs, |
| 8153 | SourceLocation rAngleLoc, |
| 8154 | SourceLocation &typeArgsLAngleLoc, |
| 8155 | SmallVectorImpl<ParsedType> &typeArgs, |
| 8156 | SourceLocation &typeArgsRAngleLoc, |
| 8157 | SourceLocation &protocolLAngleLoc, |
| 8158 | SmallVectorImpl<Decl *> &protocols, |
| 8159 | SourceLocation &protocolRAngleLoc, |
| 8160 | bool warnOnIncompleteProtocols); |
| 8161 | |
| 8162 | |
| 8163 | |
| 8164 | TypeResult actOnObjCProtocolQualifierType( |
| 8165 | SourceLocation lAngleLoc, |
| 8166 | ArrayRef<Decl *> protocols, |
| 8167 | ArrayRef<SourceLocation> protocolLocs, |
| 8168 | SourceLocation rAngleLoc); |
| 8169 | |
| 8170 | |
| 8171 | TypeResult actOnObjCTypeArgsAndProtocolQualifiers( |
| 8172 | Scope *S, |
| 8173 | SourceLocation Loc, |
| 8174 | ParsedType BaseType, |
| 8175 | SourceLocation TypeArgsLAngleLoc, |
| 8176 | ArrayRef<ParsedType> TypeArgs, |
| 8177 | SourceLocation TypeArgsRAngleLoc, |
| 8178 | SourceLocation ProtocolLAngleLoc, |
| 8179 | ArrayRef<Decl *> Protocols, |
| 8180 | ArrayRef<SourceLocation> ProtocolLocs, |
| 8181 | SourceLocation ProtocolRAngleLoc); |
| 8182 | |
| 8183 | |
| 8184 | QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, |
| 8185 | SourceLocation ProtocolLAngleLoc, |
| 8186 | ArrayRef<ObjCProtocolDecl *> Protocols, |
| 8187 | ArrayRef<SourceLocation> ProtocolLocs, |
| 8188 | SourceLocation ProtocolRAngleLoc, |
| 8189 | bool FailOnError = false); |
| 8190 | |
| 8191 | |
| 8192 | QualType BuildObjCObjectType(QualType BaseType, |
| 8193 | SourceLocation Loc, |
| 8194 | SourceLocation TypeArgsLAngleLoc, |
| 8195 | ArrayRef<TypeSourceInfo *> TypeArgs, |
| 8196 | SourceLocation TypeArgsRAngleLoc, |
| 8197 | SourceLocation ProtocolLAngleLoc, |
| 8198 | ArrayRef<ObjCProtocolDecl *> Protocols, |
| 8199 | ArrayRef<SourceLocation> ProtocolLocs, |
| 8200 | SourceLocation ProtocolRAngleLoc, |
| 8201 | bool FailOnError = false); |
| 8202 | |
| 8203 | |
| 8204 | |
| 8205 | |
| 8206 | void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, |
| 8207 | SourceLocation Loc, |
| 8208 | unsigned &Attributes, |
| 8209 | bool propertyInPrimaryClass); |
| 8210 | |
| 8211 | |
| 8212 | |
| 8213 | |
| 8214 | void ProcessPropertyDecl(ObjCPropertyDecl *property); |
| 8215 | |
| 8216 | |
| 8217 | void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, |
| 8218 | ObjCPropertyDecl *SuperProperty, |
| 8219 | const IdentifierInfo *Name, |
| 8220 | bool OverridingProtocolProperty); |
| 8221 | |
| 8222 | void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, |
| 8223 | ObjCInterfaceDecl *ID); |
| 8224 | |
| 8225 | Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd, |
| 8226 | ArrayRef<Decl *> allMethods = None, |
| 8227 | ArrayRef<DeclGroupPtrTy> allTUVars = None); |
| 8228 | |
| 8229 | Decl *ActOnProperty(Scope *S, SourceLocation AtLoc, |
| 8230 | SourceLocation LParenLoc, |
| 8231 | FieldDeclarator &FD, ObjCDeclSpec &ODS, |
| 8232 | Selector GetterSel, Selector SetterSel, |
| 8233 | tok::ObjCKeywordKind MethodImplKind, |
| 8234 | DeclContext *lexicalDC = nullptr); |
| 8235 | |
| 8236 | Decl *ActOnPropertyImplDecl(Scope *S, |
| 8237 | SourceLocation AtLoc, |
| 8238 | SourceLocation PropertyLoc, |
| 8239 | bool ImplKind, |
| 8240 | IdentifierInfo *PropertyId, |
| 8241 | IdentifierInfo *PropertyIvar, |
| 8242 | SourceLocation PropertyIvarLoc, |
| 8243 | ObjCPropertyQueryKind QueryKind); |
| 8244 | |
| 8245 | enum ObjCSpecialMethodKind { |
| 8246 | OSMK_None, |
| 8247 | OSMK_Alloc, |
| 8248 | OSMK_New, |
| 8249 | OSMK_Copy, |
| 8250 | OSMK_RetainingInit, |
| 8251 | OSMK_NonRetainingInit |
| 8252 | }; |
| 8253 | |
| 8254 | struct ObjCArgInfo { |
| 8255 | IdentifierInfo *Name; |
| 8256 | SourceLocation NameLoc; |
| 8257 | |
| 8258 | |
| 8259 | ParsedType Type; |
| 8260 | ObjCDeclSpec DeclSpec; |
| 8261 | |
| 8262 | |
| 8263 | ParsedAttributesView ArgAttrs; |
| 8264 | }; |
| 8265 | |
| 8266 | Decl *ActOnMethodDeclaration( |
| 8267 | Scope *S, |
| 8268 | SourceLocation BeginLoc, |
| 8269 | SourceLocation EndLoc, |
| 8270 | tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, |
| 8271 | ArrayRef<SourceLocation> SelectorLocs, Selector Sel, |
| 8272 | |
| 8273 | |
| 8274 | ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, |
| 8275 | unsigned CNumArgs, |
| 8276 | const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, |
| 8277 | bool isVariadic, bool MethodDefinition); |
| 8278 | |
| 8279 | ObjCMethodDecl *LookupMethodInQualifiedType(Selector Sel, |
| 8280 | const ObjCObjectPointerType *OPT, |
| 8281 | bool IsInstance); |
| 8282 | ObjCMethodDecl *LookupMethodInObjectType(Selector Sel, QualType Ty, |
| 8283 | bool IsInstance); |
| 8284 | |
| 8285 | bool CheckARCMethodDecl(ObjCMethodDecl *method); |
| 8286 | bool inferObjCARCLifetime(ValueDecl *decl); |
| 8287 | |
| 8288 | ExprResult |
| 8289 | HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, |
| 8290 | Expr *BaseExpr, |
| 8291 | SourceLocation OpLoc, |
| 8292 | DeclarationName MemberName, |
| 8293 | SourceLocation MemberLoc, |
| 8294 | SourceLocation SuperLoc, QualType SuperType, |
| 8295 | bool Super); |
| 8296 | |
| 8297 | ExprResult |
| 8298 | ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, |
| 8299 | IdentifierInfo &propertyName, |
| 8300 | SourceLocation receiverNameLoc, |
| 8301 | SourceLocation propertyNameLoc); |
| 8302 | |
| 8303 | ObjCMethodDecl *tryCaptureObjCSelf(SourceLocation Loc); |
| 8304 | |
| 8305 | |
| 8306 | |
| 8307 | enum ObjCMessageKind { |
| 8308 | |
| 8309 | ObjCSuperMessage, |
| 8310 | |
| 8311 | ObjCInstanceMessage, |
| 8312 | |
| 8313 | |
| 8314 | ObjCClassMessage |
| 8315 | }; |
| 8316 | |
| 8317 | ObjCMessageKind getObjCMessageKind(Scope *S, |
| 8318 | IdentifierInfo *Name, |
| 8319 | SourceLocation NameLoc, |
| 8320 | bool IsSuper, |
| 8321 | bool HasTrailingDot, |
| 8322 | ParsedType &ReceiverType); |
| 8323 | |
| 8324 | ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, |
| 8325 | Selector Sel, |
| 8326 | SourceLocation LBracLoc, |
| 8327 | ArrayRef<SourceLocation> SelectorLocs, |
| 8328 | SourceLocation RBracLoc, |
| 8329 | MultiExprArg Args); |
| 8330 | |
| 8331 | ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, |
| 8332 | QualType ReceiverType, |
| 8333 | SourceLocation SuperLoc, |
| 8334 | Selector Sel, |
| 8335 | ObjCMethodDecl *Method, |
| 8336 | SourceLocation LBracLoc, |
| 8337 | ArrayRef<SourceLocation> SelectorLocs, |
| 8338 | SourceLocation RBracLoc, |
| 8339 | MultiExprArg Args, |
| 8340 | bool isImplicit = false); |
| 8341 | |
| 8342 | ExprResult BuildClassMessageImplicit(QualType ReceiverType, |
| 8343 | bool isSuperReceiver, |
| 8344 | SourceLocation Loc, |
| 8345 | Selector Sel, |
| 8346 | ObjCMethodDecl *Method, |
| 8347 | MultiExprArg Args); |
| 8348 | |
| 8349 | ExprResult ActOnClassMessage(Scope *S, |
| 8350 | ParsedType Receiver, |
| 8351 | Selector Sel, |
| 8352 | SourceLocation LBracLoc, |
| 8353 | ArrayRef<SourceLocation> SelectorLocs, |
| 8354 | SourceLocation RBracLoc, |
| 8355 | MultiExprArg Args); |
| 8356 | |
| 8357 | ExprResult BuildInstanceMessage(Expr *Receiver, |
| 8358 | QualType ReceiverType, |
| 8359 | SourceLocation SuperLoc, |
| 8360 | Selector Sel, |
| 8361 | ObjCMethodDecl *Method, |
| 8362 | SourceLocation LBracLoc, |
| 8363 | ArrayRef<SourceLocation> SelectorLocs, |
| 8364 | SourceLocation RBracLoc, |
| 8365 | MultiExprArg Args, |
| 8366 | bool isImplicit = false); |
| 8367 | |
| 8368 | ExprResult BuildInstanceMessageImplicit(Expr *Receiver, |
| 8369 | QualType ReceiverType, |
| 8370 | SourceLocation Loc, |
| 8371 | Selector Sel, |
| 8372 | ObjCMethodDecl *Method, |
| 8373 | MultiExprArg Args); |
| 8374 | |
| 8375 | ExprResult ActOnInstanceMessage(Scope *S, |
| 8376 | Expr *Receiver, |
| 8377 | Selector Sel, |
| 8378 | SourceLocation LBracLoc, |
| 8379 | ArrayRef<SourceLocation> SelectorLocs, |
| 8380 | SourceLocation RBracLoc, |
| 8381 | MultiExprArg Args); |
| 8382 | |
| 8383 | ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, |
| 8384 | ObjCBridgeCastKind Kind, |
| 8385 | SourceLocation BridgeKeywordLoc, |
| 8386 | TypeSourceInfo *TSInfo, |
| 8387 | Expr *SubExpr); |
| 8388 | |
| 8389 | ExprResult ActOnObjCBridgedCast(Scope *S, |
| 8390 | SourceLocation LParenLoc, |
| 8391 | ObjCBridgeCastKind Kind, |
| 8392 | SourceLocation BridgeKeywordLoc, |
| 8393 | ParsedType Type, |
| 8394 | SourceLocation RParenLoc, |
| 8395 | Expr *SubExpr); |
| 8396 | |
| 8397 | void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr); |
| 8398 | |
| 8399 | void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr); |
| 8400 | |
| 8401 | bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, |
| 8402 | CastKind &Kind); |
| 8403 | |
| 8404 | bool checkObjCBridgeRelatedComponents(SourceLocation Loc, |
| 8405 | QualType DestType, QualType SrcType, |
| 8406 | ObjCInterfaceDecl *&RelatedClass, |
| 8407 | ObjCMethodDecl *&ClassMethod, |
| 8408 | ObjCMethodDecl *&InstanceMethod, |
| 8409 | TypedefNameDecl *&TDNDecl, |
| 8410 | bool CfToNs, bool Diagnose = true); |
| 8411 | |
| 8412 | bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, |
| 8413 | QualType DestType, QualType SrcType, |
| 8414 | Expr *&SrcExpr, bool Diagnose = true); |
| 8415 | |
| 8416 | bool ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&SrcExpr, |
| 8417 | bool Diagnose = true); |
| 8418 | |
| 8419 | bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall); |
| 8420 | |
| 8421 | |
| 8422 | |
| 8423 | void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, |
| 8424 | const ObjCMethodDecl *Overridden); |
| 8425 | |
| 8426 | |
| 8427 | enum ResultTypeCompatibilityKind { |
| 8428 | RTC_Compatible, |
| 8429 | RTC_Incompatible, |
| 8430 | RTC_Unknown |
| 8431 | }; |
| 8432 | |
| 8433 | void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, |
| 8434 | ObjCInterfaceDecl *CurrentClass, |
| 8435 | ResultTypeCompatibilityKind RTC); |
| 8436 | |
| 8437 | enum PragmaOptionsAlignKind { |
| 8438 | POAK_Native, |
| 8439 | POAK_Natural, |
| 8440 | POAK_Packed, |
| 8441 | POAK_Power, |
| 8442 | POAK_Mac68k, |
| 8443 | POAK_Reset |
| 8444 | }; |
| 8445 | |
| 8446 | |
| 8447 | void ActOnPragmaClangSection(SourceLocation PragmaLoc, |
| 8448 | PragmaClangSectionAction Action, |
| 8449 | PragmaClangSectionKind SecKind, StringRef SecName); |
| 8450 | |
| 8451 | |
| 8452 | void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, |
| 8453 | SourceLocation PragmaLoc); |
| 8454 | |
| 8455 | |
| 8456 | void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, |
| 8457 | StringRef SlotLabel, Expr *Alignment); |
| 8458 | |
| 8459 | enum class PragmaPackDiagnoseKind { |
| 8460 | NonDefaultStateAtInclude, |
| 8461 | ChangedStateAtExit |
| 8462 | }; |
| 8463 | |
| 8464 | void DiagnoseNonDefaultPragmaPack(PragmaPackDiagnoseKind Kind, |
| 8465 | SourceLocation IncludeLoc); |
| 8466 | void DiagnoseUnterminatedPragmaPack(); |
| 8467 | |
| 8468 | |
| 8469 | void ActOnPragmaMSStruct(PragmaMSStructKind Kind); |
| 8470 | |
| 8471 | |
| 8472 | |
| 8473 | void (SourceLocation , PragmaMSCommentKind Kind, |
| 8474 | StringRef Arg); |
| 8475 | |
| 8476 | |
| 8477 | |
| 8478 | |
| 8479 | void ActOnPragmaMSPointersToMembers( |
| 8480 | LangOptions::PragmaMSPointersToMembersKind Kind, |
| 8481 | SourceLocation PragmaLoc); |
| 8482 | |
| 8483 | |
| 8484 | void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, |
| 8485 | SourceLocation PragmaLoc, |
| 8486 | MSVtorDispAttr::Mode Value); |
| 8487 | |
| 8488 | enum PragmaSectionKind { |
| 8489 | PSK_DataSeg, |
| 8490 | PSK_BSSSeg, |
| 8491 | PSK_ConstSeg, |
| 8492 | PSK_CodeSeg, |
| 8493 | }; |
| 8494 | |
| 8495 | bool UnifySection(StringRef SectionName, |
| 8496 | int SectionFlags, |
| 8497 | DeclaratorDecl *TheDecl); |
| 8498 | bool UnifySection(StringRef SectionName, |
| 8499 | int SectionFlags, |
| 8500 | SourceLocation PragmaSectionLocation); |
| 8501 | |
| 8502 | |
| 8503 | void ActOnPragmaMSSeg(SourceLocation PragmaLocation, |
| 8504 | PragmaMsStackAction Action, |
| 8505 | llvm::StringRef StackSlotLabel, |
| 8506 | StringLiteral *SegmentName, |
| 8507 | llvm::StringRef PragmaName); |
| 8508 | |
| 8509 | |
| 8510 | void ActOnPragmaMSSection(SourceLocation PragmaLocation, |
| 8511 | int SectionFlags, StringLiteral *SegmentName); |
| 8512 | |
| 8513 | |
| 8514 | void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, |
| 8515 | StringLiteral *SegmentName); |
| 8516 | |
| 8517 | |
| 8518 | void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II); |
| 8519 | |
| 8520 | |
| 8521 | void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, |
| 8522 | StringRef Value); |
| 8523 | |
| 8524 | |
| 8525 | void ActOnPragmaUnused(const Token &Identifier, |
| 8526 | Scope *curScope, |
| 8527 | SourceLocation PragmaLoc); |
| 8528 | |
| 8529 | |
| 8530 | void ActOnPragmaVisibility(const IdentifierInfo* VisType, |
| 8531 | SourceLocation PragmaLoc); |
| 8532 | |
| 8533 | NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, |
| 8534 | SourceLocation Loc); |
| 8535 | void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W); |
| 8536 | |
| 8537 | |
| 8538 | void ActOnPragmaWeakID(IdentifierInfo* WeakName, |
| 8539 | SourceLocation PragmaLoc, |
| 8540 | SourceLocation WeakNameLoc); |
| 8541 | |
| 8542 | |
| 8543 | |
| 8544 | void ActOnPragmaRedefineExtname(IdentifierInfo* WeakName, |
| 8545 | IdentifierInfo* AliasName, |
| 8546 | SourceLocation PragmaLoc, |
| 8547 | SourceLocation WeakNameLoc, |
| 8548 | SourceLocation AliasNameLoc); |
| 8549 | |
| 8550 | |
| 8551 | void ActOnPragmaWeakAlias(IdentifierInfo* WeakName, |
| 8552 | IdentifierInfo* AliasName, |
| 8553 | SourceLocation PragmaLoc, |
| 8554 | SourceLocation WeakNameLoc, |
| 8555 | SourceLocation AliasNameLoc); |
| 8556 | |
| 8557 | |
| 8558 | |
| 8559 | |
| 8560 | void ActOnPragmaFPContract(LangOptions::FPContractModeKind FPC); |
| 8561 | |
| 8562 | |
| 8563 | |
| 8564 | void ActOnPragmaFEnvAccess(LangOptions::FEnvAccessModeKind FPC); |
| 8565 | |
| 8566 | |
| 8567 | |
| 8568 | void AddAlignmentAttributesForRecord(RecordDecl *RD); |
| 8569 | |
| 8570 | |
| 8571 | void AddMsStructLayoutForRecord(RecordDecl *RD); |
| 8572 | |
| 8573 | |
| 8574 | void FreePackedContext(); |
| 8575 | |
| 8576 | |
| 8577 | |
| 8578 | void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, |
| 8579 | SourceLocation Loc); |
| 8580 | |
| 8581 | |
| 8582 | |
| 8583 | void AddPushedVisibilityAttribute(Decl *RD); |
| 8584 | |
| 8585 | |
| 8586 | |
| 8587 | void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc); |
| 8588 | |
| 8589 | |
| 8590 | void FreeVisContext(); |
| 8591 | |
| 8592 | |
| 8593 | |
| 8594 | |
| 8595 | void AddCFAuditedAttribute(Decl *D); |
| 8596 | |
| 8597 | void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, |
| 8598 | SourceLocation PragmaLoc, |
| 8599 | attr::ParsedSubjectMatchRuleSet Rules); |
| 8600 | void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, |
| 8601 | const IdentifierInfo *Namespace); |
| 8602 | |
| 8603 | |
| 8604 | void ActOnPragmaAttributePop(SourceLocation PragmaLoc, |
| 8605 | const IdentifierInfo *Namespace); |
| 8606 | |
| 8607 | |
| 8608 | |
| 8609 | void AddPragmaAttributes(Scope *S, Decl *D); |
| 8610 | |
| 8611 | void DiagnoseUnterminatedPragmaAttribute(); |
| 8612 | |
| 8613 | |
| 8614 | void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc); |
| 8615 | |
| 8616 | |
| 8617 | |
| 8618 | SourceLocation getOptimizeOffPragmaLocation() const { |
| 8619 | return OptimizeOffPragmaLocation; |
| 8620 | } |
| 8621 | |
| 8622 | |
| 8623 | |
| 8624 | |
| 8625 | void AddRangeBasedOptnone(FunctionDecl *FD); |
| 8626 | |
| 8627 | |
| 8628 | |
| 8629 | |
| 8630 | void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc); |
| 8631 | |
| 8632 | |
| 8633 | void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, |
| 8634 | unsigned SpellingListIndex, bool IsPackExpansion); |
| 8635 | void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T, |
| 8636 | unsigned SpellingListIndex, bool IsPackExpansion); |
| 8637 | |
| 8638 | |
| 8639 | |
| 8640 | void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE, |
| 8641 | unsigned SpellingListIndex); |
| 8642 | |
| 8643 | |
| 8644 | |
| 8645 | void AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr, |
| 8646 | unsigned SpellingListIndex); |
| 8647 | |
| 8648 | |
| 8649 | |
| 8650 | void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, |
| 8651 | unsigned SpellingListIndex); |
| 8652 | |
| 8653 | |
| 8654 | |
| 8655 | void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads, |
| 8656 | Expr *MinBlocks, unsigned SpellingListIndex); |
| 8657 | |
| 8658 | |
| 8659 | void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name, |
| 8660 | unsigned SpellingListIndex, bool InInstantiation = false); |
| 8661 | |
| 8662 | void AddParameterABIAttr(SourceRange AttrRange, Decl *D, |
| 8663 | ParameterABI ABI, unsigned SpellingListIndex); |
| 8664 | |
| 8665 | enum class RetainOwnershipKind {NS, CF, OS}; |
| 8666 | void AddXConsumedAttr(Decl *D, SourceRange SR, unsigned SpellingIndex, |
| 8667 | RetainOwnershipKind K, bool IsTemplateInstantiation); |
| 8668 | |
| 8669 | |
| 8670 | |
| 8671 | void addAMDGPUFlatWorkGroupSizeAttr(SourceRange AttrRange, Decl *D, Expr *Min, |
| 8672 | Expr *Max, unsigned SpellingListIndex); |
| 8673 | |
| 8674 | |
| 8675 | |
| 8676 | void addAMDGPUWavesPerEUAttr(SourceRange AttrRange, Decl *D, Expr *Min, |
| 8677 | Expr *Max, unsigned SpellingListIndex); |
| 8678 | |
| 8679 | bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type); |
| 8680 | |
| 8681 | |
| 8682 | |
| 8683 | |
| 8684 | bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, |
| 8685 | StringRef Keyword); |
| 8686 | ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E); |
| 8687 | ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E); |
| 8688 | StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E); |
| 8689 | |
| 8690 | ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, |
| 8691 | bool IsImplicit = false); |
| 8692 | ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, |
| 8693 | UnresolvedLookupExpr* Lookup); |
| 8694 | ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E); |
| 8695 | StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, |
| 8696 | bool IsImplicit = false); |
| 8697 | StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs); |
| 8698 | bool buildCoroutineParameterMoves(SourceLocation Loc); |
| 8699 | VarDecl *buildCoroutinePromise(SourceLocation Loc); |
| 8700 | void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body); |
| 8701 | ClassTemplateDecl *lookupCoroutineTraits(SourceLocation KwLoc, |
| 8702 | SourceLocation FuncLoc); |
| 8703 | |
| 8704 | |
| 8705 | |
| 8706 | |
| 8707 | private: |
| 8708 | std::string CurrOpenCLExtension; |
| 8709 | |
| 8710 | llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap; |
| 8711 | |
| 8712 | llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap; |
| 8713 | public: |
| 8714 | llvm::StringRef getCurrentOpenCLExtension() const { |
| 8715 | return CurrOpenCLExtension; |
| 8716 | } |
| 8717 | |
| 8718 | |
| 8719 | |
| 8720 | |
| 8721 | std::string getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD); |
| 8722 | |
| 8723 | |
| 8724 | |
| 8725 | |
| 8726 | std::string getOpenCLExtensionsFromTypeExtMap(FunctionType *FT); |
| 8727 | |
| 8728 | |
| 8729 | template<typename T, typename MapT> |
| 8730 | std::string getOpenCLExtensionsFromExtMap(T* FT, MapT &Map); |
| 8731 | |
| 8732 | void setCurrentOpenCLExtension(llvm::StringRef Ext) { |
| 8733 | CurrOpenCLExtension = Ext; |
| 8734 | } |
| 8735 | |
| 8736 | |
| 8737 | |
| 8738 | |
| 8739 | void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts); |
| 8740 | |
| 8741 | |
| 8742 | |
| 8743 | |
| 8744 | |
| 8745 | void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts); |
| 8746 | |
| 8747 | |
| 8748 | |
| 8749 | |
| 8750 | void setCurrentOpenCLExtensionForType(QualType T); |
| 8751 | |
| 8752 | |
| 8753 | |
| 8754 | |
| 8755 | void setCurrentOpenCLExtensionForDecl(Decl *FD); |
| 8756 | |
| 8757 | bool isOpenCLDisabledDecl(Decl *FD); |
| 8758 | |
| 8759 | |
| 8760 | |
| 8761 | |
| 8762 | |
| 8763 | bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T); |
| 8764 | |
| 8765 | |
| 8766 | |
| 8767 | |
| 8768 | |
| 8769 | bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E); |
| 8770 | |
| 8771 | |
| 8772 | |
| 8773 | |
| 8774 | private: |
| 8775 | void *VarDataSharingAttributesStack; |
| 8776 | |
| 8777 | unsigned DeclareTargetNestingLevel = 0; |
| 8778 | |
| 8779 | void InitDataSharingAttributesStack(); |
| 8780 | void DestroyDataSharingAttributesStack(); |
| 8781 | ExprResult |
| 8782 | VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind, |
| 8783 | bool StrictlyPositive = true); |
| 8784 | |
| 8785 | unsigned getOpenMPNestingLevel() const; |
| 8786 | |
| 8787 | |
| 8788 | void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex, |
| 8789 | unsigned Level) const; |
| 8790 | |
| 8791 | |
| 8792 | void pushOpenMPFunctionRegion(); |
| 8793 | |
| 8794 | |
| 8795 | void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI); |
| 8796 | |
| 8797 | |
| 8798 | void checkOpenMPDeviceFunction(SourceLocation Loc, FunctionDecl *Callee); |
| 8799 | |
| 8800 | |
| 8801 | |
| 8802 | void checkOpenMPDeviceExpr(const Expr *E); |
| 8803 | |
| 8804 | |
| 8805 | |
| 8806 | |
| 8807 | |
| 8808 | |
| 8809 | |
| 8810 | |
| 8811 | |
| 8812 | |
| 8813 | |
| 8814 | template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT> |
| 8815 | bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo, |
| 8816 | MapT &Map, unsigned Selector = 0, |
| 8817 | SourceRange SrcRange = SourceRange()); |
| 8818 | |
| 8819 | public: |
| 8820 | |
| 8821 | |
| 8822 | |
| 8823 | |
| 8824 | bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level) const; |
| 8825 | |
| 8826 | |
| 8827 | |
| 8828 | |
| 8829 | VarDecl *isOpenMPCapturedDecl(ValueDecl *D); |
| 8830 | ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, |
| 8831 | ExprObjectKind OK, SourceLocation Loc); |
| 8832 | |
| 8833 | |
| 8834 | |
| 8835 | void startOpenMPLoop(); |
| 8836 | |
| 8837 | |
| 8838 | |
| 8839 | |
| 8840 | bool isOpenMPPrivateDecl(const ValueDecl *D, unsigned Level) const; |
| 8841 | |
| 8842 | |
| 8843 | |
| 8844 | |
| 8845 | void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level); |
| 8846 | |
| 8847 | |
| 8848 | |
| 8849 | |
| 8850 | bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level) const; |
| 8851 | |
| 8852 | ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, |
| 8853 | Expr *Op); |
| 8854 | |
| 8855 | void StartOpenMPDSABlock(OpenMPDirectiveKind K, |
| 8856 | const DeclarationNameInfo &DirName, Scope *CurScope, |
| 8857 | SourceLocation Loc); |
| 8858 | |
| 8859 | void StartOpenMPClause(OpenMPClauseKind K); |
| 8860 | |
| 8861 | void EndOpenMPClause(); |
| 8862 | |
| 8863 | void EndOpenMPDSABlock(Stmt *CurDirective); |
| 8864 | |
| 8865 | |
| 8866 | |
| 8867 | |
| 8868 | |
| 8869 | void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init); |
| 8870 | |
| 8871 | |
| 8872 | |
| 8873 | |
| 8874 | ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, |
| 8875 | const DeclarationNameInfo &Id, |
| 8876 | OpenMPDirectiveKind Kind); |
| 8877 | |
| 8878 | DeclGroupPtrTy ActOnOpenMPThreadprivateDirective( |
| 8879 | SourceLocation Loc, |
| 8880 | ArrayRef<Expr *> VarList); |
| 8881 | |
| 8882 | OMPThreadPrivateDecl *CheckOMPThreadPrivateDecl(SourceLocation Loc, |
| 8883 | ArrayRef<Expr *> VarList); |
| 8884 | |
| 8885 | DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, |
| 8886 | ArrayRef<Expr *> VarList, |
| 8887 | ArrayRef<OMPClause *> Clauses, |
| 8888 | DeclContext *Owner = nullptr); |
| 8889 | |
| 8890 | DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, |
| 8891 | ArrayRef<OMPClause *> ClauseList); |
| 8892 | |
| 8893 | OMPRequiresDecl *CheckOMPRequiresDecl(SourceLocation Loc, |
| 8894 | ArrayRef<OMPClause *> Clauses); |
| 8895 | |
| 8896 | |
| 8897 | QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, |
| 8898 | TypeResult ParsedType); |
| 8899 | |
| 8900 | DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart( |
| 8901 | Scope *S, DeclContext *DC, DeclarationName Name, |
| 8902 | ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes, |
| 8903 | AccessSpecifier AS, Decl *PrevDeclInScope = nullptr); |
| 8904 | |
| 8905 | void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D); |
| 8906 | |
| 8907 | void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner); |
| 8908 | |
| 8909 | |
| 8910 | VarDecl *ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D); |
| 8911 | |
| 8912 | void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, |
| 8913 | VarDecl *OmpPrivParm); |
| 8914 | |
| 8915 | DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd( |
| 8916 | Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid); |
| 8917 | |
| 8918 | |
| 8919 | TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D); |
| 8920 | |
| 8921 | |
| 8922 | QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, |
| 8923 | TypeResult ParsedType); |
| 8924 | |
| 8925 | OMPDeclareMapperDecl *ActOnOpenMPDeclareMapperDirectiveStart( |
| 8926 | Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, |
| 8927 | SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, |
| 8928 | Decl *PrevDeclInScope = nullptr); |
| 8929 | |
| 8930 | void ActOnOpenMPDeclareMapperDirectiveVarDecl(OMPDeclareMapperDecl *DMD, |
| 8931 | Scope *S, QualType MapperType, |
| 8932 | SourceLocation StartLoc, |
| 8933 | DeclarationName VN); |
| 8934 | |
| 8935 | DeclGroupPtrTy |
| 8936 | ActOnOpenMPDeclareMapperDirectiveEnd(OMPDeclareMapperDecl *D, Scope *S, |
| 8937 | ArrayRef<OMPClause *> ClauseList); |
| 8938 | |
| 8939 | |
| 8940 | bool ActOnStartOpenMPDeclareTargetDirective(SourceLocation Loc); |
| 8941 | |
| 8942 | void ActOnFinishOpenMPDeclareTargetDirective(); |
| 8943 | |
| 8944 | void ActOnOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, |
| 8945 | const DeclarationNameInfo &Id, |
| 8946 | OMPDeclareTargetDeclAttr::MapTypeTy MT, |
| 8947 | NamedDeclSetType &SameDirectiveDecls); |
| 8948 | |
| 8949 | void |
| 8950 | checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, |
| 8951 | SourceLocation IdLoc = SourceLocation()); |
| 8952 | |
| 8953 | bool isInOpenMPDeclareTargetContext() const { |
| 8954 | return DeclareTargetNestingLevel > 0; |
| 8955 | } |
| 8956 | |
| 8957 | bool isInOpenMPTargetExecutionDirective() const; |
| 8958 | |
| 8959 | |
| 8960 | bool shouldDiagnoseTargetSupportFromOpenMP() const { |
| 8961 | return !getLangOpts().OpenMPIsDevice || isInOpenMPDeclareTargetContext() || |
| 8962 | isInOpenMPTargetExecutionDirective(); |
| 8963 | } |
| 8964 | |
| 8965 | |
| 8966 | static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind); |
| 8967 | |
| 8968 | |
| 8969 | void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope); |
| 8970 | |
| 8971 | |
| 8972 | |
| 8973 | |
| 8974 | |
| 8975 | |
| 8976 | StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef<OMPClause *> Clauses); |
| 8977 | StmtResult ActOnOpenMPExecutableDirective( |
| 8978 | OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, |
| 8979 | OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses, |
| 8980 | Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc); |
| 8981 | |
| 8982 | |
| 8983 | StmtResult ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses, |
| 8984 | Stmt *AStmt, |
| 8985 | SourceLocation StartLoc, |
| 8986 | SourceLocation EndLoc); |
| 8987 | using VarsWithInheritedDSAType = |
| 8988 | llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>; |
| 8989 | |
| 8990 | |
| 8991 | StmtResult |
| 8992 | ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 8993 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 8994 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 8995 | |
| 8996 | |
| 8997 | StmtResult |
| 8998 | ActOnOpenMPForDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 8999 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 9000 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9001 | |
| 9002 | |
| 9003 | StmtResult |
| 9004 | ActOnOpenMPForSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 9005 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 9006 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9007 | |
| 9008 | |
| 9009 | StmtResult ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses, |
| 9010 | Stmt *AStmt, SourceLocation StartLoc, |
| 9011 | SourceLocation EndLoc); |
| 9012 | |
| 9013 | |
| 9014 | StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, |
| 9015 | SourceLocation EndLoc); |
| 9016 | |
| 9017 | |
| 9018 | StmtResult ActOnOpenMPSingleDirective(ArrayRef<OMPClause *> Clauses, |
| 9019 | Stmt *AStmt, SourceLocation StartLoc, |
| 9020 | SourceLocation EndLoc); |
| 9021 | |
| 9022 | |
| 9023 | StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, |
| 9024 | SourceLocation EndLoc); |
| 9025 | |
| 9026 | |
| 9027 | StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, |
| 9028 | ArrayRef<OMPClause *> Clauses, |
| 9029 | Stmt *AStmt, SourceLocation StartLoc, |
| 9030 | SourceLocation EndLoc); |
| 9031 | |
| 9032 | |
| 9033 | StmtResult ActOnOpenMPParallelForDirective( |
| 9034 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9035 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9036 | |
| 9037 | |
| 9038 | StmtResult ActOnOpenMPParallelForSimdDirective( |
| 9039 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9040 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9041 | |
| 9042 | |
| 9043 | StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses, |
| 9044 | Stmt *AStmt, |
| 9045 | SourceLocation StartLoc, |
| 9046 | SourceLocation EndLoc); |
| 9047 | |
| 9048 | |
| 9049 | StmtResult ActOnOpenMPTaskDirective(ArrayRef<OMPClause *> Clauses, |
| 9050 | Stmt *AStmt, SourceLocation StartLoc, |
| 9051 | SourceLocation EndLoc); |
| 9052 | |
| 9053 | StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, |
| 9054 | SourceLocation EndLoc); |
| 9055 | |
| 9056 | StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, |
| 9057 | SourceLocation EndLoc); |
| 9058 | |
| 9059 | StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc, |
| 9060 | SourceLocation EndLoc); |
| 9061 | |
| 9062 | StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef<OMPClause *> Clauses, |
| 9063 | Stmt *AStmt, SourceLocation StartLoc, |
| 9064 | SourceLocation EndLoc); |
| 9065 | |
| 9066 | StmtResult ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses, |
| 9067 | SourceLocation StartLoc, |
| 9068 | SourceLocation EndLoc); |
| 9069 | |
| 9070 | |
| 9071 | StmtResult ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses, |
| 9072 | Stmt *AStmt, SourceLocation StartLoc, |
| 9073 | SourceLocation EndLoc); |
| 9074 | |
| 9075 | |
| 9076 | StmtResult ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses, |
| 9077 | Stmt *AStmt, SourceLocation StartLoc, |
| 9078 | SourceLocation EndLoc); |
| 9079 | |
| 9080 | |
| 9081 | StmtResult ActOnOpenMPTargetDirective(ArrayRef<OMPClause *> Clauses, |
| 9082 | Stmt *AStmt, SourceLocation StartLoc, |
| 9083 | SourceLocation EndLoc); |
| 9084 | |
| 9085 | |
| 9086 | StmtResult ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses, |
| 9087 | Stmt *AStmt, SourceLocation StartLoc, |
| 9088 | SourceLocation EndLoc); |
| 9089 | |
| 9090 | |
| 9091 | StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef<OMPClause *> Clauses, |
| 9092 | SourceLocation StartLoc, |
| 9093 | SourceLocation EndLoc, |
| 9094 | Stmt *AStmt); |
| 9095 | |
| 9096 | |
| 9097 | StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef<OMPClause *> Clauses, |
| 9098 | SourceLocation StartLoc, |
| 9099 | SourceLocation EndLoc, |
| 9100 | Stmt *AStmt); |
| 9101 | |
| 9102 | |
| 9103 | StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef<OMPClause *> Clauses, |
| 9104 | Stmt *AStmt, |
| 9105 | SourceLocation StartLoc, |
| 9106 | SourceLocation EndLoc); |
| 9107 | |
| 9108 | |
| 9109 | StmtResult ActOnOpenMPTargetParallelForDirective( |
| 9110 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9111 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9112 | |
| 9113 | |
| 9114 | StmtResult ActOnOpenMPTeamsDirective(ArrayRef<OMPClause *> Clauses, |
| 9115 | Stmt *AStmt, SourceLocation StartLoc, |
| 9116 | SourceLocation EndLoc); |
| 9117 | |
| 9118 | StmtResult |
| 9119 | ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, |
| 9120 | SourceLocation EndLoc, |
| 9121 | OpenMPDirectiveKind CancelRegion); |
| 9122 | |
| 9123 | StmtResult ActOnOpenMPCancelDirective(ArrayRef<OMPClause *> Clauses, |
| 9124 | SourceLocation StartLoc, |
| 9125 | SourceLocation EndLoc, |
| 9126 | OpenMPDirectiveKind CancelRegion); |
| 9127 | |
| 9128 | |
| 9129 | StmtResult |
| 9130 | ActOnOpenMPTaskLoopDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 9131 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 9132 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9133 | |
| 9134 | |
| 9135 | StmtResult ActOnOpenMPTaskLoopSimdDirective( |
| 9136 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9137 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9138 | |
| 9139 | |
| 9140 | StmtResult |
| 9141 | ActOnOpenMPDistributeDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 9142 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 9143 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9144 | |
| 9145 | StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef<OMPClause *> Clauses, |
| 9146 | SourceLocation StartLoc, |
| 9147 | SourceLocation EndLoc, |
| 9148 | Stmt *AStmt); |
| 9149 | |
| 9150 | |
| 9151 | StmtResult ActOnOpenMPDistributeParallelForDirective( |
| 9152 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9153 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9154 | |
| 9155 | |
| 9156 | StmtResult ActOnOpenMPDistributeParallelForSimdDirective( |
| 9157 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9158 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9159 | |
| 9160 | |
| 9161 | StmtResult ActOnOpenMPDistributeSimdDirective( |
| 9162 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9163 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9164 | |
| 9165 | |
| 9166 | StmtResult ActOnOpenMPTargetParallelForSimdDirective( |
| 9167 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9168 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9169 | |
| 9170 | |
| 9171 | StmtResult |
| 9172 | ActOnOpenMPTargetSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt, |
| 9173 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 9174 | VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9175 | |
| 9176 | |
| 9177 | StmtResult ActOnOpenMPTeamsDistributeDirective( |
| 9178 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9179 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9180 | |
| 9181 | |
| 9182 | StmtResult ActOnOpenMPTeamsDistributeSimdDirective( |
| 9183 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9184 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9185 | |
| 9186 | |
| 9187 | StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective( |
| 9188 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9189 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9190 | |
| 9191 | |
| 9192 | StmtResult ActOnOpenMPTeamsDistributeParallelForDirective( |
| 9193 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9194 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9195 | |
| 9196 | |
| 9197 | StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef<OMPClause *> Clauses, |
| 9198 | Stmt *AStmt, |
| 9199 | SourceLocation StartLoc, |
| 9200 | SourceLocation EndLoc); |
| 9201 | |
| 9202 | |
| 9203 | StmtResult ActOnOpenMPTargetTeamsDistributeDirective( |
| 9204 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9205 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9206 | |
| 9207 | |
| 9208 | StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective( |
| 9209 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9210 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9211 | |
| 9212 | |
| 9213 | StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective( |
| 9214 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9215 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9216 | |
| 9217 | |
| 9218 | StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective( |
| 9219 | ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, |
| 9220 | SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); |
| 9221 | |
| 9222 | |
| 9223 | bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, |
| 9224 | SourceLocation LinLoc); |
| 9225 | |
| 9226 | |
| 9227 | bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, |
| 9228 | OpenMPLinearClauseKind LinKind, QualType Type); |
| 9229 | |
| 9230 | |
| 9231 | |
| 9232 | DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective( |
| 9233 | DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, |
| 9234 | Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds, |
| 9235 | ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears, |
| 9236 | ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR); |
| 9237 | |
| 9238 | OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, |
| 9239 | Expr *Expr, |
| 9240 | SourceLocation StartLoc, |
| 9241 | SourceLocation LParenLoc, |
| 9242 | SourceLocation EndLoc); |
| 9243 | |
| 9244 | OMPClause *ActOnOpenMPAllocatorClause(Expr *Allocator, |
| 9245 | SourceLocation StartLoc, |
| 9246 | SourceLocation LParenLoc, |
| 9247 | SourceLocation EndLoc); |
| 9248 | |
| 9249 | OMPClause *ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, |
| 9250 | Expr *Condition, SourceLocation StartLoc, |
| 9251 | SourceLocation LParenLoc, |
| 9252 | SourceLocation NameModifierLoc, |
| 9253 | SourceLocation ColonLoc, |
| 9254 | SourceLocation EndLoc); |
| 9255 | |
| 9256 | OMPClause *ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, |
| 9257 | SourceLocation LParenLoc, |
| 9258 | SourceLocation EndLoc); |
| 9259 | |
| 9260 | OMPClause *ActOnOpenMPNumThreadsClause(Expr *NumThreads, |
| 9261 | SourceLocation StartLoc, |
| 9262 | SourceLocation LParenLoc, |
| 9263 | SourceLocation EndLoc); |
| 9264 | |
| 9265 | OMPClause *ActOnOpenMPSafelenClause(Expr *Length, |
| 9266 | SourceLocation StartLoc, |
| 9267 | SourceLocation LParenLoc, |
| 9268 | SourceLocation EndLoc); |
| 9269 | |
| 9270 | OMPClause *ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, |
| 9271 | SourceLocation LParenLoc, |
| 9272 | SourceLocation EndLoc); |
| 9273 | |
| 9274 | OMPClause *ActOnOpenMPCollapseClause(Expr *NumForLoops, |
| 9275 | SourceLocation StartLoc, |
| 9276 | SourceLocation LParenLoc, |
| 9277 | SourceLocation EndLoc); |
| 9278 | |
| 9279 | OMPClause * |
| 9280 | ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, |
| 9281 | SourceLocation LParenLoc = SourceLocation(), |
| 9282 | Expr *NumForLoops = nullptr); |
| 9283 | |
| 9284 | OMPClause *ActOnOpenMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, |
| 9285 | SourceLocation LParenLoc, |
| 9286 | SourceLocation EndLoc); |
| 9287 | |
| 9288 | OMPClause *ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, |
| 9289 | SourceLocation LParenLoc, |
| 9290 | SourceLocation EndLoc); |
| 9291 | |
| 9292 | OMPClause *ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, |
| 9293 | SourceLocation LParenLoc, |
| 9294 | SourceLocation EndLoc); |
| 9295 | |
| 9296 | OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, |
| 9297 | unsigned Argument, |
| 9298 | SourceLocation ArgumentLoc, |
| 9299 | SourceLocation StartLoc, |
| 9300 | SourceLocation LParenLoc, |
| 9301 | SourceLocation EndLoc); |
| 9302 | |
| 9303 | OMPClause *ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind, |
| 9304 | SourceLocation KindLoc, |
| 9305 | SourceLocation StartLoc, |
| 9306 | SourceLocation LParenLoc, |
| 9307 | SourceLocation EndLoc); |
| 9308 | |
| 9309 | OMPClause *ActOnOpenMPProcBindClause(OpenMPProcBindClauseKind Kind, |
| 9310 | SourceLocation KindLoc, |
| 9311 | SourceLocation StartLoc, |
| 9312 | SourceLocation LParenLoc, |
| 9313 | SourceLocation EndLoc); |
| 9314 | |
| 9315 | OMPClause *ActOnOpenMPSingleExprWithArgClause( |
| 9316 | OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr, |
| 9317 | SourceLocation StartLoc, SourceLocation LParenLoc, |
| 9318 | ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc, |
| 9319 | SourceLocation EndLoc); |
| 9320 | |
| 9321 | OMPClause *ActOnOpenMPScheduleClause( |
| 9322 | OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, |
| 9323 | OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, |
| 9324 | SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, |
| 9325 | SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc); |
| 9326 | |
| 9327 | OMPClause *ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, |
| 9328 | SourceLocation EndLoc); |
| 9329 | |
| 9330 | OMPClause *ActOnOpenMPNowaitClause(SourceLocation StartLoc, |
| 9331 | SourceLocation EndLoc); |
| 9332 | |
| 9333 | OMPClause *ActOnOpenMPUntiedClause(SourceLocation StartLoc, |
| 9334 | SourceLocation EndLoc); |
| 9335 | |
| 9336 | OMPClause *ActOnOpenMPMergeableClause(SourceLocation StartLoc, |
| 9337 | SourceLocation EndLoc); |
| 9338 | |
| 9339 | OMPClause *ActOnOpenMPReadClause(SourceLocation StartLoc, |
| 9340 | SourceLocation EndLoc); |
| 9341 | |
| 9342 | OMPClause *ActOnOpenMPWriteClause(SourceLocation StartLoc, |
| 9343 | SourceLocation EndLoc); |
| 9344 | |
| 9345 | OMPClause *ActOnOpenMPUpdateClause(SourceLocation StartLoc, |
| 9346 | SourceLocation EndLoc); |
| 9347 | |
| 9348 | OMPClause *ActOnOpenMPCaptureClause(SourceLocation StartLoc, |
| 9349 | SourceLocation EndLoc); |
| 9350 | |
| 9351 | OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc, |
| 9352 | SourceLocation EndLoc); |
| 9353 | |
| 9354 | OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc, |
| 9355 | SourceLocation EndLoc); |
| 9356 | |
| 9357 | OMPClause *ActOnOpenMPSIMDClause(SourceLocation StartLoc, |
| 9358 | SourceLocation EndLoc); |
| 9359 | |
| 9360 | OMPClause *ActOnOpenMPNogroupClause(SourceLocation StartLoc, |
| 9361 | SourceLocation EndLoc); |
| 9362 | |
| 9363 | OMPClause *ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, |
| 9364 | SourceLocation EndLoc); |
| 9365 | |
| 9366 | |
| 9367 | OMPClause *ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, |
| 9368 | SourceLocation EndLoc); |
| 9369 | |
| 9370 | |
| 9371 | OMPClause *ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, |
| 9372 | SourceLocation EndLoc); |
| 9373 | |
| 9374 | |
| 9375 | OMPClause *ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, |
| 9376 | SourceLocation EndLoc); |
| 9377 | |
| 9378 | |
| 9379 | OMPClause *ActOnOpenMPAtomicDefaultMemOrderClause( |
| 9380 | OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, |
| 9381 | SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc); |
| 9382 | |
| 9383 | OMPClause *ActOnOpenMPVarListClause( |
| 9384 | OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr, |
| 9385 | const OMPVarListLocTy &Locs, SourceLocation ColonLoc, |
| 9386 | CXXScopeSpec &ReductionOrMapperIdScopeSpec, |
| 9387 | DeclarationNameInfo &ReductionOrMapperId, OpenMPDependClauseKind DepKind, |
| 9388 | OpenMPLinearClauseKind LinKind, |
| 9389 | ArrayRef<OpenMPMapModifierKind> MapTypeModifiers, |
| 9390 | ArrayRef<SourceLocation> MapTypeModifiersLoc, OpenMPMapClauseKind MapType, |
| 9391 | bool IsMapTypeImplicit, SourceLocation DepLinMapLoc); |
| 9392 | |
| 9393 | OMPClause * |
| 9394 | ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef<Expr *> VarList, |
| 9395 | SourceLocation StartLoc, SourceLocation ColonLoc, |
| 9396 | SourceLocation LParenLoc, SourceLocation EndLoc); |
| 9397 | |
| 9398 | OMPClause *ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList, |
| 9399 | SourceLocation StartLoc, |
| 9400 | SourceLocation LParenLoc, |
| 9401 | SourceLocation EndLoc); |
| 9402 | |
| 9403 | OMPClause *ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList, |
| 9404 | SourceLocation StartLoc, |
| 9405 | SourceLocation LParenLoc, |
| 9406 | SourceLocation EndLoc); |
| 9407 | |
| 9408 | OMPClause *ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList, |
| 9409 | SourceLocation StartLoc, |
| 9410 | SourceLocation LParenLoc, |
| 9411 | SourceLocation EndLoc); |
| 9412 | |
| 9413 | OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList, |
| 9414 | SourceLocation StartLoc, |
| 9415 | SourceLocation LParenLoc, |
| 9416 | SourceLocation EndLoc); |
| 9417 | |
| 9418 | OMPClause *ActOnOpenMPReductionClause( |
| 9419 | ArrayRef<Expr *> VarList, SourceLocation StartLoc, |
| 9420 | SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, |
| 9421 | CXXScopeSpec &ReductionIdScopeSpec, |
| 9422 | const DeclarationNameInfo &ReductionId, |
| 9423 | ArrayRef<Expr *> UnresolvedReductions = llvm::None); |
| 9424 | |
| 9425 | OMPClause *ActOnOpenMPTaskReductionClause( |
| 9426 | ArrayRef<Expr *> VarList, SourceLocation StartLoc, |
| 9427 | SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, |
| 9428 | CXXScopeSpec &ReductionIdScopeSpec, |
| 9429 | const DeclarationNameInfo &ReductionId, |
| 9430 | ArrayRef<Expr *> UnresolvedReductions = llvm::None); |
| 9431 | |
| 9432 | OMPClause *ActOnOpenMPInReductionClause( |
| 9433 | ArrayRef<Expr *> VarList, SourceLocation StartLoc, |
| 9434 | SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, |
| 9435 | CXXScopeSpec &ReductionIdScopeSpec, |
| 9436 | const DeclarationNameInfo &ReductionId, |
| 9437 | ArrayRef<Expr *> UnresolvedReductions = llvm::None); |
| 9438 | |
| 9439 | OMPClause * |
| 9440 | ActOnOpenMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step, |
| 9441 | SourceLocation StartLoc, SourceLocation LParenLoc, |
| 9442 | OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, |
| 9443 | SourceLocation ColonLoc, SourceLocation EndLoc); |
| 9444 | |
| 9445 | OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, |
| 9446 | Expr *Alignment, |
| 9447 | SourceLocation StartLoc, |
| 9448 | SourceLocation LParenLoc, |
| 9449 | SourceLocation ColonLoc, |
| 9450 | SourceLocation EndLoc); |
| 9451 | |
| 9452 | OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList, |
| 9453 | SourceLocation StartLoc, |
| 9454 | SourceLocation LParenLoc, |
| 9455 | SourceLocation EndLoc); |
| 9456 | |
| 9457 | OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList, |
| 9458 | SourceLocation StartLoc, |
| 9459 | SourceLocation LParenLoc, |
| 9460 | SourceLocation EndLoc); |
| 9461 | |
| 9462 | OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList, |
| 9463 | SourceLocation StartLoc, |
| 9464 | SourceLocation LParenLoc, |
| 9465 | SourceLocation EndLoc); |
| 9466 | |
| 9467 | OMPClause * |
| 9468 | ActOnOpenMPDependClause(OpenMPDependClauseKind DepKind, SourceLocation DepLoc, |
| 9469 | SourceLocation ColonLoc, ArrayRef<Expr *> VarList, |
| 9470 | SourceLocation StartLoc, SourceLocation LParenLoc, |
| 9471 | SourceLocation EndLoc); |
| 9472 | |
| 9473 | OMPClause *ActOnOpenMPDeviceClause(Expr *Device, SourceLocation StartLoc, |
| 9474 | SourceLocation LParenLoc, |
| 9475 | SourceLocation EndLoc); |
| 9476 | |
| 9477 | OMPClause * |
| 9478 | ActOnOpenMPMapClause(ArrayRef<OpenMPMapModifierKind> MapTypeModifiers, |
| 9479 | ArrayRef<SourceLocation> MapTypeModifiersLoc, |
| 9480 | CXXScopeSpec &MapperIdScopeSpec, |
| 9481 | DeclarationNameInfo &MapperId, |
| 9482 | OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, |
| 9483 | SourceLocation MapLoc, SourceLocation ColonLoc, |
| 9484 | ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs, |
| 9485 | ArrayRef<Expr *> UnresolvedMappers = llvm::None); |
| 9486 | |
| 9487 | OMPClause *ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, |
| 9488 | SourceLocation LParenLoc, |
| 9489 | SourceLocation EndLoc); |
| 9490 | |
| 9491 | OMPClause *ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, |
| 9492 | SourceLocation StartLoc, |
| 9493 | SourceLocation LParenLoc, |
| 9494 | SourceLocation EndLoc); |
| 9495 | |
| 9496 | OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, |
| 9497 | SourceLocation LParenLoc, |
| 9498 | SourceLocation EndLoc); |
| 9499 | |
| 9500 | OMPClause *ActOnOpenMPDistScheduleClause( |
| 9501 | OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, |
| 9502 | SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, |
| 9503 | SourceLocation CommaLoc, SourceLocation EndLoc); |
| 9504 | |
| 9505 | OMPClause *ActOnOpenMPDefaultmapClause( |
| 9506 | OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, |
| 9507 | SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, |
| 9508 | SourceLocation KindLoc, SourceLocation EndLoc); |
| 9509 | |
| 9510 | OMPClause * |
| 9511 | ActOnOpenMPToClause(ArrayRef<Expr *> VarList, CXXScopeSpec &MapperIdScopeSpec, |
| 9512 | DeclarationNameInfo &MapperId, |
| 9513 | const OMPVarListLocTy &Locs, |
| 9514 | ArrayRef<Expr *> UnresolvedMappers = llvm::None); |
| 9515 | |
| 9516 | OMPClause *ActOnOpenMPFromClause( |
| 9517 | ArrayRef<Expr *> VarList, CXXScopeSpec &MapperIdScopeSpec, |
| 9518 | DeclarationNameInfo &MapperId, const OMPVarListLocTy &Locs, |
| 9519 | ArrayRef<Expr *> UnresolvedMappers = llvm::None); |
| 9520 | |
| 9521 | OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList, |
| 9522 | const OMPVarListLocTy &Locs); |
| 9523 | |
| 9524 | OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList, |
| 9525 | const OMPVarListLocTy &Locs); |
| 9526 | |
| 9527 | |
| 9528 | enum CheckedConversionKind { |
| 9529 | |
| 9530 | CCK_ImplicitConversion, |
| 9531 | |
| 9532 | CCK_CStyleCast, |
| 9533 | |
| 9534 | CCK_FunctionalCast, |
| 9535 | |
| 9536 | CCK_OtherCast, |
| 9537 | |
| 9538 | CCK_ForBuiltinOverloadedOp |
| 9539 | }; |
| 9540 | |
| 9541 | static bool isCast(CheckedConversionKind CCK) { |
| 9542 | return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast || |
| 9543 | CCK == CCK_OtherCast; |
| 9544 | } |
| 9545 | |
| 9546 | |
| 9547 | |
| 9548 | |
| 9549 | ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, |
| 9550 | ExprValueKind VK = VK_RValue, |
| 9551 | const CXXCastPath *BasePath = nullptr, |
| 9552 | CheckedConversionKind CCK |
| 9553 | = CCK_ImplicitConversion); |
| 9554 | |
| 9555 | |
| 9556 | |
| 9557 | static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy); |
| 9558 | |
| 9559 | |
| 9560 | |
| 9561 | |
| 9562 | ExprResult IgnoredValueConversions(Expr *E); |
| 9563 | |
| 9564 | |
| 9565 | |
| 9566 | ExprResult UsualUnaryConversions(Expr *E); |
| 9567 | |
| 9568 | |
| 9569 | |
| 9570 | ExprResult CallExprUnaryConversions(Expr *E); |
| 9571 | |
| 9572 | |
| 9573 | |
| 9574 | ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose = true); |
| 9575 | |
| 9576 | |
| 9577 | |
| 9578 | |
| 9579 | ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, |
| 9580 | bool Diagnose = true); |
| 9581 | |
| 9582 | |
| 9583 | |
| 9584 | |
| 9585 | |
| 9586 | ExprResult DefaultLvalueConversion(Expr *E); |
| 9587 | |
| 9588 | |
| 9589 | |
| 9590 | |
| 9591 | ExprResult DefaultArgumentPromotion(Expr *E); |
| 9592 | |
| 9593 | |
| 9594 | |
| 9595 | |
| 9596 | ExprResult TemporaryMaterializationConversion(Expr *E); |
| 9597 | |
| 9598 | |
| 9599 | enum VariadicCallType { |
| 9600 | VariadicFunction, |
| 9601 | VariadicBlock, |
| 9602 | VariadicMethod, |
| 9603 | VariadicConstructor, |
| 9604 | VariadicDoesNotApply |
| 9605 | }; |
| 9606 | |
| 9607 | VariadicCallType getVariadicCallType(FunctionDecl *FDecl, |
| 9608 | const FunctionProtoType *Proto, |
| 9609 | Expr *Fn); |
| 9610 | |
| 9611 | |
| 9612 | |
| 9613 | enum VarArgKind { |
| 9614 | VAK_Valid, |
| 9615 | VAK_ValidInCXX11, |
| 9616 | VAK_Undefined, |
| 9617 | VAK_MSVCUndefined, |
| 9618 | VAK_Invalid |
| 9619 | }; |
| 9620 | |
| 9621 | |
| 9622 | VarArgKind isValidVarArgType(const QualType &Ty); |
| 9623 | |
| 9624 | |
| 9625 | |
| 9626 | void checkVariadicArgument(const Expr *E, VariadicCallType CT); |
| 9627 | |
| 9628 | |
| 9629 | bool hasCStrMethod(const Expr *E); |
| 9630 | |
| 9631 | |
| 9632 | |
| 9633 | bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, |
| 9634 | const FunctionProtoType *Proto, |
| 9635 | unsigned FirstParam, ArrayRef<Expr *> Args, |
| 9636 | SmallVectorImpl<Expr *> &AllArgs, |
| 9637 | VariadicCallType CallType = VariadicDoesNotApply, |
| 9638 | bool AllowExplicit = false, |
| 9639 | bool IsListInitialization = false); |
| 9640 | |
| 9641 | |
| 9642 | |
| 9643 | ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, |
| 9644 | FunctionDecl *FDecl); |
| 9645 | |
| 9646 | |
| 9647 | |
| 9648 | |
| 9649 | |
| 9650 | |
| 9651 | QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, |
| 9652 | bool IsCompAssign = false); |
| 9653 | |
| 9654 | |
| 9655 | |
| 9656 | |
| 9657 | |
| 9658 | |
| 9659 | enum AssignConvertType { |
| 9660 | |
| 9661 | Compatible, |
| 9662 | |
| 9663 | |
| 9664 | |
| 9665 | PointerToInt, |
| 9666 | |
| 9667 | |
| 9668 | |
| 9669 | IntToPointer, |
| 9670 | |
| 9671 | |
| 9672 | |
| 9673 | FunctionVoidPointer, |
| 9674 | |
| 9675 | |
| 9676 | |
| 9677 | IncompatiblePointer, |
| 9678 | |
| 9679 | |
| 9680 | |
| 9681 | |
| 9682 | |
| 9683 | IncompatiblePointerSign, |
| 9684 | |
| 9685 | |
| 9686 | |
| 9687 | CompatiblePointerDiscardsQualifiers, |
| 9688 | |
| 9689 | |
| 9690 | |
| 9691 | |
| 9692 | IncompatiblePointerDiscardsQualifiers, |
| 9693 | |
| 9694 | |
| 9695 | |
| 9696 | |
| 9697 | |
| 9698 | IncompatibleNestedPointerQualifiers, |
| 9699 | |
| 9700 | |
| 9701 | |
| 9702 | IncompatibleVectors, |
| 9703 | |
| 9704 | |
| 9705 | |
| 9706 | IntToBlockPointer, |
| 9707 | |
| 9708 | |
| 9709 | |
| 9710 | IncompatibleBlockPointer, |
| 9711 | |
| 9712 | |
| 9713 | |
| 9714 | |
| 9715 | IncompatibleObjCQualifiedId, |
| 9716 | |
| 9717 | |
| 9718 | |
| 9719 | IncompatibleObjCWeakRef, |
| 9720 | |
| 9721 | |
| 9722 | |
| 9723 | Incompatible |
| 9724 | }; |
| 9725 | |
| 9726 | |
| 9727 | |
| 9728 | |
| 9729 | bool DiagnoseAssignmentResult(AssignConvertType ConvTy, |
| 9730 | SourceLocation Loc, |
| 9731 | QualType DstType, QualType SrcType, |
| 9732 | Expr *SrcExpr, AssignmentAction Action, |
| 9733 | bool *Complained = nullptr); |
| 9734 | |
| 9735 | |
| 9736 | |
| 9737 | |
| 9738 | bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, |
| 9739 | bool AllowMask) const; |
| 9740 | |
| 9741 | |
| 9742 | |
| 9743 | void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, |
| 9744 | Expr *SrcExpr); |
| 9745 | |
| 9746 | |
| 9747 | |
| 9748 | |
| 9749 | AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, |
| 9750 | QualType LHSType, |
| 9751 | QualType RHSType); |
| 9752 | |
| 9753 | |
| 9754 | |
| 9755 | |
| 9756 | AssignConvertType CheckAssignmentConstraints(QualType LHSType, |
| 9757 | ExprResult &RHS, |
| 9758 | CastKind &Kind, |
| 9759 | bool ConvertRHS = true); |
| 9760 | |
| 9761 | |
| 9762 | |
| 9763 | |
| 9764 | |
| 9765 | |
| 9766 | |
| 9767 | |
| 9768 | |
| 9769 | |
| 9770 | |
| 9771 | |
| 9772 | |
| 9773 | |
| 9774 | |
| 9775 | AssignConvertType CheckSingleAssignmentConstraints( |
| 9776 | QualType LHSType, ExprResult &RHS, bool Diagnose = true, |
| 9777 | bool DiagnoseCFAudited = false, bool ConvertRHS = true); |
| 9778 | |
| 9779 | |
| 9780 | |
| 9781 | AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, |
| 9782 | ExprResult &RHS); |
| 9783 | |
| 9784 | bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType); |
| 9785 | |
| 9786 | bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType); |
| 9787 | |
| 9788 | ExprResult PerformImplicitConversion(Expr *From, QualType ToType, |
| 9789 | AssignmentAction Action, |
| 9790 | bool AllowExplicit = false); |
| 9791 | ExprResult PerformImplicitConversion(Expr *From, QualType ToType, |
| 9792 | AssignmentAction Action, |
| 9793 | bool AllowExplicit, |
| 9794 | ImplicitConversionSequence& ICS); |
| 9795 | ExprResult PerformImplicitConversion(Expr *From, QualType ToType, |
| 9796 | const ImplicitConversionSequence& ICS, |
| 9797 | AssignmentAction Action, |
| 9798 | CheckedConversionKind CCK |
| 9799 | = CCK_ImplicitConversion); |
| 9800 | ExprResult PerformImplicitConversion(Expr *From, QualType ToType, |
| 9801 | const StandardConversionSequence& SCS, |
| 9802 | AssignmentAction Action, |
| 9803 | CheckedConversionKind CCK); |
| 9804 | |
| 9805 | ExprResult PerformQualificationConversion( |
| 9806 | Expr *E, QualType Ty, ExprValueKind VK = VK_RValue, |
| 9807 | CheckedConversionKind CCK = CCK_ImplicitConversion); |
| 9808 | |
| 9809 | |
| 9810 | |
| 9811 | |
| 9812 | |
| 9813 | QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, |
| 9814 | ExprResult &RHS); |
| 9815 | QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, |
| 9816 | ExprResult &RHS); |
| 9817 | QualType CheckPointerToMemberOperands( |
| 9818 | ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, |
| 9819 | SourceLocation OpLoc, bool isIndirect); |
| 9820 | QualType CheckMultiplyDivideOperands( |
| 9821 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, |
| 9822 | bool IsDivide); |
| 9823 | QualType CheckRemainderOperands( |
| 9824 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9825 | bool IsCompAssign = false); |
| 9826 | QualType CheckAdditionOperands( |
| 9827 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9828 | BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr); |
| 9829 | QualType CheckSubtractionOperands( |
| 9830 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9831 | QualType* CompLHSTy = nullptr); |
| 9832 | QualType CheckShiftOperands( |
| 9833 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9834 | BinaryOperatorKind Opc, bool IsCompAssign = false); |
| 9835 | QualType CheckCompareOperands( |
| 9836 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9837 | BinaryOperatorKind Opc); |
| 9838 | QualType CheckBitwiseOperands( |
| 9839 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9840 | BinaryOperatorKind Opc); |
| 9841 | QualType CheckLogicalOperands( |
| 9842 | ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, |
| 9843 | BinaryOperatorKind Opc); |
| 9844 | |
| 9845 | |
| 9846 | |
| 9847 | QualType CheckAssignmentOperands( |
| 9848 | Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType); |
| 9849 | |
| 9850 | ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, |
| 9851 | UnaryOperatorKind Opcode, Expr *Op); |
| 9852 | ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, |
| 9853 | BinaryOperatorKind Opcode, |
| 9854 | Expr *LHS, Expr *RHS); |
| 9855 | ExprResult checkPseudoObjectRValue(Expr *E); |
| 9856 | Expr *recreateSyntacticForm(PseudoObjectExpr *E); |
| 9857 | |
| 9858 | QualType CheckConditionalOperands( |
| 9859 | ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, |
| 9860 | ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc); |
| 9861 | QualType CXXCheckConditionalOperands( |
| 9862 | ExprResult &cond, ExprResult &lhs, ExprResult &rhs, |
| 9863 | ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); |
| 9864 | QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, |
| 9865 | bool ConvertArgs = true); |
| 9866 | QualType FindCompositePointerType(SourceLocation Loc, |
| 9867 | ExprResult &E1, ExprResult &E2, |
| 9868 | bool ConvertArgs = true) { |
| 9869 | Expr *E1Tmp = E1.get(), *E2Tmp = E2.get(); |
| 9870 | QualType Composite = |
| 9871 | FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs); |
| 9872 | E1 = E1Tmp; |
| 9873 | E2 = E2Tmp; |
| 9874 | return Composite; |
| 9875 | } |
| 9876 | |
| 9877 | QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, |
| 9878 | SourceLocation QuestionLoc); |
| 9879 | |
| 9880 | bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, |
| 9881 | SourceLocation QuestionLoc); |
| 9882 | |
| 9883 | void DiagnoseAlwaysNonNullPointer(Expr *E, |
| 9884 | Expr::NullPointerConstantKind NullType, |
| 9885 | bool IsEqual, SourceRange Range); |
| 9886 | |
| 9887 | |
| 9888 | QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, |
| 9889 | SourceLocation Loc, bool IsCompAssign, |
| 9890 | bool AllowBothBool, bool AllowBoolConversion); |
| 9891 | QualType GetSignedVectorType(QualType V); |
| 9892 | QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, |
| 9893 | SourceLocation Loc, |
| 9894 | BinaryOperatorKind Opc); |
| 9895 | QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, |
| 9896 | SourceLocation Loc); |
| 9897 | |
| 9898 | bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType); |
| 9899 | bool isLaxVectorConversion(QualType srcType, QualType destType); |
| 9900 | |
| 9901 | |
| 9902 | bool CheckForConstantInitializer(Expr *e, QualType t); |
| 9903 | |
| 9904 | |
| 9905 | |
| 9906 | |
| 9907 | |
| 9908 | |
| 9909 | enum ReferenceCompareResult { |
| 9910 | |
| 9911 | |
| 9912 | Ref_Incompatible = 0, |
| 9913 | |
| 9914 | |
| 9915 | |
| 9916 | Ref_Related, |
| 9917 | |
| 9918 | Ref_Compatible |
| 9919 | }; |
| 9920 | |
| 9921 | ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, |
| 9922 | QualType T1, QualType T2, |
| 9923 | bool &DerivedToBase, |
| 9924 | bool &ObjCConversion, |
| 9925 | bool &ObjCLifetimeConversion); |
| 9926 | |
| 9927 | ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, |
| 9928 | Expr *CastExpr, CastKind &CastKind, |
| 9929 | ExprValueKind &VK, CXXCastPath &Path); |
| 9930 | |
| 9931 | |
| 9932 | |
| 9933 | ExprResult forceUnknownAnyToType(Expr *E, QualType ToType); |
| 9934 | |
| 9935 | |
| 9936 | |
| 9937 | ExprResult checkUnknownAnyArg(SourceLocation callLoc, |
| 9938 | Expr *result, QualType ¶mType); |
| 9939 | |
| 9940 | |
| 9941 | |
| 9942 | |
| 9943 | |
| 9944 | bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, |
| 9945 | CastKind &Kind); |
| 9946 | |
| 9947 | |
| 9948 | |
| 9949 | ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr); |
| 9950 | |
| 9951 | |
| 9952 | |
| 9953 | |
| 9954 | |
| 9955 | |
| 9956 | ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, |
| 9957 | CastKind &Kind); |
| 9958 | |
| 9959 | ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, |
| 9960 | SourceLocation LParenLoc, |
| 9961 | Expr *CastExpr, |
| 9962 | SourceLocation RParenLoc); |
| 9963 | |
| 9964 | enum ARCConversionResult { ACR_okay, ACR_unbridged, ACR_error }; |
| 9965 | |
| 9966 | |
| 9967 | |
| 9968 | ARCConversionResult CheckObjCConversion(SourceRange castRange, |
| 9969 | QualType castType, Expr *&op, |
| 9970 | CheckedConversionKind CCK, |
| 9971 | bool Diagnose = true, |
| 9972 | bool DiagnoseCFAudited = false, |
| 9973 | BinaryOperatorKind Opc = BO_PtrMemD |
| 9974 | ); |
| 9975 | |
| 9976 | Expr *stripARCUnbridgedCast(Expr *e); |
| 9977 | void diagnoseARCUnbridgedCast(Expr *e); |
| 9978 | |
| 9979 | bool CheckObjCARCUnavailableWeakConversion(QualType castType, |
| 9980 | QualType ExprType); |
| 9981 | |
| 9982 | |
| 9983 | |
| 9984 | void checkRetainCycles(ObjCMessageExpr *msg); |
| 9985 | void checkRetainCycles(Expr *receiver, Expr *argument); |
| 9986 | void checkRetainCycles(VarDecl *Var, Expr *Init); |
| 9987 | |
| 9988 | |
| 9989 | |
| 9990 | bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS); |
| 9991 | |
| 9992 | |
| 9993 | |
| 9994 | void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS); |
| 9995 | |
| 9996 | |
| 9997 | |
| 9998 | |
| 9999 | |
| 10000 | bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, |
| 10001 | MultiExprArg Args, Selector Sel, |
| 10002 | ArrayRef<SourceLocation> SelectorLocs, |
| 10003 | ObjCMethodDecl *Method, bool isClassMessage, |
| 10004 | bool isSuperMessage, SourceLocation lbrac, |
| 10005 | SourceLocation rbrac, SourceRange RecRange, |
| 10006 | QualType &ReturnType, ExprValueKind &VK); |
| 10007 | |
| 10008 | |
| 10009 | |
| 10010 | |
| 10011 | QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, |
| 10012 | ObjCMethodDecl *Method, bool isClassMessage, |
| 10013 | bool isSuperMessage); |
| 10014 | |
| 10015 | |
| 10016 | |
| 10017 | void EmitRelatedResultTypeNote(const Expr *E); |
| 10018 | |
| 10019 | |
| 10020 | |
| 10021 | |
| 10022 | void EmitRelatedResultTypeNoteForReturn(QualType destType); |
| 10023 | |
| 10024 | class ConditionResult { |
| 10025 | Decl *ConditionVar; |
| 10026 | FullExprArg Condition; |
| 10027 | bool Invalid; |
| 10028 | bool HasKnownValue; |
| 10029 | bool KnownValue; |
| 10030 | |
| 10031 | friend class Sema; |
| 10032 | ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition, |
| 10033 | bool IsConstexpr) |
| 10034 | : ConditionVar(ConditionVar), Condition(Condition), Invalid(false), |
| 10035 | HasKnownValue(IsConstexpr && Condition.get() && |
| 10036 | !Condition.get()->isValueDependent()), |
| 10037 | KnownValue(HasKnownValue && |
| 10038 | !!Condition.get()->EvaluateKnownConstInt(S.Context)) {} |
| 10039 | explicit ConditionResult(bool Invalid) |
| 10040 | : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid), |
| 10041 | HasKnownValue(false), KnownValue(false) {} |
| 10042 | |
| 10043 | public: |
| 10044 | ConditionResult() : ConditionResult(false) {} |
| 10045 | bool isInvalid() const { return Invalid; } |
| 10046 | std::pair<VarDecl *, Expr *> get() const { |
| 10047 | return std::make_pair(cast_or_null<VarDecl>(ConditionVar), |
| 10048 | Condition.get()); |
| 10049 | } |
| 10050 | llvm::Optional<bool> getKnownValue() const { |
| 10051 | if (!HasKnownValue) |
| 10052 | return None; |
| 10053 | return KnownValue; |
| 10054 | } |
| 10055 | }; |
| 10056 | static ConditionResult ConditionError() { return ConditionResult(true); } |
| 10057 | |
| 10058 | enum class ConditionKind { |
| 10059 | Boolean, |
| 10060 | ConstexprIf, |
| 10061 | Switch |
| 10062 | }; |
| 10063 | |
| 10064 | ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, |
| 10065 | Expr *SubExpr, ConditionKind CK); |
| 10066 | |
| 10067 | ConditionResult ActOnConditionVariable(Decl *ConditionVar, |
| 10068 | SourceLocation StmtLoc, |
| 10069 | ConditionKind CK); |
| 10070 | |
| 10071 | DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D); |
| 10072 | |
| 10073 | ExprResult CheckConditionVariable(VarDecl *ConditionVar, |
| 10074 | SourceLocation StmtLoc, |
| 10075 | ConditionKind CK); |
| 10076 | ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond); |
| 10077 | |
| 10078 | |
| 10079 | |
| 10080 | |
| 10081 | |
| 10082 | |
| 10083 | |
| 10084 | |
| 10085 | |
| 10086 | ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, |
| 10087 | bool IsConstexpr = false); |
| 10088 | |
| 10089 | |
| 10090 | |
| 10091 | void DiagnoseAssignmentAsCondition(Expr *E); |
| 10092 | |
| 10093 | |
| 10094 | |
| 10095 | void (ParenExpr *ParenE); |
| 10096 | |
| 10097 | |
| 10098 | ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false); |
| 10099 | |
| 10100 | |
| 10101 | |
| 10102 | |
| 10103 | void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, |
| 10104 | unsigned NewWidth, bool NewSign, |
| 10105 | SourceLocation Loc, unsigned DiagID); |
| 10106 | |
| 10107 | |
| 10108 | |
| 10109 | |
| 10110 | bool CheckObjCDeclScope(Decl *D); |
| 10111 | |
| 10112 | |
| 10113 | |
| 10114 | class VerifyICEDiagnoser { |
| 10115 | public: |
| 10116 | bool Suppress; |
| 10117 | |
| 10118 | VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { } |
| 10119 | |
| 10120 | virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) =0; |
| 10121 | virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR); |
| 10122 | virtual ~VerifyICEDiagnoser() { } |
| 10123 | }; |
| 10124 | |
| 10125 | |
| 10126 | |
| 10127 | |
| 10128 | ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, |
| 10129 | VerifyICEDiagnoser &Diagnoser, |
| 10130 | bool AllowFold = true); |
| 10131 | ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, |
| 10132 | unsigned DiagID, |
| 10133 | bool AllowFold = true); |
| 10134 | ExprResult VerifyIntegerConstantExpression(Expr *E, |
| 10135 | llvm::APSInt *Result = nullptr); |
| 10136 | |
| 10137 | |
| 10138 | |
| 10139 | |
| 10140 | |
| 10141 | ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, |
| 10142 | QualType FieldTy, bool IsMsStruct, |
| 10143 | Expr *BitWidth, bool *ZeroWidth = nullptr); |
| 10144 | |
| 10145 | private: |
| 10146 | unsigned ForceCUDAHostDeviceDepth = 0; |
| 10147 | |
| 10148 | public: |
| 10149 | |
| 10150 | |
| 10151 | |
| 10152 | void PushForceCUDAHostDevice(); |
| 10153 | |
| 10154 | |
| 10155 | |
| 10156 | |
| 10157 | bool PopForceCUDAHostDevice(); |
| 10158 | |
| 10159 | |
| 10160 | |
| 10161 | |
| 10162 | llvm::DenseMap<CanonicalDeclPtr<FunctionDecl>, |
| 10163 | std::vector<PartialDiagnosticAt>> |
| 10164 | DeviceDeferredDiags; |
| 10165 | |
| 10166 | |
| 10167 | |
| 10168 | struct FunctionDeclAndLoc { |
| 10169 | CanonicalDeclPtr<FunctionDecl> FD; |
| 10170 | SourceLocation Loc; |
| 10171 | }; |
| 10172 | |
| 10173 | |
| 10174 | |
| 10175 | |
| 10176 | llvm::DenseSet<FunctionDeclAndLoc> LocsWithCUDACallDiags; |
| 10177 | |
| 10178 | |
| 10179 | |
| 10180 | |
| 10181 | |
| 10182 | |
| 10183 | llvm::DenseMap< CanonicalDeclPtr<FunctionDecl>, |
| 10184 | FunctionDeclAndLoc> |
| 10185 | DeviceKnownEmittedFns; |
| 10186 | |
| 10187 | |
| 10188 | |
| 10189 | |
| 10190 | |
| 10191 | |
| 10192 | |
| 10193 | |
| 10194 | llvm::DenseMap< CanonicalDeclPtr<FunctionDecl>, |
| 10195 | llvm::MapVector<CanonicalDeclPtr<FunctionDecl>, |
| 10196 | SourceLocation>> |
| 10197 | DeviceCallGraph; |
| 10198 | |
| 10199 | |
| 10200 | |
| 10201 | |
| 10202 | |
| 10203 | |
| 10204 | |
| 10205 | |
| 10206 | |
| 10207 | |
| 10208 | |
| 10209 | |
| 10210 | |
| 10211 | |
| 10212 | |
| 10213 | |
| 10214 | class DeviceDiagBuilder { |
| 10215 | public: |
| 10216 | enum Kind { |
| 10217 | |
| 10218 | K_Nop, |
| 10219 | |
| 10220 | K_Immediate, |
| 10221 | |
| 10222 | |
| 10223 | |
| 10224 | K_ImmediateWithCallStack, |
| 10225 | |
| 10226 | |
| 10227 | |
| 10228 | K_Deferred |
| 10229 | }; |
| 10230 | |
| 10231 | DeviceDiagBuilder(Kind K, SourceLocation Loc, unsigned DiagID, |
| 10232 | FunctionDecl *Fn, Sema &S); |
| 10233 | DeviceDiagBuilder(DeviceDiagBuilder &&D); |
| 10234 | DeviceDiagBuilder(const DeviceDiagBuilder &) = default; |
| 10235 | ~DeviceDiagBuilder(); |
| 10236 | |
| 10237 | |
| 10238 | |
| 10239 | |
| 10240 | |
| 10241 | |
| 10242 | |
| 10243 | |
| 10244 | |
| 10245 | |
| 10246 | |
| 10247 | operator bool() const { return ImmediateDiag.hasValue(); } |
| 10248 | |
| 10249 | template <typename T> |
| 10250 | friend const DeviceDiagBuilder &operator<<(const DeviceDiagBuilder &Diag, |
| 10251 | const T &Value) { |
| 10252 | if (Diag.ImmediateDiag.hasValue()) |
| 10253 | *Diag.ImmediateDiag << Value; |
| 10254 | else if (Diag.PartialDiagId.hasValue()) |
| 10255 | Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second |
| 10256 | << Value; |
| 10257 | return Diag; |
| 10258 | } |
| 10259 | |
| 10260 | private: |
| 10261 | Sema &S; |
| 10262 | SourceLocation Loc; |
| 10263 | unsigned DiagID; |
| 10264 | FunctionDecl *Fn; |
| 10265 | bool ShowCallStack; |
| 10266 | |
| 10267 | |
| 10268 | |
| 10269 | llvm::Optional<SemaDiagnosticBuilder> ImmediateDiag; |
| 10270 | llvm::Optional<unsigned> PartialDiagId; |
| 10271 | }; |
| 10272 | |
| 10273 | |
| 10274 | |
| 10275 | |
| 10276 | void markKnownEmitted( |
| 10277 | Sema &S, FunctionDecl *OrigCaller, FunctionDecl *OrigCallee, |
| 10278 | SourceLocation OrigLoc, |
| 10279 | const llvm::function_ref<bool(Sema &, FunctionDecl *)> IsKnownEmitted); |
| 10280 | |
| 10281 | |
| 10282 | |
| 10283 | |
| 10284 | |
| 10285 | |
| 10286 | |
| 10287 | |
| 10288 | |
| 10289 | |
| 10290 | |
| 10291 | |
| 10292 | |
| 10293 | |
| 10294 | |
| 10295 | |
| 10296 | |
| 10297 | DeviceDiagBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID); |
| 10298 | |
| 10299 | |
| 10300 | |
| 10301 | |
| 10302 | |
| 10303 | DeviceDiagBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID); |
| 10304 | |
| 10305 | |
| 10306 | |
| 10307 | |
| 10308 | |
| 10309 | |
| 10310 | |
| 10311 | |
| 10312 | |
| 10313 | |
| 10314 | |
| 10315 | |
| 10316 | |
| 10317 | |
| 10318 | |
| 10319 | |
| 10320 | DeviceDiagBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID); |
| 10321 | |
| 10322 | DeviceDiagBuilder targetDiag(SourceLocation Loc, unsigned DiagID); |
| 10323 | |
| 10324 | enum CUDAFunctionTarget { |
| 10325 | CFT_Device, |
| 10326 | CFT_Global, |
| 10327 | CFT_Host, |
| 10328 | CFT_HostDevice, |
| 10329 | CFT_InvalidTarget |
| 10330 | }; |
| 10331 | |
| 10332 | |
| 10333 | |
| 10334 | |
| 10335 | |
| 10336 | |
| 10337 | CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, |
| 10338 | bool IgnoreImplicitHDAttr = false); |
| 10339 | CUDAFunctionTarget IdentifyCUDATarget(const ParsedAttributesView &Attrs); |
| 10340 | |
| 10341 | |
| 10342 | CUDAFunctionTarget CurrentCUDATarget() { |
| 10343 | return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext)); |
| 10344 | } |
| 10345 | |
| 10346 | |
| 10347 | |
| 10348 | enum CUDAFunctionPreference { |
| 10349 | CFP_Never, |
| 10350 | CFP_WrongSide, |
| 10351 | |
| 10352 | |
| 10353 | CFP_HostDevice, |
| 10354 | CFP_SameSide, |
| 10355 | |
| 10356 | CFP_Native, |
| 10357 | }; |
| 10358 | |
| 10359 | |
| 10360 | |
| 10361 | |
| 10362 | |
| 10363 | |
| 10364 | |
| 10365 | |
| 10366 | CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, |
| 10367 | const FunctionDecl *Callee); |
| 10368 | |
| 10369 | |
| 10370 | |
| 10371 | |
| 10372 | |
| 10373 | |
| 10374 | bool IsAllowedCUDACall(const FunctionDecl *Caller, |
| 10375 | const FunctionDecl *Callee) { |
| 10376 | return IdentifyCUDAPreference(Caller, Callee) != CFP_Never; |
| 10377 | } |
| 10378 | |
| 10379 | |
| 10380 | |
| 10381 | void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, |
| 10382 | const LookupResult &Previous); |
| 10383 | |
| 10384 | public: |
| 10385 | |
| 10386 | |
| 10387 | |
| 10388 | |
| 10389 | |
| 10390 | |
| 10391 | |
| 10392 | |
| 10393 | |
| 10394 | |
| 10395 | |
| 10396 | |
| 10397 | |
| 10398 | |
| 10399 | bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee); |
| 10400 | |
| 10401 | |
| 10402 | |
| 10403 | |
| 10404 | |
| 10405 | |
| 10406 | |
| 10407 | void CUDASetLambdaAttrs(CXXMethodDecl *Method); |
| 10408 | |
| 10409 | |
| 10410 | |
| 10411 | |
| 10412 | void EraseUnwantedCUDAMatches( |
| 10413 | const FunctionDecl *Caller, |
| 10414 | SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches); |
| 10415 | |
| 10416 | |
| 10417 | |
| 10418 | |
| 10419 | |
| 10420 | |
| 10421 | |
| 10422 | |
| 10423 | |
| 10424 | |
| 10425 | |
| 10426 | |
| 10427 | bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, |
| 10428 | CXXSpecialMember CSM, |
| 10429 | CXXMethodDecl *MemberDecl, |
| 10430 | bool ConstRHS, |
| 10431 | bool Diagnose); |
| 10432 | |
| 10433 | |
| 10434 | |
| 10435 | bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD); |
| 10436 | bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD); |
| 10437 | |
| 10438 | |
| 10439 | |
| 10440 | |
| 10441 | |
| 10442 | |
| 10443 | |
| 10444 | |
| 10445 | |
| 10446 | void checkAllowedCUDAInitializer(VarDecl *VD); |
| 10447 | |
| 10448 | |
| 10449 | |
| 10450 | void checkCUDATargetOverload(FunctionDecl *NewFD, |
| 10451 | const LookupResult &Previous); |
| 10452 | |
| 10453 | void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD); |
| 10454 | |
| 10455 | |
| 10456 | |
| 10457 | |
| 10458 | std::string getCudaConfigureFuncName() const; |
| 10459 | |
| 10460 | |
| 10461 | |
| 10462 | |
| 10463 | enum ParserCompletionContext { |
| 10464 | |
| 10465 | PCC_Namespace, |
| 10466 | |
| 10467 | PCC_Class, |
| 10468 | |
| 10469 | |
| 10470 | PCC_ObjCInterface, |
| 10471 | |
| 10472 | |
| 10473 | PCC_ObjCImplementation, |
| 10474 | |
| 10475 | |
| 10476 | PCC_ObjCInstanceVariableList, |
| 10477 | |
| 10478 | |
| 10479 | PCC_Template, |
| 10480 | |
| 10481 | |
| 10482 | PCC_MemberTemplate, |
| 10483 | |
| 10484 | PCC_Expression, |
| 10485 | |
| 10486 | |
| 10487 | PCC_Statement, |
| 10488 | |
| 10489 | |
| 10490 | PCC_ForInit, |
| 10491 | |
| 10492 | |
| 10493 | PCC_Condition, |
| 10494 | |
| 10495 | |
| 10496 | |
| 10497 | PCC_RecoveryInFunction, |
| 10498 | |
| 10499 | PCC_Type, |
| 10500 | |
| 10501 | |
| 10502 | PCC_ParenthesizedExpression, |
| 10503 | |
| 10504 | |
| 10505 | PCC_LocalDeclarationSpecifiers |
| 10506 | }; |
| 10507 | |
| 10508 | void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path); |
| 10509 | void CodeCompleteOrdinaryName(Scope *S, |
| 10510 | ParserCompletionContext CompletionContext); |
| 10511 | void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, |
| 10512 | bool AllowNonIdentifiers, |
| 10513 | bool AllowNestedNameSpecifiers); |
| 10514 | |
| 10515 | struct CodeCompleteExpressionData; |
| 10516 | void CodeCompleteExpression(Scope *S, |
| 10517 | const CodeCompleteExpressionData &Data); |
| 10518 | void CodeCompleteExpression(Scope *S, QualType PreferredType, |
| 10519 | bool IsParenthesized = false); |
| 10520 | void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, |
| 10521 | SourceLocation OpLoc, bool IsArrow, |
| 10522 | bool IsBaseExprStatement, |
| 10523 | QualType PreferredType); |
| 10524 | void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, |
| 10525 | QualType PreferredType); |
| 10526 | void CodeCompleteTag(Scope *S, unsigned TagSpec); |
| 10527 | void CodeCompleteTypeQualifiers(DeclSpec &DS); |
| 10528 | void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, |
| 10529 | const VirtSpecifiers *VS = nullptr); |
| 10530 | void CodeCompleteBracketDeclarator(Scope *S); |
| 10531 | void CodeCompleteCase(Scope *S); |
| 10532 | |
| 10533 | |
| 10534 | QualType ProduceCallSignatureHelp(Scope *S, Expr *Fn, ArrayRef<Expr *> Args, |
| 10535 | SourceLocation OpenParLoc); |
| 10536 | QualType ProduceConstructorSignatureHelp(Scope *S, QualType Type, |
| 10537 | SourceLocation Loc, |
| 10538 | ArrayRef<Expr *> Args, |
| 10539 | SourceLocation OpenParLoc); |
| 10540 | QualType ProduceCtorInitMemberSignatureHelp(Scope *S, Decl *ConstructorDecl, |
| 10541 | CXXScopeSpec SS, |
| 10542 | ParsedType TemplateTypeTy, |
| 10543 | ArrayRef<Expr *> ArgExprs, |
| 10544 | IdentifierInfo *II, |
| 10545 | SourceLocation OpenParLoc); |
| 10546 | void CodeCompleteInitializer(Scope *S, Decl *D); |
| 10547 | void CodeCompleteAfterIf(Scope *S); |
| 10548 | |
| 10549 | void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, |
| 10550 | bool EnteringContext, QualType BaseType); |
| 10551 | void CodeCompleteUsing(Scope *S); |
| 10552 | void CodeCompleteUsingDirective(Scope *S); |
| 10553 | void CodeCompleteNamespaceDecl(Scope *S); |
| 10554 | void CodeCompleteNamespaceAliasDecl(Scope *S); |
| 10555 | void CodeCompleteOperatorName(Scope *S); |
| 10556 | void CodeCompleteConstructorInitializer( |
| 10557 | Decl *Constructor, |
| 10558 | ArrayRef<CXXCtorInitializer *> Initializers); |
| 10559 | |
| 10560 | void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, |
| 10561 | bool AfterAmpersand); |
| 10562 | |
| 10563 | void CodeCompleteObjCAtDirective(Scope *S); |
| 10564 | void CodeCompleteObjCAtVisibility(Scope *S); |
| 10565 | void CodeCompleteObjCAtStatement(Scope *S); |
| 10566 | void CodeCompleteObjCAtExpression(Scope *S); |
| 10567 | void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS); |
| 10568 | void CodeCompleteObjCPropertyGetter(Scope *S); |
| 10569 | void CodeCompleteObjCPropertySetter(Scope *S); |
| 10570 | void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, |
| 10571 | bool IsParameter); |
| 10572 | void CodeCompleteObjCMessageReceiver(Scope *S); |
| 10573 | void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, |
| 10574 | ArrayRef<IdentifierInfo *> SelIdents, |
| 10575 | bool AtArgumentExpression); |
| 10576 | void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, |
| 10577 | ArrayRef<IdentifierInfo *> SelIdents, |
| 10578 | bool AtArgumentExpression, |
| 10579 | bool IsSuper = false); |
| 10580 | void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, |
| 10581 | ArrayRef<IdentifierInfo *> SelIdents, |
| 10582 | bool AtArgumentExpression, |
| 10583 | ObjCInterfaceDecl *Super = nullptr); |
| 10584 | void CodeCompleteObjCForCollection(Scope *S, |
| 10585 | DeclGroupPtrTy IterationVar); |
| 10586 | void CodeCompleteObjCSelector(Scope *S, |
| 10587 | ArrayRef<IdentifierInfo *> SelIdents); |
| 10588 | void CodeCompleteObjCProtocolReferences( |
| 10589 | ArrayRef<IdentifierLocPair> Protocols); |
| 10590 | void CodeCompleteObjCProtocolDecl(Scope *S); |
| 10591 | void CodeCompleteObjCInterfaceDecl(Scope *S); |
| 10592 | void CodeCompleteObjCSuperclass(Scope *S, |
| 10593 | IdentifierInfo *ClassName, |
| 10594 | SourceLocation ClassNameLoc); |
| 10595 | void CodeCompleteObjCImplementationDecl(Scope *S); |
| 10596 | void CodeCompleteObjCInterfaceCategory(Scope *S, |
| 10597 | IdentifierInfo *ClassName, |
| 10598 | SourceLocation ClassNameLoc); |
| 10599 | void CodeCompleteObjCImplementationCategory(Scope *S, |
| 10600 | IdentifierInfo *ClassName, |
| 10601 | SourceLocation ClassNameLoc); |
| 10602 | void CodeCompleteObjCPropertyDefinition(Scope *S); |
| 10603 | void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, |
| 10604 | IdentifierInfo *PropertyName); |
| 10605 | void CodeCompleteObjCMethodDecl(Scope *S, Optional<bool> IsInstanceMethod, |
| 10606 | ParsedType ReturnType); |
| 10607 | void CodeCompleteObjCMethodDeclSelector(Scope *S, |
| 10608 | bool IsInstanceMethod, |
| 10609 | bool AtParameterName, |
| 10610 | ParsedType ReturnType, |
| 10611 | ArrayRef<IdentifierInfo *> SelIdents); |
| 10612 | void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, |
| 10613 | SourceLocation ClassNameLoc, |
| 10614 | bool IsBaseExprStatement); |
| 10615 | void CodeCompletePreprocessorDirective(bool InConditional); |
| 10616 | void CodeCompleteInPreprocessorConditionalExclusion(Scope *S); |
| 10617 | void CodeCompletePreprocessorMacroName(bool IsDefinition); |
| 10618 | void CodeCompletePreprocessorExpression(); |
| 10619 | void CodeCompletePreprocessorMacroArgument(Scope *S, |
| 10620 | IdentifierInfo *Macro, |
| 10621 | MacroInfo *MacroInfo, |
| 10622 | unsigned Argument); |
| 10623 | void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled); |
| 10624 | void CodeCompleteNaturalLanguage(); |
| 10625 | void CodeCompleteAvailabilityPlatformName(); |
| 10626 | void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, |
| 10627 | CodeCompletionTUInfo &CCTUInfo, |
| 10628 | SmallVectorImpl<CodeCompletionResult> &Results); |
| 10629 | |
| 10630 | |
| 10631 | |
| 10632 | |
| 10633 | |
| 10634 | public: |
| 10635 | SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, |
| 10636 | unsigned ByteNo) const; |
| 10637 | |
| 10638 | private: |
| 10639 | void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr, |
| 10640 | const ArraySubscriptExpr *ASE=nullptr, |
| 10641 | bool AllowOnePastEnd=true, bool IndexNegated=false); |
| 10642 | void CheckArrayAccess(const Expr *E); |
| 10643 | |
| 10644 | |
| 10645 | struct FormatStringInfo { |
| 10646 | unsigned FormatIdx; |
| 10647 | unsigned FirstDataArg; |
| 10648 | bool HasVAListArg; |
| 10649 | }; |
| 10650 | |
| 10651 | static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, |
| 10652 | FormatStringInfo *FSI); |
| 10653 | bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, |
| 10654 | const FunctionProtoType *Proto); |
| 10655 | bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, |
| 10656 | ArrayRef<const Expr *> Args); |
| 10657 | bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall, |
| 10658 | const FunctionProtoType *Proto); |
| 10659 | bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto); |
| 10660 | void CheckConstructorCall(FunctionDecl *FDecl, |
| 10661 | ArrayRef<const Expr *> Args, |
| 10662 | const FunctionProtoType *Proto, |
| 10663 | SourceLocation Loc); |
| 10664 | |
| 10665 | void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, |
| 10666 | const Expr *ThisArg, ArrayRef<const Expr *> Args, |
| 10667 | bool IsMemberFunction, SourceLocation Loc, SourceRange Range, |
| 10668 | VariadicCallType CallType); |
| 10669 | |
| 10670 | bool CheckObjCString(Expr *Arg); |
| 10671 | ExprResult CheckOSLogFormatStringArg(Expr *Arg); |
| 10672 | |
| 10673 | ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl, |
| 10674 | unsigned BuiltinID, CallExpr *TheCall); |
| 10675 | void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall); |
| 10676 | |
| 10677 | bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall, |
| 10678 | unsigned MaxWidth); |
| 10679 | bool CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10680 | bool CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10681 | |
| 10682 | bool CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10683 | bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10684 | bool CheckHexagonBuiltinCpu(unsigned BuiltinID, CallExpr *TheCall); |
| 10685 | bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall); |
| 10686 | bool CheckMipsBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10687 | bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10688 | bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall); |
| 10689 | bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall); |
| 10690 | bool CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10691 | bool CheckPPCBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); |
| 10692 | |
| 10693 | bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall); |
| 10694 | bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call); |
| 10695 | bool SemaBuiltinUnorderedCompare(CallExpr *TheCall); |
| 10696 | bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs); |
| 10697 | bool SemaBuiltinVSX(CallExpr *TheCall); |
| 10698 | bool SemaBuiltinOSLogFormat(CallExpr *TheCall); |
| 10699 | |
| 10700 | public: |
| 10701 | |
| 10702 | ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall); |
| 10703 | ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, |
| 10704 | SourceLocation BuiltinLoc, |
| 10705 | SourceLocation RParenLoc); |
| 10706 | |
| 10707 | private: |
| 10708 | bool SemaBuiltinPrefetch(CallExpr *TheCall); |
| 10709 | bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall); |
| 10710 | bool SemaBuiltinAssume(CallExpr *TheCall); |
| 10711 | bool SemaBuiltinAssumeAligned(CallExpr *TheCall); |
| 10712 | bool SemaBuiltinLongjmp(CallExpr *TheCall); |
| 10713 | bool SemaBuiltinSetjmp(CallExpr *TheCall); |
| 10714 | ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult); |
| 10715 | ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult); |
| 10716 | ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult, |
| 10717 | AtomicExpr::AtomicOp Op); |
| 10718 | ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult, |
| 10719 | bool IsDelete); |
| 10720 | bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum, |
| 10721 | llvm::APSInt &Result); |
| 10722 | bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low, |
| 10723 | int High, bool RangeIsError = true); |
| 10724 | bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum, |
| 10725 | unsigned Multiple); |
| 10726 | bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, |
| 10727 | int ArgNum, unsigned ExpectedFieldNum, |
| 10728 | bool AllowName); |
| 10729 | public: |
| 10730 | enum FormatStringType { |
| 10731 | FST_Scanf, |
| 10732 | FST_Printf, |
| 10733 | FST_NSString, |
| 10734 | FST_Strftime, |
| 10735 | FST_Strfmon, |
| 10736 | FST_Kprintf, |
| 10737 | FST_FreeBSDKPrintf, |
| 10738 | FST_OSTrace, |
| 10739 | FST_OSLog, |
| 10740 | FST_Unknown |
| 10741 | }; |
| 10742 | static FormatStringType GetFormatStringType(const FormatAttr *Format); |
| 10743 | |
| 10744 | bool FormatStringHasSArg(const StringLiteral *FExpr); |
| 10745 | |
| 10746 | static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx); |
| 10747 | |
| 10748 | private: |
| 10749 | bool CheckFormatArguments(const FormatAttr *Format, |
| 10750 | ArrayRef<const Expr *> Args, |
| 10751 | bool IsCXXMember, |
| 10752 | VariadicCallType CallType, |
| 10753 | SourceLocation Loc, SourceRange Range, |
| 10754 | llvm::SmallBitVector &CheckedVarArgs); |
| 10755 | bool CheckFormatArguments(ArrayRef<const Expr *> Args, |
| 10756 | bool HasVAListArg, unsigned format_idx, |
| 10757 | unsigned firstDataArg, FormatStringType Type, |
| 10758 | VariadicCallType CallType, |
| 10759 | SourceLocation Loc, SourceRange range, |
| 10760 | llvm::SmallBitVector &CheckedVarArgs); |
| 10761 | |
| 10762 | void CheckAbsoluteValueFunction(const CallExpr *Call, |
| 10763 | const FunctionDecl *FDecl); |
| 10764 | |
| 10765 | void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl); |
| 10766 | |
| 10767 | void CheckMemaccessArguments(const CallExpr *Call, |
| 10768 | unsigned BId, |
| 10769 | IdentifierInfo *FnName); |
| 10770 | |
| 10771 | void CheckStrlcpycatArguments(const CallExpr *Call, |
| 10772 | IdentifierInfo *FnName); |
| 10773 | |
| 10774 | void CheckStrncatArguments(const CallExpr *Call, |
| 10775 | IdentifierInfo *FnName); |
| 10776 | |
| 10777 | void CheckReturnValExpr(Expr *RetValExp, QualType lhsType, |
| 10778 | SourceLocation ReturnLoc, |
| 10779 | bool isObjCMethod = false, |
| 10780 | const AttrVec *Attrs = nullptr, |
| 10781 | const FunctionDecl *FD = nullptr); |
| 10782 | |
| 10783 | public: |
| 10784 | void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS); |
| 10785 | |
| 10786 | private: |
| 10787 | void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation()); |
| 10788 | void CheckBoolLikeConversion(Expr *E, SourceLocation CC); |
| 10789 | void CheckForIntOverflow(Expr *E); |
| 10790 | void CheckUnsequencedOperations(Expr *E); |
| 10791 | |
| 10792 | |
| 10793 | |
| 10794 | void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(), |
| 10795 | bool IsConstexpr = false); |
| 10796 | |
| 10797 | void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field, |
| 10798 | Expr *Init); |
| 10799 | |
| 10800 | |
| 10801 | void CheckShadowInheritedFields(const SourceLocation &Loc, |
| 10802 | DeclarationName FieldName, |
| 10803 | const CXXRecordDecl *RD, |
| 10804 | bool DeclIsField = true); |
| 10805 | |
| 10806 | |
| 10807 | |
| 10808 | void CheckBreakContinueBinding(Expr *E); |
| 10809 | |
| 10810 | |
| 10811 | |
| 10812 | void CheckObjCCircularContainer(ObjCMessageExpr *Message); |
| 10813 | |
| 10814 | void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE); |
| 10815 | void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc, |
| 10816 | bool DeleteWasArrayForm); |
| 10817 | public: |
| 10818 | |
| 10819 | void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind, |
| 10820 | uint64_t MagicValue, QualType Type, |
| 10821 | bool LayoutCompatible, bool MustBeNull); |
| 10822 | |
| 10823 | struct TypeTagData { |
| 10824 | TypeTagData() {} |
| 10825 | |
| 10826 | TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull) : |
| 10827 | Type(Type), LayoutCompatible(LayoutCompatible), |
| 10828 | MustBeNull(MustBeNull) |
| 10829 | {} |
| 10830 | |
| 10831 | QualType Type; |
| 10832 | |
| 10833 | |
| 10834 | |
| 10835 | unsigned LayoutCompatible : 1; |
| 10836 | unsigned MustBeNull : 1; |
| 10837 | }; |
| 10838 | |
| 10839 | |
| 10840 | |
| 10841 | typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue; |
| 10842 | |
| 10843 | private: |
| 10844 | |
| 10845 | std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>> |
| 10846 | TypeTagForDatatypeMagicValues; |
| 10847 | |
| 10848 | |
| 10849 | |
| 10850 | void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr, |
| 10851 | const ArrayRef<const Expr *> ExprArgs, |
| 10852 | SourceLocation CallSiteLoc); |
| 10853 | |
| 10854 | |
| 10855 | |
| 10856 | void CheckAddressOfPackedMember(Expr *rhs); |
| 10857 | |
| 10858 | |
| 10859 | |
| 10860 | |
| 10861 | Scope *CurScope; |
| 10862 | |
| 10863 | mutable IdentifierInfo *Ident_super; |
| 10864 | mutable IdentifierInfo *Ident___float128; |
| 10865 | |
| 10866 | |
| 10867 | IdentifierInfo *Ident__Nonnull = nullptr; |
| 10868 | IdentifierInfo *Ident__Nullable = nullptr; |
| 10869 | IdentifierInfo *Ident__Null_unspecified = nullptr; |
| 10870 | |
| 10871 | IdentifierInfo *Ident_NSError = nullptr; |
| 10872 | |
| 10873 | |
| 10874 | |
| 10875 | |
| 10876 | |
| 10877 | sema::SemaPPCallbacks *SemaPPCallbackHandler; |
| 10878 | |
| 10879 | protected: |
| 10880 | friend class Parser; |
| 10881 | friend class InitializationSequence; |
| 10882 | friend class ASTReader; |
| 10883 | friend class ASTDeclReader; |
| 10884 | friend class ASTWriter; |
| 10885 | |
| 10886 | public: |
| 10887 | |
| 10888 | IdentifierInfo *getNullabilityKeyword(NullabilityKind nullability); |
| 10889 | |
| 10890 | |
| 10891 | RecordDecl *CFError = nullptr; |
| 10892 | |
| 10893 | |
| 10894 | IdentifierInfo *getNSErrorIdent(); |
| 10895 | |
| 10896 | |
| 10897 | |
| 10898 | |
| 10899 | |
| 10900 | |
| 10901 | |
| 10902 | |
| 10903 | |
| 10904 | Scope *getCurScope() const { return CurScope; } |
| 10905 | |
| 10906 | void incrementMSManglingNumber() const { |
| 10907 | return CurScope->incrementMSManglingNumber(); |
| 10908 | } |
| 10909 | |
| 10910 | IdentifierInfo *getSuperIdentifier() const; |
| 10911 | IdentifierInfo *getFloat128Identifier() const; |
| 10912 | |
| 10913 | Decl *getObjCDeclContext() const; |
| 10914 | |
| 10915 | DeclContext *getCurLexicalContext() const { |
| 10916 | return OriginalLexicalContext ? OriginalLexicalContext : CurContext; |
| 10917 | } |
| 10918 | |
| 10919 | const DeclContext *getCurObjCLexicalContext() const { |
| 10920 | const DeclContext *DC = getCurLexicalContext(); |
| 10921 | |
| 10922 | if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC)) |
| 10923 | DC = CatD->getClassInterface(); |
| 10924 | return DC; |
| 10925 | } |
| 10926 | |
| 10927 | |
| 10928 | |
| 10929 | static bool TooManyArguments(size_t NumParams, size_t NumArgs, |
| 10930 | bool PartialOverloading = false) { |
| 10931 | |
| 10932 | if (NumArgs > 0 && PartialOverloading) |
| 10933 | return NumArgs + 1 > NumParams; |
| 10934 | return NumArgs > NumParams; |
| 10935 | } |
| 10936 | |
| 10937 | |
| 10938 | |
| 10939 | SmallVector<CXXRecordDecl*, 4> DelayedDllExportClasses; |
| 10940 | |
| 10941 | private: |
| 10942 | class SavePendingParsedClassStateRAII { |
| 10943 | public: |
| 10944 | SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); } |
| 10945 | |
| 10946 | ~SavePendingParsedClassStateRAII() { |
| 10947 | (0) . __assert_fail ("S.DelayedOverridingExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10948, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedOverridingExceptionSpecChecks.empty() && |
| 10948 | (0) . __assert_fail ("S.DelayedOverridingExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10948, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "there shouldn't be any pending delayed exception spec checks"); |
| 10949 | (0) . __assert_fail ("S.DelayedEquivalentExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10950, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedEquivalentExceptionSpecChecks.empty() && |
| 10950 | (0) . __assert_fail ("S.DelayedEquivalentExceptionSpecChecks.empty() && \"there shouldn't be any pending delayed exception spec checks\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10950, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "there shouldn't be any pending delayed exception spec checks"); |
| 10951 | (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedDefaultedMemberExceptionSpecs.empty() && |
| 10952 | (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "there shouldn't be any pending delayed defaulted member " |
| 10953 | (0) . __assert_fail ("S.DelayedDefaultedMemberExceptionSpecs.empty() && \"there shouldn't be any pending delayed defaulted member \" \"exception specs\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10953, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "exception specs"); |
| 10954 | (0) . __assert_fail ("S.DelayedDllExportClasses.empty() && \"there shouldn't be any pending delayed DLL export classes\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10955, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(S.DelayedDllExportClasses.empty() && |
| 10955 | (0) . __assert_fail ("S.DelayedDllExportClasses.empty() && \"there shouldn't be any pending delayed DLL export classes\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Sema/Sema.h", 10955, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "there shouldn't be any pending delayed DLL export classes"); |
| 10956 | swapSavedState(); |
| 10957 | } |
| 10958 | |
| 10959 | private: |
| 10960 | Sema &S; |
| 10961 | decltype(DelayedOverridingExceptionSpecChecks) |
| 10962 | SavedOverridingExceptionSpecChecks; |
| 10963 | decltype(DelayedEquivalentExceptionSpecChecks) |
| 10964 | SavedEquivalentExceptionSpecChecks; |
| 10965 | decltype(DelayedDefaultedMemberExceptionSpecs) |
| 10966 | SavedDefaultedMemberExceptionSpecs; |
| 10967 | decltype(DelayedDllExportClasses) SavedDllExportClasses; |
| 10968 | |
| 10969 | void swapSavedState() { |
| 10970 | SavedOverridingExceptionSpecChecks.swap( |
| 10971 | S.DelayedOverridingExceptionSpecChecks); |
| 10972 | SavedEquivalentExceptionSpecChecks.swap( |
| 10973 | S.DelayedEquivalentExceptionSpecChecks); |
| 10974 | SavedDefaultedMemberExceptionSpecs.swap( |
| 10975 | S.DelayedDefaultedMemberExceptionSpecs); |
| 10976 | SavedDllExportClasses.swap(S.DelayedDllExportClasses); |
| 10977 | } |
| 10978 | }; |
| 10979 | |
| 10980 | |
| 10981 | |
| 10982 | struct MisalignedMember { |
| 10983 | Expr *E; |
| 10984 | RecordDecl *RD; |
| 10985 | ValueDecl *MD; |
| 10986 | CharUnits Alignment; |
| 10987 | |
| 10988 | MisalignedMember() : E(), RD(), MD(), Alignment() {} |
| 10989 | MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD, |
| 10990 | CharUnits Alignment) |
| 10991 | : E(E), RD(RD), MD(MD), Alignment(Alignment) {} |
| 10992 | explicit MisalignedMember(Expr *E) |
| 10993 | : MisalignedMember(E, nullptr, nullptr, CharUnits()) {} |
| 10994 | |
| 10995 | bool operator==(const MisalignedMember &m) { return this->E == m.E; } |
| 10996 | }; |
| 10997 | |
| 10998 | |
| 10999 | SmallVector<MisalignedMember, 4> MisalignedMembers; |
| 11000 | |
| 11001 | |
| 11002 | void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD, |
| 11003 | CharUnits Alignment); |
| 11004 | |
| 11005 | public: |
| 11006 | |
| 11007 | |
| 11008 | |
| 11009 | void DiagnoseMisalignedMembers(); |
| 11010 | |
| 11011 | |
| 11012 | |
| 11013 | |
| 11014 | |
| 11015 | |
| 11016 | void DiscardMisalignedMemberAddress(const Type *T, Expr *E); |
| 11017 | |
| 11018 | |
| 11019 | |
| 11020 | |
| 11021 | void RefersToMemberWithReducedAlignment( |
| 11022 | Expr *E, |
| 11023 | llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> |
| 11024 | Action); |
| 11025 | |
| 11026 | |
| 11027 | |
| 11028 | enum class CallingConventionIgnoredReason { |
| 11029 | ForThisTarget = 0, |
| 11030 | VariadicFunction, |
| 11031 | ConstructorDestructor, |
| 11032 | BuiltinFunction |
| 11033 | }; |
| 11034 | }; |
| 11035 | |
| 11036 | |
| 11037 | class EnterExpressionEvaluationContext { |
| 11038 | Sema &Actions; |
| 11039 | bool Entered = true; |
| 11040 | |
| 11041 | public: |
| 11042 | EnterExpressionEvaluationContext( |
| 11043 | Sema &Actions, Sema::ExpressionEvaluationContext NewContext, |
| 11044 | Decl *LambdaContextDecl = nullptr, |
| 11045 | Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext = |
| 11046 | Sema::ExpressionEvaluationContextRecord::EK_Other, |
| 11047 | bool ShouldEnter = true) |
| 11048 | : Actions(Actions), Entered(ShouldEnter) { |
| 11049 | if (Entered) |
| 11050 | Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl, |
| 11051 | ExprContext); |
| 11052 | } |
| 11053 | EnterExpressionEvaluationContext( |
| 11054 | Sema &Actions, Sema::ExpressionEvaluationContext NewContext, |
| 11055 | Sema::ReuseLambdaContextDecl_t, |
| 11056 | Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext = |
| 11057 | Sema::ExpressionEvaluationContextRecord::EK_Other) |
| 11058 | : Actions(Actions) { |
| 11059 | Actions.PushExpressionEvaluationContext( |
| 11060 | NewContext, Sema::ReuseLambdaContextDecl, ExprContext); |
| 11061 | } |
| 11062 | |
| 11063 | enum InitListTag { InitList }; |
| 11064 | EnterExpressionEvaluationContext(Sema &Actions, InitListTag, |
| 11065 | bool ShouldEnter = true) |
| 11066 | : Actions(Actions), Entered(false) { |
| 11067 | |
| 11068 | |
| 11069 | |
| 11070 | |
| 11071 | if (ShouldEnter && Actions.isUnevaluatedContext() && |
| 11072 | Actions.getLangOpts().CPlusPlus11) { |
| 11073 | Actions.PushExpressionEvaluationContext( |
| 11074 | Sema::ExpressionEvaluationContext::UnevaluatedList); |
| 11075 | Entered = true; |
| 11076 | } |
| 11077 | } |
| 11078 | |
| 11079 | ~EnterExpressionEvaluationContext() { |
| 11080 | if (Entered) |
| 11081 | Actions.PopExpressionEvaluationContext(); |
| 11082 | } |
| 11083 | }; |
| 11084 | |
| 11085 | DeductionFailureInfo |
| 11086 | MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK, |
| 11087 | sema::TemplateDeductionInfo &Info); |
| 11088 | |
| 11089 | |
| 11090 | |
| 11091 | struct LateParsedTemplate { |
| 11092 | CachedTokens Toks; |
| 11093 | |
| 11094 | Decl *D; |
| 11095 | }; |
| 11096 | } |
| 11097 | |
| 11098 | namespace llvm { |
| 11099 | |
| 11100 | |
| 11101 | template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> { |
| 11102 | using FunctionDeclAndLoc = clang::Sema::FunctionDeclAndLoc; |
| 11103 | using FDBaseInfo = DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>>; |
| 11104 | |
| 11105 | static FunctionDeclAndLoc getEmptyKey() { |
| 11106 | return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()}; |
| 11107 | } |
| 11108 | |
| 11109 | static FunctionDeclAndLoc getTombstoneKey() { |
| 11110 | return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()}; |
| 11111 | } |
| 11112 | |
| 11113 | static unsigned getHashValue(const FunctionDeclAndLoc &FDL) { |
| 11114 | return hash_combine(FDBaseInfo::getHashValue(FDL.FD), |
| 11115 | FDL.Loc.getRawEncoding()); |
| 11116 | } |
| 11117 | |
| 11118 | static bool isEqual(const FunctionDeclAndLoc &LHS, |
| 11119 | const FunctionDeclAndLoc &RHS) { |
| 11120 | return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc; |
| 11121 | } |
| 11122 | }; |
| 11123 | } |
| 11124 | |
| 11125 | #endif |
| 11126 | |