diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 1eec97bd9f83..2dacdd74f6f4 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -267,7 +267,7 @@ public: /// /// This set is used to suppress redundant diagnostics. llvm::SmallPtrSet HiddenDefinitions; - + /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes. OwningPtr FieldCollector; @@ -382,7 +382,7 @@ public: public: DelayedDiagnostics() : CurPool(0) {} - /// Adds a delayed diagnostic. + /// Adds a delayed diagnostic. void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h /// Determines whether diagnostics should be delayed. @@ -432,7 +432,7 @@ public: DeclContext *SavedContext; ProcessingContextState SavedContextState; QualType SavedCXXThisTypeOverride; - + public: ContextRAII(Sema &S, DeclContext *ContextToPush) : S(S), SavedContext(S.CurContext), @@ -507,19 +507,19 @@ public: /// \brief The declaration of the Objective-C NSNumber class. ObjCInterfaceDecl *NSNumberDecl; - + /// \brief Pointer to NSNumber type (NSNumber *). QualType NSNumberPointer; - + /// \brief The Objective-C NSNumber methods used to create NSNumber literals. ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]; - + /// \brief The declaration of the Objective-C NSString class. ObjCInterfaceDecl *NSStringDecl; /// \brief Pointer to NSString type (NSString *). QualType NSStringPointer; - + /// \brief The declaration of the stringWithUTF8String: method. ObjCMethodDecl *StringWithUTF8StringMethod; @@ -528,7 +528,7 @@ public: /// \brief The declaration of the arrayWithObjects:count: method. ObjCMethodDecl *ArrayWithObjectsMethod; - + /// \brief The declaration of the Objective-C NSDictionary class. ObjCInterfaceDecl *NSDictionaryDecl; @@ -596,10 +596,10 @@ public: llvm::SmallVector Lambdas; /// \brief The declaration that provides context for the lambda expression - /// if the normal declaration context does not suffice, e.g., in a + /// if the normal declaration context does not suffice, e.g., in a /// default function argument. Decl *LambdaContextDecl; - + /// \brief The context information used to mangle lambda expressions /// within this context. /// @@ -614,7 +614,7 @@ public: /// \brief If we are processing a decltype type, a set of temporary binding /// expressions for which we have deferred checking the destructor. llvm::SmallVector DelayedDecltypeBinds; - + ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, bool ParentNeedsCleanups, @@ -623,11 +623,11 @@ public: : Context(Context), ParentNeedsCleanups(ParentNeedsCleanups), IsDecltype(IsDecltype), NumCleanupObjects(NumCleanupObjects), LambdaContextDecl(LambdaContextDecl), LambdaMangle() { } - + ~ExpressionEvaluationContextRecord() { delete LambdaMangle; } - + /// \brief Retrieve the mangling context for lambdas. LambdaMangleContext &getLambdaMangleContext() { assert(LambdaContextDecl && "Need to have a lambda context declaration"); @@ -639,7 +639,7 @@ public: /// A stack of expression evaluation contexts. SmallVector ExprEvalContexts; - + /// SpecialMemberOverloadResult - The overloading result for a special member /// function. /// @@ -882,7 +882,7 @@ public: TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &D, QualType FromTy); TypeSourceInfo *GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, TypeSourceInfo *ReturnTypeInfo); - + /// \brief Package the given type and TSI into a ParsedType. ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo); DeclarationNameInfo GetNameForDeclarator(Declarator &D); @@ -922,9 +922,9 @@ public: /// \brief Abstract class used to diagnose incomplete types. struct TypeDiagnoser { bool Suppressed; - + TypeDiagnoser(bool Suppressed = false) : Suppressed(Suppressed) { } - + virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0; virtual ~TypeDiagnoser() {} }; @@ -944,12 +944,12 @@ public: static SourceRange getPrintable(SourceLocation L) { return L; } static SourceRange getPrintable(Expr *E) { return E->getSourceRange(); } static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();} - + template class BoundTypeDiagnoser1 : public TypeDiagnoser { unsigned DiagID; const T1 &Arg1; - + public: BoundTypeDiagnoser1(unsigned DiagID, const T1 &Arg1) : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1) { } @@ -957,7 +957,7 @@ public: if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << T; } - + virtual ~BoundTypeDiagnoser1() { } }; @@ -966,18 +966,18 @@ public: unsigned DiagID; const T1 &Arg1; const T2 &Arg2; - + public: BoundTypeDiagnoser2(unsigned DiagID, const T1 &Arg1, const T2 &Arg2) : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1), Arg2(Arg2) { } - + virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << getPrintable(Arg2) << T; } - + virtual ~BoundTypeDiagnoser2() { } }; @@ -987,34 +987,34 @@ public: const T1 &Arg1; const T2 &Arg2; const T3 &Arg3; - + public: BoundTypeDiagnoser3(unsigned DiagID, const T1 &Arg1, const T2 &Arg2, const T3 &Arg3) : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1), Arg2(Arg2), Arg3(Arg3) { } - + virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << getPrintable(Arg2) << getPrintable(Arg3) << T; } - + virtual ~BoundTypeDiagnoser3() { } }; - + bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser); bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID); - + template bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const T1 &Arg1) { BoundTypeDiagnoser1 Diagnoser(DiagID, Arg1); return RequireCompleteType(Loc, T, Diagnoser); } - + template bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const T1 &Arg1, const T2 &Arg2) { @@ -1058,7 +1058,7 @@ public: bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser); bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID); - + template bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const T1 &Arg1) { @@ -1318,7 +1318,7 @@ public: void CheckForFunctionRedefinition(FunctionDecl *FD); Decl *ActOnStartOfFunctionDef(Scope *S, Declarator &D); Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D); - void ActOnStartOfObjCMethodOrCFunctionDef(Scope *S, Decl *D, + void ActOnStartOfObjCMethodOrCFunctionDef(Scope *S, Decl *D, bool parseMethod); bool isObjCMethodDecl(Decl *D) { return D && isa(D); @@ -1357,7 +1357,7 @@ public: /// \param ImportLoc The location of the 'import' keyword. /// /// \param Path The module access path. - DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc, + DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc, ModuleIdPath Path); /// \brief Retrieve a suitable printing policy. @@ -1728,20 +1728,20 @@ public: public: bool Suppress; bool SuppressConversion; - + ICEConvertDiagnoser(bool Suppress = false, bool SuppressConversion = false) : Suppress(Suppress), SuppressConversion(SuppressConversion) { } - + /// \brief Emits a diagnostic complaining that the expression does not have /// integral or enumeration type. virtual DiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T) = 0; - + /// \brief Emits a diagnostic when the expression has incomplete class type. virtual DiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) = 0; - + /// \brief Emits a diagnostic when the only matching conversion function /// is explicit. virtual DiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, @@ -1766,7 +1766,7 @@ public: virtual DiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0; - + virtual ~ICEConvertDiagnoser() {} }; @@ -2330,7 +2330,7 @@ public: /// \brief Add the given method to the list of globally-known methods. void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method); - + private: /// AddMethodToGlobalPool - Add an instance or factory method to the global /// pool. See descriptoin of AddInstanceMethodToGlobalPool. @@ -2503,7 +2503,7 @@ public: Stmt *First, Expr *collection, SourceLocation RParenLoc); StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body); - + StmtResult ActOnCXXForRangeStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, @@ -2701,13 +2701,13 @@ public: /// /// \param Loc The location at which the capture occurs. /// - /// \param Kind The kind of capture, which may be implicit (for either a + /// \param Kind The kind of capture, which may be implicit (for either a /// block or a lambda), or explicit by-value or by-reference (for a lambda). /// /// \param EllipsisLoc The location of the ellipsis, if one is provided in /// an explicit lambda capture. /// - /// \param BuildAndDiagnose Whether we are actually supposed to add the + /// \param BuildAndDiagnose Whether we are actually supposed to add the /// captures or diagnose errors. If false, this routine merely check whether /// the capture can occur without performing the capture itself or complaining /// if the variable cannot be captured. @@ -2717,13 +2717,13 @@ public: /// variable can be captured. /// /// \param DeclRefType Will be set to the type of a reference to the capture - /// from within the current scope. Only valid when the variable can be + /// from within the current scope. Only valid when the variable can be /// captured. /// /// \returns true if an error occurred (i.e., the variable cannot be /// captured) and false if the capture succeeded. bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, - SourceLocation EllipsisLoc, bool BuildAndDiagnose, + SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType); @@ -2731,13 +2731,13 @@ public: bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind = TryCapture_Implicit, SourceLocation EllipsisLoc = SourceLocation()); - + /// \brief Given a variable, determine the type that a reference to that /// variable will have in the given scope. QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc); - + void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T); - void MarkDeclarationsReferencedInExpr(Expr *E, + void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables = false); /// \brief Try to recover by turning the given expression into a @@ -3493,7 +3493,7 @@ public: /// \brief Determine whether the given function is an implicitly-deleted /// special member function. bool isImplicitlyDeleted(FunctionDecl *FD); - + /// \brief Check whether 'this' shows up in the type of a static member /// function after the (naturally empty) cv-qualifier-seq would be. /// @@ -3509,7 +3509,7 @@ public: /// /// \returns true if an error occurred. bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method); - + /// MaybeBindToTemporary - If the passed in expression has a record type with /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise /// it simply returns the passed in expression. @@ -3589,29 +3589,29 @@ public: /// \returns The type of 'this', if possible. Otherwise, returns a NULL type. QualType getCurrentThisType(); - /// \brief When non-NULL, the C++ 'this' expression is allowed despite the + /// \brief When non-NULL, the C++ 'this' expression is allowed despite the /// current context not being a non-static member function. In such cases, /// this provides the type used for 'this'. QualType CXXThisTypeOverride; - + /// \brief RAII object used to temporarily allow the C++ 'this' expression /// to be used, with the given qualifiers on the current class type. class CXXThisScopeRAII { Sema &S; QualType OldCXXThisTypeOverride; bool Enabled; - + public: /// \brief Introduce a new scope where 'this' may be allowed (when enabled), - /// using the given declaration (which is either a class template or a + /// using the given declaration (which is either a class template or a /// class) along with the given qualifiers. /// along with the qualifiers placed on '*this'. - CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals, + CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals, bool Enabled = true); - + ~CXXThisScopeRAII(); }; - + /// \brief Make sure the value of 'this' is actually available in the current /// context, if it is a potentially evaluated context. /// @@ -3622,14 +3622,14 @@ public: void CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false); /// \brief Determine whether the given type is the type of *this that is used - /// outside of the body of a member function for a type that is currently + /// outside of the body of a member function for a type that is currently /// being defined. bool isThisOutsideMemberFunctionBody(QualType BaseType); - + /// ActOnCXXBoolLiteral - Parse {true,false} literals. ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind); - - + + /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals. ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind); @@ -3745,7 +3745,7 @@ public: ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef Args, SourceLocation RParenLoc); - + /// ActOnArrayTypeTrait - Parsed one of the bianry type trait support /// pseudo-functions. ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, @@ -3804,7 +3804,7 @@ public: ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, - SourceLocation TildeLoc, + SourceLocation TildeLoc, const DeclSpec& DS, bool HasTrailingLParen); @@ -3896,7 +3896,7 @@ public: ExprResult ActOnDecltypeExpression(Expr *E); bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, - const DeclSpec &DS, + const DeclSpec &DS, SourceLocation ColonColonLoc); bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, @@ -3995,14 +3995,14 @@ public: /// \brief Create a new lambda closure type. CXXRecordDecl *createLambdaClosureType(SourceRange IntroducerRange, bool KnownDependent = false); - + /// \brief Start the definition of a lambda expression. CXXMethodDecl *startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, llvm::ArrayRef Params); - + /// \brief Introduce the scope for a lambda expression. sema::LambdaScopeInfo *enterLambdaScope(CXXMethodDecl *CallOperator, SourceRange IntroducerRange, @@ -4010,20 +4010,20 @@ public: bool ExplicitParams, bool ExplicitResultType, bool Mutable); - + /// \brief Note that we have finished the explicit captures for the /// given lambda. void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI); - + /// \brief Introduce the lambda parameters into scope. void addLambdaParameters(CXXMethodDecl *CallOperator, Scope *CurScope); /// \brief Deduce a block or lambda's return type based on the return /// statements present in the body. void deduceClosureReturnType(sema::CapturingScopeInfo &CSI); - + /// ActOnStartOfLambdaDefinition - This is called just before we start - /// parsing the body of a lambda; it analyzes the explicit captures and + /// parsing the body of a lambda; it analyzes the explicit captures and /// arguments, and sets up various data-structures for the body of the /// lambda. void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, @@ -4037,10 +4037,10 @@ public: /// ActOnLambdaExpr - This is called when the body of a lambda expression /// was successfully completed. ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, - Scope *CurScope, + Scope *CurScope, bool IsInstantiation = false); - /// \brief Define the "body" of the conversion from a lambda object to a + /// \brief Define the "body" of the conversion from a lambda object to a /// function pointer. /// /// This routine doesn't actually define a sensible body; rather, it fills @@ -4050,7 +4050,7 @@ public: void DefineImplicitLambdaToFunctionPointerConversion( SourceLocation CurrentLoc, CXXConversionDecl *Conv); - /// \brief Define the "body" of the conversion from a lambda object to a + /// \brief Define the "body" of the conversion from a lambda object to a /// block pointer. /// /// This routine doesn't actually define a sensible body; rather, it fills @@ -4069,9 +4069,9 @@ public: ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, Expr **Strings, unsigned NumStrings); - + ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S); - + /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the /// numeric literal expression. Type of the expression will be "NSNumber *" /// or "id" if NSNumber is unavailable. @@ -4079,23 +4079,23 @@ public: ExprResult ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value); ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements); - + /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the /// '@' prefixed parenthesized expression. The type of the expression will /// either be "NSNumber *" or "NSString *" depending on the type of /// ValueType, which is allowed to be a built-in numeric type or /// "char *" or "const char *". ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr); - + ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod); - + ExprResult BuildObjCDictionaryLiteral(SourceRange SR, ObjCDictionaryElement *Elements, unsigned NumElements); - + ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc); @@ -4511,9 +4511,9 @@ public: //===--------------------------------------------------------------------===// // C++ Templates [C++ 14] // - void FilterAcceptableTemplateNames(LookupResult &R, + void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates = true); - bool hasAnyAcceptableTemplateNames(LookupResult &R, + bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates = true); void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, @@ -4979,10 +4979,10 @@ public: /// \brief Microsoft __if_not_exists. UPPC_IfNotExists, - + /// \brief Lambda expression. UPPC_Lambda, - + /// \brief Block expression, UPPC_Block }; @@ -6300,7 +6300,7 @@ public: SourceLocation PragmaLoc, SourceLocation WeakNameLoc); - /// ActOnPragmaRedefineExtname - Called on well formed + /// ActOnPragmaRedefineExtname - Called on well formed /// \#pragma redefine_extname oldname newname. void ActOnPragmaRedefineExtname(IdentifierInfo* WeakName, IdentifierInfo* AliasName, @@ -6351,9 +6351,9 @@ public: void AddCFAuditedAttribute(Decl *D); /// AddAlignedAttr - Adds an aligned attribute to a particular declaration. - void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, + void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, bool isDeclSpec); - void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T, + void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T, bool isDeclSpec); /// \brief The kind of conversion being performed. @@ -6542,7 +6542,7 @@ public: QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained = 0); - + /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant /// integer not in the range of enum values. void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, @@ -6713,7 +6713,7 @@ public: /// \brief Force an expression with unknown-type to an expression of the /// given type. ExprResult forceUnknownAnyToType(Expr *E, QualType ToType); - + // CheckVectorCast - check type constraints for vectors. // Since vectors are an extension, there are no C standard reference for this. // We allow casting between vectors and integer datatypes of the same size. @@ -6824,14 +6824,14 @@ public: class VerifyICEDiagnoser { public: bool Suppress; - + VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { } - + virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) =0; virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR); virtual ~VerifyICEDiagnoser() { } }; - + /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE, /// and reports the appropriate diagnostics. Returns false on success. /// Can optionally return the value of the expression. @@ -7045,7 +7045,7 @@ private: FormatStringInfo *FSI); bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, const FunctionProtoType *Proto); - bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, + bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, Expr **Args, unsigned NumArgs); bool CheckBlockCall(NamedDecl *NDecl, CallExpr *TheCall, const FunctionProtoType *Proto);