diff options
Diffstat (limited to 'include/clang/Sema')
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 136 | ||||
-rw-r--r-- | include/clang/Sema/DelayedDiagnostic.h | 2 | ||||
-rw-r--r-- | include/clang/Sema/ExternalSemaSource.h | 18 | ||||
-rw-r--r-- | include/clang/Sema/IdentifierResolver.h | 10 | ||||
-rw-r--r-- | include/clang/Sema/Initialization.h | 156 | ||||
-rw-r--r-- | include/clang/Sema/Lookup.h | 10 | ||||
-rw-r--r-- | include/clang/Sema/MultiplexExternalSemaSource.h | 24 | ||||
-rw-r--r-- | include/clang/Sema/Overload.h | 38 | ||||
-rw-r--r-- | include/clang/Sema/ParsedAttr.h | 12 | ||||
-rw-r--r-- | include/clang/Sema/ParsedTemplate.h | 76 | ||||
-rw-r--r-- | include/clang/Sema/Scope.h | 4 | ||||
-rw-r--r-- | include/clang/Sema/ScopeInfo.h | 98 | ||||
-rw-r--r-- | include/clang/Sema/SemaInternal.h | 16 | ||||
-rw-r--r-- | include/clang/Sema/SemaLambda.h | 6 | ||||
-rw-r--r-- | include/clang/Sema/Template.h | 62 |
15 files changed, 334 insertions, 334 deletions
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 83d5ab2cff85d..2e70203c6cc08 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -61,7 +61,7 @@ namespace clang { /// /// The actual scope is described by getScopeRep(). class CXXScopeSpec { - SourceRange Range; + SourceRange Range; NestedNameSpecifierLocBuilder Builder; public: @@ -73,8 +73,8 @@ public: SourceLocation getEndLoc() const { return Range.getEnd(); } /// Retrieve the representation of the nested-name-specifier. - NestedNameSpecifier *getScopeRep() const { - return Builder.getRepresentation(); + NestedNameSpecifier *getScopeRep() const { + return Builder.getRepresentation(); } /// Extend the current nested-name-specifier by another @@ -91,7 +91,7 @@ public: void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc); - /// Extend the current nested-name-specifier by another + /// Extend the current nested-name-specifier by another /// nested-name-specifier component of the form 'identifier::'. /// /// \param Context The AST context in which this nested-name-specifier @@ -105,7 +105,7 @@ public: void Extend(ASTContext &Context, IdentifierInfo *Identifier, SourceLocation IdentifierLoc, SourceLocation ColonColonLoc); - /// Extend the current nested-name-specifier by another + /// Extend the current nested-name-specifier by another /// nested-name-specifier component of the form 'namespace::'. /// /// \param Context The AST context in which this nested-name-specifier @@ -119,7 +119,7 @@ public: void Extend(ASTContext &Context, NamespaceDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc); - /// Extend the current nested-name-specifier by another + /// Extend the current nested-name-specifier by another /// nested-name-specifier component of the form 'namespace-alias::'. /// /// \param Context The AST context in which this nested-name-specifier @@ -127,7 +127,7 @@ public: /// /// \param Alias The namespace alias. /// - /// \param AliasLoc The location of the namespace alias + /// \param AliasLoc The location of the namespace alias /// name. /// /// \param ColonColonLoc The location of the trailing '::'. @@ -137,7 +137,7 @@ public: /// Turn this (empty) nested-name-specifier into the global /// nested-name-specifier '::'. void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc); - + /// Turns this (empty) nested-name-specifier into '__super' /// nested-name-specifier. /// @@ -160,13 +160,13 @@ public: /// FIXME: This routine should be used very, very rarely, in cases where we /// need to synthesize a nested-name-specifier. Most code should instead use /// \c Adopt() with a proper \c NestedNameSpecifierLoc. - void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, + void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R); - - /// Adopt an existing nested-name-specifier (with source-range + + /// Adopt an existing nested-name-specifier (with source-range /// information). void Adopt(NestedNameSpecifierLoc Other); - + /// Retrieve a nested-name-specifier with location information, copied /// into the given AST context. /// @@ -196,14 +196,14 @@ public: bool isValid() const { return isNotEmpty() && getScopeRep() != nullptr; } /// Indicate that this nested-name-specifier is invalid. - void SetInvalid(SourceRange R) { + void SetInvalid(SourceRange R) { assert(R.isValid() && "Must have a valid source range"); if (Range.getBegin().isInvalid()) Range.setBegin(R.getBegin()); Range.setEnd(R.getEnd()); Builder.Clear(); } - + /// Deprecated. Some call sites intend isNotEmpty() while others intend /// isValid(). bool isSet() const { return getScopeRep() != nullptr; } @@ -215,8 +215,8 @@ public: /// Retrieve the data associated with the source-location information. char *location_data() const { return Builder.getBuffer().first; } - - /// Retrieve the size of the data associated with source-location + + /// Retrieve the size of the data associated with source-location /// information. unsigned location_size() const { return Builder.getBuffer().second; } }; @@ -254,7 +254,7 @@ public: static const TSW TSW_short = clang::TSW_short; static const TSW TSW_long = clang::TSW_long; static const TSW TSW_longlong = clang::TSW_longlong; - + enum TSC { TSC_unspecified, TSC_imaginary, @@ -709,7 +709,7 @@ public: bool isModulePrivateSpecified() const { return ModulePrivateLoc.isValid(); } SourceLocation getModulePrivateSpecLoc() const { return ModulePrivateLoc; } - + bool isConstexprSpecified() const { return Constexpr_specified; } SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; } @@ -916,7 +916,7 @@ enum class UnqualifiedIdKind { IK_DeductionGuideName }; -/// Represents a C++ unqualified-id that has been parsed. +/// Represents a C++ unqualified-id that has been parsed. class UnqualifiedId { private: UnqualifiedId(const UnqualifiedId &Other) = delete; @@ -931,8 +931,8 @@ public: OverloadedOperatorKind Operator; /// The source locations of the individual tokens that name - /// the operator, e.g., the "new", "[", and "]" tokens in - /// operator new []. + /// the operator, e.g., the "new", "[", and "]" tokens in + /// operator new []. /// /// Different operators have different numbers of tokens in their name, /// up to three. Any remaining source locations in this array will be @@ -946,44 +946,44 @@ public: /// When Kind == IK_Identifier, the parsed identifier, or when /// Kind == IK_UserLiteralId, the identifier suffix. IdentifierInfo *Identifier; - + /// When Kind == IK_OperatorFunctionId, the overloaded operator /// that we parsed. struct OFI OperatorFunctionId; - - /// When Kind == IK_ConversionFunctionId, the type that the + + /// When Kind == IK_ConversionFunctionId, the type that the /// conversion function names. UnionParsedType ConversionFunctionId; /// When Kind == IK_ConstructorName, the class-name of the type /// whose constructor is being referenced. UnionParsedType ConstructorName; - + /// When Kind == IK_DestructorName, the type referred to by the /// class-name. UnionParsedType DestructorName; /// When Kind == IK_DeductionGuideName, the parsed template-name. UnionParsedTemplateTy TemplateName; - + /// When Kind == IK_TemplateId or IK_ConstructorTemplateId, /// the template-id annotation that contains the template name and /// template arguments. TemplateIdAnnotation *TemplateId; }; - + /// The location of the first token that describes this unqualified-id, /// which will be the location of the identifier, "operator" keyword, /// tilde (for a destructor), or the template name of a template-id. SourceLocation StartLocation; - + /// The location of the last token that describes this unqualified-id. SourceLocation EndLocation; UnqualifiedId() : Kind(UnqualifiedIdKind::IK_Identifier), Identifier(nullptr) {} - /// Clear out this unqualified-id, setting it to default (invalid) + /// Clear out this unqualified-id, setting it to default (invalid) /// state. void clear() { Kind = UnqualifiedIdKind::IK_Identifier; @@ -991,17 +991,17 @@ public: StartLocation = SourceLocation(); EndLocation = SourceLocation(); } - + /// Determine whether this unqualified-id refers to a valid name. bool isValid() const { return StartLocation.isValid(); } /// Determine whether this unqualified-id refers to an invalid name. bool isInvalid() const { return !isValid(); } - + /// Determine what kind of name we have. UnqualifiedIdKind getKind() const { return Kind; } - void setKind(UnqualifiedIdKind kind) { Kind = kind; } - + void setKind(UnqualifiedIdKind kind) { Kind = kind; } + /// Specify that this unqualified-id was parsed as an identifier. /// /// \param Id the parsed identifier. @@ -1011,8 +1011,8 @@ public: Identifier = const_cast<IdentifierInfo *>(Id); StartLocation = EndLocation = IdLoc; } - - /// Specify that this unqualified-id was parsed as an + + /// Specify that this unqualified-id was parsed as an /// operator-function-id. /// /// \param OperatorLoc the location of the 'operator' keyword. @@ -1021,11 +1021,11 @@ public: /// /// \param SymbolLocations the locations of the individual operator symbols /// in the operator. - void setOperatorFunctionId(SourceLocation OperatorLoc, + void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3]); - - /// Specify that this unqualified-id was parsed as a + + /// Specify that this unqualified-id was parsed as a /// conversion-function-id. /// /// \param OperatorLoc the location of the 'operator' keyword. @@ -1033,7 +1033,7 @@ public: /// \param Ty the type to which this conversion function is converting. /// /// \param EndLoc the location of the last token that makes up the type name. - void setConversionFunctionId(SourceLocation OperatorLoc, + void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc) { Kind = UnqualifiedIdKind::IK_ConversionFunctionId; @@ -1057,7 +1057,7 @@ public: StartLocation = OpLoc; EndLocation = IdLoc; } - + /// Specify that this unqualified-id was parsed as a constructor name. /// /// \param ClassType the class type referred to by the constructor name. @@ -1065,7 +1065,7 @@ public: /// \param ClassNameLoc the location of the class name. /// /// \param EndLoc the location of the last token that makes up the type name. - void setConstructorName(ParsedType ClassType, + void setConstructorName(ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc) { Kind = UnqualifiedIdKind::IK_ConstructorName; @@ -1096,7 +1096,7 @@ public: EndLocation = EndLoc; DestructorName = ClassType; } - + /// Specify that this unqualified-id was parsed as a template-id. /// /// \param TemplateId the template-id annotation that describes the parsed @@ -1115,10 +1115,10 @@ public: TemplateName = Template; StartLocation = EndLocation = TemplateLoc; } - + /// Return the source range that covers this unqualified-id. - SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(StartLocation, EndLocation); + SourceRange getSourceRange() const LLVM_READONLY { + return SourceRange(StartLocation, EndLocation); } SourceLocation getLocStart() const LLVM_READONLY { return StartLocation; } SourceLocation getLocEnd() const LLVM_READONLY { return EndLocation; } @@ -1326,7 +1326,7 @@ struct DeclaratorChunk { /// Pointer to the expression in the noexcept-specifier of this /// function, if it has one. Expr *NoexceptExpr; - + /// Pointer to the cached tokens for an exception-specification /// that has not yet been parsed. CachedTokens *ExceptionSpecTokens; @@ -1426,7 +1426,7 @@ struct DeclaratorChunk { return SourceLocation::getFromRawEncoding(MutableLoc); } - /// Determine whether this function declaration contains a + /// Determine whether this function declaration contains a /// ref-qualifier. bool hasRefQualifier() const { return getRefQualifierLoc().isValid(); } @@ -1746,7 +1746,7 @@ enum class DeclaratorContext { /// Instances of this class should be a transient object that lives on the /// stack, not objects that are allocated in large quantities on the heap. class Declarator { - + private: const DeclSpec &DS; CXXScopeSpec SS; @@ -1771,7 +1771,7 @@ private: /// GroupingParens - Set by Parser::ParseParenDeclarator(). unsigned GroupingParens : 1; - /// FunctionDefinition - Is this Declarator for a function or member + /// FunctionDefinition - Is this Declarator for a function or member /// definition and, if so, what kind? /// /// Actually a FunctionDefinitionKind. @@ -1785,7 +1785,7 @@ private: /// Indicates whether this is an Objective-C instance variable. unsigned ObjCIvar : 1; - + /// Indicates whether this is an Objective-C 'weak' property. unsigned ObjCWeakProperty : 1; @@ -1817,7 +1817,7 @@ private: /// If provided, the source location of the ellipsis used to describe /// this declarator as a parameter pack. SourceLocation EllipsisLoc; - + friend struct DeclaratorChunk; public: @@ -1858,7 +1858,7 @@ public: const DecompositionDeclarator &getDecompositionDeclarator() const { return BindingGroup; } - + DeclaratorContext getContext() const { return Context; } bool isPrototypeContext() const { @@ -2107,10 +2107,10 @@ public: return BindingGroup.isSet(); } - IdentifierInfo *getIdentifier() const { + IdentifierInfo *getIdentifier() const { if (Name.getKind() == UnqualifiedIdKind::IK_Identifier) return Name.Identifier; - + return nullptr; } SourceLocation getIdentifierLoc() const { return Name.StartLocation; } @@ -2261,9 +2261,9 @@ public: return const_cast<Declarator*>(this)->getFunctionTypeInfo(); } - /// Determine whether the declaration that will be produced from + /// Determine whether the declaration that will be produced from /// this declaration will be a function. - /// + /// /// A declaration can declare a function even if the declarator itself /// isn't a function declarator, if the type specifier refers to a function /// type. This routine checks for both cases. @@ -2318,8 +2318,8 @@ public: case DeclaratorContext::MemberContext: // FIXME: sizeof(...) permits an expression. - case DeclaratorContext::TypeNameContext: - + case DeclaratorContext::TypeNameContext: + case DeclaratorContext::FunctionalCastContext: case DeclaratorContext::AliasDeclContext: case DeclaratorContext::AliasTemplateContext: @@ -2349,7 +2349,7 @@ public: llvm_unreachable("unknown context kind!"); } - + /// Return true if a function declarator at this position would be a /// function declaration. bool isFunctionDeclaratorAFunctionDeclaration() const { @@ -2418,7 +2418,7 @@ public: void setObjCIvar(bool Val = true) { ObjCIvar = Val; } bool isObjCIvar() const { return ObjCIvar; } - + void setObjCWeakProperty(bool Val = true) { ObjCWeakProperty = Val; } bool isObjCWeakProperty() const { return ObjCWeakProperty; } @@ -2438,16 +2438,16 @@ public: SourceLocation getEllipsisLoc() const { return EllipsisLoc; } void setEllipsisLoc(SourceLocation EL) { EllipsisLoc = EL; } - void setFunctionDefinitionKind(FunctionDefinitionKind Val) { - FunctionDefinition = Val; + void setFunctionDefinitionKind(FunctionDefinitionKind Val) { + FunctionDefinition = Val; } - + bool isFunctionDefinition() const { return getFunctionDefinitionKind() != FDK_Declaration; } - - FunctionDefinitionKind getFunctionDefinitionKind() const { - return (FunctionDefinitionKind)FunctionDefinition; + + FunctionDefinitionKind getFunctionDefinitionKind() const { + return (FunctionDefinitionKind)FunctionDefinition; } /// Returns true if this declares a real member and not a friend. @@ -2511,7 +2511,7 @@ public: SourceLocation getFirstLocation() const { return FirstLocation; } SourceLocation getLastLocation() const { return LastLocation; } Specifier getLastSpecifier() const { return LastSpecifier; } - + private: unsigned Specifiers; Specifier LastSpecifier; @@ -2565,7 +2565,7 @@ struct LambdaIntroducer { IdentifierInfo* Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, - ExprResult Init, + ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange) { Captures.push_back(LambdaCapture(Kind, Loc, Id, EllipsisLoc, InitKind, Init, diff --git a/include/clang/Sema/DelayedDiagnostic.h b/include/clang/Sema/DelayedDiagnostic.h index 76aa4546d749a..a26b6ff070f6f 100644 --- a/include/clang/Sema/DelayedDiagnostic.h +++ b/include/clang/Sema/DelayedDiagnostic.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // /// \file -/// Defines the classes clang::DelayedDiagnostic and +/// Defines the classes clang::DelayedDiagnostic and /// clang::AccessedEntity. /// /// DelayedDiangostic is used to record diagnostics that are being diff --git a/include/clang/Sema/ExternalSemaSource.h b/include/clang/Sema/ExternalSemaSource.h index 42754b33e2df2..00f80e27415d4 100644 --- a/include/clang/Sema/ExternalSemaSource.h +++ b/include/clang/Sema/ExternalSemaSource.h @@ -46,7 +46,7 @@ struct ExternalVTableUse { SourceLocation Location; bool DefinitionRequired; }; - + /// An abstract interface that should be implemented by /// external AST sources that also provide information for semantic /// analysis. @@ -106,7 +106,7 @@ public: /// introduce the same declarations repeatedly. virtual void ReadTentativeDefinitions( SmallVectorImpl<VarDecl *> &TentativeDefs) {} - + /// Read the set of unused file-scope declarations known to the /// external Sema source. /// @@ -116,7 +116,7 @@ public: /// introduce the same declarations repeatedly. virtual void ReadUnusedFileScopedDecls( SmallVectorImpl<const DeclaratorDecl *> &Decls) {} - + /// Read the set of delegating constructors known to the /// external Sema source. /// @@ -148,9 +148,9 @@ public: /// Read the set of referenced selectors known to the /// external Sema source. /// - /// The external source should append its own referenced selectors to the - /// given vector of selectors. Note that this routine - /// may be invoked multiple times; the external source should take care not + /// The external source should append its own referenced selectors to the + /// given vector of selectors. Note that this routine + /// may be invoked multiple times; the external source should take care not /// to introduce the same selectors repeatedly. virtual void ReadReferencedSelectors( SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {} @@ -159,7 +159,7 @@ public: /// external Sema source. /// /// The external source should append its own weak, undeclared identifiers to - /// the given vector. Note that this routine may be invoked multiple times; + /// the given vector. Note that this routine may be invoked multiple times; /// the external source should take care not to introduce the same identifiers /// repeatedly. virtual void ReadWeakUndeclaredIdentifiers( @@ -180,7 +180,7 @@ public: /// external source should take care not to introduce the same instantiations /// repeatedly. virtual void ReadPendingInstantiations( - SmallVectorImpl<std::pair<ValueDecl *, + SmallVectorImpl<std::pair<ValueDecl *, SourceLocation> > &Pending) {} /// Read the set of late parsed template functions for this source. @@ -227,7 +227,7 @@ public: static bool classof(const ExternalASTSource *Source) { return Source->SemaSource; } -}; +}; } // end namespace clang diff --git a/include/clang/Sema/IdentifierResolver.h b/include/clang/Sema/IdentifierResolver.h index ea6c3df74af0b..1c46e1d0e3d2c 100644 --- a/include/clang/Sema/IdentifierResolver.h +++ b/include/clang/Sema/IdentifierResolver.h @@ -32,7 +32,7 @@ class LangOptions; class NamedDecl; class Preprocessor; class Scope; - + /// IdentifierResolver - Keeps track of shadowed decls on enclosing /// scopes. It manages the shadowing chains of declaration names and /// implements efficient decl lookup based on a declaration name. @@ -58,7 +58,7 @@ class IdentifierResolver { void InsertDecl(DeclsTy::iterator Pos, NamedDecl *D) { Decls.insert(Pos, D); } - + private: DeclsTy Decls; }; @@ -176,17 +176,17 @@ public: /// /// \returns true if the declaration was added, false otherwise. bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name); - + private: const LangOptions &LangOpt; Preprocessor &PP; - + class IdDeclInfoMap; IdDeclInfoMap *IdDeclInfos; void updatingIdentifier(IdentifierInfo &II); void readingIdentifier(IdentifierInfo &II); - + /// FETokenInfo contains a Decl pointer if lower bit == 0. static inline bool isDeclPtr(void *Ptr) { return (reinterpret_cast<uintptr_t>(Ptr) & 0x1) == 0; diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h index 7a510f391bda4..8582e971d0b6c 100644 --- a/include/clang/Sema/Initialization.h +++ b/include/clang/Sema/Initialization.h @@ -102,7 +102,7 @@ public: /// complex number. EK_ComplexElement, - /// The entity being initialized is the field that captures a + /// The entity being initialized is the field that captures a /// variable in a lambda. EK_LambdaCapture, @@ -178,7 +178,7 @@ private: union { /// When Kind == EK_Variable, EK_Member or EK_Binding, the variable. VD Variable; - + /// When Kind == EK_RelatedResult, the ObjectiveC method where /// result type was implicitly changed to accommodate ARC semantics. ObjCMethodDecl *MethodDecl; @@ -186,21 +186,21 @@ private: /// When Kind == EK_Parameter, the ParmVarDecl, with the /// low bit indicating whether the parameter is "consumed". uintptr_t Parameter; - + /// When Kind == EK_Temporary or EK_CompoundLiteralInit, the type /// source information for the temporary. TypeSourceInfo *TypeInfo; struct LN LocAndNRVO; - - /// When Kind == EK_Base, the base specifier that provides the + + /// When Kind == EK_Base, the base specifier that provides the /// base class. The lower bit specifies whether the base is an inherited /// virtual base. uintptr_t Base; /// When Kind == EK_ArrayElement, EK_VectorElement, or /// EK_ComplexElement, the index of the array or vector element being - /// initialized. + /// initialized. unsigned Index; struct C Capture; @@ -211,7 +211,7 @@ private: /// Create the initialization entity for a variable. InitializedEntity(VarDecl *Var, EntityKind EK = EK_Variable) : Kind(EK), Type(Var->getType()), Variable{Var, false, false} {} - + /// Create the initialization entity for the result of a /// function, throwing an object, performing an explicit cast, or /// initializing a parameter for which there is no declaration. @@ -221,15 +221,15 @@ private: LocAndNRVO.Location = Loc.getRawEncoding(); LocAndNRVO.NRVO = NRVO; } - + /// Create the initialization entity for a member subobject. InitializedEntity(FieldDecl *Member, const InitializedEntity *Parent, bool Implicit, bool DefaultMemberInit) : Kind(EK_Member), Parent(Parent), Type(Member->getType()), Variable{Member, Implicit, DefaultMemberInit} {} - + /// Create the initialization entity for an array element. - InitializedEntity(ASTContext &Context, unsigned Index, + InitializedEntity(ASTContext &Context, unsigned Index, const InitializedEntity &Parent); /// Create the initialization entity for a lambda capture. @@ -238,7 +238,7 @@ private: Capture.VarID = VarID; Capture.Location = Loc.getRawEncoding(); } - + public: /// Create the initialization entity for a variable. static InitializedEntity InitializeVariable(VarDecl *Var) { @@ -314,7 +314,7 @@ public: static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type) { return InitializedEntity(EK_New, NewLoc, Type); } - + /// Create the initialization entity for a temporary. static InitializedEntity InitializeTemporary(QualType Type) { return InitializeTemporary(nullptr, Type); @@ -324,7 +324,7 @@ public: static InitializedEntity InitializeTemporary(TypeSourceInfo *TypeInfo) { return InitializeTemporary(TypeInfo, TypeInfo->getType()); } - + /// Create the initialization entity for a temporary. static InitializedEntity InitializeTemporary(TypeSourceInfo *TypeInfo, QualType Type) { @@ -332,7 +332,7 @@ public: Result.TypeInfo = TypeInfo; return Result; } - + /// Create the initialization entity for a related result. static InitializedEntity InitializeRelatedResult(ObjCMethodDecl *MD, QualType Type) { @@ -375,8 +375,8 @@ public: } /// Create the initialization entity for an array element. - static InitializedEntity InitializeElement(ASTContext &Context, - unsigned Index, + static InitializedEntity InitializeElement(ASTContext &Context, + unsigned Index, const InitializedEntity &Parent) { return InitializedEntity(Context, Index, Parent); } @@ -403,7 +403,7 @@ public: /// Determine the kind of initialization. EntityKind getKind() const { return Kind; } - + /// Retrieve the parent of the entity being initialized, when /// the initialization itself is occurring within the context of a /// larger initialization. @@ -411,27 +411,27 @@ public: /// Retrieve type being initialized. QualType getType() const { return Type; } - - /// Retrieve complete type-source information for the object being + + /// Retrieve complete type-source information for the object being /// constructed, if known. TypeSourceInfo *getTypeSourceInfo() const { if (Kind == EK_Temporary || Kind == EK_CompoundLiteralInit) return TypeInfo; - + return nullptr; } - + /// Retrieve the name of the entity being initialized. DeclarationName getName() const; /// Retrieve the variable, parameter, or field being /// initialized. ValueDecl *getDecl() const; - + /// Retrieve the ObjectiveC method being initialized. ObjCMethodDecl *getMethodDecl() const { return MethodDecl; } - /// Determine whether this initialization allows the named return + /// Determine whether this initialization allows the named return /// value optimization, which also applies to thrown objects. bool allowsNRVO() const; @@ -446,7 +446,7 @@ public: assert(isParameterKind() && "Not a parameter"); return (Parameter & 1); } - + /// Retrieve the base specifier. const CXXBaseSpecifier *getBaseSpecifier() const { assert(getKind() == EK_Base && "Not a base specifier"); @@ -519,7 +519,7 @@ public: assert(getKind() == EK_LambdaCapture && "Not a lambda capture!"); return SourceLocation::getFromRawEncoding(Capture.Location); } - + void setParameterCFAudited() { Kind = EK_Parameter_CF_Audited; } @@ -533,8 +533,8 @@ public: private: unsigned dumpImpl(raw_ostream &OS) const; }; - -/// Describes the kind of initialization being performed, along with + +/// Describes the kind of initialization being performed, along with /// location information for tokens related to the initialization (equal sign, /// parentheses). class InitializationKind { @@ -556,7 +556,7 @@ public: /// Value initialization IK_Value }; - + private: /// The context of the initialization. enum InitContext { @@ -578,24 +578,24 @@ private: /// Functional cast context IC_FunctionalCast }; - + /// The kind of initialization being performed. InitKind Kind : 8; /// The context of the initialization. InitContext Context : 8; - + /// The source locations involved in the initialization. SourceLocation Locations[3]; - - InitializationKind(InitKind Kind, InitContext Context, SourceLocation Loc1, + + InitializationKind(InitKind Kind, InitContext Context, SourceLocation Loc1, SourceLocation Loc2, SourceLocation Loc3) : Kind(Kind), Context(Context) { Locations[0] = Loc1; Locations[1] = Loc2; Locations[2] = Loc3; } - + public: /// Create a direct initialization. static InitializationKind CreateDirect(SourceLocation InitLoc, @@ -617,13 +617,13 @@ public: RBraceLoc); } - /// Create a direct initialization due to a cast that isn't a C-style + /// Create a direct initialization due to a cast that isn't a C-style /// or functional cast. static InitializationKind CreateCast(SourceRange TypeRange) { return InitializationKind(IK_Direct, IC_StaticCast, TypeRange.getBegin(), TypeRange.getBegin(), TypeRange.getEnd()); } - + /// Create a direct initialization for a C-style cast. static InitializationKind CreateCStyleCast(SourceLocation StartLoc, SourceRange TypeRange, @@ -647,16 +647,16 @@ public: static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs = false) { - return InitializationKind(IK_Copy, + return InitializationKind(IK_Copy, AllowExplicitConvs? IC_ExplicitConvs : IC_Normal, InitLoc, EqualLoc, EqualLoc); } - + /// Create a default initialization. static InitializationKind CreateDefault(SourceLocation InitLoc) { return InitializationKind(IK_Default, IC_Normal, InitLoc, InitLoc, InitLoc); } - + /// Create a value initialization. static InitializationKind CreateValue(SourceLocation InitLoc, SourceLocation LParenLoc, @@ -676,20 +676,20 @@ public: return CreateDirectList(Loc, Init->getLocStart(), Init->getLocEnd()); return CreateDirect(Loc, Init->getLocStart(), Init->getLocEnd()); } - + /// Determine the initialization kind. InitKind getKind() const { return Kind; } - + /// Determine whether this initialization is an explicit cast. bool isExplicitCast() const { return Context >= IC_StaticCast; } - + /// Determine whether this initialization is a C-style cast. - bool isCStyleOrFunctionalCast() const { - return Context >= IC_CStyleCast; + bool isCStyleOrFunctionalCast() const { + return Context >= IC_CStyleCast; } /// Determine whether this is a C-style cast. @@ -709,12 +709,12 @@ public: /// Retrieve the location at which initialization is occurring. SourceLocation getLocation() const { return Locations[0]; } - + /// Retrieve the source range that covers the initialization. - SourceRange getRange() const { + SourceRange getRange() const { return SourceRange(Locations[0], Locations[2]); } - + /// Retrieve the location of the equal sign for copy initialization /// (if present). SourceLocation getEqualLoc() const { @@ -741,7 +741,7 @@ public: bool hasParenOrBraceRange() const { return Kind == IK_Direct || Kind == IK_Value || Kind == IK_DirectList; } - + /// Retrieve the source range containing the locations of the open /// and closing parentheses or braces for value, direct, and direct list /// initializations. @@ -771,7 +771,7 @@ public: /// A normal sequence. NormalSequence }; - + /// Describes the kind of a particular step in an initialization /// sequence. enum StepKind { @@ -898,13 +898,13 @@ public: /// Passing zero to a function where OpenCL event_t is expected. SK_OCLZeroEvent }; - + /// A single step in the initialization sequence. class Step { public: /// The kind of conversion or initialization step we are taking. StepKind Kind; - + // The type that results from this initialization. QualType Type; @@ -916,7 +916,7 @@ public: union { /// When Kind == SK_ResolvedOverloadedFunction or Kind == - /// SK_UserConversion, the function that the expression should be + /// SK_UserConversion, the function that the expression should be /// resolved to or the conversion function to call, respectively. /// When Kind == SK_ConstructorInitialization or SK_ListConstruction, /// the constructor to be called. @@ -938,14 +938,14 @@ public: void Destroy(); }; - + private: /// The kind of initialization sequence computed. enum SequenceKind SequenceKind; - + /// Steps taken by this initialization. SmallVector<Step, 4> Steps; - + public: /// Describes why initialization failed. enum FailureKind { @@ -958,7 +958,7 @@ public: /// Array must be initialized with an initializer list. FK_ArrayNeedsInitList, - /// Array must be initialized with an initializer list or a + /// Array must be initialized with an initializer list or a /// string literal. FK_ArrayNeedsInitListOrStringLiteral, @@ -1067,14 +1067,14 @@ public: /// List-copy-initialization chose an explicit constructor. FK_ExplicitConstructor, }; - + private: /// The reason why initialization failed. FailureKind Failure; /// The failed result of overload resolution. OverloadingResult FailedOverloadResult; - + /// The candidate set created when initialization failed. OverloadCandidateSet FailedCandidateSet; @@ -1100,11 +1100,11 @@ private: void PrintInitLocationNote(Sema &S, const InitializedEntity &Entity); public: - /// Try to perform initialization of the given entity, creating a + /// Try to perform initialization of the given entity, creating a /// record of the steps required to perform the initialization. /// /// The generated initialization sequence will either contain enough - /// information to diagnose + /// information to diagnose /// /// \param S the semantic analysis object. /// @@ -1119,7 +1119,7 @@ public: /// narrowing conversions in C++11 onwards. /// \param TreatUnavailableAsInvalid true if we want to treat unavailable /// as invalid. - InitializationSequence(Sema &S, + InitializationSequence(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, @@ -1130,7 +1130,7 @@ public: bool TopLevelOfInitList, bool TreatUnavailableAsInvalid); ~InitializationSequence(); - + /// Perform the actual initialization of the given entity based on /// the computed initialization sequence. /// @@ -1157,22 +1157,22 @@ public: const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType = nullptr); - + /// Diagnose an potentially-invalid initialization sequence. /// - /// \returns true if the initialization sequence was ill-formed, + /// \returns true if the initialization sequence was ill-formed, /// false otherwise. - bool Diagnose(Sema &S, + bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef<Expr *> Args); - + /// Determine the kind of initialization sequence computed. enum SequenceKind getKind() const { return SequenceKind; } - + /// Set the kind of sequence computed. void setSequenceKind(enum SequenceKind SK) { SequenceKind = SK; } - + /// Determine whether the initialization sequence is valid. explicit operator bool() const { return !Failed(); } @@ -1188,14 +1188,14 @@ public: step_range steps() const { return {step_begin(), step_end()}; } - /// Determine whether this initialization is a direct reference + /// Determine whether this initialization is a direct reference /// binding (C++ [dcl.init.ref]). bool isDirectReferenceBinding() const; - + /// Determine whether this initialization failed due to an ambiguity. bool isAmbiguous() const; - - /// Determine whether this initialization is direct call to a + + /// Determine whether this initialization is direct call to a /// constructor. bool isConstructorInitialization() const; @@ -1228,7 +1228,7 @@ public: /// rvalue, an xvalue, or an lvalue. void AddDerivedToBaseCastStep(QualType BaseType, ExprValueKind Category); - + /// Add a new step binding a reference to an object. /// /// \param BindingTemporary True if we are binding a reference to a temporary @@ -1351,11 +1351,11 @@ public: assert((Failure != FK_Incomplete || !FailedIncompleteType.isNull()) && "Incomplete type failure requires a type!"); } - + /// Note that this initialization sequence failed due to failed /// overload resolution. void SetOverloadFailure(FailureKind Failure, OverloadingResult Result); - + /// Retrieve a reference to the candidate set when overload /// resolution fails. OverloadCandidateSet &getFailedCandidateSet() { @@ -1381,15 +1381,15 @@ public: return Failure; } - /// Dump a representation of this initialization sequence to + /// Dump a representation of this initialization sequence to /// the given stream, for debugging purposes. void dump(raw_ostream &OS) const; - - /// Dump a representation of this initialization sequence to + + /// Dump a representation of this initialization sequence to /// standard error, for debugging purposes. void dump() const; }; - + } // namespace clang #endif // LLVM_CLANG_SEMA_INITIALIZATION_H diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h index c06952064dd9e..e28b847f4ae5a 100644 --- a/include/clang/Sema/Lookup.h +++ b/include/clang/Sema/Lookup.h @@ -50,11 +50,11 @@ public: /// No entity found met the criteria. NotFound = 0, - /// No entity found met the criteria within the current - /// instantiation,, but there were dependent base classes of the + /// No entity found met the criteria within the current + /// instantiation,, but there were dependent base classes of the /// current instantiation that could not be searched. NotFoundInCurrentInstantiation, - + /// Name lookup found a single declaration that met the /// criteria. getFoundDecl() will return this declaration. Found, @@ -435,7 +435,7 @@ public: bool wasNotFoundInCurrentInstantiation() const { return ResultKind == NotFoundInCurrentInstantiation; } - + /// Note that while no result was found in the current instantiation, /// there were dependent base classes that could not be searched. void setNotFoundInCurrentInstantiation() { @@ -610,7 +610,7 @@ public: LookupResult::iterator I; bool Changed = false; bool CalledDone = false; - + Filter(LookupResult &Results) : Results(Results), I(Results.begin()) {} public: diff --git a/include/clang/Sema/MultiplexExternalSemaSource.h b/include/clang/Sema/MultiplexExternalSemaSource.h index 4c242c89f3f4b..86bddebcef691 100644 --- a/include/clang/Sema/MultiplexExternalSemaSource.h +++ b/include/clang/Sema/MultiplexExternalSemaSource.h @@ -42,7 +42,7 @@ private: SmallVector<ExternalSemaSource *, 2> Sources; // doesn't own them. public: - + ///Constructs a new multiplexing external sema source and appends the /// given element to it. /// @@ -113,7 +113,7 @@ public: /// Get the decls that are contained in a file in the Offset/Length /// range. \p Length can be 0 to indicate a point at \p Offset instead of - /// a range. + /// a range. void FindFileRegionDecls(FileID File, unsigned Offset,unsigned Length, SmallVectorImpl<Decl *> &Decls) override; @@ -125,7 +125,7 @@ public: /// incomplete Objective-C class. /// /// This routine will only be invoked if the "externally completed" bit is - /// set on the ObjCInterfaceDecl via the function + /// set on the ObjCInterfaceDecl via the function /// \c ObjCInterfaceDecl::setExternallyCompleted(). void CompleteType(ObjCInterfaceDecl *Class) override; @@ -156,7 +156,7 @@ public: /// Perform layout on the given record. /// - /// This routine allows the external AST source to provide an specific + /// This routine allows the external AST source to provide an specific /// layout for a record, overriding the layout that would normally be /// constructed. It is intended for clients who receive specific layout /// details rather than source code (such as LLDB). The client is expected @@ -173,13 +173,13 @@ public: /// expressed in bits. All of the fields must be provided with offsets. /// /// \param BaseOffsets The offset of each of the direct, non-virtual base - /// classes. If any bases are not given offsets, the bases will be laid + /// classes. If any bases are not given offsets, the bases will be laid /// out according to the ABI. /// /// \param VirtualBaseOffsets The offset of each of the virtual base classes - /// (either direct or not). If any bases are not given offsets, the bases will + /// (either direct or not). If any bases are not given offsets, the bases will /// be laid out according to the ABI. - /// + /// /// \returns true if the record layout was provided, false otherwise. bool layoutRecordType(const RecordDecl *Record, @@ -287,9 +287,9 @@ public: /// Read the set of referenced selectors known to the /// external Sema source. /// - /// The external source should append its own referenced selectors to the - /// given vector of selectors. Note that this routine - /// may be invoked multiple times; the external source should take care not + /// The external source should append its own referenced selectors to the + /// given vector of selectors. Note that this routine + /// may be invoked multiple times; the external source should take care not /// to introduce the same selectors repeatedly. void ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) override; @@ -298,7 +298,7 @@ public: /// external Sema source. /// /// The external source should append its own weak, undeclared identifiers to - /// the given vector. Note that this routine may be invoked multiple times; + /// the given vector. Note that this routine may be invoked multiple times; /// the external source should take care not to introduce the same identifiers /// repeatedly. void ReadWeakUndeclaredIdentifiers( @@ -356,7 +356,7 @@ public: // isa/cast/dyn_cast support static bool classof(const MultiplexExternalSemaSource*) { return true; } //static bool classof(const ExternalSemaSource*) { return true; } -}; +}; } // end namespace clang diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h index f75faf049625d..6ded010ee8ed7 100644 --- a/include/clang/Sema/Overload.h +++ b/include/clang/Sema/Overload.h @@ -62,7 +62,7 @@ class Sema; /// Succeeded, but refers to a deleted function. OR_Deleted }; - + enum OverloadCandidateDisplayKind { /// Requests that all candidates be shown. Viable candidates will /// be printed first. @@ -107,7 +107,7 @@ class Sema; /// Integral conversions (C++ [conv.integral]) ICK_Integral_Conversion, - /// Floating point conversions (C++ [conv.double] + /// Floating point conversions (C++ [conv.double] ICK_Floating_Conversion, /// Complex conversions (C99 6.3.1.6) @@ -252,7 +252,7 @@ class Sema; /// Whether the qualification conversion involves a change in the /// Objective-C lifetime (for automatic reference counting). unsigned QualificationIncludesObjCLifetime : 1; - + /// IncompatibleObjC - Whether this is an Objective-C conversion /// that we should warn about (if we actually use it). unsigned IncompatibleObjC : 1; @@ -268,21 +268,21 @@ class Sema; /// Whether this is an lvalue reference binding (otherwise, it's /// an rvalue reference binding). unsigned IsLvalueReference : 1; - + /// Whether we're binding to a function lvalue. unsigned BindsToFunctionLvalue : 1; - + /// Whether we're binding to an rvalue. unsigned BindsToRvalue : 1; - - /// Whether this binds an implicit object argument to a + + /// Whether this binds an implicit object argument to a /// non-static member function without a ref-qualifier. unsigned BindsImplicitObjectArgumentWithoutRefQualifier : 1; - + /// Whether this binds a reference to an object with a different /// Objective-C lifetime qualifier. unsigned ObjCLifetimeConversionBinding : 1; - + /// FromType - The type that this conversion is converting /// from. This is an opaque pointer that can be translated into a /// QualType. @@ -303,13 +303,13 @@ class Sema; void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); } - void setToType(unsigned Idx, QualType T) { + void setToType(unsigned Idx, QualType T) { assert(Idx < 3 && "To type index is out of range"); - ToTypePtrs[Idx] = T.getAsOpaquePtr(); + ToTypePtrs[Idx] = T.getAsOpaquePtr(); } void setAllToTypes(QualType T) { - ToTypePtrs[0] = T.getAsOpaquePtr(); + ToTypePtrs[0] = T.getAsOpaquePtr(); ToTypePtrs[1] = ToTypePtrs[0]; ToTypePtrs[2] = ToTypePtrs[0]; } @@ -324,11 +324,11 @@ class Sema; } void setAsIdentityConversion(); - + bool isIdentityConversion() const { return Second == ICK_Identity && Third == ICK_Identity; } - + ImplicitConversionRank getRank() const; NarrowingKind getNarrowingKind(ASTContext &Context, const Expr *Converted, @@ -562,7 +562,7 @@ class Sema; new (this) ImplicitConversionSequence(Other); return *this; } - + ~ImplicitConversionSequence() { destruct(); } @@ -571,7 +571,7 @@ class Sema; assert(isInitialized() && "querying uninitialized conversion"); return Kind(ConversionKind); } - + /// Return a ranking of the implicit conversion sequence /// kind, where smaller ranks represent better conversion /// sequences. @@ -581,11 +581,11 @@ class Sema; /// per C++ [over.best.ics]p10. unsigned getKindRank() const { switch (getKind()) { - case StandardConversion: + case StandardConversion: return 0; case UserDefinedConversion: - case AmbiguousConversion: + case AmbiguousConversion: return 1; case EllipsisConversion: @@ -781,7 +781,7 @@ class Sema; union { DeductionFailureInfo DeductionFailure; - + /// FinalConversion - For a conversion function (where Function is /// a CXXConversionDecl), the standard conversion that occurs /// after the call to the overload candidate to convert the result diff --git a/include/clang/Sema/ParsedAttr.h b/include/clang/Sema/ParsedAttr.h index 3f293247787ca..cfb91af78370f 100644 --- a/include/clang/Sema/ParsedAttr.h +++ b/include/clang/Sema/ParsedAttr.h @@ -179,7 +179,7 @@ private: /// The location of the 'unavailable' keyword in an /// availability attribute. SourceLocation UnavailableLoc; - + const Expr *MessageExpr; /// Arguments, if any, are stored immediately following the object. @@ -265,7 +265,7 @@ private: Args[2] = Parm3; AttrKind = getKind(getName(), getScopeName(), syntaxUsed); } - + /// Constructor for type_tag_for_datatype attribute. ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, @@ -352,7 +352,7 @@ public: void operator delete(void *) = delete; - enum Kind { + enum Kind { #define PARSED_ATTR(NAME) AT_##NAME, #include "clang/Sema/AttrParsedAttrList.inc" #undef PARSED_ATTR @@ -363,11 +363,11 @@ public: IdentifierInfo *getName() const { return AttrName; } SourceLocation getLoc() const { return AttrRange.getBegin(); } SourceRange getRange() const { return AttrRange; } - + bool hasScope() const { return ScopeName; } IdentifierInfo *getScopeName() const { return ScopeName; } SourceLocation getScopeLoc() const { return ScopeLoc; } - + bool hasParsedType() const { return HasParsedType; } /// Is this the Microsoft __declspec(property) attribute? @@ -473,7 +473,7 @@ public: assert(getKind() == AT_Availability && "Not an availability attribute"); return UnavailableLoc; } - + const Expr * getMessageExpr() const { assert(getKind() == AT_Availability && "Not an availability attribute"); return MessageExpr; diff --git a/include/clang/Sema/ParsedTemplate.h b/include/clang/Sema/ParsedTemplate.h index f79157ba813e6..258b2291d2602 100644 --- a/include/clang/Sema/ParsedTemplate.h +++ b/include/clang/Sema/ParsedTemplate.h @@ -25,7 +25,7 @@ #include <cstdlib> #include <new> -namespace clang { +namespace clang { /// Represents the parsed form of a C++ template argument. class ParsedTemplateArgument { public: @@ -39,87 +39,87 @@ namespace clang { Template }; - /// Build an empty template argument. + /// Build an empty template argument. /// /// This template argument is invalid. ParsedTemplateArgument() : Kind(Type), Arg(nullptr) { } - + /// Create a template type argument or non-type template argument. /// /// \param Arg the template type argument or non-type template argument. /// \param Loc the location of the type. ParsedTemplateArgument(KindType Kind, void *Arg, SourceLocation Loc) : Kind(Kind), Arg(Arg), Loc(Loc) { } - + /// Create a template template argument. /// /// \param SS the C++ scope specifier that precedes the template name, if /// any. /// - /// \param Template the template to which this template template + /// \param Template the template to which this template template /// argument refers. /// /// \param TemplateLoc the location of the template name. ParsedTemplateArgument(const CXXScopeSpec &SS, - ParsedTemplateTy Template, - SourceLocation TemplateLoc) + ParsedTemplateTy Template, + SourceLocation TemplateLoc) : Kind(ParsedTemplateArgument::Template), - Arg(Template.getAsOpaquePtr()), + Arg(Template.getAsOpaquePtr()), SS(SS), Loc(TemplateLoc), EllipsisLoc() { } - + /// Determine whether the given template argument is invalid. bool isInvalid() const { return Arg == nullptr; } - + /// Determine what kind of template argument we have. KindType getKind() const { return Kind; } - + /// Retrieve the template type argument's type. ParsedType getAsType() const { assert(Kind == Type && "Not a template type argument"); return ParsedType::getFromOpaquePtr(Arg); } - + /// Retrieve the non-type template argument's expression. Expr *getAsExpr() const { assert(Kind == NonType && "Not a non-type template argument"); return static_cast<Expr*>(Arg); } - + /// Retrieve the template template argument's template name. ParsedTemplateTy getAsTemplate() const { assert(Kind == Template && "Not a template template argument"); return ParsedTemplateTy::getFromOpaquePtr(Arg); } - + /// Retrieve the location of the template argument. SourceLocation getLocation() const { return Loc; } - + /// Retrieve the nested-name-specifier that precedes the template /// name in a template template argument. const CXXScopeSpec &getScopeSpec() const { - assert(Kind == Template && + assert(Kind == Template && "Only template template arguments can have a scope specifier"); return SS; } - + /// Retrieve the location of the ellipsis that makes a template /// template argument into a pack expansion. SourceLocation getEllipsisLoc() const { - assert(Kind == Template && + assert(Kind == Template && "Only template template arguments can have an ellipsis"); return EllipsisLoc; } - + /// Retrieve a pack expansion of the given template template /// argument. /// /// \param EllipsisLoc The location of the ellipsis. ParsedTemplateArgument getTemplatePackExpansion( SourceLocation EllipsisLoc) const; - + private: KindType Kind; - + /// The actual template argument representation, which may be /// an \c Sema::TypeTy* (for a type), an Expr* (for an /// expression), or an Sema::TemplateTy (for a template). @@ -136,14 +136,14 @@ namespace clang { /// argument (turning it into a template template argument expansion). SourceLocation EllipsisLoc; }; - + /// Information about a template-id annotation /// token. /// - /// A template-id annotation token contains the template declaration, - /// template arguments, whether those template arguments were types, - /// expressions, or template names, and the source locations for important - /// tokens. All of the information about template arguments is allocated + /// A template-id annotation token contains the template declaration, + /// template arguments, whether those template arguments were types, + /// expressions, or template names, and the source locations for important + /// tokens. All of the information about template arguments is allocated /// directly after this structure. struct TemplateIdAnnotation final : private llvm::TrailingObjects<TemplateIdAnnotation, @@ -159,34 +159,34 @@ namespace clang { /// TemplateNameLoc - The location of the template name within the /// source. SourceLocation TemplateNameLoc; - + /// FIXME: Temporarily stores the name of a specialization IdentifierInfo *Name; - + /// FIXME: Temporarily stores the overloaded operator kind. OverloadedOperatorKind Operator; - + /// The declaration of the template corresponding to the /// template-name. ParsedTemplateTy Template; - + /// The kind of template that Template refers to. TemplateNameKind Kind; - + /// The location of the '<' before the template argument /// list. SourceLocation LAngleLoc; - + /// The location of the '>' after the template argument /// list. SourceLocation RAngleLoc; - + /// NumArgs - The number of template arguments. unsigned NumArgs; - + /// Retrieves a pointer to the template arguments - ParsedTemplateArgument *getTemplateArgs() { - return getTrailingObjects<ParsedTemplateArgument>(); + ParsedTemplateArgument *getTemplateArgs() { + return getTrailingObjects<ParsedTemplateArgument>(); } /// Creates a new TemplateIdAnnotation with NumArgs arguments and @@ -213,7 +213,7 @@ namespace clang { getTemplateArgs(), getTemplateArgs() + NumArgs, [](ParsedTemplateArgument &A) { A.~ParsedTemplateArgument(); }); this->~TemplateIdAnnotation(); - free(this); + free(this); } private: TemplateIdAnnotation(const TemplateIdAnnotation &) = delete; @@ -239,7 +239,7 @@ namespace clang { /// Retrieves the range of the given template parameter lists. SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params, - unsigned NumParams); + unsigned NumParams); } // end namespace clang #endif // LLVM_CLANG_SEMA_PARSEDTEMPLATE_H diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h index a3379ff34f123..11fa0362124b9 100644 --- a/include/clang/Sema/Scope.h +++ b/include/clang/Sema/Scope.h @@ -89,7 +89,7 @@ public: /// This is a scope that corresponds to the Objective-C /// \@catch statement. AtCatchScope = 0x400, - + /// This scope corresponds to an Objective-C method body. /// It always has FnScope and DeclScope set as well. ObjCMethodScope = 0x800, @@ -347,7 +347,7 @@ public: } return false; } - + /// isInObjcMethodScope - Return true if this scope is, or is contained in, an /// Objective-C method body. Note that this method is not constant time. bool isInObjcMethodScope() const { diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index 5eac2845fd33e..5925fd6ccead9 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -85,12 +85,12 @@ public: PartialDiagnostic PD; SourceLocation Loc; const Stmt *stmt; - + PossiblyUnreachableDiag(const PartialDiagnostic &PD, SourceLocation Loc, const Stmt *stmt) : PD(PD), Loc(Loc), stmt(stmt) {} }; - + /// Retains information about a function, method, or block that is /// currently being parsed. class FunctionScopeInfo { @@ -101,7 +101,7 @@ protected: SK_Lambda, SK_CapturedRegion }; - + public: /// What kind of scope we are describing. ScopeKind Kind : 3; @@ -206,7 +206,7 @@ public: /// current function scope. These diagnostics are vetted for reachability /// prior to being emitted. SmallVector<PossiblyUnreachableDiag, 4> PossiblyUnreachableDiags; - + /// A list of parameters which have the nonnull attribute and are /// modified in the function. llvm::SmallPtrSet<const ParmVarDecl *, 8> ModifiedNonNullParams; @@ -633,9 +633,9 @@ public: QualType ReturnType; void addCapture(VarDecl *Var, bool isBlock, bool isByref, bool isNested, - SourceLocation Loc, SourceLocation EllipsisLoc, + SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, Expr *Cpy) { - Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc, + Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc, EllipsisLoc, CaptureType, Cpy)); CaptureMap[Var] = Captures.size(); } @@ -655,13 +655,13 @@ public: /// Determine whether the C++ 'this' is captured. bool isCXXThisCaptured() const { return CXXThisCaptureIndex != 0; } - + /// Retrieve the capture of C++ 'this', if it has been captured. Capture &getCXXThisCapture() { assert(isCXXThisCaptured() && "this has not been captured"); return Captures[CXXThisCaptureIndex - 1]; } - + /// Determine whether the given variable has been captured. bool isCaptured(VarDecl *Var) const { return CaptureMap.count(Var); @@ -684,7 +684,7 @@ public: return Captures[Known->second - 1]; } - static bool classof(const FunctionScopeInfo *FSI) { + static bool classof(const FunctionScopeInfo *FSI) { return FSI->Kind == SK_Block || FSI->Kind == SK_Lambda || FSI->Kind == SK_CapturedRegion; } @@ -694,7 +694,7 @@ public: class BlockScopeInfo final : public CapturingScopeInfo { public: BlockDecl *TheDecl; - + /// TheScope - This is the scope for the block itself, which contains /// arguments etc. Scope *TheScope; @@ -711,8 +711,8 @@ public: ~BlockScopeInfo() override; - static bool classof(const FunctionScopeInfo *FSI) { - return FSI->Kind == SK_Block; + static bool classof(const FunctionScopeInfo *FSI) { + return FSI->Kind == SK_Block; } }; @@ -796,12 +796,12 @@ public: /// Whether the lambda contains an unexpanded parameter pack. bool ContainsUnexpandedParameterPack = false; - /// If this is a generic lambda, use this as the depth of + /// If this is a generic lambda, use this as the depth of /// each 'auto' parameter, during initial AST construction. unsigned AutoTemplateParameterDepth = 0; /// Store the list of the auto parameters for a generic lambda. - /// If this is a generic lambda, store the list of the auto + /// If this is a generic lambda, store the list of the auto /// parameters converted into TemplateTypeParmDecls into a vector /// that can be used to construct the generic lambda's template /// parameter list, during initial AST construction. @@ -811,19 +811,19 @@ public: /// list has been created (from the AutoTemplateParams) then /// store a reference to it (cache it to avoid reconstructing it). TemplateParameterList *GLTemplateParameterList = nullptr; - + /// Contains all variable-referring-expressions (i.e. DeclRefExprs /// or MemberExprs) that refer to local variables in a generic lambda /// or a lambda in a potentially-evaluated-if-used context. - /// - /// Potentially capturable variables of a nested lambda that might need - /// to be captured by the lambda are housed here. + /// + /// Potentially capturable variables of a nested lambda that might need + /// to be captured by the lambda are housed here. /// This is specifically useful for generic lambdas or /// lambdas within a potentially evaluated-if-used context. /// If an enclosing variable is named in an expression of a lambda nested - /// within a generic lambda, we don't always know know whether the variable + /// within a generic lambda, we don't always know know whether the variable /// will truly be odr-used (i.e. need to be captured) by that nested lambda, - /// until its instantiation. But we still need to capture it in the + /// until its instantiation. But we still need to capture it in the /// enclosing lambda if all intervening lambdas can capture the variable. llvm::SmallVector<Expr*, 4> PotentiallyCapturingExprs; @@ -867,10 +867,10 @@ public: return !AutoTemplateParams.empty() || GLTemplateParameterList; } - /// Add a variable that might potentially be captured by the - /// lambda and therefore the enclosing lambdas. - /// - /// This is also used by enclosing lambda's to speculatively capture + /// Add a variable that might potentially be captured by the + /// lambda and therefore the enclosing lambdas. + /// + /// This is also used by enclosing lambda's to speculatively capture /// variables that nested lambda's - depending on their enclosing /// specialization - might need to capture. /// Consider: @@ -879,7 +879,7 @@ public: /// void foo() { /// const int x = 10; /// auto L = [=](auto a) { // capture 'x' - /// return [=](auto b) { + /// return [=](auto b) { /// f(x, a); // we may or may not need to capture 'x' /// }; /// }; @@ -888,46 +888,46 @@ public: assert(isa<DeclRefExpr>(VarExpr) || isa<MemberExpr>(VarExpr)); PotentiallyCapturingExprs.push_back(VarExpr); } - + void addPotentialThisCapture(SourceLocation Loc) { PotentialThisCaptureLocation = Loc; } - bool hasPotentialThisCapture() const { - return PotentialThisCaptureLocation.isValid(); + bool hasPotentialThisCapture() const { + return PotentialThisCaptureLocation.isValid(); } /// Mark a variable's reference in a lambda as non-odr using. /// - /// For generic lambdas, if a variable is named in a potentially evaluated - /// expression, where the enclosing full expression is dependent then we + /// For generic lambdas, if a variable is named in a potentially evaluated + /// expression, where the enclosing full expression is dependent then we /// must capture the variable (given a default capture). - /// This is accomplished by recording all references to variables - /// (DeclRefExprs or MemberExprs) within said nested lambda in its array of + /// This is accomplished by recording all references to variables + /// (DeclRefExprs or MemberExprs) within said nested lambda in its array of /// PotentialCaptures. All such variables have to be captured by that lambda, /// except for as described below. - /// If that variable is usable as a constant expression and is named in a - /// manner that does not involve its odr-use (e.g. undergoes + /// If that variable is usable as a constant expression and is named in a + /// manner that does not involve its odr-use (e.g. undergoes /// lvalue-to-rvalue conversion, or discarded) record that it is so. Upon the /// act of analyzing the enclosing full expression (ActOnFinishFullExpr) /// if we can determine that the full expression is not instantiation- - /// dependent, then we can entirely avoid its capture. + /// dependent, then we can entirely avoid its capture. /// /// const int n = 0; /// [&] (auto x) { /// (void)+n + x; /// }; - /// Interestingly, this strategy would involve a capture of n, even though - /// it's obviously not odr-used here, because the full-expression is + /// Interestingly, this strategy would involve a capture of n, even though + /// it's obviously not odr-used here, because the full-expression is /// instantiation-dependent. It could be useful to avoid capturing such /// variables, even when they are referred to in an instantiation-dependent /// expression, if we can unambiguously determine that they shall never be /// odr-used. This would involve removal of the variable-referring-expression - /// from the array of PotentialCaptures during the lvalue-to-rvalue + /// from the array of PotentialCaptures during the lvalue-to-rvalue /// conversions. But per the working draft N3797, (post-chicago 2013) we must - /// capture such variables. + /// capture such variables. /// Before anyone is tempted to implement a strategy for not-capturing 'n', - /// consider the insightful warning in: + /// consider the insightful warning in: /// /cfe-commits/Week-of-Mon-20131104/092596.html /// "The problem is that the set of captures for a lambda is part of the ABI /// (since lambda layout can be made visible through inline functions and the @@ -937,32 +937,32 @@ public: /// building such a node. So we need a rule that anyone can implement and get /// exactly the same result". void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) { - assert(isa<DeclRefExpr>(CapturingVarExpr) + assert(isa<DeclRefExpr>(CapturingVarExpr) || isa<MemberExpr>(CapturingVarExpr)); NonODRUsedCapturingExprs.insert(CapturingVarExpr); } bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const { - assert(isa<DeclRefExpr>(CapturingVarExpr) + assert(isa<DeclRefExpr>(CapturingVarExpr) || isa<MemberExpr>(CapturingVarExpr)); return NonODRUsedCapturingExprs.count(CapturingVarExpr); } void removePotentialCapture(Expr *E) { PotentiallyCapturingExprs.erase( - std::remove(PotentiallyCapturingExprs.begin(), - PotentiallyCapturingExprs.end(), E), + std::remove(PotentiallyCapturingExprs.begin(), + PotentiallyCapturingExprs.end(), E), PotentiallyCapturingExprs.end()); } void clearPotentialCaptures() { PotentiallyCapturingExprs.clear(); PotentialThisCaptureLocation = SourceLocation(); } - unsigned getNumPotentialVariableCaptures() const { - return PotentiallyCapturingExprs.size(); + unsigned getNumPotentialVariableCaptures() const { + return PotentiallyCapturingExprs.size(); } - bool hasPotentialCaptures() const { - return getNumPotentialVariableCaptures() || - PotentialThisCaptureLocation.isValid(); + bool hasPotentialCaptures() const { + return getNumPotentialVariableCaptures() || + PotentialThisCaptureLocation.isValid(); } // When passed the index, returns the VarDecl and Expr associated diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h index 86ab703a5b3af..c55e16a27cd30 100644 --- a/include/clang/Sema/SemaInternal.h +++ b/include/clang/Sema/SemaInternal.h @@ -45,7 +45,7 @@ inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) { const VarDecl *DefVD = nullptr; return !isa<ParmVarDecl>(Var) && Var->isUsableInConstantExpressions(Context) && - Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE(); + Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE(); } // Helper function to check whether D's attributes match current CUDA mode. @@ -60,13 +60,13 @@ inline bool DeclAttrsMatchCUDAMode(const LangOptions &LangOpts, Decl *D) { return isDeviceSideDecl == LangOpts.CUDAIsDevice; } -// Directly mark a variable odr-used. Given a choice, prefer to use -// MarkVariableReferenced since it does additional checks and then +// Directly mark a variable odr-used. Given a choice, prefer to use +// MarkVariableReferenced since it does additional checks and then // calls MarkVarDeclODRUsed. // If the variable must be captured: // - if FunctionScopeIndexToStopAt is null, capture it in the CurContext -// - else capture it in the DeclContext that maps to the -// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack. +// - else capture it in the DeclContext that maps to the +// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack. inline void MarkVarDeclODRUsed(VarDecl *Var, SourceLocation Loc, Sema &SemaRef, const unsigned *const FunctionScopeIndexToStopAt) { @@ -81,10 +81,10 @@ inline void MarkVarDeclODRUsed(VarDecl *Var, old = Loc; } QualType CaptureType, DeclRefType; - SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit, + SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit, /*EllipsisLoc*/ SourceLocation(), - /*BuildAndDiagnose*/ true, - CaptureType, DeclRefType, + /*BuildAndDiagnose*/ true, + CaptureType, DeclRefType, FunctionScopeIndexToStopAt); Var->markUsed(SemaRef.Context); diff --git a/include/clang/Sema/SemaLambda.h b/include/clang/Sema/SemaLambda.h index dfdc4ebc3643d..8edb9b5c613d2 100644 --- a/include/clang/Sema/SemaLambda.h +++ b/include/clang/Sema/SemaLambda.h @@ -25,11 +25,11 @@ class FunctionScopeInfo; class Sema; /// Examines the FunctionScopeInfo stack to determine the nearest -/// enclosing lambda (to the current lambda) that is 'capture-capable' for +/// enclosing lambda (to the current lambda) that is 'capture-capable' for /// the variable referenced in the current lambda (i.e. \p VarToCapture). /// If successful, returns the index into Sema's FunctionScopeInfo stack -/// of the capture-capable lambda's LambdaScopeInfo. -/// See Implementation for more detailed comments. +/// of the capture-capable lambda's LambdaScopeInfo. +/// See Implementation for more detailed comments. Optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda( ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes, diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h index c0dee3e82d58a..39b08e934be4d 100644 --- a/include/clang/Sema/Template.h +++ b/include/clang/Sema/Template.h @@ -46,7 +46,7 @@ class VarDecl; /// Data structure that captures multiple levels of template argument /// lists for use in template instantiation. /// - /// Multiple levels of template arguments occur when instantiating the + /// Multiple levels of template arguments occur when instantiating the /// definitions of member templates. For example: /// /// \code @@ -63,7 +63,7 @@ class VarDecl; /// list will contain a template argument list (int) at depth 0 and a /// template argument list (17) at depth 1. class MultiLevelTemplateArgumentList { - /// The template argument list at a certain template depth + /// The template argument list at a certain template depth using ArgList = ArrayRef<TemplateArgument>; /// The template argument lists, stored from the innermost template @@ -73,17 +73,17 @@ class VarDecl; /// The number of outer levels of template arguments that are not /// being substituted. unsigned NumRetainedOuterLevels = 0; - + public: /// Construct an empty set of template argument lists. MultiLevelTemplateArgumentList() = default; - + /// Construct a single-level template argument list. - explicit + explicit MultiLevelTemplateArgumentList(const TemplateArgumentList &TemplateArgs) { addOuterTemplateArguments(&TemplateArgs); } - + /// Determine the number of levels in this template argument /// list. unsigned getNumLevels() const { @@ -102,7 +102,7 @@ class VarDecl; assert(Index < TemplateArgumentLists[getNumLevels() - Depth - 1].size()); return TemplateArgumentLists[getNumLevels() - Depth - 1][Index]; } - + /// Determine whether there is a non-NULL template argument at the /// given depth and index. /// @@ -112,13 +112,13 @@ class VarDecl; if (Depth < NumRetainedOuterLevels) return false; - + if (Index >= TemplateArgumentLists[getNumLevels() - Depth - 1].size()) return false; - + return !(*this)(Depth, Index).isNull(); } - + /// Clear out a specific template argument. void setArgument(unsigned Depth, unsigned Index, TemplateArgument Arg) { @@ -128,8 +128,8 @@ class VarDecl; TemplateArgumentLists[getNumLevels() - Depth - 1][Index]) = Arg; } - - /// Add a new outermost level to the multi-level template argument + + /// Add a new outermost level to the multi-level template argument /// list. void addOuterTemplateArguments(const TemplateArgumentList *TemplateArgs) { addOuterTemplateArguments(ArgList(TemplateArgs->data(), @@ -153,21 +153,21 @@ class VarDecl; /// Retrieve the innermost template argument list. const ArgList &getInnermost() const { - return TemplateArgumentLists.front(); + return TemplateArgumentLists.front(); } }; - + /// The context in which partial ordering of function templates occurs. enum TPOC { /// Partial ordering of function templates for a function call. TPOC_Call, - /// Partial ordering of function templates for a call to a + /// Partial ordering of function templates for a call to a /// conversion function. TPOC_Conversion, /// Partial ordering of function templates in other contexts, e.g., - /// taking the address of a function template or matching a function + /// taking the address of a function template or matching a function /// template specialization to a function template. TPOC_Other }; @@ -261,7 +261,7 @@ class VarDecl; /// The set of argument packs we've allocated. SmallVector<DeclArgumentPack *, 1> ArgumentPacks; - + /// The outer scope, which contains local variable /// definitions from some other instantiation (that may not be /// relevant to this particular scope). @@ -273,17 +273,17 @@ class VarDecl; /// Whether to combine this scope with the outer scope, such that /// lookup will search our outer scope. bool CombineWithOuterScope; - + /// If non-NULL, the template parameter pack that has been /// partially substituted per C++0x [temp.arg.explicit]p9. NamedDecl *PartiallySubstitutedPack = nullptr; - + /// If \c PartiallySubstitutedPack is non-null, the set of /// explicitly-specified template arguments in that pack. - const TemplateArgument *ArgsInPartiallySubstitutedPack; - - /// If \c PartiallySubstitutedPack, the number of - /// explicitly-specified template arguments in + const TemplateArgument *ArgsInPartiallySubstitutedPack; + + /// If \c PartiallySubstitutedPack, the number of + /// explicitly-specified template arguments in /// ArgsInPartiallySubstitutedPack. unsigned NumArgsInPartiallySubstitutedPack; @@ -301,17 +301,17 @@ class VarDecl; ~LocalInstantiationScope() { Exit(); } - + const Sema &getSema() const { return SemaRef; } /// Exit this local instantiation scope early. void Exit() { if (Exited) return; - + for (unsigned I = 0, N = ArgumentPacks.size(); I != N; ++I) delete ArgumentPacks[I]; - + SemaRef.CurrentInstantiationScope = Outer; Exited = true; } @@ -381,9 +381,9 @@ class VarDecl; void InstantiatedLocal(const Decl *D, Decl *Inst); void InstantiatedLocalPackArg(const Decl *D, ParmVarDecl *Inst); void MakeInstantiatedLocalArgPack(const Decl *D); - + /// Note that the given parameter pack has been partially substituted - /// via explicit specification of template arguments + /// via explicit specification of template arguments /// (C++0x [temp.arg.explicit]p9). /// /// \param Pack The parameter pack, which will always be a template @@ -394,7 +394,7 @@ class VarDecl; /// /// \param NumExplicitArgs The number of explicitly-specified template /// arguments provided for this parameter pack. - void SetPartiallySubstitutedPack(NamedDecl *Pack, + void SetPartiallySubstitutedPack(NamedDecl *Pack, const TemplateArgument *ExplicitArgs, unsigned NumExplicitArgs); @@ -416,7 +416,7 @@ class VarDecl; }; class TemplateDeclInstantiator - : public DeclVisitor<TemplateDeclInstantiator, Decl *> + : public DeclVisitor<TemplateDeclInstantiator, Decl *> { Sema &SemaRef; Sema::ArgumentPackSubstitutionIndexRAII SubstIndex; @@ -562,7 +562,7 @@ class VarDecl; template<typename T> Decl *instantiateUnresolvedUsingDecl(T *D, bool InstantiatingPackElement = false); - }; + }; } // namespace clang |