From ba243b59a1074e0962f6abfa3bb9aa984eac1245 Mon Sep 17 00:00:00 2001 From: David Blaikie <dblaikie@gmail.com> Date: Wed, 9 Nov 2011 06:07:30 +0000 Subject: [PATCH] Fixing 80 col violations (& removing any trailing whitespace on files I was touching anyway) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144171 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ASTConsumer.h | 4 +- include/clang/AST/Decl.h | 158 +++--- include/clang/AST/DeclBase.h | 59 +-- include/clang/AST/DeclCXX.h | 240 ++++----- include/clang/AST/DeclObjC.h | 190 +++---- include/clang/AST/DeclTemplate.h | 164 +++--- include/clang/AST/Expr.h | 194 ++++---- include/clang/AST/ExprCXX.h | 456 ++++++++--------- include/clang/AST/NestedNameSpecifier.h | 85 ++-- include/clang/AST/RecursiveASTVisitor.h | 49 +- include/clang/AST/Stmt.h | 68 +-- include/clang/AST/StmtCXX.h | 40 +- include/clang/AST/Type.h | 339 ++++++------- include/clang/AST/TypeLoc.h | 53 +- include/clang/AST/VTableBuilder.h | 82 +-- include/clang/Analysis/Analyses/Dominators.h | 9 +- .../clang/Analysis/Analyses/FormatString.h | 56 +-- .../Analysis/Analyses/PostOrderCFGView.h | 36 +- .../clang/Analysis/Analyses/ThreadSafety.h | 6 +- .../Analysis/Analyses/UninitializedValues.h | 8 +- include/clang/Analysis/AnalysisContext.h | 78 +-- include/clang/Analysis/CFG.h | 52 +- include/clang/Frontend/Utils.h | 3 +- include/clang/Index/ASTLocation.h | 14 +- include/clang/Lex/Preprocessor.h | 91 ++-- include/clang/Sema/CodeCompleteConsumer.h | 320 ++++++------ include/clang/Sema/LocInfoType.h | 12 +- include/clang/Sema/PrettyDeclStackTrace.h | 5 +- include/clang/Sema/Sema.h | 466 +++++++++--------- include/clang/Sema/TemplateDeduction.h | 21 +- include/clang/Serialization/ASTReader.h | 143 +++--- include/clang/Serialization/ASTWriter.h | 82 +-- include/clang/Serialization/Module.h | 168 +++---- 33 files changed, 1907 insertions(+), 1844 deletions(-) diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h index 300e4f26d33..c6cb71cc7c5 100644 --- a/include/clang/AST/ASTConsumer.h +++ b/include/clang/AST/ASTConsumer.h @@ -99,7 +99,9 @@ public: /// \brief If the consumer is interested in entities being deserialized from /// AST files, it should return a pointer to a ASTDeserializationListener here - virtual ASTDeserializationListener *GetASTDeserializationListener() { return 0; } + virtual ASTDeserializationListener *GetASTDeserializationListener() { + return 0; + } /// PrintStats - If desired, print any statistics. virtual void PrintStats() {} diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index a02a2ce3369..058e304149e 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -185,13 +185,13 @@ public: /// \brief Whether this declaration was marked as being private to the /// module in which it was defined. bool isModulePrivate() const { return ModulePrivate; } - + /// \brief Specify whether this declaration was marked as being private /// to the module in which it was defined. void setModulePrivate(bool MP = true) { ModulePrivate = MP; } - + /// \brief Determine whether this declaration is a C++ class member. bool isCXXClassMember() const { const DeclContext *DC = getDeclContext(); @@ -281,7 +281,9 @@ public: Linkage getLinkage() const; /// \brief Determines the visibility of this entity. - Visibility getVisibility() const { return getLinkageAndVisibility().visibility(); } + Visibility getVisibility() const { + return getLinkageAndVisibility().visibility(); + } /// \brief Determines the linkage and visibility of this entity. LinkageInfo getLinkageAndVisibility() const; @@ -291,7 +293,7 @@ public: llvm::Optional<Visibility> getExplicitVisibility() const; /// \brief Clear the linkage cache in response to a change - /// to the declaration. + /// to the declaration. void ClearLinkageCache(); /// \brief Looks through UsingDecls and ObjCCompatibleAliasDecls for @@ -349,7 +351,7 @@ public: static bool classof(const LabelDecl *D) { return true; } static bool classofKind(Kind K) { return K == Label; } }; - + /// NamespaceDecl - Represent a C++ namespace. class NamespaceDecl : public NamedDecl, public DeclContext { bool IsInline : 1; @@ -422,7 +424,7 @@ public: /// \brief Return the next extended namespace declaration or null if there /// is none. NamespaceDecl *getNextNamespace(); - const NamespaceDecl *getNextNamespace() const { + const NamespaceDecl *getNextNamespace() const { return const_cast<NamespaceDecl *>(this)->getNextNamespace(); } @@ -445,7 +447,7 @@ public: } /// \brief Set the original (first) namespace declaration. - void setOriginalNamespace(NamespaceDecl *ND) { + void setOriginalNamespace(NamespaceDecl *ND) { if (ND != this) { OrigOrAnonNamespace.setPointer(ND); OrigOrAnonNamespace.setInt(false); @@ -463,8 +465,8 @@ public: } virtual NamespaceDecl *getCanonicalDecl() { return getOriginalNamespace(); } - const NamespaceDecl *getCanonicalDecl() const { - return getOriginalNamespace(); + const NamespaceDecl *getCanonicalDecl() const { + return getOriginalNamespace(); } virtual SourceRange getSourceRange() const { @@ -486,7 +488,7 @@ public: static NamespaceDecl *castFromDeclContext(const DeclContext *DC) { return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC)); } - + friend class ASTDeclReader; friend class ASTDeclWriter; }; @@ -537,7 +539,7 @@ struct QualifierInfo { void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists, TemplateParameterList **TPLists); - + private: // Copy constructor and copy assignment are disabled. QualifierInfo(const QualifierInfo&); @@ -600,15 +602,15 @@ public: return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() : 0; } - - /// \brief Retrieve the nested-name-specifier (with source-location - /// information) that qualifies the name of this declaration, if it was + + /// \brief Retrieve the nested-name-specifier (with source-location + /// information) that qualifies the name of this declaration, if it was /// present in the source. NestedNameSpecifierLoc getQualifierLoc() const { return hasExtInfo() ? getExtInfo()->QualifierLoc : NestedNameSpecifierLoc(); } - + void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc); unsigned getNumTemplateParameterLists() const { @@ -705,9 +707,10 @@ private: /// \brief Whether this variable is the exception variable in a C++ catch /// or an Objective-C @catch statement. unsigned ExceptionVar : 1; - + /// \brief Whether this local variable could be allocated in the return - /// slot of its function, enabling the named return value optimization (NRVO). + /// slot of its function, enabling the named return value optimization + /// (NRVO). unsigned NRVOVariable : 1; /// \brief Whether this variable is the for-range-declaration in a C++0x @@ -725,10 +728,10 @@ private: friend class ASTDeclReader; friend class StmtIteratorBase; - + protected: enum { NumParameterIndexBits = 8 }; - + class ParmVarDeclBitfields { friend class ParmVarDecl; friend class ASTDeclReader; @@ -823,12 +826,12 @@ public: return getStorageClass() >= SC_Auto; } - /// isStaticLocal - Returns true if a variable with function scope is a + /// isStaticLocal - Returns true if a variable with function scope is a /// static local variable. bool isStaticLocal() const { return getStorageClass() == SC_Static && !isFileVarDecl(); } - + /// hasExternStorage - Returns true if a variable has extern or /// __private_extern__ storage. bool hasExternalStorage() const { @@ -919,21 +922,21 @@ public: return const_cast<VarDecl*>(this)->getDefinition(); } - /// \brief Determine whether this is or was instantiated from an out-of-line + /// \brief Determine whether this is or was instantiated from an out-of-line /// definition of a static data member. virtual bool isOutOfLine() const; /// \brief If this is a static data member, find its out-of-line definition. VarDecl *getOutOfLineDefinition(); - + /// isFileVarDecl - Returns true for file scoped variable declaration. bool isFileVarDecl() const { if (getKind() != Decl::Var) return false; - + if (getDeclContext()->getRedeclContext()->isFileContext()) return true; - + if (isStaticDataMember()) return true; @@ -996,7 +999,7 @@ public: void setInit(Expr *I); /// \brief Determine whether this variable is a reference that - /// extends the lifetime of its temporary initializer. + /// extends the lifetime of its temporary initializer. /// /// A reference extends the lifetime of its temporary initializer if /// it's initializer is an rvalue that would normally go out of scope @@ -1118,7 +1121,7 @@ public: return VarDeclBits.ExceptionVar; } void setExceptionVariable(bool EV) { VarDeclBits.ExceptionVar = EV; } - + /// \brief Determine whether this local variable can be used with the named /// return value optimization (NRVO). /// @@ -1143,7 +1146,7 @@ public: /// Generally such variables are also 'const' for safety. bool isARCPseudoStrong() const { return VarDeclBits.ARCPseudoStrong; } void setARCPseudoStrong(bool ps) { VarDeclBits.ARCPseudoStrong = ps; } - + /// Whether this variable is (C++0x) constexpr. bool isConstexpr() const { return VarDeclBits.IsConstexpr; } void setConstexpr(bool IC) { VarDeclBits.IsConstexpr = IC; } @@ -1153,15 +1156,15 @@ public: /// from which it was instantiated. VarDecl *getInstantiatedFromStaticDataMember() const; - /// \brief If this variable is a static data member, determine what kind of + /// \brief If this variable is a static data member, determine what kind of /// template specialization or instantiation this is. TemplateSpecializationKind getTemplateSpecializationKind() const; - + /// \brief If this variable is an instantiation of a static data member of a /// class template specialization, retrieves the member specialization /// information. MemberSpecializationInfo *getMemberSpecializationInfo() const; - + /// \brief For a static data member that was instantiated from a static /// data member of a class template, set the template specialiation kind. void setTemplateSpecializationKind(TemplateSpecializationKind TSK, @@ -1219,7 +1222,7 @@ public: Expr *DefArg); virtual SourceRange getSourceRange() const; - + void setObjCMethodScopeInfo(unsigned parameterIndex) { ParmVarDeclBits.IsObjCMethodParam = true; setParameterIndex(parameterIndex); @@ -1229,7 +1232,8 @@ public: assert(!ParmVarDeclBits.IsObjCMethodParam); ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth; - assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth && "truncation!"); + assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth + && "truncation!"); setParameterIndex(parameterIndex); } @@ -1276,7 +1280,7 @@ public: const Expr *getDefaultArg() const { return const_cast<ParmVarDecl *>(this)->getDefaultArg(); } - + void setDefaultArg(Expr *defarg) { Init = reinterpret_cast<Stmt *>(defarg); } @@ -1286,10 +1290,10 @@ public: const CXXTemporary *getDefaultArgTemporary(unsigned i) const { return const_cast<ParmVarDecl *>(this)->getDefaultArgTemporary(i); } - + /// \brief Retrieve the source range that covers the entire default /// argument. - SourceRange getDefaultArgRange() const; + SourceRange getDefaultArgRange() const; void setUninstantiatedDefaultArg(Expr *arg) { Init = reinterpret_cast<UninstantiatedDefaultArgument *>(arg); } @@ -1351,7 +1355,7 @@ public: /// \brief Determine whether this parameter is actually a function /// parameter pack. bool isParameterPack() const; - + /// setOwningFunction - Sets the function declaration that owns this /// ParmVarDecl. Since ParmVarDecls are often created before the /// FunctionDecls that own them, this routine is required to update @@ -1362,7 +1366,7 @@ public: static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const ParmVarDecl *D) { return true; } static bool classofKind(Kind K) { return K == ParmVar; } - + private: enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 }; @@ -1371,7 +1375,7 @@ private: setParameterIndexLarge(parameterIndex); return; } - + ParmVarDeclBits.ParameterIndex = parameterIndex; assert(ParmVarDeclBits.ParameterIndex == parameterIndex && "truncation!"); } @@ -1379,7 +1383,7 @@ private: unsigned d = ParmVarDeclBits.ParameterIndex; return d == ParameterIndexSentinel ? getParameterIndexLarge() : d; } - + void setParameterIndexLarge(unsigned parameterIndex); unsigned getParameterIndexLarge() const; }; @@ -1456,7 +1460,7 @@ private: /// FunctionTemplateSpecializationInfo, which contains information about /// the template being specialized and the template arguments involved in /// that specialization. - llvm::PointerUnion4<FunctionTemplateDecl *, + llvm::PointerUnion4<FunctionTemplateDecl *, MemberSpecializationInfo *, FunctionTemplateSpecializationInfo *, DependentFunctionTemplateSpecializationInfo *> @@ -1486,7 +1490,7 @@ private: /// \param TemplateArgsAsWritten location info of template arguments. /// /// \param PointOfInstantiation point at which the function template - /// specialization was first instantiated. + /// specialization was first instantiated. void setFunctionTemplateSpecialization(ASTContext &C, FunctionTemplateDecl *Template, const TemplateArgumentList *TemplateArgs, @@ -1656,7 +1660,7 @@ public: void setTrivial(bool IT) { IsTrivial = IT; } /// Whether this function is defaulted per C++0x. Only valid for - /// special member functions. + /// special member functions. bool isDefaulted() const { return IsDefaulted; } void setDefaulted(bool D = true) { IsDefaulted = D; } @@ -1783,12 +1787,12 @@ public: QualType getResultType() const { return getType()->getAs<FunctionType>()->getResultType(); } - + /// \brief Determine the type of an expression that calls this function. QualType getCallResultType() const { return getType()->getAs<FunctionType>()->getCallResultType(getASTContext()); } - + StorageClass getStorageClass() const { return StorageClass(SClass); } void setStorageClass(StorageClass SC); @@ -1799,10 +1803,10 @@ public: /// \brief Determine whether the "inline" keyword was specified for this /// function. bool isInlineSpecified() const { return IsInlineSpecified; } - + /// Set whether the "inline" keyword was specified for this function. - void setInlineSpecified(bool I) { - IsInlineSpecified = I; + void setInlineSpecified(bool I) { + IsInlineSpecified = I; IsInline = I; } @@ -1819,7 +1823,7 @@ public: bool isInlineDefinitionExternallyVisible() const; bool doesDeclarationForceExternallyVisibleDefinition() const; - + /// isOverloadedOperator - Whether this function declaration /// represents an C++ overloaded operator, e.g., "operator+". bool isOverloadedOperator() const { @@ -1852,7 +1856,7 @@ public: /// X<int>::A is required, it will be instantiated from the /// declaration returned by getInstantiatedFromMemberFunction(). FunctionDecl *getInstantiatedFromMemberFunction() const; - + /// \brief What kind of templated function this is. TemplatedKind getTemplatedKind() const; @@ -1860,7 +1864,7 @@ public: /// class template specialization, retrieves the member specialization /// information. MemberSpecializationInfo *getMemberSpecializationInfo() const; - + /// \brief Specify that this record is an instantiation of the /// member function FD. void setInstantiationOfMemberFunction(FunctionDecl *FD, @@ -1888,7 +1892,7 @@ public: TemplateOrSpecialization = Template; } - /// \brief Determine whether this function is a function template + /// \brief Determine whether this function is a function template /// specialization. bool isFunctionTemplateSpecialization() const { return getPrimaryTemplate() != 0; @@ -1899,7 +1903,7 @@ public: FunctionDecl *getClassScopeSpecializationPattern() const; /// \brief If this function is actually a function template specialization, - /// retrieve information about this function template specialization. + /// retrieve information about this function template specialization. /// Otherwise, returns NULL. FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo() const { return TemplateOrSpecialization. @@ -1910,7 +1914,7 @@ public: /// specialization or a member of a class template specialization that can /// be implicitly instantiated. bool isImplicitlyInstantiable() const; - + /// \brief Retrieve the function declaration from which this function could /// be instantiated, if it is an instantiation (rather than a non-template /// or a specialization, for example). @@ -1958,7 +1962,7 @@ public: /// \param TemplateArgsAsWritten location info of template arguments. /// /// \param PointOfInstantiation point at which the function template - /// specialization was first instantiated. + /// specialization was first instantiated. void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template, const TemplateArgumentList *TemplateArgs, void *InsertPos, @@ -1994,15 +1998,15 @@ public: /// \brief Retrieve the (first) point of instantiation of a function template /// specialization or a member of a class template specialization. /// - /// \returns the first point of instantiation, if this function was - /// instantiated from a template; otherwise, returns an invalid source + /// \returns the first point of instantiation, if this function was + /// instantiated from a template; otherwise, returns an invalid source /// location. SourceLocation getPointOfInstantiation() const; - - /// \brief Determine whether this is or was instantiated from an out-of-line + + /// \brief Determine whether this is or was instantiated from an out-of-line /// definition of a member function. virtual bool isOutOfLine() const; - + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const FunctionDecl *D) { return true; } @@ -2108,7 +2112,8 @@ public: Expr *getInClassInitializer() const { return hasInClassInitializer() ? InitializerOrBitWidth.getPointer() : 0; } - /// setInClassInitializer - Set the C++0x in-class initializer for this member. + /// setInClassInitializer - Set the C++0x in-class initializer for this + /// member. void setInClassInitializer(Expr *Init); /// removeInClassInitializer - Remove the C++0x in-class initializer from this /// member. @@ -2164,7 +2169,7 @@ public: void setInitVal(const llvm::APSInt &V) { Val = V; } SourceRange getSourceRange() const; - + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const EnumConstantDecl *D) { return true; } @@ -2189,7 +2194,7 @@ public: static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, NamedDecl **CH, unsigned CHS); - + typedef NamedDecl * const *chain_iterator; chain_iterator chain_begin() const { return Chaining; } chain_iterator chain_end() const { return Chaining+ChainingSize; } @@ -2435,8 +2440,8 @@ protected: /// @brief Completes the definition of this tag declaration. /// /// This is a helper function for derived classes. - void completeDefinition(); - + void completeDefinition(); + public: typedef redeclarable_base::redecl_iterator redecl_iterator; redecl_iterator redecls_begin() const { @@ -2532,7 +2537,8 @@ public: bool isEnum() const { return getTagKind() == TTK_Enum; } TypedefNameDecl *getTypedefNameForAnonDecl() const { - return hasExtInfo() ? 0 : TypedefNameDeclOrQualifier.get<TypedefNameDecl*>(); + return hasExtInfo() ? 0 : + TypedefNameDeclOrQualifier.get<TypedefNameDecl*>(); } void setTypedefNameForAnonDecl(TypedefNameDecl *TDD); @@ -2543,15 +2549,15 @@ public: return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() : 0; } - - /// \brief Retrieve the nested-name-specifier (with source-location - /// information) that qualifies the name of this declaration, if it was + + /// \brief Retrieve the nested-name-specifier (with source-location + /// information) that qualifies the name of this declaration, if it was /// present in the source. NestedNameSpecifierLoc getQualifierLoc() const { return hasExtInfo() ? getExtInfo()->QualifierLoc : NestedNameSpecifierLoc(); } - + void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc); unsigned getNumTemplateParameterLists() const { @@ -2723,7 +2729,7 @@ public: /// \brief Returns the width in bits required to store all the /// negative enumerators of this enum. These widths include /// the rightmost leading 1; that is: - /// + /// /// MOST NEGATIVE ENUMERATOR PATTERN NUM NEGATIVE BITS /// ------------------------ ------- ----------------- /// -1 1111111 1 @@ -3058,7 +3064,7 @@ public: bool capturesCXXThis); virtual SourceRange getSourceRange() const; - + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const BlockDecl *D) { return true; } @@ -3086,20 +3092,20 @@ void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) { // and Redeclarable to be defined. decl_type *First; - + if (PrevDecl) { // Point to previous. Make sure that this is actually the most recent // redeclaration, or we can build invalid chains. If the most recent // redeclaration is invalid, it won't be PrevDecl, but we want it anyway. - RedeclLink = PreviousDeclLink(llvm::cast<decl_type>( - PrevDecl->getMostRecentDeclaration())); + RedeclLink = PreviousDeclLink( + llvm::cast<decl_type>(PrevDecl->getMostRecentDeclaration())); First = PrevDecl->getFirstDeclaration(); assert(First->RedeclLink.NextIsLatest() && "Expected first"); } else { // Make this first. First = static_cast<decl_type*>(this); } - + // First one will point to this one as latest. First->RedeclLink = LatestDeclLink(static_cast<decl_type*>(this)); if (NamedDecl *ND = dyn_cast<NamedDecl>(static_cast<decl_type*>(this))) diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 5d95cc81c75..db0cf958426 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -98,7 +98,7 @@ public: /// identifiers. C++ describes lookup completely differently: /// certain lookups merely "ignore" certain kinds of declarations, /// usually based on whether the declaration is of a type, etc. - /// + /// /// These are meant as bitmasks, so that searches in /// C++ can look into the "tag" namespace during ordinary lookup. /// @@ -243,7 +243,7 @@ private: /// evaluated context or not, e.g. functions used in uninstantiated templates /// are regarded as "referenced" but not "used". unsigned Referenced : 1; - + protected: /// Access - Used by C++ decls for the access specifier. // NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum @@ -252,7 +252,7 @@ protected: /// \brief Whether this declaration was loaded from an AST file. unsigned FromASTFile : 1; - + /// ChangedAfterLoad - if this declaration has changed since being loaded unsigned ChangedAfterLoad : 1; @@ -267,12 +267,12 @@ protected: /// /// This field is only valid for NamedDecls subclasses. mutable unsigned HasCachedLinkage : 1; - + /// \brief If \c HasCachedLinkage, the linkage of this declaration. /// /// This field is only valid for NamedDecls subclasses. mutable unsigned CachedLinkage : 2; - + friend class ASTDeclWriter; friend class ASTDeclReader; @@ -288,7 +288,7 @@ protected: Access(AS_none), FromASTFile(0), ChangedAfterLoad(false), ModulePrivate(0), IdentifierNamespace(getIdentifierNamespaceForKind(DK)), - HasCachedLinkage(0) + HasCachedLinkage(0) { if (Decl::CollectingStats()) add(DK); } @@ -389,11 +389,11 @@ public: attr_iterator attr_end() const { return hasAttrs() ? getAttrs().end() : 0; } - + template <typename T> void dropAttr() { if (!HasAttrs) return; - + AttrVec &Attrs = getAttrs(); for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) { if (isa<T>(Attrs[i])) { @@ -406,7 +406,7 @@ public: if (Attrs.empty()) HasAttrs = false; } - + template <typename T> specific_attr_iterator<T> specific_attr_begin() const { return specific_attr_iterator<T>(attr_begin()); @@ -504,7 +504,7 @@ public: /// \brief Determine whether this declaration came from an AST file (such as /// a precompiled header or module) rather than having been parsed. bool isFromASTFile() const { return FromASTFile; } - + /// \brief Query whether this declaration was changed in a significant way /// since being loaded from an AST file. /// @@ -673,7 +673,7 @@ public: /// \brief Whether this declaration is a parameter pack. bool isParameterPack() const; - + /// \brief returns true if this declaration is a template bool isTemplateDecl() const; @@ -722,7 +722,7 @@ public: unsigned mask = (IdentifierNamespace & (IDNS_TagFriend | IDNS_OrdinaryFriend)); if (!mask) return FOK_None; - return (IdentifierNamespace & (IDNS_Tag | IDNS_Ordinary) ? + return (IdentifierNamespace & (IDNS_Tag | IDNS_Ordinary) ? FOK_Declared : FOK_Undeclared); } @@ -886,11 +886,11 @@ public: } DeclContext *getLookupParent(); - + const DeclContext *getLookupParent() const { return const_cast<DeclContext*>(this)->getLookupParent(); } - + ASTContext &getParentASTContext() const { return cast<Decl>(this)->getASTContext(); } @@ -1141,13 +1141,13 @@ public: return tmp; } - friend bool - operator==(const specific_decl_iterator& x, const specific_decl_iterator& y) { + friend bool operator==(const specific_decl_iterator& x, + const specific_decl_iterator& y) { return x.Current == y.Current; } - friend bool - operator!=(const specific_decl_iterator& x, const specific_decl_iterator& y) { + friend bool operator!=(const specific_decl_iterator& x, + const specific_decl_iterator& y) { return x.Current != y.Current; } }; @@ -1215,13 +1215,13 @@ public: return tmp; } - friend bool - operator==(const filtered_decl_iterator& x, const filtered_decl_iterator& y) { + friend bool operator==(const filtered_decl_iterator& x, + const filtered_decl_iterator& y) { return x.Current == y.Current; } - friend bool - operator!=(const filtered_decl_iterator& x, const filtered_decl_iterator& y) { + friend bool operator!=(const filtered_decl_iterator& x, + const filtered_decl_iterator& y) { return x.Current != y.Current; } }; @@ -1283,12 +1283,12 @@ public: /// \brief A simplistic name lookup mechanism that performs name lookup /// into this declaration context without consulting the external source. /// - /// This function should almost never be used, because it subverts the + /// This function should almost never be used, because it subverts the /// usual relationship between a DeclContext and the external source. /// See the ASTImporter for the (few, but important) use cases. - void localUncachedLookup(DeclarationName Name, + void localUncachedLookup(DeclarationName Name, llvm::SmallVectorImpl<NamedDecl *> &Results); - + /// @brief Makes a declaration visible within this context. /// /// This routine makes the declaration D visible to name lookup @@ -1360,7 +1360,7 @@ public: bool isDeclInLexicalTraversal(const Decl *D) const { return D && (D->NextDeclInContext || D == FirstDecl || D == LastDecl); } - + static bool classof(const Decl *D); static bool classof(const DeclContext *D) { return true; } #define DECL(NAME, BASE) @@ -1372,8 +1372,8 @@ public: private: void LoadLexicalDeclsFromExternalStorage() const; - - /// @brief Makes a declaration visible within this context, but + + /// @brief Makes a declaration visible within this context, but /// suppresses searches for external declarations with the same /// name. /// @@ -1386,7 +1386,8 @@ private: StoredDeclsMap *CreateStoredDeclsMap(ASTContext &C) const; void buildLookup(DeclContext *DCtx); - void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal, bool Recoverable); + void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal, + bool Recoverable); void makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal); }; diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index e2313785bfd..ca416771a04 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -36,7 +36,7 @@ class CXXMemberLookupCriteria; class CXXFinalOverriderMap; class CXXIndirectPrimaryBaseSet; class FriendDecl; - + /// \brief Represents any kind of function declaration, whether it is a /// concrete function or a function template. class AnyFunctionDecl { @@ -170,7 +170,7 @@ class CXXBaseSpecifier { /// \brief The source location of the ellipsis, if this is a pack /// expansion. SourceLocation EllipsisLoc; - + /// Virtual - Whether this is a virtual base class or not. bool Virtual : 1; @@ -200,7 +200,7 @@ public: CXXBaseSpecifier(SourceRange R, bool V, bool BC, AccessSpecifier A, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc) - : Range(R), EllipsisLoc(EllipsisLoc), Virtual(V), BaseOfClass(BC), + : Range(R), EllipsisLoc(EllipsisLoc), Virtual(V), BaseOfClass(BC), Access(A), InheritConstructors(false), BaseTypeInfo(TInfo) { } /// getSourceRange - Retrieves the source range that contains the @@ -214,7 +214,7 @@ public: /// \brief Determine whether this base class is a base of a class declared /// with the 'class' keyword (vs. one declared with the 'struct' keyword). bool isBaseOfClass() const { return BaseOfClass; } - + /// \brief Determine whether this base specifier is a pack expansion. bool isPackExpansion() const { return EllipsisLoc.isValid(); } @@ -319,7 +319,8 @@ class CXXRecordDecl : public RecordDecl { /// * has no non-static data members of type non-standard-layout class (or /// array of such types) or reference, /// * has no virtual functions (10.3) and no virtual base classes (10.1), - /// * has the same access control (Clause 11) for all non-static data members + /// * has the same access control (Clause 11) for all non-static data + /// members /// * has no non-standard-layout base classes, /// * either has no non-static data members in the most derived class and at /// most one base class with non-static data members, or has no base @@ -346,7 +347,7 @@ class CXXRecordDecl : public RecordDecl { /// \brief True if this class (or any subobject) has mutable fields. bool HasMutableFields : 1; - + /// HasTrivialDefaultConstructor - True when, if this class has a default /// constructor, this default constructor is trivial. /// @@ -458,13 +459,13 @@ class CXXRecordDecl : public RecordDecl { /// \brief Whether we have already declared the move constructor. bool DeclaredMoveConstructor : 1; - + /// \brief Whether we have already declared the copy-assignment operator. bool DeclaredCopyAssignment : 1; /// \brief Whether we have already declared the move-assignment operator. bool DeclaredMoveAssignment : 1; - + /// \brief Whether we have already declared a destructor within the class. bool DeclaredDestructor : 1; @@ -478,7 +479,7 @@ class CXXRecordDecl : public RecordDecl { /// NumBases - The number of base class specifiers in Bases. unsigned NumBases; - + /// NumVBases - The number of virtual base class specifiers in VBases. unsigned NumVBases; @@ -510,12 +511,12 @@ class CXXRecordDecl : public RecordDecl { /// in reverse order. FriendDecl *FirstFriend; - /// \brief Retrieve the set of direct base classes. + /// \brief Retrieve the set of direct base classes. CXXBaseSpecifier *getBases() const { return Bases.get(Definition->getASTContext().getExternalSource()); } - /// \brief Retrieve the set of virtual base classes. + /// \brief Retrieve the set of virtual base classes. CXXBaseSpecifier *getVBases() const { return VBases.get(Definition->getASTContext().getExternalSource()); } @@ -530,7 +531,7 @@ class CXXRecordDecl : public RecordDecl { assert(DefinitionData && "queried property of class with no definition"); return *DefinitionData; } - + /// \brief The template or declaration that this declaration /// describes or was instantiated from, respectively. /// @@ -538,25 +539,25 @@ class CXXRecordDecl : public RecordDecl { /// declarations that describe a class template, this will be a /// pointer to a ClassTemplateDecl. For member /// classes of class template specializations, this will be the - /// MemberSpecializationInfo referring to the member class that was + /// MemberSpecializationInfo referring to the member class that was /// instantiated or specialized. llvm::PointerUnion<ClassTemplateDecl*, MemberSpecializationInfo*> TemplateOrInstantiation; friend class DeclContext; - + /// \brief Notify the class that member has been added. /// - /// This routine helps maintain information about the class based on which + /// This routine helps maintain information about the class based on which /// members have been added. It will be invoked by DeclContext::addDecl() /// whenever a member is added to this record. void addedMember(Decl *D); void markedVirtualFunctionPure(); friend void FunctionDecl::setPure(bool); - + friend class ASTNodeImporter; - + protected: CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, @@ -587,7 +588,7 @@ public: virtual const CXXRecordDecl *getCanonicalDecl() const { return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl()); } - + const CXXRecordDecl *getPreviousDeclaration() const { return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDeclaration()); } @@ -706,7 +707,7 @@ public: /// /// This value is used for lazy creation of default constructors. bool needsImplicitDefaultConstructor() const { - return !data().UserDeclaredConstructor && + return !data().UserDeclaredConstructor && !data().DeclaredDefaultConstructor; } @@ -724,11 +725,11 @@ public: CXXConstructorDecl *getCopyConstructor(unsigned TypeQuals) const; /// getMoveConstructor - Returns the move constructor for this class - CXXConstructorDecl *getMoveConstructor() const; + CXXConstructorDecl *getMoveConstructor() const; /// \brief Retrieve the copy-assignment operator for this class, if available. /// - /// This routine attempts to find the copy-assignment operator for this + /// This routine attempts to find the copy-assignment operator for this /// class, using a simplistic form of overload resolution. /// /// \param ArgIsConst Whether the argument to the copy-assignment operator @@ -741,7 +742,7 @@ public: /// getMoveAssignmentOperator - Returns the move assignment operator for this /// class CXXMethodDecl *getMoveAssignmentOperator() const; - + /// hasUserDeclaredConstructor - Whether this class has any /// user-declared constructors. When true, a default constructor /// will not be implicitly declared. @@ -762,7 +763,7 @@ public: return data().UserDeclaredCopyConstructor; } - /// \brief Determine whether this class has had its copy constructor + /// \brief Determine whether this class has had its copy constructor /// declared, either via the user or via an implicit declaration. /// /// This value is used for lazy creation of copy constructors. @@ -824,7 +825,7 @@ public: return data().UserDeclaredCopyAssignment; } - /// \brief Determine whether this class has had its copy assignment operator + /// \brief Determine whether this class has had its copy assignment operator /// declared, either via the user or via an implicit declaration. /// /// This value is used for lazy creation of copy assignment operators. @@ -943,7 +944,7 @@ public: /// \brief Whether this class, or any of its class subobjects, contains a /// mutable field. bool hasMutableFields() const { return data().HasMutableFields; } - + // hasTrivialDefaultConstructor - Whether this class has a trivial default // constructor // (C++0x [class.ctor]p5) @@ -1045,12 +1046,12 @@ public: /// X<int>::A is required, it will be instantiated from the /// declaration returned by getInstantiatedFromMemberClass(). CXXRecordDecl *getInstantiatedFromMemberClass() const; - + /// \brief If this class is an instantiation of a member class of a /// class template specialization, retrieves the member specialization /// information. MemberSpecializationInfo *getMemberSpecializationInfo() const; - + /// \brief Specify that this record is an instantiation of the /// member class RD. void setInstantiationOfMemberClass(CXXRecordDecl *RD, @@ -1079,7 +1080,7 @@ public: /// instantiation of a class template or member class of a class template, /// and how it was instantiated or specialized. TemplateSpecializationKind getTemplateSpecializationKind() const; - + /// \brief Set the kind of specialization or template instantiation this is. void setTemplateSpecializationKind(TemplateSpecializationKind TSK); @@ -1106,7 +1107,7 @@ public: /// /// \returns true if this class is derived from Base, false otherwise. bool isDerivedFrom(const CXXRecordDecl *Base) const; - + /// \brief Determine whether this class is derived from the type \p Base. /// /// This routine only determines whether this class is derived from \p Base, @@ -1121,8 +1122,8 @@ public: /// /// \returns true if this class is derived from Base, false otherwise. /// - /// \todo add a separate paramaeter to configure IsDerivedFrom, rather than - /// tangling input and output in \p Paths + /// \todo add a separate paramaeter to configure IsDerivedFrom, rather than + /// tangling input and output in \p Paths bool isDerivedFrom(const CXXRecordDecl *Base, CXXBasePaths &Paths) const; /// \brief Determine whether this class is virtually derived from @@ -1157,20 +1158,20 @@ public: /// /// The class itself does not count as a base class. This routine /// returns false if the class has non-computable base classes. - /// + /// /// \param AllowShortCircuit if false, forces the callback to be called /// for every base class, even if a dependent or non-matching base was /// found. bool forallBases(ForallBasesCallback *BaseMatches, void *UserData, bool AllowShortCircuit = true) const; - - /// \brief Function type used by lookupInBases() to determine whether a + + /// \brief Function type used by lookupInBases() to determine whether a /// specific base class subobject matches the lookup criteria. /// - /// \param Specifier the base-class specifier that describes the inheritance + /// \param Specifier the base-class specifier that describes the inheritance /// from the base class we are trying to match. /// - /// \param Path the current path, from the most-derived class down to the + /// \param Path the current path, from the most-derived class down to the /// base named by the \p Specifier. /// /// \param UserData a single pointer to user-specified data, provided to @@ -1180,13 +1181,13 @@ public: typedef bool BaseMatchesCallback(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *UserData); - + /// \brief Look for entities within the base classes of this C++ class, /// transitively searching all base class subobjects. /// - /// This routine uses the callback function \p BaseMatches to find base + /// This routine uses the callback function \p BaseMatches to find base /// classes meeting some search criteria, walking all base class subobjects - /// and populating the given \p Paths structure with the paths through the + /// and populating the given \p Paths structure with the paths through the /// inheritance hierarchy that resulted in a match. On a successful search, /// the \p Paths structure can be queried to retrieve the matching paths and /// to determine if there were any ambiguities. @@ -1203,7 +1204,7 @@ public: /// subobject that matches the search criteria. bool lookupInBases(BaseMatchesCallback *BaseMatches, void *UserData, CXXBasePaths &Paths) const; - + /// \brief Base-class lookup callback that determines whether the given /// base class specifier refers to a specific class declaration. /// @@ -1225,7 +1226,7 @@ public: /// are searching for. static bool FindVirtualBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *BaseRecord); - + /// \brief Base-class lookup callback that determines whether there exists /// a tag with the given name. /// @@ -1243,7 +1244,7 @@ public: /// is an opaque \c DeclarationName pointer. static bool FindOrdinaryMember(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *Name); - + /// \brief Base-class lookup callback that determines whether there exists /// a member with the given name that can be used in a nested-name-specifier. /// @@ -1279,15 +1280,15 @@ public: /// \brief Indicates that the definition of this class is now complete. virtual void completeDefinition(); - /// \brief Indicates that the definition of this class is now complete, + /// \brief Indicates that the definition of this class is now complete, /// and provides a final overrider map to help determine - /// + /// /// \param FinalOverriders The final overrider map for this class, which can /// be provided as an optimization for abstract-class checking. If NULL, /// final overriders will be computed if they are needed to complete the /// definition. void completeDefinition(CXXFinalOverriderMap *FinalOverriders); - + /// \brief Determine whether this class may end up being abstract, even though /// it is not yet known to be abstract. /// @@ -1296,7 +1297,7 @@ public: /// will need to compute final overriders to determine whether the class is /// actually abstract. bool mayBeAbstract() const; - + static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classofKind(Kind K) { return K >= firstCXXRecord && K <= lastCXXRecord; @@ -1343,12 +1344,12 @@ public: bool isInstance() const { return !isStatic(); } bool isVirtual() const { - CXXMethodDecl *CD = + CXXMethodDecl *CD = cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl()); if (CD->isVirtualAsWritten()) return true; - + return (CD->begin_overridden_methods() != CD->end_overridden_methods()); } @@ -1356,14 +1357,14 @@ public: /// (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded /// delete or delete[] operator with a particular signature. bool isUsualDeallocationFunction() const; - + /// \brief Determine whether this is a copy-assignment operator, regardless /// of whether it was declared implicitly or explicitly. bool isCopyAssignmentOperator() const; /// \brief Determine whether this is a move assignment operator. bool isMoveAssignmentOperator() const; - + const CXXMethodDecl *getCanonicalDecl() const { return cast<CXXMethodDecl>(FunctionDecl::getCanonicalDecl()); } @@ -1376,7 +1377,7 @@ public: bool isUserProvided() const { return !(isDeleted() || getCanonicalDecl()->isDefaulted()); } - + /// void addOverriddenMethod(const CXXMethodDecl *MD); @@ -1421,7 +1422,7 @@ public: RefQualifierKind getRefQualifier() const { return getType()->getAs<FunctionProtoType>()->getRefQualifier(); } - + bool hasInlineBody() const; // Implement isa/cast/dyncast/etc. @@ -1448,23 +1449,23 @@ public: /// @endcode class CXXCtorInitializer { /// \brief Either the base class name/delegating constructor type (stored as - /// a TypeSourceInfo*), an normal field (FieldDecl), or an anonymous field + /// a TypeSourceInfo*), an normal field (FieldDecl), or an anonymous field /// (IndirectFieldDecl*) being initialized. llvm::PointerUnion3<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *> Initializee; - + /// \brief The source location for the field name or, for a base initializer /// pack expansion, the location of the ellipsis. In the case of a delegating /// constructor, it will still include the type's source location as the /// Initializee points to the CXXConstructorDecl (to allow loop detection). SourceLocation MemberOrEllipsisLocation; - + /// \brief The argument used to initialize the base or member, which may /// end up constructing an object (when multiple arguments are involved). - /// If 0, this is a field initializer, and the in-class member initializer + /// If 0, this is a field initializer, and the in-class member initializer /// will be used. Stmt *Init; - + /// LParenLoc - Location of the left paren of the ctor-initializer. SourceLocation LParenLoc; @@ -1474,7 +1475,7 @@ class CXXCtorInitializer { /// \brief If the initializee is a type, whether that type makes this /// a delegating initialization. bool IsDelegating : 1; - + /// IsVirtual - If the initializer is a base initializer, this keeps track /// of whether the base is virtual or not. bool IsVirtual : 1; @@ -1493,7 +1494,7 @@ class CXXCtorInitializer { CXXCtorInitializer(ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R, VarDecl **Indices, unsigned NumIndices); - + public: /// CXXCtorInitializer - Creates a new base-class initializer. explicit @@ -1518,24 +1519,24 @@ public: CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, SourceLocation L, Expr *Init, SourceLocation R); - /// \brief Creates a new member initializer that optionally contains + /// \brief Creates a new member initializer that optionally contains /// array indices used to describe an elementwise initialization. static CXXCtorInitializer *Create(ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R, VarDecl **Indices, unsigned NumIndices); - + /// isBaseInitializer - Returns true when this initializer is /// initializing a base class. - bool isBaseInitializer() const { - return Initializee.is<TypeSourceInfo*>() && !IsDelegating; + bool isBaseInitializer() const { + return Initializee.is<TypeSourceInfo*>() && !IsDelegating; } /// isMemberInitializer - Returns true when this initializer is /// initializing a non-static data member. bool isMemberInitializer() const { return Initializee.is<FieldDecl*>(); } - bool isAnyMemberInitializer() const { + bool isAnyMemberInitializer() const { return isMemberInitializer() || isIndirectMemberInitializer(); } @@ -1553,21 +1554,21 @@ public: /// isDelegatingInitializer - Returns true when this initializer is creating /// a delegating constructor. bool isDelegatingInitializer() const { - return Initializee.is<TypeSourceInfo*>() && IsDelegating; + return Initializee.is<TypeSourceInfo*>() && IsDelegating; } /// \brief Determine whether this initializer is a pack expansion. - bool isPackExpansion() const { - return isBaseInitializer() && MemberOrEllipsisLocation.isValid(); + bool isPackExpansion() const { + return isBaseInitializer() && MemberOrEllipsisLocation.isValid(); } - + // \brief For a pack expansion, returns the location of the ellipsis. SourceLocation getEllipsisLoc() const { assert(isPackExpansion() && "Initializer is not a pack expansion"); return MemberOrEllipsisLocation; } - - /// If this is a base class initializer, returns the type of the + + /// If this is a base class initializer, returns the type of the /// base class with location information. Otherwise, returns an NULL /// type location. TypeLoc getBaseClassLoc() const; @@ -1579,7 +1580,7 @@ public: /// Returns whether the base is virtual or not. bool isBaseVirtual() const { assert(isBaseInitializer() && "Must call this on base initializer!"); - + return IsVirtual; } @@ -1588,7 +1589,7 @@ public: TypeSourceInfo *getTypeSourceInfo() const { return Initializee.dyn_cast<TypeSourceInfo *>(); } - + /// getMember - If this is a member initializer, returns the /// declaration of the non-static data member being /// initialized. Otherwise, returns NULL. @@ -1614,13 +1615,13 @@ public: return 0; } - SourceLocation getMemberLocation() const { + SourceLocation getMemberLocation() const { return MemberOrEllipsisLocation; } - + /// \brief Determine the source location of the initializer. SourceLocation getSourceLocation() const; - + /// \brief Determine the source range covering the entire initializer. SourceRange getSourceRange() const; @@ -1657,7 +1658,7 @@ public: return IsWritten ? 0 : SourceOrderOrNumArrayIndices; } - /// \brief Retrieve a particular array index variable used to + /// \brief Retrieve a particular array index variable used to /// describe an array member initialization. VarDecl *getArrayIndex(unsigned I) { assert(I < getNumArrayIndices() && "Out of bounds member array index"); @@ -1671,7 +1672,7 @@ public: assert(I < getNumArrayIndices() && "Out of bounds member array index"); reinterpret_cast<VarDecl **>(this + 1)[I] = Index; } - + /// \brief Get the initializer. This is 0 if this is an in-class initializer /// for a non-static data member which has not yet been parsed. Expr *getInit() const { @@ -1713,7 +1714,7 @@ class CXXConstructorDecl : public CXXMethodDecl { CXXConstructorDecl(CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, - bool isExplicitSpecified, bool isInline, + bool isExplicitSpecified, bool isInline, bool isImplicitlyDeclared, bool isConstexpr) : CXXMethodDecl(CXXConstructor, RD, StartLoc, NameInfo, T, TInfo, false, SC_None, isInline, isConstexpr, SourceLocation()), @@ -1735,7 +1736,7 @@ public: /// isExplicitSpecified - Whether this constructor declaration has the /// 'explicit' keyword specified. bool isExplicitSpecified() const { return IsExplicitSpecified; } - + /// isExplicit - Whether this constructor was marked "explicit" or not. bool isExplicit() const { return cast<CXXConstructorDecl>(getFirstDeclaration()) @@ -1783,7 +1784,8 @@ public: } typedef std::reverse_iterator<init_iterator> init_reverse_iterator; - typedef std::reverse_iterator<init_const_iterator> init_const_reverse_iterator; + typedef std::reverse_iterator<init_const_iterator> + init_const_reverse_iterator; init_reverse_iterator init_rbegin() { return init_reverse_iterator(init_end()); @@ -1899,12 +1901,12 @@ public: CXXConstructorDecl *getCanonicalDecl() { return cast<CXXConstructorDecl>(FunctionDecl::getCanonicalDecl()); } - + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const CXXConstructorDecl *D) { return true; } static bool classofKind(Kind K) { return K == CXXConstructor; } - + friend class ASTDeclReader; friend class ASTDeclWriter; }; @@ -1928,7 +1930,7 @@ class CXXDestructorDecl : public CXXMethodDecl { bool ImplicitlyDefined : 1; FunctionDecl *OperatorDelete; - + CXXDestructorDecl(CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, @@ -1954,7 +1956,8 @@ public: /// already been defined. bool isImplicitlyDefined() const { assert(isThisDeclarationADefinition() && - "Can only get the implicit-definition flag once the destructor has been defined"); + "Can only get the implicit-definition flag once the destructor has " + "been defined"); return ImplicitlyDefined; } @@ -1962,7 +1965,8 @@ public: /// implicitly defined or not. void setImplicitlyDefined(bool ID) { assert(isThisDeclarationADefinition() && - "Can only set the implicit-definition flag once the destructor has been defined"); + "Can only set the implicit-definition flag once the destructor has " + "been defined"); ImplicitlyDefined = ID; } @@ -1973,7 +1977,7 @@ public: static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const CXXDestructorDecl *D) { return true; } static bool classofKind(Kind K) { return K == CXXDestructor; } - + friend class ASTDeclReader; friend class ASTDeclWriter; }; @@ -1988,7 +1992,7 @@ public: /// }; /// @endcode class CXXConversionDecl : public CXXMethodDecl { - /// IsExplicitSpecified - Whether this conversion function declaration is + /// IsExplicitSpecified - Whether this conversion function declaration is /// marked "explicit", meaning that it can only be applied when the user /// explicitly wrote a cast. This is a C++0x feature. bool IsExplicitSpecified : 1; @@ -2012,7 +2016,7 @@ public: bool isConstexpr, SourceLocation EndLocation); - /// IsExplicitSpecified - Whether this conversion function declaration is + /// IsExplicitSpecified - Whether this conversion function declaration is /// marked "explicit", meaning that it can only be applied when the user /// explicitly wrote a cast. This is a C++0x feature. bool isExplicitSpecified() const { return IsExplicitSpecified; } @@ -2035,7 +2039,7 @@ public: static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const CXXConversionDecl *D) { return true; } static bool classofKind(Kind K) { return K == CXXConversion; } - + friend class ASTDeclReader; friend class ASTDeclWriter; }; @@ -2121,7 +2125,7 @@ public: class UsingDirectiveDecl : public NamedDecl { /// \brief The location of the "using" keyword. SourceLocation UsingLoc; - + /// SourceLocation - Location of 'namespace' token. SourceLocation NamespaceLoc; @@ -2156,11 +2160,11 @@ public: /// \brief Retrieve the nested-name-specifier that qualifies the /// name of the namespace, with source-location information. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - + /// \brief Retrieve the nested-name-specifier that qualifies the /// name of the namespace. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } NamedDecl *getNominatedNamespaceAsWritten() { return NominatedNamespace; } @@ -2182,7 +2186,7 @@ public: /// \brief Return the location of the "using" keyword. SourceLocation getUsingLoc() const { return UsingLoc; } - + // FIXME: Could omit 'Key' in name. /// getNamespaceKeyLocation - Returns location of namespace keyword. SourceLocation getNamespaceKeyLocation() const { return NamespaceLoc; } @@ -2201,14 +2205,14 @@ public: SourceRange getSourceRange() const { return SourceRange(UsingLoc, getLocation()); } - + static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const UsingDirectiveDecl *D) { return true; } static bool classofKind(Kind K) { return K == UsingDirective; } // Friend for getUsingDirectiveName. friend class DeclContext; - + friend class ASTDeclReader; }; @@ -2223,10 +2227,10 @@ class NamespaceAliasDecl : public NamedDecl { /// IdentLoc - Location of namespace identifier. Accessed by TargetNameLoc. SourceLocation IdentLoc; - + /// \brief The nested-name-specifier that precedes the namespace. NestedNameSpecifierLoc QualifierLoc; - + /// Namespace - The Decl that this alias points to. Can either be a /// NamespaceDecl or a NamespaceAliasDecl. NamedDecl *Namespace; @@ -2235,23 +2239,23 @@ class NamespaceAliasDecl : public NamedDecl { SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace) - : NamedDecl(NamespaceAlias, DC, AliasLoc, Alias), + : NamedDecl(NamespaceAlias, DC, AliasLoc, Alias), NamespaceLoc(NamespaceLoc), IdentLoc(IdentLoc), QualifierLoc(QualifierLoc), Namespace(Namespace) { } friend class ASTDeclReader; - + public: /// \brief Retrieve the nested-name-specifier that qualifies the /// name of the namespace, with source-location information. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - + /// \brief Retrieve the nested-name-specifier that qualifies the /// name of the namespace. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } - + /// \brief Retrieve the namespace declaration aliased by this directive. NamespaceDecl *getNamespace() { if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(Namespace)) @@ -2279,7 +2283,7 @@ public: NamedDecl *getAliasedNamespace() const { return Namespace; } static NamespaceAliasDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation NamespaceLoc, + SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, @@ -2289,7 +2293,7 @@ public: virtual SourceRange getSourceRange() const { return SourceRange(NamespaceLoc, IdentLoc); } - + static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const NamespaceAliasDecl *D) { return true; } static bool classofKind(Kind K) { return K == NamespaceAlias; } @@ -2383,7 +2387,7 @@ class UsingDecl : public NamedDecl { // \brief Has 'typename' keyword. bool IsTypeName; - UsingDecl(DeclContext *DC, SourceLocation UL, + UsingDecl(DeclContext *DC, SourceLocation UL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool IsTypeNameArg) : NamedDecl(Using, DC, NameInfo.getLoc(), NameInfo.getName()), @@ -2403,8 +2407,8 @@ public: NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } /// \brief Retrieve the nested-name-specifier that qualifies the name. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } DeclarationNameInfo getNameInfo() const { @@ -2507,7 +2511,7 @@ class UnresolvedUsingValueDecl : public ValueDecl { DeclarationNameLoc DNLoc; UnresolvedUsingValueDecl(DeclContext *DC, QualType Ty, - SourceLocation UsingLoc, + SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo) : ValueDecl(UnresolvedUsingValue, DC, @@ -2528,17 +2532,17 @@ public: NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } /// \brief Retrieve the nested-name-specifier that qualifies the name. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } - + DeclarationNameInfo getNameInfo() const { return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc); } static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, - NestedNameSpecifierLoc QualifierLoc, + NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo); SourceRange getSourceRange() const { @@ -2575,14 +2579,14 @@ class UnresolvedUsingTypenameDecl : public TypeDecl { UnresolvedUsingTypenameDecl(DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, - SourceLocation TargetNameLoc, + SourceLocation TargetNameLoc, IdentifierInfo *TargetName) : TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName, UsingLoc), TypenameLocation(TypenameLoc), QualifierLoc(QualifierLoc) { } friend class ASTDeclReader; - + public: /// \brief Returns the source location of the 'using' keyword. SourceLocation getUsingLoc() const { return getLocStart(); } @@ -2595,8 +2599,8 @@ public: NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } /// \brief Retrieve the nested-name-specifier that qualifies the name. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } static UnresolvedUsingTypenameDecl * diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index b717af0d01b..a428e773122 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -84,7 +84,7 @@ public: loc_iterator loc_begin() const { return Locations; } loc_iterator loc_end() const { return Locations + size(); } - void set(ObjCProtocolDecl* const* InList, unsigned Elts, + void set(ObjCProtocolDecl* const* InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx); }; @@ -124,7 +124,7 @@ private: // Synthesized declaration method for a property setter/getter unsigned IsSynthesized : 1; - + // Method has a definition. unsigned IsDefined : 1; @@ -144,14 +144,14 @@ private: /// \brief Indicates whether this method has a related result type. unsigned RelatedResultType : 1; - + /// \brief Whether the locations of the selector identifiers are in a /// "standard" position, a enum SelectorLocationsKind. unsigned SelLocsKind : 2; // Result type of this method. QualType MethodDeclType; - + // Type source information for the result type. TypeSourceInfo *ResultTInfo; @@ -246,7 +246,7 @@ public: SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, - QualType T, + QualType T, TypeSourceInfo *ResultTInfo, DeclContext *contextDecl, bool isInstance = true, @@ -270,14 +270,14 @@ public: /// \brief Determine whether this method has a result type that is related /// to the message receiver's type. bool hasRelatedResultType() const { return RelatedResultType; } - + /// \brief Note whether this method has a related result type. void SetRelatedResultType(bool RRT = true) { RelatedResultType = RRT; } /// \brief True if this is a method redeclaration in the same interface. bool isRedeclaration() const { return IsRedeclaration; } void setAsRedeclaration(const ObjCMethodDecl *PrevMethod); - + // Location information, modeled after the Stmt API. SourceLocation getLocStart() const { return getLocation(); } SourceLocation getLocEnd() const { return EndLoc; } @@ -319,12 +319,12 @@ public: QualType getResultType() const { return MethodDeclType; } void setResultType(QualType T) { MethodDeclType = T; } - /// \brief Determine the type of an expression that sends a message to this + /// \brief Determine the type of an expression that sends a message to this /// function. QualType getSendResultType() const { return getResultType().getNonLValueExprType(getASTContext()); } - + TypeSourceInfo *getResultTypeSourceInfo() const { return ResultTInfo; } void setResultTypeSourceInfo(TypeSourceInfo *TInfo) { ResultTInfo = TInfo; } @@ -338,8 +338,8 @@ public: param_iterator param_end() { return getParams() + NumParams; } // This method returns and of the parameters which are part of the selector // name mangling requirements. - param_const_iterator sel_param_end() const { - return param_begin() + getSelector().getNumArgs(); + param_const_iterator sel_param_end() const { + return param_begin() + getSelector().getNumArgs(); } /// \brief Sets the method's parameters and selector source locations. @@ -385,7 +385,7 @@ public: bool isSynthesized() const { return IsSynthesized; } void setSynthesized(bool isSynth) { IsSynthesized = isSynth; } - + bool isDefined() const { return IsDefined; } void setDefined(bool isDefined) { IsDefined = isDefined; } @@ -551,7 +551,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl { /// Protocols referenced in the @interface declaration ObjCProtocolList ReferencedProtocols; - + /// Protocols reference in both the @interface and class extensions. ObjCList<ObjCProtocolDecl> AllReferencedProtocols; @@ -561,7 +561,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl { /// and class extensions come long after the initial interface declaration, /// and we avoid dynamically-resized arrays in the AST wherever possible. ObjCCategoryDecl *CategoryList; - + /// IvarList - List of all ivars defined by this class; including class /// extensions and implementation. This list is built lazily. ObjCIvarDecl *IvarList; @@ -573,11 +573,11 @@ class ObjCInterfaceDecl : public ObjCContainerDecl { bool InitiallyForwardDecl : 1; bool ForwardDecl:1; // declared with @class. bool InternalInterface:1; // true - no @interface for @implementation - + /// \brief Indicates that the contents of this Objective-C class will be /// completed by the external AST source when required. mutable bool ExternallyCompleted : 1; - + SourceLocation SuperClassLoc; // location of the super class identifier. SourceLocation EndLoc; // marks the '>', '}', or identifier. @@ -598,16 +598,16 @@ public: return SourceRange(getAtStartLoc(), getLocation()); return ObjCContainerDecl::getSourceRange(); } - + /// \brief Indicate that this Objective-C class is complete, but that /// the external AST source will be responsible for filling in its contents /// when a complete class is required. void setExternallyCompleted(); - + const ObjCProtocolList &getReferencedProtocols() const { if (ExternallyCompleted) LoadExternalDefinition(); - + return ReferencedProtocols; } @@ -625,7 +625,7 @@ public: } typedef ObjCProtocolList::iterator protocol_iterator; - + protocol_iterator protocol_begin() const { if (ExternallyCompleted) LoadExternalDefinition(); @@ -641,22 +641,22 @@ public: typedef ObjCProtocolList::loc_iterator protocol_loc_iterator; - protocol_loc_iterator protocol_loc_begin() const { + protocol_loc_iterator protocol_loc_begin() const { if (ExternallyCompleted) LoadExternalDefinition(); - return ReferencedProtocols.loc_begin(); + return ReferencedProtocols.loc_begin(); } - protocol_loc_iterator protocol_loc_end() const { + protocol_loc_iterator protocol_loc_end() const { if (ExternallyCompleted) LoadExternalDefinition(); - return ReferencedProtocols.loc_end(); + return ReferencedProtocols.loc_end(); } - + typedef ObjCList<ObjCProtocolDecl>::iterator all_protocol_iterator; - + all_protocol_iterator all_referenced_protocol_begin() const { if (ExternallyCompleted) LoadExternalDefinition(); @@ -668,7 +668,7 @@ public: if (ExternallyCompleted) LoadExternalDefinition(); - return AllReferencedProtocols.empty() ? protocol_end() + return AllReferencedProtocols.empty() ? protocol_end() : AllReferencedProtocols.end(); } @@ -680,9 +680,9 @@ public: unsigned ivar_size() const { return std::distance(ivar_begin(), ivar_end()); } - + bool ivar_empty() const { return ivar_begin() == ivar_end(); } - + ObjCIvarDecl *all_declared_ivar_begin(); const ObjCIvarDecl *all_declared_ivar_begin() const { // Even though this modifies IvarList, it's conceptually const: @@ -690,7 +690,7 @@ public: return const_cast<ObjCInterfaceDecl *>(this)->all_declared_ivar_begin(); } void setIvarList(ObjCIvarDecl *ivar) { IvarList = ivar; } - + /// setProtocolList - Set the list of protocols that this interface /// implements. void setProtocolList(ObjCProtocolDecl *const* List, unsigned Num, @@ -700,7 +700,7 @@ public: /// mergeClassExtensionProtocolList - Merge class extension's protocol list /// into the protocol list for this class. - void mergeClassExtensionProtocolList(ObjCProtocolDecl *const* List, + void mergeClassExtensionProtocolList(ObjCProtocolDecl *const* List, unsigned Num, ASTContext &C); @@ -712,26 +712,26 @@ public: bool isForwardDecl() const { return ForwardDecl; } void setForwardDecl(bool val) { ForwardDecl = val; } - ObjCInterfaceDecl *getSuperClass() const { + ObjCInterfaceDecl *getSuperClass() const { if (ExternallyCompleted) LoadExternalDefinition(); - return SuperClass; + return SuperClass; } - + void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; } - ObjCCategoryDecl* getCategoryList() const { + ObjCCategoryDecl* getCategoryList() const { if (ExternallyCompleted) LoadExternalDefinition(); - return CategoryList; + return CategoryList; } - + void setCategoryList(ObjCCategoryDecl *category) { CategoryList = category; } - + ObjCCategoryDecl* getFirstClassExtension() const; ObjCPropertyDecl @@ -758,7 +758,7 @@ public: return true; Class = Class->getSuperClass(); } - return false; + return false; } ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName, @@ -778,7 +778,7 @@ public: return lookupMethod(Sel, false/*isInstance*/); } ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName); - + // Lookup a method in the classes implementation hierarchy. ObjCMethodDecl *lookupPrivateMethod(const Selector &Sel, bool Instance=true); @@ -858,7 +858,7 @@ public: /// interface the ivar is conceptually a part of in the case of synthesized /// ivars. const ObjCInterfaceDecl *getContainingInterface() const; - + ObjCIvarDecl *getNextIvar() { return NextIvar; } const ObjCIvarDecl *getNextIvar() const { return NextIvar; } void setNextIvar(ObjCIvarDecl *ivar) { NextIvar = ivar; } @@ -873,16 +873,16 @@ public: void setSynthesize(bool synth) { Synthesized = synth; } bool getSynthesize() const { return Synthesized; } - + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const ObjCIvarDecl *D) { return true; } static bool classofKind(Kind K) { return K == ObjCIvar; } private: - /// NextIvar - Next Ivar in the list of ivars declared in class; class's + /// NextIvar - Next Ivar in the list of ivars declared in class; class's /// extensions and class's implementation ObjCIvarDecl *NextIvar; - + // NOTE: VC++ treats enums as signed, avoid using the AccessControl enum unsigned DeclAccess : 3; unsigned Synthesized : 1; @@ -967,11 +967,11 @@ public: protocol_iterator protocol_begin() const {return ReferencedProtocols.begin();} protocol_iterator protocol_end() const { return ReferencedProtocols.end(); } typedef ObjCProtocolList::loc_iterator protocol_loc_iterator; - protocol_loc_iterator protocol_loc_begin() const { - return ReferencedProtocols.loc_begin(); + protocol_loc_iterator protocol_loc_begin() const { + return ReferencedProtocols.loc_begin(); } - protocol_loc_iterator protocol_loc_end() const { - return ReferencedProtocols.loc_end(); + protocol_loc_iterator protocol_loc_end() const { + return ReferencedProtocols.loc_end(); } unsigned protocol_size() const { return ReferencedProtocols.size(); } @@ -998,7 +998,7 @@ public: /// Differs with \see isForwardDecl in that \see isForwardDecl will change to /// false when we see the definition, but this will remain true. bool isInitiallyForwardDecl() const { return InitiallyForwardDecl; } - + bool isForwardDecl() const { return isForwardProtoDecl; } void setForwardDecl(bool val) { isForwardProtoDecl = val; } @@ -1033,18 +1033,20 @@ private: ObjCClassRef *ForwardDecl; ObjCClassDecl(DeclContext *DC, SourceLocation L, - ObjCInterfaceDecl *const Elt, const SourceLocation Loc, + ObjCInterfaceDecl *const Elt, const SourceLocation Loc, ASTContext &C); public: static ObjCClassDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, ObjCInterfaceDecl *const Elt = 0, const SourceLocation Locs = SourceLocation()); - - ObjCInterfaceDecl *getForwardInterfaceDecl() { return ForwardDecl->getInterface(); } + + ObjCInterfaceDecl *getForwardInterfaceDecl() { + return ForwardDecl->getInterface(); + } ObjCClassRef *getForwardDecl() { return ForwardDecl; } void setClass(ASTContext &C, ObjCInterfaceDecl*const Cls, const SourceLocation Locs); - + virtual SourceRange getSourceRange() const; static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -1080,11 +1082,11 @@ public: protocol_iterator protocol_begin() const {return ReferencedProtocols.begin();} protocol_iterator protocol_end() const { return ReferencedProtocols.end(); } typedef ObjCProtocolList::loc_iterator protocol_loc_iterator; - protocol_loc_iterator protocol_loc_begin() const { - return ReferencedProtocols.loc_begin(); + protocol_loc_iterator protocol_loc_begin() const { + return ReferencedProtocols.loc_begin(); } - protocol_loc_iterator protocol_loc_end() const { - return ReferencedProtocols.loc_end(); + protocol_loc_iterator protocol_loc_end() const { + return ReferencedProtocols.loc_end(); } unsigned protocol_size() const { return ReferencedProtocols.size(); } @@ -1133,7 +1135,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl { /// \brief The location of the category name in this declaration. SourceLocation CategoryNameLoc; - ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc, + ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, ObjCInterfaceDecl *IDecl) : ObjCContainerDecl(ObjCCategory, DC, Id, ClassNameLoc, AtLoc), @@ -1143,7 +1145,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl { public: static ObjCCategoryDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation AtLoc, + SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, @@ -1172,21 +1174,21 @@ public: protocol_iterator protocol_end() const { return ReferencedProtocols.end(); } unsigned protocol_size() const { return ReferencedProtocols.size(); } typedef ObjCProtocolList::loc_iterator protocol_loc_iterator; - protocol_loc_iterator protocol_loc_begin() const { - return ReferencedProtocols.loc_begin(); + protocol_loc_iterator protocol_loc_begin() const { + return ReferencedProtocols.loc_begin(); } - protocol_loc_iterator protocol_loc_end() const { - return ReferencedProtocols.loc_end(); + protocol_loc_iterator protocol_loc_end() const { + return ReferencedProtocols.loc_end(); } ObjCCategoryDecl *getNextClassCategory() const { return NextClassCategory; } bool IsClassExtension() const { return getIdentifier() == 0; } const ObjCCategoryDecl *getNextClassExtension() const; - + bool hasSynthBitfield() const { return HasSynthBitfield; } void setHasSynthBitfield (bool val) { HasSynthBitfield = val; } - + typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator; ivar_iterator ivar_begin() const { return ivar_iterator(decls_begin()); @@ -1295,9 +1297,9 @@ public: /// interface associated with this implementation. /// FIXME: This is a bad API, we are overriding the NamedDecl::getIdentifier() /// to mean something different. For example: - /// ((NamedDecl *)SomeCategoryImplDecl)->getIdentifier() - /// returns the class interface name, whereas - /// ((ObjCCategoryImplDecl *)SomeCategoryImplDecl)->getIdentifier() + /// ((NamedDecl *)SomeCategoryImplDecl)->getIdentifier() + /// returns the class interface name, whereas + /// ((ObjCCategoryImplDecl *)SomeCategoryImplDecl)->getIdentifier() /// returns the category name. IdentifierInfo *getIdentifier() const { return Id; @@ -1363,10 +1365,10 @@ class ObjCImplementationDecl : public ObjCImplDecl { /// true if class has a .cxx_[construct,destruct] method. bool HasCXXStructors : 1; - + /// true of class extension has at least one bitfield ivar. bool HasSynthBitfield : 1; - + ObjCImplementationDecl(DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, @@ -1380,18 +1382,18 @@ public: ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc); - + /// init_iterator - Iterates through the ivar initializer list. typedef CXXCtorInitializer **init_iterator; - + /// init_const_iterator - Iterates through the ivar initializer list. typedef CXXCtorInitializer * const * init_const_iterator; - + /// init_begin() - Retrieve an iterator to the first initializer. init_iterator init_begin() { return IvarInitializers; } /// begin() - Retrieve an iterator to the first initializer. init_const_iterator init_begin() const { return IvarInitializers; } - + /// init_end() - Retrieve an iterator past the last initializer. init_iterator init_end() { return IvarInitializers + NumIvarInitializers; @@ -1404,21 +1406,21 @@ public: unsigned getNumIvarInitializers() const { return NumIvarInitializers; } - + void setNumIvarInitializers(unsigned numNumIvarInitializers) { NumIvarInitializers = numNumIvarInitializers; } - + void setIvarInitializers(ASTContext &C, CXXCtorInitializer ** initializers, unsigned numInitializers); bool hasCXXStructors() const { return HasCXXStructors; } void setHasCXXStructors(bool val) { HasCXXStructors = val; } - + bool hasSynthBitfield() const { return HasSynthBitfield; } void setHasSynthBitfield (bool val) { HasSynthBitfield = val; } - + /// getIdentifier - Get the identifier that names the class /// interface associated with this implementation. IdentifierInfo *getIdentifier() const { @@ -1553,7 +1555,7 @@ private: ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation AtLocation, TypeSourceInfo *T) : NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), DeclType(T), - PropertyAttributes(OBJC_PR_noattr), + PropertyAttributes(OBJC_PR_noattr), PropertyAttributesAsWritten(OBJC_PR_noattr), PropertyImplementation(None), GetterName(Selector()), @@ -1567,7 +1569,7 @@ public: PropertyControl propControl = None); SourceLocation getAtLoc() const { return AtLoc; } void setAtLoc(SourceLocation L) { AtLoc = L; } - + TypeSourceInfo *getTypeSourceInfo() const { return DeclType; } QualType getType() const { return DeclType->getType(); } void setType(TypeSourceInfo *T) { DeclType = T; } @@ -1588,11 +1590,11 @@ public: OBJC_PR_unsafe_unretained | OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_weak); } - + void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) { PropertyAttributesAsWritten = PRVal; } - + void makeitReadWriteAttribute(void) { PropertyAttributes &= ~OBJC_PR_readonly; PropertyAttributes |= OBJC_PR_readwrite; @@ -1683,7 +1685,7 @@ public: }; private: SourceLocation AtLoc; // location of @synthesize or @dynamic - + /// \brief For @synthesize, the location of the ivar, if it was written in /// the source code. /// @@ -1691,16 +1693,16 @@ private: /// @synthesize int a = b /// \endcode SourceLocation IvarLoc; - + /// Property declaration being implemented ObjCPropertyDecl *PropertyDecl; /// Null for @dynamic. Required for @synthesize. ObjCIvarDecl *PropertyIvarDecl; - + /// Null for @dynamic. Non-null if property must be copy-constructed in getter Expr *GetterCXXConstructor; - + /// Null for @dynamic. Non-null if property has assignment operator to call /// in Setter synthesis. Expr *SetterCXXAssignment; @@ -1711,7 +1713,7 @@ private: ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc) : Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc), - IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl), + IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl), GetterCXXConstructor(0), SetterCXXAssignment(0) { assert (PK == Dynamic || PropertyIvarDecl); } @@ -1725,7 +1727,7 @@ public: SourceLocation ivarLoc); virtual SourceRange getSourceRange() const; - + SourceLocation getLocStart() const { return AtLoc; } void setAtLoc(SourceLocation Loc) { AtLoc = Loc; } @@ -1742,13 +1744,13 @@ public: return PropertyIvarDecl; } SourceLocation getPropertyIvarDeclLoc() const { return IvarLoc; } - + void setPropertyIvarDecl(ObjCIvarDecl *Ivar, - SourceLocation IvarLoc) { - PropertyIvarDecl = Ivar; + SourceLocation IvarLoc) { + PropertyIvarDecl = Ivar; this->IvarLoc = IvarLoc; } - + Expr *getGetterCXXConstructor() const { return GetterCXXConstructor; } @@ -1762,11 +1764,11 @@ public: void setSetterCXXAssignment(Expr *setterCXXAssignment) { SetterCXXAssignment = setterCXXAssignment; } - + static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const ObjCPropertyImplDecl *D) { return true; } static bool classofKind(Decl::Kind K) { return K == ObjCPropertyImpl; } - + friend class ASTDeclReader; }; diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 138e47d1a96..9149850e8fa 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -99,7 +99,7 @@ public: /// The first template parameter list in a declaration will have depth 0, /// the second template parameter list will have depth 1, etc. unsigned getDepth() const; - + SourceLocation getTemplateLoc() const { return TemplateLoc; } SourceLocation getLAngleLoc() const { return LAngleLoc; } SourceLocation getRAngleLoc() const { return RAngleLoc; } @@ -116,7 +116,8 @@ class FixedSizeTemplateParameterList : public TemplateParameterList { NamedDecl *Params[N]; public: - FixedSizeTemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, + FixedSizeTemplateParameterList(SourceLocation TemplateLoc, + SourceLocation LAngleLoc, NamedDecl **Params, SourceLocation RAngleLoc) : TemplateParameterList(TemplateLoc, LAngleLoc, Params, N, RAngleLoc) { } @@ -142,7 +143,7 @@ class TemplateArgumentList { : Arguments(Args, Owned), NumArguments(NumArgs) { } public: - /// \brief Type used to indicate that the template argument list itself is a + /// \brief Type used to indicate that the template argument list itself is a /// stack object. It does not own its template arguments. enum OnStackType { OnStack }; @@ -156,12 +157,12 @@ public: /// /// The template argument list does not own the template arguments /// provided. - explicit TemplateArgumentList(OnStackType, + explicit TemplateArgumentList(OnStackType, const TemplateArgument *Args, unsigned NumArgs) : Arguments(Args, false), NumArguments(NumArgs) { } - - /// \brief Produces a shallow copy of the given template argument list. - /// + + /// \brief Produces a shallow copy of the given template argument list. + /// /// This operation assumes that the input argument list outlives it. /// This takes the list as a pointer to avoid looking like a copy /// constructor, since this really really isn't safe to use that @@ -244,7 +245,7 @@ public: protected: NamedDecl *TemplatedDecl; TemplateParameterList* TemplateParams; - + public: /// \brief Initialize the underlying templated declaration and /// template parameters. @@ -298,9 +299,9 @@ public: const ASTTemplateArgumentListInfo *TemplateArgumentsAsWritten; /// \brief The point at which this function template specialization was - /// first instantiated. + /// first instantiated. SourceLocation PointOfInstantiation; - + /// \brief Retrieve the template from which this function was specialized. FunctionTemplateDecl *getTemplate() const { return Template.getPointer(); } @@ -325,16 +326,16 @@ public: /// /// The point of instantiation may be an invalid source location if this /// function has yet to be instantiated. - SourceLocation getPointOfInstantiation() const { - return PointOfInstantiation; + SourceLocation getPointOfInstantiation() const { + return PointOfInstantiation; } - + /// \brief Set the (first) point of instantiation of this function template /// specialization. void setPointOfInstantiation(SourceLocation POI) { PointOfInstantiation = POI; } - + void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, TemplateArguments->data(), TemplateArguments->size(), @@ -350,49 +351,49 @@ public: } }; -/// \brief Provides information a specialization of a member of a class +/// \brief Provides information a specialization of a member of a class /// template, which may be a member function, static data member, or /// member class. class MemberSpecializationInfo { // The member declaration from which this member was instantiated, and the // manner in which the instantiation occurred (in the lower two bits). llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK; - + // The point at which this member was first instantiated. SourceLocation PointOfInstantiation; - + public: - explicit + explicit MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI = SourceLocation()) : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) { - assert(TSK != TSK_Undeclared && + assert(TSK != TSK_Undeclared && "Cannot encode undeclared template specializations for members"); } - + /// \brief Retrieve the member declaration from which this member was /// instantiated. NamedDecl *getInstantiatedFrom() const { return MemberAndTSK.getPointer(); } - + /// \brief Determine what kind of template specialization this is. TemplateSpecializationKind getTemplateSpecializationKind() const { return (TemplateSpecializationKind)(MemberAndTSK.getInt() + 1); } - + /// \brief Set the template specialization kind. void setTemplateSpecializationKind(TemplateSpecializationKind TSK) { - assert(TSK != TSK_Undeclared && + assert(TSK != TSK_Undeclared && "Cannot encode undeclared template specializations for members"); MemberAndTSK.setInt(TSK - 1); } - - /// \brief Retrieve the first point of instantiation of this member. + + /// \brief Retrieve the first point of instantiation of this member. /// If the point of instantiation is an invalid location, then this member /// has not yet been instantiated. - SourceLocation getPointOfInstantiation() const { - return PointOfInstantiation; + SourceLocation getPointOfInstantiation() const { + return PointOfInstantiation; } - + /// \brief Set the first point of instantiation. void setPointOfInstantiation(SourceLocation POI) { PointOfInstantiation = POI; @@ -414,14 +415,14 @@ class DependentFunctionTemplateSpecializationInfo { union { // Force sizeof to be a multiple of sizeof(void*) so that the // trailing data is aligned. - void *Aligner; + void *Aligner; struct { /// The number of potential template candidates. unsigned NumTemplates; /// The number of template arguments. - unsigned NumArgs; + unsigned NumArgs; } d; }; @@ -452,7 +453,7 @@ public: /// \brief Returns the explicit template arguments that were given. const TemplateArgumentLoc *getTemplateArgs() const { return reinterpret_cast<const TemplateArgumentLoc*>( - &getTemplates()[getNumTemplates()]); + &getTemplates()[getNumTemplates()]); } /// \brief Returns the number of explicit template arguments that were given. @@ -474,7 +475,7 @@ public: return AngleLocs.getEnd(); } }; - + /// Declaration of a redeclarable template. class RedeclarableTemplateDecl : public TemplateDecl { @@ -631,7 +632,7 @@ public: const_cast<RedeclarableTemplateDecl*>(this)->getMostRecentDeclaration(); } - /// \brief Determines whether this template was a specialization of a + /// \brief Determines whether this template was a specialization of a /// member template. /// /// In the following example, the function template \c X<int>::f and the @@ -652,14 +653,14 @@ public: bool isMemberSpecialization() { return getCommonPtr()->InstantiatedFromMember.getInt(); } - + /// \brief Note that this member template is a specialization. void setMemberSpecialization() { assert(getCommonPtr()->InstantiatedFromMember.getPointer() && "Only member templates can be member template specializations"); getCommonPtr()->InstantiatedFromMember.setInt(true); } - + /// \brief Retrieve the previous declaration of this template, or /// NULL if no such declaration exists. RedeclarableTemplateDecl *getInstantiatedFromMemberTemplate() { @@ -774,11 +775,11 @@ protected: /// function template. struct Common : CommonBase { Common() : InjectedArgs(0) { } - + /// \brief The function template specializations for this function /// template, including explicit specializations and instantiations. llvm::FoldingSet<FunctionTemplateSpecializationInfo> Specializations; - + /// \brief The set of "injected" template arguments used within this /// function template. /// @@ -813,7 +814,7 @@ protected: /// retrieved by an earlier call to findSpecialization(). void addSpecialization(FunctionTemplateSpecializationInfo* Info, void *InsertPos); - + public: /// Get the underlying function declaration of the template. FunctionDecl *getTemplatedDecl() const { @@ -866,13 +867,13 @@ public: /// \brief Retrieve the "injected" template arguments that correspond to the /// template parameters of this function template. - /// + /// /// Although the C++ standard has no notion of the "injected" template /// arguments for a function template, the notion is convenient when /// we need to perform substitutions inside the definition of a function - /// template. + /// template. std::pair<const TemplateArgument *, unsigned> getInjectedTemplateArgs(); - + /// \brief Create a function template node. static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, @@ -1003,14 +1004,14 @@ public: DefaultArgument = 0; InheritedDefault = false; } - + /// \brief Set whether this template type parameter was declared with /// the 'typename' or 'class' keyword. void setDeclaredWithTypename(bool withTypename) { Typename = withTypename; } /// \brief Retrieve the depth of the template parameter. unsigned getDepth() const; - + /// \brief Retrieve the index of the template parameter. unsigned getIndex() const; @@ -1038,18 +1039,18 @@ class NonTypeTemplateParmDecl // FIXME: Collapse this into TemplateParamPosition; or, just move depth/index // down here to save memory. - + /// \brief Whether this non-type template parameter is a parameter pack. bool ParameterPack; - - /// \brief Whether this non-type template parameter is an "expanded" + + /// \brief Whether this non-type template parameter is an "expanded" /// parameter pack, meaning that its type is a pack expansion and we /// already know the set of types that expansion expands to. bool ExpandedParameterPack; - + /// \brief The number of types in an expanded parameter pack. unsigned NumExpandedTypes; - + NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, @@ -1069,7 +1070,7 @@ class NonTypeTemplateParmDecl TypeSourceInfo **ExpandedTInfos); friend class ASTDeclReader; - + public: static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, @@ -1135,7 +1136,7 @@ public: /// template<typename T, unsigned ...Dims> struct multi_array; /// \endcode bool isParameterPack() const { return ParameterPack; } - + /// \brief Whether this parameter is a non-type template parameter pack /// that has different types at different positions. /// @@ -1150,25 +1151,26 @@ public: /// struct Y { /* ... */ }; /// }; /// \endcode - /// + /// /// The parameter pack \c Values has a \c PackExpansionType as its type, /// which expands \c Types. When \c Types is supplied with template arguments - /// by instantiating \c X, the instantiation of \c Values becomes an - /// expanded parameter pack. For example, instantiating + /// by instantiating \c X, the instantiation of \c Values becomes an + /// expanded parameter pack. For example, instantiating /// \c X<int, unsigned int> results in \c Values being an expanded parameter /// pack with expansion types \c int and \c unsigned int. /// - /// The \c getExpansionType() and \c getExpansionTypeSourceInfo() functions + /// The \c getExpansionType() and \c getExpansionTypeSourceInfo() functions /// return the expansion types. bool isExpandedParameterPack() const { return ExpandedParameterPack; } - - /// \brief Retrieves the number of expansion types in an expanded parameter pack. + + /// \brief Retrieves the number of expansion types in an expanded parameter + /// pack. unsigned getNumExpansionTypes() const { assert(ExpandedParameterPack && "Not an expansion parameter pack"); return NumExpandedTypes; } - /// \brief Retrieve a particular expansion type within an expanded parameter + /// \brief Retrieve a particular expansion type within an expanded parameter /// pack. QualType getExpansionType(unsigned I) const { assert(I < NumExpandedTypes && "Out-of-range expansion type index"); @@ -1176,7 +1178,7 @@ public: return QualType::getFromOpaquePtr(TypesAndInfos[2*I]); } - /// \brief Retrieve a particular expansion type source info within an + /// \brief Retrieve a particular expansion type source info within an /// expanded parameter pack. TypeSourceInfo *getExpansionTypeSourceInfo(unsigned I) const { assert(I < NumExpandedTypes && "Out-of-range expansion type index"); @@ -1207,7 +1209,7 @@ class TemplateTemplateParmDecl /// \brief Whether this parameter is a parameter pack. bool ParameterPack; - + TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params) @@ -1552,7 +1554,7 @@ public: static bool classof(const ClassTemplatePartialSpecializationDecl *) { return true; } - + friend class ASTDeclReader; friend class ASTDeclWriter; }; @@ -1571,15 +1573,15 @@ class ClassTemplatePartialSpecializationDecl /// specialization was added to the set of partial specializations for /// its owning class template. unsigned SequenceNumber; - - /// \brief The class template partial specialization from which this + + /// \brief The class template partial specialization from which this /// class template partial specialization was instantiated. /// /// The boolean value will be true to indicate that this class template /// partial specialization was specialized at this level. llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool> InstantiatedFromMember; - + ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, @@ -1592,7 +1594,7 @@ class ClassTemplatePartialSpecializationDecl unsigned NumArgInfos, ClassTemplatePartialSpecializationDecl *PrevDecl, unsigned SequenceNumber); - + ClassTemplatePartialSpecializationDecl() : ClassTemplateSpecializationDecl(ClassTemplatePartialSpecialization), TemplateParams(0), ArgsAsWritten(0), @@ -1654,9 +1656,9 @@ public: /// \endcode /// /// In this example, the instantiation of \c Outer<float>::Inner<int*> will - /// end up instantiating the partial specialization - /// \c Outer<float>::Inner<U*>, which itself was instantiated from the class - /// template partial specialization \c Outer<T>::Inner<U*>. Given + /// end up instantiating the partial specialization + /// \c Outer<float>::Inner<U*>, which itself was instantiated from the class + /// template partial specialization \c Outer<T>::Inner<U*>. Given /// \c Outer<float>::Inner<U*>, this function would return /// \c Outer<T>::Inner<U*>. ClassTemplatePartialSpecializationDecl *getInstantiatedFromMember() { @@ -1664,15 +1666,15 @@ public: = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); return First->InstantiatedFromMember.getPointer(); } - + void setInstantiatedFromMember( ClassTemplatePartialSpecializationDecl *PartialSpec) { ClassTemplatePartialSpecializationDecl *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); First->InstantiatedFromMember.setPointer(PartialSpec); } - - /// \brief Determines whether this class template partial specialization + + /// \brief Determines whether this class template partial specialization /// template was a specialization of a member partial specialization. /// /// In the following example, the member template partial specialization @@ -1693,7 +1695,7 @@ public: = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); return First->InstantiatedFromMember.getInt(); } - + /// \brief Note that this member template is a specialization. void setMemberSpecialization() { ClassTemplatePartialSpecializationDecl *First @@ -1711,7 +1713,7 @@ public: return cast<InjectedClassNameType>(getTypeForDecl()) ->getInjectedSpecializationType(); } - + // FIXME: Add Profile support! static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -1731,7 +1733,7 @@ public: class ClassTemplateDecl : public RedeclarableTemplateDecl, public RedeclarableTemplate<ClassTemplateDecl> { static void DeallocateCommon(void *Ptr); - + protected: typedef RedeclarableTemplate<ClassTemplateDecl> redeclarable_base; @@ -1739,7 +1741,7 @@ protected: /// class template. struct Common : CommonBase { Common() : LazySpecializations() { } - + /// \brief The class template specializations for this class /// template, including explicit specializations and instantiations. llvm::FoldingSet<ClassTemplateSpecializationDecl> Specializations; @@ -1751,7 +1753,7 @@ protected: /// \brief The injected-class-name type for this class template. QualType InjectedClassNameType; - + /// \brief If non-null, points to an array of specializations (including /// partial specializations) known ownly by their external declaration IDs. /// @@ -1762,7 +1764,7 @@ protected: /// \brief Load any lazily-loaded specializations from the external source. void LoadLazySpecializations(); - + /// \brief Retrieve the set of specializations of this class template. llvm::FoldingSet<ClassTemplateSpecializationDecl> &getSpecializations(); @@ -1860,7 +1862,7 @@ public: /// \brief Retrieve the partial specializations as an ordered list. void getPartialSpecializations( SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS); - + /// \brief Find a class template partial specialization with the given /// type T. /// @@ -1870,7 +1872,7 @@ public: /// \returns the class template partial specialization that exactly matches /// the type \p T, or NULL if no such partial specialization exists. ClassTemplatePartialSpecializationDecl *findPartialSpecialization(QualType T); - + /// \brief Find a class template partial specialization which was instantiated /// from the given member partial specialization. /// @@ -1957,7 +1959,7 @@ private: FriendTemplateDecl(DeclContext *DC, SourceLocation Loc, - unsigned NParams, + unsigned NParams, TemplateParameterList **Params, FriendUnion Friend, SourceLocation FriendLoc) @@ -1977,7 +1979,7 @@ private: public: static FriendTemplateDecl *Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc, - unsigned NParams, + unsigned NParams, TemplateParameterList **Params, FriendUnion Friend, SourceLocation FriendLoc); @@ -2072,7 +2074,7 @@ public: return redeclarable_base::getInstantiatedFromMemberTemplate(); } - + /// \brief Create a function template node. static TypeAliasTemplateDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index af46e1799c9..f0a4802db1d 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -56,8 +56,8 @@ class Expr : public Stmt { protected: Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, - bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack) - : Stmt(SC) + bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack) + : Stmt(SC) { ExprBits.TypeDependent = TD; ExprBits.ValueDependent = VD; @@ -97,8 +97,8 @@ public: bool isValueDependent() const { return ExprBits.ValueDependent; } /// \brief Set whether this expression is value-dependent or not. - void setValueDependent(bool VD) { - ExprBits.ValueDependent = VD; + void setValueDependent(bool VD) { + ExprBits.ValueDependent = VD; if (VD) ExprBits.InstantiationDependent = true; } @@ -117,8 +117,8 @@ public: bool isTypeDependent() const { return ExprBits.TypeDependent; } /// \brief Set whether this expression is type-dependent or not. - void setTypeDependent(bool TD) { - ExprBits.TypeDependent = TD; + void setTypeDependent(bool TD) { + ExprBits.TypeDependent = TD; if (TD) ExprBits.InstantiationDependent = true; } @@ -140,12 +140,12 @@ public: /// } /// \endcode /// - bool isInstantiationDependent() const { - return ExprBits.InstantiationDependent; + bool isInstantiationDependent() const { + return ExprBits.InstantiationDependent; } - + /// \brief Set whether this expression is instantiation-dependent or not. - void setInstantiationDependent(bool ID) { + void setInstantiationDependent(bool ID) { ExprBits.InstantiationDependent = ID; } @@ -163,8 +163,8 @@ public: /// /// The expressions \c args and \c static_cast<Types&&>(args) both /// contain parameter packs. - bool containsUnexpandedParameterPack() const { - return ExprBits.ContainsUnexpandedParameterPack; + bool containsUnexpandedParameterPack() const { + return ExprBits.ContainsUnexpandedParameterPack; } /// \brief Set the bit that describes whether this expression @@ -302,12 +302,12 @@ public: bool isPRValue() const { return Kind >= CL_Function; } bool isRValue() const { return Kind >= CL_XValue; } bool isModifiable() const { return getModifiable() == CM_Modifiable; } - + /// \brief Create a simple, modifiably lvalue static Classification makeSimpleLValue() { return Classification(CL_LValue, CM_Modifiable); } - + }; /// \brief Classify - Classify this expression according to the C++0x /// expression taxonomy. @@ -403,13 +403,13 @@ public: return BT->getKind() == K; return false; } - + /// isKnownToHaveBooleanValue - Return true if this is an integer expression /// that is known to return 0 or 1. This happens for _Bool/bool expressions /// but also int expressions which are produced by things like comparisons in /// C. bool isKnownToHaveBooleanValue() const; - + /// isIntegerConstantExpr - Return true if this expression is a valid integer /// constant expression, and, if so, return its value in Result. If not a /// valid i-c-e, return false and fill in Loc (if specified) with the location @@ -521,16 +521,16 @@ public: enum NullPointerConstantValueDependence { /// \brief Specifies that the expression should never be value-dependent. NPC_NeverValueDependent = 0, - + /// \brief Specifies that a value-dependent expression of integral or /// dependent type should be considered a null pointer constant. NPC_ValueDependentIsNull, - + /// \brief Specifies that a value-dependent expression should be considered /// to never be a null pointer constant. NPC_ValueDependentIsNotNull }; - + /// isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to /// a Null pointer constant. The return value can further distinguish the /// kind of NULL pointer constant that was detected. @@ -578,8 +578,8 @@ public: /// or CastExprs, returning their operand. Expr *IgnoreParenCasts(); - /// IgnoreParenImpCasts - Ignore parentheses and implicit casts. Strip off any - /// ParenExpr or ImplicitCastExprs, returning their operand. + /// IgnoreParenImpCasts - Ignore parentheses and implicit casts. Strip off + /// any ParenExpr or ImplicitCastExprs, returning their operand. Expr *IgnoreParenImpCasts(); /// IgnoreConversionOperator - Ignore conversion operator. If this Expr is a @@ -593,11 +593,11 @@ public: const Expr *IgnoreParenImpCasts() const { return const_cast<Expr*>(this)->IgnoreParenImpCasts(); } - + /// Ignore parentheses and lvalue casts. Strip off any ParenExpr and /// CastExprs that represent lvalue casts, returning their operand. Expr *IgnoreParenLValueCasts(); - + const Expr *IgnoreParenLValueCasts() const { return const_cast<Expr*>(this)->IgnoreParenLValueCasts(); } @@ -610,12 +610,12 @@ public: /// \brief Determine whether this expression is a default function argument. /// /// Default arguments are implicitly generated in the abstract syntax tree - /// by semantic analysis for function calls, object constructions, etc. in + /// by semantic analysis for function calls, object constructions, etc. in /// C++. Default arguments are represented by \c CXXDefaultArgExpr nodes; /// this routine also looks through any implicit casts to determine whether /// the expression is a default argument. bool isDefaultArgument() const; - + /// \brief Determine whether the result of this expression is a /// temporary object of the given class type. bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const; @@ -660,14 +660,14 @@ class OpaqueValueExpr : public Expr { friend class ASTStmtReader; Expr *SourceExpr; SourceLocation Loc; - + public: - OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, + OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, ExprObjectKind OK = OK_Ordinary) : Expr(OpaqueValueExprClass, T, VK, OK, - T->isDependentType(), T->isDependentType(), + T->isDependentType(), T->isDependentType(), T->isInstantiationDependentType(), - false), + false), SourceExpr(0), Loc(Loc) { } @@ -681,7 +681,7 @@ public: /// \brief Retrieve the location of this expression. SourceLocation getLocation() const { return Loc; } - + SourceRange getSourceRange() const { if (SourceExpr) return SourceExpr->getSourceRange(); return Loc; @@ -989,7 +989,7 @@ private: public: PredefinedExpr(SourceLocation l, QualType type, IdentType IT) : Expr(PredefinedExprClass, type, VK_LValue, OK_Ordinary, - type->isDependentType(), type->isDependentType(), + type->isDependentType(), type->isDependentType(), type->isInstantiationDependentType(), /*ContainsUnexpandedParameterPack=*/false), Loc(l), Type(IT) {} @@ -1051,14 +1051,14 @@ protected: }; class APIntStorage : public APNumericStorage { -public: - llvm::APInt getValue() const { return getIntValue(); } +public: + llvm::APInt getValue() const { return getIntValue(); } void setValue(ASTContext &C, const llvm::APInt &Val) { setIntValue(C, Val); } }; class APFloatStorage : public APNumericStorage { -public: - llvm::APFloat getValue() const { return llvm::APFloat(getIntValue()); } +public: + llvm::APFloat getValue() const { return llvm::APFloat(getIntValue()); } void setValue(ASTContext &C, const llvm::APFloat &Val) { setIntValue(C, Val.bitcastToAPInt()); } @@ -1347,8 +1347,8 @@ public: StringKind Kind, bool IsPascal); StringKind getKind() const { return static_cast<StringKind>(Kind); } - - + + bool isAscii() const { return Kind == Ascii; } bool isWide() const { return Kind == Wide; } bool isUTF8() const { return Kind == UTF8; } @@ -1363,7 +1363,7 @@ public: return true; return false; } - + /// getNumConcatenated - Get the number of string literal tokens that were /// concatenated in translation phase #6 to form this string literal. unsigned getNumConcatenated() const { return NumConcatenated; } @@ -1376,7 +1376,7 @@ public: assert(TokNum < NumConcatenated && "Invalid tok number"); TokLocs[TokNum] = L; } - + /// getLocationOfByte - Return a source location that points to the specified /// byte of this string literal. /// @@ -1471,7 +1471,7 @@ public: : Expr(UnaryOperatorClass, type, VK, OK, input->isTypeDependent() || type->isDependentType(), input->isValueDependent(), - (input->isInstantiationDependent() || + (input->isInstantiationDependent() || type->isInstantiationDependentType()), input->containsUnexpandedParameterPack()), Opc(opc), Loc(l), Val(input) {} @@ -1561,14 +1561,14 @@ public: /// @code /// struct S { /// float f; -/// double d; +/// double d; /// }; /// struct T { /// int i; /// struct S s[10]; /// }; /// @endcode -/// we can represent and evaluate the expression @c offsetof(struct T, s[2].d). +/// we can represent and evaluate the expression @c offsetof(struct T, s[2].d). class OffsetOfExpr : public Expr { public: @@ -1590,48 +1590,48 @@ public: private: enum { MaskBits = 2, Mask = 0x03 }; - + /// \brief The source range that covers this part of the designator. SourceRange Range; - + /// \brief The data describing the designator, which comes in three /// different forms, depending on the lower two bits. - /// - An unsigned index into the array of Expr*'s stored after this node + /// - An unsigned index into the array of Expr*'s stored after this node /// in memory, for [constant-expression] designators. /// - A FieldDecl*, for references to a known field. /// - An IdentifierInfo*, for references to a field with a given name /// when the class type is dependent. - /// - A CXXBaseSpecifier*, for references that look at a field in a + /// - A CXXBaseSpecifier*, for references that look at a field in a /// base class. uintptr_t Data; - + public: /// \brief Create an offsetof node that refers to an array element. - OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, + OffsetOfNode(SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc) : Range(LBracketLoc, RBracketLoc), Data((Index << 2) | Array) { } - + /// \brief Create an offsetof node that refers to a field. - OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, + OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc) - : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc), + : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc), Data(reinterpret_cast<uintptr_t>(Field) | OffsetOfNode::Field) { } - + /// \brief Create an offsetof node that refers to an identifier. OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc) - : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc), + : Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc), Data(reinterpret_cast<uintptr_t>(Name) | Identifier) { } /// \brief Create an offsetof node that refers into a C++ base class. explicit OffsetOfNode(const CXXBaseSpecifier *Base) : Range(), Data(reinterpret_cast<uintptr_t>(Base) | OffsetOfNode::Base) {} - + /// \brief Determine what kind of offsetof node this is. - Kind getKind() const { + Kind getKind() const { return static_cast<Kind>(Data & Mask); } - + /// \brief For an array element node, returns the index into the array /// of expressions. unsigned getArrayExprIndex() const { @@ -1644,28 +1644,28 @@ public: assert(getKind() == Field); return reinterpret_cast<FieldDecl *>(Data & ~(uintptr_t)Mask); } - + /// \brief For a field or identifier offsetof node, returns the name of /// the field. IdentifierInfo *getFieldName() const; - + /// \brief For a base class node, returns the base specifier. CXXBaseSpecifier *getBase() const { assert(getKind() == Base); - return reinterpret_cast<CXXBaseSpecifier *>(Data & ~(uintptr_t)Mask); + return reinterpret_cast<CXXBaseSpecifier *>(Data & ~(uintptr_t)Mask); } - + /// \brief Retrieve the source range that covers this offsetof node. /// /// For an array element node, the source range contains the locations of /// the square brackets. For a field or identifier node, the source range - /// contains the location of the period (if there is one) and the + /// contains the location of the period (if there is one) and the /// identifier. SourceRange getSourceRange() const { return Range; } }; private: - + SourceLocation OperatorLoc, RParenLoc; // Base type; TypeSourceInfo *TSInfo; @@ -1673,26 +1673,26 @@ private: unsigned NumComps; // Number of sub-expressions (i.e. array subscript expressions). unsigned NumExprs; - - OffsetOfExpr(ASTContext &C, QualType type, + + OffsetOfExpr(ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, - OffsetOfNode* compsPtr, unsigned numComps, + OffsetOfNode* compsPtr, unsigned numComps, Expr** exprsPtr, unsigned numExprs, SourceLocation RParenLoc); explicit OffsetOfExpr(unsigned numComps, unsigned numExprs) : Expr(OffsetOfExprClass, EmptyShell()), - TSInfo(0), NumComps(numComps), NumExprs(numExprs) {} + TSInfo(0), NumComps(numComps), NumExprs(numExprs) {} public: - - static OffsetOfExpr *Create(ASTContext &C, QualType type, - SourceLocation OperatorLoc, TypeSourceInfo *tsi, - OffsetOfNode* compsPtr, unsigned numComps, + + static OffsetOfExpr *Create(ASTContext &C, QualType type, + SourceLocation OperatorLoc, TypeSourceInfo *tsi, + OffsetOfNode* compsPtr, unsigned numComps, Expr** exprsPtr, unsigned numExprs, SourceLocation RParenLoc); - static OffsetOfExpr *CreateEmpty(ASTContext &C, + static OffsetOfExpr *CreateEmpty(ASTContext &C, unsigned NumComps, unsigned NumExprs); /// getOperatorLoc - Return the location of the operator. @@ -1702,14 +1702,14 @@ public: /// \brief Return the location of the right parentheses. SourceLocation getRParenLoc() const { return RParenLoc; } void setRParenLoc(SourceLocation R) { RParenLoc = R; } - + TypeSourceInfo *getTypeSourceInfo() const { return TSInfo; } void setTypeSourceInfo(TypeSourceInfo *tsi) { TSInfo = tsi; } - + const OffsetOfNode &getComponent(unsigned Idx) const { assert(Idx < NumComps && "Subscript out of range"); return reinterpret_cast<const OffsetOfNode *> (this + 1)[Idx]; @@ -1719,7 +1719,7 @@ public: assert(Idx < NumComps && "Subscript out of range"); reinterpret_cast<OffsetOfNode *> (this + 1)[Idx] = ON; } - + unsigned getNumComponents() const { return NumComps; } @@ -1738,7 +1738,7 @@ public: reinterpret_cast<Expr **>( reinterpret_cast<OffsetOfNode *>(this+1) + NumComps)[Idx] = E; } - + unsigned getNumExpressions() const { return NumExprs; } @@ -2007,7 +2007,7 @@ public: const Expr *const *getArgs() const { return const_cast<CallExpr*>(this)->getArgs(); } - + /// getArg - Return the specified argument. Expr *getArg(unsigned Arg) { assert(Arg < NumArgs && "Arg access out of range!"); @@ -2139,7 +2139,7 @@ public: const DeclarationNameInfo &NameInfo, QualType ty, ExprValueKind VK, ExprObjectKind OK) : Expr(MemberExprClass, ty, VK, OK, - base->isTypeDependent(), + base->isTypeDependent(), base->isValueDependent(), base->isInstantiationDependent(), base->containsUnexpandedParameterPack()), @@ -2206,13 +2206,13 @@ public: return getMemberQualifier()->QualifierLoc.getNestedNameSpecifier(); } - /// \brief If the member name was qualified, retrieves the + /// \brief If the member name was qualified, retrieves the /// nested-name-specifier that precedes the member name, with source-location /// information. NestedNameSpecifierLoc getQualifierLoc() const { if (!hasQualifier()) return NestedNameSpecifierLoc(); - + return getMemberQualifier()->QualifierLoc; } @@ -2255,7 +2255,7 @@ public: if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } - + /// \brief Retrieve the location of the left angle bracket following the /// member name ('<'), if any. SourceLocation getLAngleLoc() const { @@ -2307,7 +2307,7 @@ public: void setMemberLoc(SourceLocation L) { MemberLoc = L; } SourceRange getSourceRange() const; - + SourceLocation getExprLoc() const { return MemberLoc; } /// \brief Determine whether the base of this explicit is implicit. @@ -2356,7 +2356,7 @@ public: CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, QualType T, ExprValueKind VK, Expr *init, bool fileScope) : Expr(CompoundLiteralExprClass, T, VK, OK_Ordinary, - tinfo->getType()->isDependentType(), + tinfo->getType()->isDependentType(), init->isValueDependent(), (init->isInstantiationDependent() || tinfo->getType()->isInstantiationDependentType()), @@ -2432,7 +2432,7 @@ protected: // Cast expressions are value-dependent if the type is // dependent or if the subexpression is value-dependent. ty->isDependentType() || (op && op->isValueDependent()), - (ty->isInstantiationDependentType() || + (ty->isInstantiationDependentType() || (op && op->isInstantiationDependent())), (ty->containsUnexpandedParameterPack() || op->containsUnexpandedParameterPack())), @@ -2929,7 +2929,7 @@ public: // the expression if the condition evaluates to false. This is // the same as getRHS. Expr *getFalseExpr() const { return cast<Expr>(SubExprs[RHS]); } - + Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); } Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); } @@ -3015,7 +3015,7 @@ public: Expr *getFalseExpr() const { return cast<Expr>(SubExprs[RHS]); } - + SourceRange getSourceRange() const { return SourceRange(getCommon()->getLocStart(), getFalseExpr()->getLocEnd()); } @@ -3175,7 +3175,7 @@ public: /// \brief Retrieve the array of expressions. Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); } - + /// getExpr - Return the Expr at the specified index. Expr *getExpr(unsigned Index) { assert((Index < NumExprs) && "Arg access out of range!"); @@ -3423,7 +3423,7 @@ public: /// \brief Retrieve the set of initializers. Expr **getInits() { return reinterpret_cast<Expr **>(InitExprs.data()); } - + const Expr *getInit(unsigned Init) const { assert(Init < getNumInits() && "Initializer access out of range!"); return cast_or_null<Expr>(InitExprs[Init]); @@ -3798,7 +3798,7 @@ public: Designator *getDesignator(unsigned Idx) { return &designators_begin()[Idx]; } - void setDesignators(ASTContext &C, const Designator *Desigs, + void setDesignators(ASTContext &C, const Designator *Desigs, unsigned NumDesigs); Expr *getArrayIndex(const Designator& D); @@ -4133,7 +4133,7 @@ protected: public: BlockExpr(BlockDecl *BD, QualType ty) : Expr(BlockExprClass, ty, VK_RValue, OK_Ordinary, - ty->isDependentType(), false, + ty->isDependentType(), false, // FIXME: Check for instantiate-dependence in the statement? ty->isInstantiationDependentType(), false), @@ -4197,7 +4197,7 @@ public: bool isConstQualAdded() const { return ConstQualAdded; } void setConstQualAdded(bool C) { ConstQualAdded = C; } - + static bool classof(const Stmt *T) { return T->getStmtClass() == BlockDeclRefExprClass; } @@ -4218,12 +4218,12 @@ private: friend class ASTReader; friend class ASTStmtReader; explicit AsTypeExpr(EmptyShell Empty) : Expr(AsTypeExprClass, Empty) {} - + public: AsTypeExpr(Expr* SrcExpr, QualType DstType, ExprValueKind VK, ExprObjectKind OK, SourceLocation BuiltinLoc, SourceLocation RParenLoc) - : Expr(AsTypeExprClass, DstType, VK, OK, + : Expr(AsTypeExprClass, DstType, VK, OK, DstType->isDependentType(), DstType->isDependentType() || SrcExpr->isValueDependent(), (DstType->isInstantiationDependentType() || @@ -4231,7 +4231,7 @@ public: (DstType->containsUnexpandedParameterPack() || SrcExpr->containsUnexpandedParameterPack())), SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {} - + /// getSrcExpr - Return the Expr to be converted. Expr *getSrcExpr() const { return cast<Expr>(SrcExpr); } @@ -4240,16 +4240,16 @@ public: /// getRParenLoc - Return the location of final right parenthesis. SourceLocation getRParenLoc() const { return RParenLoc; } - + SourceRange getSourceRange() const { return SourceRange(BuiltinLoc, RParenLoc); } - + static bool classof(const Stmt *T) { - return T->getStmtClass() == AsTypeExprClass; + return T->getStmtClass() == AsTypeExprClass; } static bool classof(const AsTypeExpr *) { return true; } - + // Iterators child_range children() { return child_range(&SrcExpr, &SrcExpr+1); } }; diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 3cc09cdf5e4..3998ae8a4b9 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -101,7 +101,7 @@ public: /// argument for the member call. For example, in "x.f(5)", this /// operation would return "x". Expr *getImplicitObjectArgument() const; - + /// Retrieves the declaration of the called method. CXXMethodDecl *getMethodDecl() const; @@ -158,7 +158,7 @@ class CXXNamedCastExpr : public ExplicitCastExpr { private: SourceLocation Loc; // the location of the casting op SourceLocation RParenLoc; // the location of the right parenthesis - + protected: CXXNamedCastExpr(StmtClass SC, QualType ty, ExprValueKind VK, CastKind kind, Expr *op, unsigned PathSize, @@ -171,7 +171,7 @@ protected: : ExplicitCastExpr(SC, Shell, PathSize) { } friend class ASTStmtReader; - + public: const char *getCastName() const; @@ -181,7 +181,7 @@ public: /// \brief Retrieve the location of the closing parenthesis. SourceLocation getRParenLoc() const { return RParenLoc; } - + SourceRange getSourceRange() const { return SourceRange(Loc, RParenLoc); } @@ -199,7 +199,8 @@ public: static bool classof(const CXXNamedCastExpr *) { return true; } }; -/// CXXStaticCastExpr - A C++ @c static_cast expression (C++ [expr.static.cast]). +/// CXXStaticCastExpr - A C++ @c static_cast expression +/// (C++ [expr.static.cast]). /// /// This expression node represents a C++ static cast, e.g., /// @c static_cast<int>(1.0). @@ -217,7 +218,7 @@ public: static CXXStaticCastExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, - TypeSourceInfo *Written, SourceLocation L, + TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc); static CXXStaticCastExpr *CreateEmpty(ASTContext &Context, unsigned PathSize); @@ -248,9 +249,9 @@ public: static CXXDynamicCastExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, - TypeSourceInfo *Written, SourceLocation L, + TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc); - + static CXXDynamicCastExpr *CreateEmpty(ASTContext &Context, unsigned pathSize); @@ -271,7 +272,7 @@ public: class CXXReinterpretCastExpr : public CXXNamedCastExpr { CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op, unsigned pathSize, - TypeSourceInfo *writtenTy, SourceLocation l, + TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc) : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, vk, kind, op, pathSize, writtenTy, l, RParenLoc) {} @@ -283,7 +284,7 @@ public: static CXXReinterpretCastExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, - TypeSourceInfo *WrittenTy, SourceLocation L, + TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc); static CXXReinterpretCastExpr *CreateEmpty(ASTContext &Context, unsigned pathSize); @@ -301,9 +302,9 @@ public: /// @c const_cast<char*>(PtrToConstChar). class CXXConstCastExpr : public CXXNamedCastExpr { CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op, - TypeSourceInfo *writtenTy, SourceLocation l, + TypeSourceInfo *writtenTy, SourceLocation l, SourceLocation RParenLoc) - : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, + : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, 0, writtenTy, l, RParenLoc) {} explicit CXXConstCastExpr(EmptyShell Empty) @@ -312,7 +313,7 @@ class CXXConstCastExpr : public CXXNamedCastExpr { public: static CXXConstCastExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, - TypeSourceInfo *WrittenTy, SourceLocation L, + TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc); static CXXConstCastExpr *CreateEmpty(ASTContext &Context); @@ -398,7 +399,7 @@ public: Operand->getType()->isInstantiationDependentType(), Operand->getType()->containsUnexpandedParameterPack()), Operand(Operand), Range(R) { } - + CXXTypeidExpr(QualType Ty, Expr *Operand, SourceRange R) : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary, // typeid is never type-dependent (C++ [temp.dep.expr]p4) @@ -416,9 +417,9 @@ public: else Operand = (TypeSourceInfo*)0; } - + bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); } - + /// \brief Retrieves the type operand of this typeid() expression after /// various required adjustments (removing reference types, cv-qualifiers). QualType getTypeOperand() const; @@ -433,20 +434,20 @@ public: assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)"); Operand = TSI; } - + Expr *getExprOperand() const { assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)"); return static_cast<Expr*>(Operand.get<Stmt *>()); } - + void setExprOperand(Expr *E) { assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)"); Operand = E; } - + SourceRange getSourceRange() const { return Range; } void setSourceRange(SourceRange R) { Range = R; } - + static bool classof(const Stmt *T) { return T->getStmtClass() == CXXTypeidExprClass; } @@ -476,7 +477,7 @@ public: Operand->getType()->isInstantiationDependentType(), Operand->getType()->containsUnexpandedParameterPack()), Operand(Operand), Range(R) { } - + CXXUuidofExpr(QualType Ty, Expr *Operand, SourceRange R) : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary, false, Operand->isTypeDependent(), @@ -491,9 +492,9 @@ public: else Operand = (TypeSourceInfo*)0; } - + bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); } - + /// \brief Retrieves the type operand of this __uuidof() expression after /// various required adjustments (removing reference types, cv-qualifiers). QualType getTypeOperand() const; @@ -508,12 +509,12 @@ public: assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)"); Operand = TSI; } - + Expr *getExprOperand() const { assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)"); return static_cast<Expr*>(Operand.get<Stmt *>()); } - + void setExprOperand(Expr *E) { assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)"); Operand = E; @@ -521,7 +522,7 @@ public: SourceRange getSourceRange() const { return Range; } void setSourceRange(SourceRange R) { Range = R; } - + static bool classof(const Stmt *T) { return T->getStmtClass() == CXXUuidofExprClass; } @@ -549,7 +550,7 @@ public: class CXXThisExpr : public Expr { SourceLocation Loc; bool Implicit : 1; - + public: CXXThisExpr(SourceLocation L, QualType Type, bool isImplicit) : Expr(CXXThisExprClass, Type, VK_RValue, OK_Ordinary, @@ -569,7 +570,7 @@ public: bool isImplicit() const { return Implicit; } void setImplicit(bool I) { Implicit = I; } - + static bool classof(const Stmt *T) { return T->getStmtClass() == CXXThisExprClass; } @@ -588,9 +589,9 @@ class CXXThrowExpr : public Expr { SourceLocation ThrowLoc; /// \brief Whether the thrown variable (if any) is in scope. unsigned IsThrownVariableInScope : 1; - + friend class ASTStmtReader; - + public: // Ty is the void type which is used as the result type of the // exepression. The l is the location of the throw keyword. expr @@ -614,7 +615,7 @@ public: /// This information is required to determine whether the NRVO can apply to /// this variable. bool isThrownVariableInScope() const { return IsThrownVariableInScope; } - + SourceRange getSourceRange() const { if (getSubExpr() == 0) return SourceRange(ThrowLoc, ThrowLoc); @@ -639,16 +640,16 @@ public: class CXXDefaultArgExpr : public Expr { /// \brief The parameter whose default is being used. /// - /// When the bit is set, the subexpression is stored after the + /// When the bit is set, the subexpression is stored after the /// CXXDefaultArgExpr itself. When the bit is clear, the parameter's /// actual default expression is the subexpression. llvm::PointerIntPair<ParmVarDecl *, 1, bool> Param; /// \brief The location where the default argument expression was used. SourceLocation Loc; - + CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param) - : Expr(SC, + : Expr(SC, param->hasUnparsedDefaultArg() ? param->getType().getNonReferenceType() : param->getDefaultArg()->getType(), @@ -656,19 +657,19 @@ class CXXDefaultArgExpr : public Expr { param->getDefaultArg()->getObjectKind(), false, false, false, false), Param(param, false), Loc(Loc) { } - CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param, + CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param, Expr *SubExpr) : Expr(SC, SubExpr->getType(), SubExpr->getValueKind(), SubExpr->getObjectKind(), - false, false, false, false), + false, false, false, false), Param(param, true), Loc(Loc) { *reinterpret_cast<Expr **>(this + 1) = SubExpr; } - + public: CXXDefaultArgExpr(EmptyShell Empty) : Expr(CXXDefaultArgExprClass, Empty) {} - + // Param is the parameter whose default argument is used by this // expression. static CXXDefaultArgExpr *Create(ASTContext &C, SourceLocation Loc, @@ -678,31 +679,31 @@ public: // Param is the parameter whose default argument is used by this // expression, and SubExpr is the expression that will actually be used. - static CXXDefaultArgExpr *Create(ASTContext &C, + static CXXDefaultArgExpr *Create(ASTContext &C, SourceLocation Loc, - ParmVarDecl *Param, + ParmVarDecl *Param, Expr *SubExpr); - + // Retrieve the parameter that the argument was created from. const ParmVarDecl *getParam() const { return Param.getPointer(); } ParmVarDecl *getParam() { return Param.getPointer(); } - + // Retrieve the actual argument to the function call. - const Expr *getExpr() const { + const Expr *getExpr() const { if (Param.getInt()) return *reinterpret_cast<Expr const * const*> (this + 1); - return getParam()->getDefaultArg(); + return getParam()->getDefaultArg(); } - Expr *getExpr() { + Expr *getExpr() { if (Param.getInt()) return *reinterpret_cast<Expr **> (this + 1); - return getParam()->getDefaultArg(); + return getParam()->getDefaultArg(); } - /// \brief Retrieve the location where this default argument was actually + /// \brief Retrieve the location where this default argument was actually /// used. SourceLocation getUsedLocation() const { return Loc; } - + SourceRange getSourceRange() const { // Default argument expressions have no representation in the // source, so they have an empty source range. @@ -757,7 +758,7 @@ class CXXBindTemporaryExpr : public Expr { CXXBindTemporaryExpr(CXXTemporary *temp, Expr* SubExpr) : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), - VK_RValue, OK_Ordinary, SubExpr->isTypeDependent(), + VK_RValue, OK_Ordinary, SubExpr->isTypeDependent(), SubExpr->isValueDependent(), SubExpr->isInstantiationDependent(), SubExpr->containsUnexpandedParameterPack()), @@ -766,7 +767,7 @@ class CXXBindTemporaryExpr : public Expr { public: CXXBindTemporaryExpr(EmptyShell Empty) : Expr(CXXBindTemporaryExprClass, Empty), Temp(0), SubExpr(0) {} - + static CXXBindTemporaryExpr *Create(ASTContext &C, CXXTemporary *Temp, Expr* SubExpr); @@ -778,7 +779,7 @@ public: Expr *getSubExpr() { return cast<Expr>(SubExpr); } void setSubExpr(Expr *E) { SubExpr = E; } - SourceRange getSourceRange() const { + SourceRange getSourceRange() const { return SubExpr->getSourceRange(); } @@ -801,7 +802,7 @@ public: CK_VirtualBase, CK_Delegating }; - + private: CXXConstructorDecl *Constructor; @@ -849,10 +850,10 @@ public: CXXConstructorDecl* getConstructor() const { return Constructor; } void setConstructor(CXXConstructorDecl *C) { Constructor = C; } - + SourceLocation getLocation() const { return Loc; } void setLocation(SourceLocation Loc) { this->Loc = Loc; } - + /// \brief Whether this construction is elidable. bool isElidable() const { return Elidable; } void setElidable(bool E) { Elidable = E; } @@ -868,16 +869,16 @@ public: void setRequiresZeroInitialization(bool ZeroInit) { ZeroInitialization = ZeroInit; } - + /// \brief Determines whether this constructor is actually constructing /// a base class (rather than a complete object). ConstructionKind getConstructionKind() const { return (ConstructionKind)ConstructKind; } - void setConstructionKind(ConstructionKind CK) { + void setConstructionKind(ConstructionKind CK) { ConstructKind = CK; } - + typedef ExprIterator arg_iterator; typedef ConstExprIterator const_arg_iterator; @@ -933,7 +934,7 @@ class CXXFunctionalCastExpr : public ExplicitCastExpr { TypeSourceInfo *writtenTy, SourceLocation tyBeginLoc, CastKind kind, Expr *castExpr, unsigned pathSize, - SourceLocation rParenLoc) + SourceLocation rParenLoc) : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, castExpr, pathSize, writtenTy), TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {} @@ -971,7 +972,7 @@ public: /// /// This expression type represents a C++ "functional" cast /// (C++[expr.type.conv]) with N != 1 arguments that invokes a -/// constructor to build a temporary object. With N == 1 arguments the +/// constructor to build a temporary object. With N == 1 arguments the /// functional cast expression will be represented by CXXFunctionalCastExpr. /// Example: /// @code @@ -997,7 +998,7 @@ public: TypeSourceInfo *getTypeSourceInfo() const { return Type; } SourceRange getSourceRange() const; - + static bool classof(const Stmt *T) { return T->getStmtClass() == CXXTemporaryObjectExprClass; } @@ -1015,9 +1016,9 @@ class CXXScalarValueInitExpr : public Expr { TypeSourceInfo *TypeInfo; friend class ASTStmtReader; - + public: - /// \brief Create an explicitly-written scalar-value initialization + /// \brief Create an explicitly-written scalar-value initialization /// expression. CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo, @@ -1032,7 +1033,7 @@ public: TypeSourceInfo *getTypeSourceInfo() const { return TypeInfo; } - + SourceLocation getRParenLoc() const { return RParenLoc; } SourceRange getSourceRange() const; @@ -1082,11 +1083,11 @@ class CXXNewExpr : public Expr { /// \brief The allocated type-source information, as written in the source. TypeSourceInfo *AllocatedTypeInfo; - - /// \brief If the allocated type was expressed as a parenthesized type-id, + + /// \brief If the allocated type was expressed as a parenthesized type-id, /// the source range covering the parenthesized type-id. SourceRange TypeIdParens; - + SourceLocation StartLoc; SourceLocation EndLoc; SourceLocation ConstructorLParen; @@ -1110,7 +1111,7 @@ public: void AllocateArgsArray(ASTContext &C, bool isArray, unsigned numPlaceArgs, unsigned numConsArgs); - + QualType getAllocatedType() const { assert(getType()->isPointerType()); return getType()->getAs<PointerType>()->getPointeeType(); @@ -1130,7 +1131,7 @@ public: /// identical except that the definition of a non-throwing /// exception specification is just "is it throw()?". bool shouldNullCheckAllocation(ASTContext &Ctx) const; - + FunctionDecl *getOperatorNew() const { return OperatorNew; } void setOperatorNew(FunctionDecl *D) { OperatorNew = D; } FunctionDecl *getOperatorDelete() const { return OperatorDelete; } @@ -1147,10 +1148,10 @@ public: } unsigned getNumPlacementArgs() const { return NumPlacementArgs; } - Expr **getPlacementArgs() { - return reinterpret_cast<Expr **>(SubExprs + Array); + Expr **getPlacementArgs() { + return reinterpret_cast<Expr **>(SubExprs + Array); } - + Expr *getPlacementArg(unsigned i) { assert(i < NumPlacementArgs && "Index out of range"); return cast<Expr>(SubExprs[Array + i]); @@ -1174,11 +1175,11 @@ public: } unsigned getNumConstructorArgs() const { return NumConstructorArgs; } - + Expr **getConstructorArgs() { return reinterpret_cast<Expr **>(SubExprs + Array + NumPlacementArgs); } - + Expr *getConstructorArg(unsigned i) { assert(i < NumConstructorArgs && "Index out of range"); return cast<Expr>(SubExprs[Array + NumPlacementArgs + i]); @@ -1221,7 +1222,7 @@ public: const_arg_iterator constructor_arg_end() const { return SubExprs + Array + getNumPlacementArgs() + getNumConstructorArgs(); } - + typedef Stmt **raw_arg_iterator; raw_arg_iterator raw_arg_begin() { return SubExprs; } raw_arg_iterator raw_arg_end() { @@ -1308,7 +1309,7 @@ public: /// destroyed is a dependent type which may or may not be a pointer, /// return an invalid type. QualType getDestroyedType() const; - + SourceRange getSourceRange() const { return SourceRange(Loc, Argument->getLocEnd()); } @@ -1324,39 +1325,39 @@ public: friend class ASTStmtReader; }; -/// \brief Structure used to store the type being destroyed by a +/// \brief Structure used to store the type being destroyed by a /// pseudo-destructor expression. class PseudoDestructorTypeStorage { - /// \brief Either the type source information or the name of the type, if + /// \brief Either the type source information or the name of the type, if /// it couldn't be resolved due to type-dependence. llvm::PointerUnion<TypeSourceInfo *, IdentifierInfo *> Type; - + /// \brief The starting source location of the pseudo-destructor type. SourceLocation Location; - + public: PseudoDestructorTypeStorage() { } - + PseudoDestructorTypeStorage(IdentifierInfo *II, SourceLocation Loc) : Type(II), Location(Loc) { } - + PseudoDestructorTypeStorage(TypeSourceInfo *Info); - - TypeSourceInfo *getTypeSourceInfo() const { - return Type.dyn_cast<TypeSourceInfo *>(); + + TypeSourceInfo *getTypeSourceInfo() const { + return Type.dyn_cast<TypeSourceInfo *>(); } - + IdentifierInfo *getIdentifier() const { return Type.dyn_cast<IdentifierInfo *>(); } - + SourceLocation getLocation() const { return Location; } }; - + /// \brief Represents a C++ pseudo-destructor (C++ [expr.pseudo]). /// /// A pseudo-destructor is an expression that looks like a member access to a -/// destructor of a scalar type, except that scalar types don't have +/// destructor of a scalar type, except that scalar types don't have /// destructors. For example: /// /// \code @@ -1367,7 +1368,7 @@ public: /// \endcode /// /// Pseudo-destructors typically occur when instantiating templates such as: -/// +/// /// \code /// template<typename T> /// void destroy(T* ptr) { @@ -1387,27 +1388,27 @@ class CXXPseudoDestructorExpr : public Expr { /// \brief The location of the '.' or '->' operator. SourceLocation OperatorLoc; - + /// \brief The nested-name-specifier that follows the operator, if present. NestedNameSpecifierLoc QualifierLoc; /// \brief The type that precedes the '::' in a qualified pseudo-destructor /// expression. TypeSourceInfo *ScopeType; - - /// \brief The location of the '::' in a qualified pseudo-destructor + + /// \brief The location of the '::' in a qualified pseudo-destructor /// expression. SourceLocation ColonColonLoc; - + /// \brief The location of the '~'. SourceLocation TildeLoc; - - /// \brief The type being destroyed, or its name if we were unable to + + /// \brief The type being destroyed, or its name if we were unable to /// resolve the name. PseudoDestructorTypeStorage DestroyedType; friend class ASTStmtReader; - + public: CXXPseudoDestructorExpr(ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, @@ -1431,12 +1432,12 @@ public: /// \brief Retrieves the nested-name-specifier that qualifies the type name, /// with source-location information. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - + /// \brief If the member name was qualified, retrieves the /// nested-name-specifier that precedes the member name. Otherwise, returns /// NULL. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } /// \brief Determine whether this pseudo-destructor expression was written @@ -1446,48 +1447,48 @@ public: /// \brief Retrieve the location of the '.' or '->' operator. SourceLocation getOperatorLoc() const { return OperatorLoc; } - /// \brief Retrieve the scope type in a qualified pseudo-destructor + /// \brief Retrieve the scope type in a qualified pseudo-destructor /// expression. /// /// Pseudo-destructor expressions can have extra qualification within them /// that is not part of the nested-name-specifier, e.g., \c p->T::~T(). /// Here, if the object type of the expression is (or may be) a scalar type, - /// \p T may also be a scalar type and, therefore, cannot be part of a + /// \p T may also be a scalar type and, therefore, cannot be part of a /// nested-name-specifier. It is stored as the "scope type" of the pseudo- /// destructor expression. TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; } - + /// \brief Retrieve the location of the '::' in a qualified pseudo-destructor /// expression. SourceLocation getColonColonLoc() const { return ColonColonLoc; } - + /// \brief Retrieve the location of the '~'. SourceLocation getTildeLoc() const { return TildeLoc; } - + /// \brief Retrieve the source location information for the type /// being destroyed. /// - /// This type-source information is available for non-dependent + /// This type-source information is available for non-dependent /// pseudo-destructor expressions and some dependent pseudo-destructor /// expressions. Returns NULL if we only have the identifier for a /// dependent pseudo-destructor expression. - TypeSourceInfo *getDestroyedTypeInfo() const { - return DestroyedType.getTypeSourceInfo(); + TypeSourceInfo *getDestroyedTypeInfo() const { + return DestroyedType.getTypeSourceInfo(); } - + /// \brief In a dependent pseudo-destructor expression for which we do not /// have full type information on the destroyed type, provides the name /// of the destroyed type. IdentifierInfo *getDestroyedTypeIdentifier() const { return DestroyedType.getIdentifier(); } - + /// \brief Retrieve the type being destroyed. QualType getDestroyedType() const; - + /// \brief Retrieve the starting location of the type being destroyed. - SourceLocation getDestroyedTypeLoc() const { - return DestroyedType.getLocation(); + SourceLocation getDestroyedTypeLoc() const { + return DestroyedType.getLocation(); } /// \brief Set the name of destroyed type for a dependent pseudo-destructor @@ -1533,7 +1534,7 @@ class UnaryTypeTraitExpr : public Expr { TypeSourceInfo *QueriedType; public: - UnaryTypeTraitExpr(SourceLocation loc, UnaryTypeTrait utt, + UnaryTypeTraitExpr(SourceLocation loc, UnaryTypeTrait utt, TypeSourceInfo *queried, bool value, SourceLocation rparen, QualType ty) : Expr(UnaryTypeTraitExprClass, ty, VK_RValue, OK_Ordinary, @@ -1553,7 +1554,7 @@ public: QualType getQueriedType() const { return QueriedType->getType(); } TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; } - + bool getValue() const { return Value; } static bool classof(const Stmt *T) { @@ -1591,10 +1592,10 @@ class BinaryTypeTraitExpr : public Expr { TypeSourceInfo *RhsType; public: - BinaryTypeTraitExpr(SourceLocation loc, BinaryTypeTrait btt, - TypeSourceInfo *lhsType, TypeSourceInfo *rhsType, + BinaryTypeTraitExpr(SourceLocation loc, BinaryTypeTrait btt, + TypeSourceInfo *lhsType, TypeSourceInfo *rhsType, bool value, SourceLocation rparen, QualType ty) - : Expr(BinaryTypeTraitExprClass, ty, VK_RValue, OK_Ordinary, false, + : Expr(BinaryTypeTraitExprClass, ty, VK_RValue, OK_Ordinary, false, lhsType->getType()->isDependentType() || rhsType->getType()->isDependentType(), (lhsType->getType()->isInstantiationDependentType() || @@ -1622,7 +1623,7 @@ public: TypeSourceInfo *getLhsTypeSourceInfo() const { return LhsType; } TypeSourceInfo *getRhsTypeSourceInfo() const { return RhsType; } - + bool getValue() const { assert(!isTypeDependent()); return Value; } static bool classof(const Stmt *T) { @@ -1679,7 +1680,9 @@ public: virtual ~ArrayTypeTraitExpr() { } - virtual SourceRange getSourceRange() const { return SourceRange(Loc, RParen); } + virtual SourceRange getSourceRange() const { + return SourceRange(Loc, RParen); + } ArrayTypeTrait getTrait() const { return static_cast<ArrayTypeTrait>(ATT); } @@ -1720,7 +1723,7 @@ class ExpressionTraitExpr : public Expr { Expr* QueriedExpression; public: - ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, + ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, Expr *queried, bool value, SourceLocation rparen, QualType resultType) : Expr(ExpressionTraitExprClass, resultType, VK_RValue, OK_Ordinary, @@ -1729,7 +1732,8 @@ public: queried->isTypeDependent(), queried->isInstantiationDependent(), queried->containsUnexpandedParameterPack()), - ET(et), Value(value), Loc(loc), RParen(rparen), QueriedExpression(queried) { } + ET(et), Value(value), Loc(loc), RParen(rparen), + QueriedExpression(queried) { } explicit ExpressionTraitExpr(EmptyShell Empty) : Expr(ExpressionTraitExprClass, Empty), ET(0), Value(false), @@ -1832,10 +1836,10 @@ public: typedef UnresolvedSetImpl::iterator decls_iterator; decls_iterator decls_begin() const { return UnresolvedSetIterator(Results); } - decls_iterator decls_end() const { + decls_iterator decls_end() const { return UnresolvedSetIterator(Results + NumResults); } - + /// Gets the number of declarations in the unresolved set. unsigned getNumDecls() const { return NumResults; } @@ -1849,11 +1853,11 @@ public: SourceLocation getNameLoc() const { return NameInfo.getLoc(); } /// Fetches the nested-name qualifier, if one was given. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } - /// Fetches the nested-name qualifier with source-location information, if + /// Fetches the nested-name qualifier with source-location information, if /// one was given. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } @@ -1916,15 +1920,15 @@ class UnresolvedLookupExpr : public OverloadExpr { /// against the qualified-lookup bits. CXXRecordDecl *NamingClass; - UnresolvedLookupExpr(ASTContext &C, + UnresolvedLookupExpr(ASTContext &C, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, - bool RequiresADL, bool Overloaded, + bool RequiresADL, bool Overloaded, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool StdIsAssociatedNamespace) - : OverloadExpr(UnresolvedLookupExprClass, C, QualifierLoc, NameInfo, + : OverloadExpr(UnresolvedLookupExprClass, C, QualifierLoc, NameInfo, TemplateArgs, Begin, End, false, false, false), RequiresADL(RequiresADL), StdIsAssociatedNamespace(StdIsAssociatedNamespace), @@ -1938,19 +1942,19 @@ class UnresolvedLookupExpr : public OverloadExpr { {} friend class ASTStmtReader; - + public: static UnresolvedLookupExpr *Create(ASTContext &C, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool ADL, bool Overloaded, - UnresolvedSetIterator Begin, + UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool StdIsAssociatedNamespace = false) { assert((ADL || !StdIsAssociatedNamespace) && "std considered associated namespace when not performing ADL"); - return new(C) UnresolvedLookupExpr(C, NamingClass, QualifierLoc, NameInfo, + return new(C) UnresolvedLookupExpr(C, NamingClass, QualifierLoc, NameInfo, ADL, Overloaded, 0, Begin, End, StdIsAssociatedNamespace); } @@ -1961,7 +1965,7 @@ public: const DeclarationNameInfo &NameInfo, bool ADL, const TemplateArgumentListInfo &Args, - UnresolvedSetIterator Begin, + UnresolvedSetIterator Begin, UnresolvedSetIterator End); static UnresolvedLookupExpr *CreateEmpty(ASTContext &C, @@ -2012,7 +2016,7 @@ public: void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { getExplicitTemplateArgs().copyInto(List); } - + SourceLocation getLAngleLoc() const { return getExplicitTemplateArgs().LAngleLoc; } @@ -2031,9 +2035,9 @@ public: SourceRange getSourceRange() const { SourceRange Range(getNameInfo().getSourceRange()); - if (getQualifierLoc()) + if (getQualifierLoc()) Range.setBegin(getQualifierLoc().getBeginLoc()); - if (hasExplicitTemplateArgs()) + if (hasExplicitTemplateArgs()) Range.setEnd(getRAngleLoc()); return Range; } @@ -2064,7 +2068,7 @@ class DependentScopeDeclRefExpr : public Expr { /// \brief The nested-name-specifier that qualifies this unresolved /// declaration name. NestedNameSpecifierLoc QualifierLoc; - + /// The name of the entity we will be referencing. DeclarationNameInfo NameInfo; @@ -2098,12 +2102,12 @@ public: /// \brief Retrieve the nested-name-specifier that qualifies the /// name, with source location information. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - - + + /// \brief Retrieve the nested-name-specifier that qualifies this /// declaration. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } /// Determines whether this lookup had explicit template arguments. @@ -2137,7 +2141,7 @@ public: void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { getExplicitTemplateArgs().copyInto(List); } - + SourceLocation getLAngleLoc() const { return getExplicitTemplateArgs().LAngleLoc; } @@ -2185,19 +2189,19 @@ class ExprWithCleanups : public Expr { ExprWithCleanups(ASTContext &C, Expr *SubExpr, CXXTemporary **Temps, unsigned NumTemps); - + public: ExprWithCleanups(EmptyShell Empty) : Expr(ExprWithCleanupsClass, Empty), SubExpr(0), Temps(0), NumTemps(0) {} - + static ExprWithCleanups *Create(ASTContext &C, Expr *SubExpr, - CXXTemporary **Temps, + CXXTemporary **Temps, unsigned NumTemps); unsigned getNumTemporaries() const { return NumTemps; } void setNumTemporaries(ASTContext &C, unsigned N); - + CXXTemporary *getTemporary(unsigned i) { assert(i < NumTemps && "Index out of range"); return Temps[i]; @@ -2214,7 +2218,7 @@ public: const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } void setSubExpr(Expr *E) { SubExpr = E; } - SourceRange getSourceRange() const { + SourceRange getSourceRange() const { return SubExpr->getSourceRange(); } @@ -2252,7 +2256,7 @@ public: class CXXUnresolvedConstructExpr : public Expr { /// \brief The type being constructed. TypeSourceInfo *Type; - + /// \brief The location of the left parentheses ('('). SourceLocation LParenLoc; @@ -2272,7 +2276,7 @@ class CXXUnresolvedConstructExpr : public Expr { : Expr(CXXUnresolvedConstructExprClass, Empty), Type(), NumArgs(NumArgs) { } friend class ASTStmtReader; - + public: static CXXUnresolvedConstructExpr *Create(ASTContext &C, TypeSourceInfo *Type, @@ -2288,10 +2292,10 @@ public: /// in the source code. QualType getTypeAsWritten() const { return Type->getType(); } - /// \brief Retrieve the type source information for the type being + /// \brief Retrieve the type source information for the type being /// constructed. TypeSourceInfo *getTypeSourceInfo() const { return Type; } - + /// \brief Retrieve the location of the left parentheses ('(') that /// precedes the argument list. SourceLocation getLParenLoc() const { return LParenLoc; } @@ -2333,7 +2337,7 @@ public: } SourceRange getSourceRange() const; - + static bool classof(const Stmt *T) { return T->getStmtClass() == CXXUnresolvedConstructExprClass; } @@ -2417,7 +2421,7 @@ public: const TemplateArgumentListInfo *TemplateArgs); static CXXDependentScopeMemberExpr * - CreateEmpty(ASTContext &C, bool HasExplicitTemplateArgs, + CreateEmpty(ASTContext &C, bool HasExplicitTemplateArgs, unsigned NumTemplateArgs); /// \brief True if this is an implicit access, i.e. one in which the @@ -2443,15 +2447,15 @@ public: /// \brief Retrieve the nested-name-specifier that qualifies the member /// name. - NestedNameSpecifier *getQualifier() const { - return QualifierLoc.getNestedNameSpecifier(); + NestedNameSpecifier *getQualifier() const { + return QualifierLoc.getNestedNameSpecifier(); } /// \brief Retrieve the nested-name-specifier that qualifies the member /// name, with source location information. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - - + + /// \brief Retrieve the first part of the nested-name-specifier that was /// found in the scope of the member access expression when the member access /// was initially parsed. @@ -2615,13 +2619,13 @@ class UnresolvedMemberExpr : public OverloadExpr { const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End); - + UnresolvedMemberExpr(EmptyShell Empty) : OverloadExpr(UnresolvedMemberExprClass, Empty), IsArrow(false), HasUnresolvedUsing(false), Base(0) { } friend class ASTStmtReader; - + public: static UnresolvedMemberExpr * Create(ASTContext &C, bool HasUnresolvedUsing, @@ -2796,7 +2800,7 @@ public: child_range children() { return child_range(&Operand, &Operand + 1); } }; -/// \brief Represents a C++0x pack expansion that produces a sequence of +/// \brief Represents a C++0x pack expansion that produces a sequence of /// expressions. /// /// A pack expansion expression contains a pattern (which itself is an @@ -2810,29 +2814,29 @@ public: /// \endcode /// /// Here, the argument to the function object \c f is a pack expansion whose -/// pattern is \c static_cast<Types&&>(args). When the \c forward function +/// pattern is \c static_cast<Types&&>(args). When the \c forward function /// template is instantiated, the pack expansion will instantiate to zero or /// or more function arguments to the function object \c f. class PackExpansionExpr : public Expr { SourceLocation EllipsisLoc; - + /// \brief The number of expansions that will be produced by this pack /// expansion expression, if known. /// /// When zero, the number of expansions is not known. Otherwise, this value /// is the number of expansions + 1. unsigned NumExpansions; - + Stmt *Pattern; - + friend class ASTStmtReader; friend class ASTStmtWriter; - + public: PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc, llvm::Optional<unsigned> NumExpansions) - : Expr(PackExpansionExprClass, T, Pattern->getValueKind(), - Pattern->getObjectKind(), /*TypeDependent=*/true, + : Expr(PackExpansionExprClass, T, Pattern->getValueKind(), + Pattern->getObjectKind(), /*TypeDependent=*/true, /*ValueDependent=*/true, /*InstantiationDependent=*/true, /*ContainsUnexpandedParameterPack=*/false), EllipsisLoc(EllipsisLoc), @@ -2840,7 +2844,7 @@ public: Pattern(Pattern) { } PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) { } - + /// \brief Retrieve the pattern of the pack expansion. Expr *getPattern() { return reinterpret_cast<Expr *>(Pattern); } @@ -2850,16 +2854,16 @@ public: /// \brief Retrieve the location of the ellipsis that describes this pack /// expansion. SourceLocation getEllipsisLoc() const { return EllipsisLoc; } - - /// \brief Determine the number of expansions that will be produced when + + /// \brief Determine the number of expansions that will be produced when /// this pack expansion is instantiated, if already known. llvm::Optional<unsigned> getNumExpansions() const { if (NumExpansions) return NumExpansions - 1; - + return llvm::Optional<unsigned>(); } - + SourceRange getSourceRange() const { return SourceRange(Pattern->getLocStart(), EllipsisLoc); } @@ -2868,13 +2872,13 @@ public: return T->getStmtClass() == PackExpansionExprClass; } static bool classof(const PackExpansionExpr *) { return true; } - + // Iterators child_range children() { return child_range(&Pattern, &Pattern + 1); } }; - + inline ASTTemplateArgumentListInfo &OverloadExpr::getExplicitTemplateArgs() { if (isa<UnresolvedLookupExpr>(this)) return cast<UnresolvedLookupExpr>(this)->getExplicitTemplateArgs(); @@ -2882,7 +2886,7 @@ inline ASTTemplateArgumentListInfo &OverloadExpr::getExplicitTemplateArgs() { return cast<UnresolvedMemberExpr>(this)->getExplicitTemplateArgs(); } -/// \brief Represents an expression that computes the length of a parameter +/// \brief Represents an expression that computes the length of a parameter /// pack. /// /// \code @@ -2894,30 +2898,30 @@ inline ASTTemplateArgumentListInfo &OverloadExpr::getExplicitTemplateArgs() { class SizeOfPackExpr : public Expr { /// \brief The location of the 'sizeof' keyword. SourceLocation OperatorLoc; - + /// \brief The location of the name of the parameter pack. SourceLocation PackLoc; - + /// \brief The location of the closing parenthesis. SourceLocation RParenLoc; - + /// \brief The length of the parameter pack, if known. /// /// When this expression is value-dependent, the length of the parameter pack /// is unknown. When this expression is not value-dependent, the length is /// known. unsigned Length; - + /// \brief The parameter pack itself. NamedDecl *Pack; - + friend class ASTStmtReader; friend class ASTStmtWriter; - + public: /// \brief Creates a value-dependent expression that computes the length of /// the given parameter pack. - SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, + SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc) : Expr(SizeOfPackExprClass, SizeType, VK_RValue, OK_Ordinary, /*TypeDependent=*/false, /*ValueDependent=*/true, @@ -2928,7 +2932,7 @@ public: /// \brief Creates an expression that computes the length of /// the given parameter pack, which is already known. - SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, + SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, unsigned Length) : Expr(SizeOfPackExprClass, SizeType, VK_RValue, OK_Ordinary, @@ -2940,38 +2944,38 @@ public: /// \brief Create an empty expression. SizeOfPackExpr(EmptyShell Empty) : Expr(SizeOfPackExprClass, Empty) { } - + /// \brief Determine the location of the 'sizeof' keyword. SourceLocation getOperatorLoc() const { return OperatorLoc; } /// \brief Determine the location of the parameter pack. SourceLocation getPackLoc() const { return PackLoc; } - + /// \brief Determine the location of the right parenthesis. SourceLocation getRParenLoc() const { return RParenLoc; } - + /// \brief Retrieve the parameter pack. NamedDecl *getPack() const { return Pack; } - + /// \brief Retrieve the length of the parameter pack. /// - /// This routine may only be invoked when the expression is not + /// This routine may only be invoked when the expression is not /// value-dependent. unsigned getPackLength() const { - assert(!isValueDependent() && + assert(!isValueDependent() && "Cannot get the length of a value-dependent pack size expression"); return Length; } - + SourceRange getSourceRange() const { return SourceRange(OperatorLoc, RParenLoc); } - + static bool classof(const Stmt *T) { return T->getStmtClass() == SizeOfPackExprClass; } static bool classof(const SizeOfPackExpr *) { return true; } - + // Iterators child_range children() { return child_range(); } }; @@ -2990,11 +2994,11 @@ class SubstNonTypeTemplateParmExpr : public Expr { friend class ASTReader; friend class ASTStmtReader; - explicit SubstNonTypeTemplateParmExpr(EmptyShell Empty) + explicit SubstNonTypeTemplateParmExpr(EmptyShell Empty) : Expr(SubstNonTypeTemplateParmExprClass, Empty) { } public: - SubstNonTypeTemplateParmExpr(QualType type, + SubstNonTypeTemplateParmExpr(QualType type, ExprValueKind valueKind, SourceLocation loc, NonTypeTemplateParmDecl *param, @@ -3009,16 +3013,16 @@ public: SourceRange getSourceRange() const { return NameLoc; } Expr *getReplacement() const { return cast<Expr>(Replacement); } - + NonTypeTemplateParmDecl *getParameter() const { return Param; } static bool classof(const Stmt *s) { return s->getStmtClass() == SubstNonTypeTemplateParmExprClass; } - static bool classof(const SubstNonTypeTemplateParmExpr *) { - return true; + static bool classof(const SubstNonTypeTemplateParmExpr *) { + return true; } - + // Iterators child_range children() { return child_range(&Replacement, &Replacement+1); } }; @@ -3028,7 +3032,7 @@ public: /// /// When a pack expansion in the source code contains multiple parameter packs /// and those parameter packs correspond to different levels of template -/// parameter lists, this node node is used to represent a non-type template +/// parameter lists, this node node is used to represent a non-type template /// parameter pack from an outer level, which has already had its argument pack /// substituted but that still lives within a pack expansion that itself /// could not be instantiated. When actually performing a substitution into @@ -3038,47 +3042,47 @@ public: class SubstNonTypeTemplateParmPackExpr : public Expr { /// \brief The non-type template parameter pack itself. NonTypeTemplateParmDecl *Param; - + /// \brief A pointer to the set of template arguments that this /// parameter pack is instantiated with. const TemplateArgument *Arguments; - + /// \brief The number of template arguments in \c Arguments. unsigned NumArguments; - + /// \brief The location of the non-type template parameter pack reference. SourceLocation NameLoc; - + friend class ASTReader; friend class ASTStmtReader; - explicit SubstNonTypeTemplateParmPackExpr(EmptyShell Empty) + explicit SubstNonTypeTemplateParmPackExpr(EmptyShell Empty) : Expr(SubstNonTypeTemplateParmPackExprClass, Empty) { } - + public: - SubstNonTypeTemplateParmPackExpr(QualType T, + SubstNonTypeTemplateParmPackExpr(QualType T, NonTypeTemplateParmDecl *Param, SourceLocation NameLoc, const TemplateArgument &ArgPack); - + /// \brief Retrieve the non-type template parameter pack being substituted. NonTypeTemplateParmDecl *getParameterPack() const { return Param; } /// \brief Retrieve the location of the parameter pack name. SourceLocation getParameterPackLocation() const { return NameLoc; } - + /// \brief Retrieve the template argument pack containing the substituted /// template arguments. TemplateArgument getArgumentPack() const; SourceRange getSourceRange() const { return NameLoc; } - + static bool classof(const Stmt *T) { return T->getStmtClass() == SubstNonTypeTemplateParmPackExprClass; } - static bool classof(const SubstNonTypeTemplateParmPackExpr *) { - return true; + static bool classof(const SubstNonTypeTemplateParmPackExpr *) { + return true; } - + // Iterators child_range children() { return child_range(); } }; @@ -3103,12 +3107,12 @@ class MaterializeTemporaryExpr : public Expr { /// \brief The temporary-generating expression whose value will be /// materialized. Stmt *Temporary; - + friend class ASTStmtReader; friend class ASTStmtWriter; - + public: - MaterializeTemporaryExpr(QualType T, Expr *Temporary, + MaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference) : Expr(MaterializeTemporaryExprClass, T, BoundToLvalueReference? VK_LValue : VK_XValue, OK_Ordinary, @@ -3116,33 +3120,33 @@ public: Temporary->isInstantiationDependent(), Temporary->containsUnexpandedParameterPack()), Temporary(Temporary) { } - - MaterializeTemporaryExpr(EmptyShell Empty) + + MaterializeTemporaryExpr(EmptyShell Empty) : Expr(MaterializeTemporaryExprClass, Empty) { } - + /// \brief Retrieve the temporary-generating subexpression whose value will /// be materialized into a glvalue. Expr *GetTemporaryExpr() const { return reinterpret_cast<Expr *>(Temporary); } - + /// \brief Determine whether this materialized temporary is bound to an /// lvalue reference; otherwise, it's bound to an rvalue reference. - bool isBoundToLvalueReference() const { + bool isBoundToLvalueReference() const { return getValueKind() == VK_LValue; } - + SourceRange getSourceRange() const { return Temporary->getSourceRange(); } - + static bool classof(const Stmt *T) { return T->getStmtClass() == MaterializeTemporaryExprClass; } - static bool classof(const MaterializeTemporaryExpr *) { - return true; + static bool classof(const MaterializeTemporaryExpr *) { + return true; } - + // Iterators child_range children() { return child_range(&Temporary, &Temporary + 1); } }; - + } // end namespace clang #endif diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h index c81c06e332b..e831113863e 100644 --- a/include/clang/AST/NestedNameSpecifier.h +++ b/include/clang/AST/NestedNameSpecifier.h @@ -95,7 +95,8 @@ private: Specifier(Other.Specifier) { } - NestedNameSpecifier &operator=(const NestedNameSpecifier &); // do not implement + NestedNameSpecifier &operator=(const NestedNameSpecifier &); // do not + // implement /// \brief Either find or insert the given nested name specifier /// mockup in the given context. @@ -221,12 +222,12 @@ class NestedNameSpecifierLoc { public: /// \brief Construct an empty nested-name-specifier. NestedNameSpecifierLoc() : Qualifier(0), Data(0) { } - + /// \brief Construct a nested-name-specifier with source location information - /// from + /// from NestedNameSpecifierLoc(NestedNameSpecifier *Qualifier, void *Data) : Qualifier(Qualifier), Data(Data) { } - + /// \brief Evalutes true when this nested-name-specifier location is /// non-empty. operator bool() const { return Qualifier; } @@ -239,7 +240,7 @@ public: /// \brief Retrieve the opaque pointer that refers to source-location data. void *getOpaqueData() const { return Data; } - + /// \brief Retrieve the source range covering the entirety of this /// nested-name-specifier. /// @@ -258,25 +259,25 @@ public: /// \brief Retrieve the location of the beginning of this /// nested-name-specifier. - SourceLocation getBeginLoc() const { + SourceLocation getBeginLoc() const { return getSourceRange().getBegin(); } /// \brief Retrieve the location of the end of this /// nested-name-specifier. - SourceLocation getEndLoc() const { + SourceLocation getEndLoc() const { return getSourceRange().getEnd(); } /// \brief Retrieve the location of the beginning of this /// component of the nested-name-specifier. - SourceLocation getLocalBeginLoc() const { + SourceLocation getLocalBeginLoc() const { return getLocalSourceRange().getBegin(); } - + /// \brief Retrieve the location of the end of this component of the /// nested-name-specifier. - SourceLocation getLocalEndLoc() const { + SourceLocation getLocalEndLoc() const { return getLocalSourceRange().getEnd(); } @@ -300,13 +301,13 @@ public: /// \brief Determines the data length for the entire /// nested-name-specifier. unsigned getDataLength() const { return getDataLength(Qualifier); } - - friend bool operator==(NestedNameSpecifierLoc X, + + friend bool operator==(NestedNameSpecifierLoc X, NestedNameSpecifierLoc Y) { return X.Qualifier == Y.Qualifier && X.Data == Y.Data; } - friend bool operator!=(NestedNameSpecifierLoc X, + friend bool operator!=(NestedNameSpecifierLoc X, NestedNameSpecifierLoc Y) { return !(X == Y); } @@ -316,39 +317,39 @@ public: /// with source-location information for all of the components of the /// nested-name-specifier. class NestedNameSpecifierLocBuilder { - /// \brief The current representation of the nested-name-specifier we're + /// \brief The current representation of the nested-name-specifier we're /// building. NestedNameSpecifier *Representation; - + /// \brief Buffer used to store source-location information for the /// nested-name-specifier. /// - /// Note that we explicitly manage the buffer (rather than using a + /// Note that we explicitly manage the buffer (rather than using a /// SmallVector) because \c Declarator expects it to be possible to memcpy() /// a \c CXXScopeSpec, and CXXScopeSpec uses a NestedNameSpecifierLocBuilder. char *Buffer; - + /// \brief The size of the buffer used to store source-location information /// for the nested-name-specifier. unsigned BufferSize; - - /// \brief The capacity of the buffer used to store source-location + + /// \brief The capacity of the buffer used to store source-location /// information for the nested-name-specifier. unsigned BufferCapacity; public: NestedNameSpecifierLocBuilder(); - + NestedNameSpecifierLocBuilder(const NestedNameSpecifierLocBuilder &Other); - + NestedNameSpecifierLocBuilder & operator=(const NestedNameSpecifierLocBuilder &Other); - + ~NestedNameSpecifierLocBuilder(); - + /// \brief Retrieve the representation of the nested-name-specifier. NestedNameSpecifier *getRepresentation() const { return Representation; } - + /// \brief Extend the current nested-name-specifier by another /// nested-name-specifier component of the form 'type::'. /// @@ -362,8 +363,8 @@ public: /// \param ColonColonLoc The location of the trailing '::'. void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc); - - /// \brief Extend the current nested-name-specifier by another + + /// \brief 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 @@ -376,8 +377,8 @@ public: /// \param ColonColonLoc The location of the trailing '::'. void Extend(ASTContext &Context, IdentifierInfo *Identifier, SourceLocation IdentifierLoc, SourceLocation ColonColonLoc); - - /// \brief Extend the current nested-name-specifier by another + + /// \brief 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 @@ -390,8 +391,8 @@ public: /// \param ColonColonLoc The location of the trailing '::'. void Extend(ASTContext &Context, NamespaceDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc); - - /// \brief Extend the current nested-name-specifier by another + + /// \brief 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 @@ -399,35 +400,35 @@ 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 '::'. void Extend(ASTContext &Context, NamespaceAliasDecl *Alias, SourceLocation AliasLoc, SourceLocation ColonColonLoc); - + /// \brief Turn this (empty) nested-name-specifier into the global /// nested-name-specifier '::'. void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc); - + /// \brief Make a new nested-name-specifier from incomplete source-location /// information. /// /// 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); - - /// \brief Adopt an existing nested-name-specifier (with source-range + + /// \brief Adopt an existing nested-name-specifier (with source-range /// information). void Adopt(NestedNameSpecifierLoc Other); - + /// \brief Retrieve the source range covered by this nested-name-specifier. SourceRange getSourceRange() const { return NestedNameSpecifierLoc(Representation, Buffer).getSourceRange(); } - + /// \brief Retrieve a nested-name-specifier with location information, /// copied into the given AST context. /// @@ -449,7 +450,7 @@ public: Representation = 0; BufferSize = 0; } - + /// \brief Retrieve the underlying buffer. /// /// \returns A pair containing a pointer to the buffer of source-location @@ -459,9 +460,9 @@ public: return std::make_pair(Buffer, BufferSize); } }; - -/// Insertion operator for diagnostics. This allows sending NestedNameSpecifiers -/// into a diagnostic with <<. + +/// Insertion operator for diagnostics. This allows sending +/// NestedNameSpecifiers into a diagnostic with <<. inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, NestedNameSpecifier *NNS) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS), diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 409f83019ff..f553ec1f95a 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -147,7 +147,7 @@ public: /// \brief Return whether this visitor should recurse into the types of /// TypeLocs. bool shouldWalkTypesOfTypeLocs() const { return true; } - + /// \brief Recursively visit a statement or expression, by /// dispatching to Traverse*() based on the argument's dynamic type. /// @@ -181,7 +181,7 @@ public: /// \returns false if the visitation was terminated early, true otherwise. bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS); - /// \brief Recursively visit a C++ nested-name-specifier with location + /// \brief Recursively visit a C++ nested-name-specifier with location /// information. /// /// \returns false if the visitation was terminated early, true otherwise. @@ -191,7 +191,7 @@ public: /// /// \returns false if the visitation was terminated early, true otherwise. bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo); - + /// \brief Recursively visit a template name and dispatch to the /// appropriate method. /// @@ -530,23 +530,23 @@ bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifierLoc( NestedNameSpecifierLoc NNS) { if (!NNS) return true; - + if (NestedNameSpecifierLoc Prefix = NNS.getPrefix()) TRY_TO(TraverseNestedNameSpecifierLoc(Prefix)); - + switch (NNS.getNestedNameSpecifier()->getKind()) { case NestedNameSpecifier::Identifier: case NestedNameSpecifier::Namespace: case NestedNameSpecifier::NamespaceAlias: case NestedNameSpecifier::Global: return true; - + case NestedNameSpecifier::TypeSpec: case NestedNameSpecifier::TypeSpecWithTemplate: TRY_TO(TraverseTypeLoc(NNS.getTypeLoc())); break; } - + return true; } @@ -559,9 +559,9 @@ bool RecursiveASTVisitor<Derived>::TraverseDeclarationNameInfo( case DeclarationName::CXXConversionFunctionName: if (TypeSourceInfo *TSInfo = NameInfo.getNamedTypeInfo()) TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc())); - + break; - + case DeclarationName::Identifier: case DeclarationName::ObjCZeroArgSelector: case DeclarationName::ObjCOneArgSelector: @@ -571,7 +571,7 @@ bool RecursiveASTVisitor<Derived>::TraverseDeclarationNameInfo( case DeclarationName::CXXUsingDirective: break; } - + return true; } @@ -630,7 +630,7 @@ bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLoc( // FIXME: how can TSI ever be NULL? if (TypeSourceInfo *TSI = ArgLoc.getTypeSourceInfo()) return getDerived().TraverseTypeLoc(TSI->getTypeLoc()); - else + else return getDerived().TraverseType(Arg.getAsType()); } @@ -669,7 +669,7 @@ bool RecursiveASTVisitor<Derived>::TraverseConstructorInitializer( CXXCtorInitializer *Init) { if (TypeSourceInfo *TInfo = Init->getTypeSourceInfo()) TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc())); - + if (Init->isWritten()) TRY_TO(TraverseStmt(Init->getInit())); return true; @@ -854,8 +854,8 @@ DEF_TRAVERSE_TYPE(AtomicType, { // ----------------- TypeLoc traversal ----------------- // This macro makes available a variable TL, the passed-in TypeLoc. -// If requested, it calls WalkUpFrom* for the Type in the given TypeLoc, -// in addition to WalkUpFrom* for the TypeLoc itself, such that existing +// If requested, it calls WalkUpFrom* for the Type in the given TypeLoc, +// in addition to WalkUpFrom* for the TypeLoc itself, such that existing // clients that override the WalkUpFrom*Type() and/or Visit*Type() methods // continue to work. #define DEF_TRAVERSE_TYPELOC(TYPE, CODE) \ @@ -1054,7 +1054,7 @@ DEF_TRAVERSE_TYPELOC(DependentTemplateSpecializationType, { if (TL.getQualifierLoc()) { TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc())); } - + for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) { TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I))); } @@ -1196,8 +1196,8 @@ DEF_TRAVERSE_DECL(NamespaceAliasDecl, { DEF_TRAVERSE_DECL(LabelDecl, { // There is no code in a LabelDecl. }) - - + + DEF_TRAVERSE_DECL(NamespaceDecl, { // Code in an unnamed namespace shows up automatically in // decls_begin()/decls_end(). Thus we don't need to recurse on @@ -1345,7 +1345,8 @@ template<typename Derived> bool RecursiveASTVisitor<Derived>::TraverseFunctionInstantiations( FunctionTemplateDecl* D) { FunctionTemplateDecl::spec_iterator end = D->spec_end(); - for (FunctionTemplateDecl::spec_iterator it = D->spec_begin(); it != end; ++it) { + for (FunctionTemplateDecl::spec_iterator it = D->spec_begin(); it != end; + ++it) { FunctionDecl* FD = *it; switch (FD->getTemplateSpecializationKind()) { case TSK_ImplicitInstantiation: @@ -1770,7 +1771,7 @@ DEF_TRAVERSE_STMT(ObjCAtTryStmt, { }) DEF_TRAVERSE_STMT(ObjCForCollectionStmt, { }) DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStmt, { }) DEF_TRAVERSE_STMT(CXXForRangeStmt, { }) -DEF_TRAVERSE_STMT(MSDependentExistsStmt, { +DEF_TRAVERSE_STMT(MSDependentExistsStmt, { TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc())); TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo())); }) @@ -1986,7 +1987,7 @@ DEF_TRAVERSE_STMT(CXXDefaultArgExpr, { }) DEF_TRAVERSE_STMT(CXXDeleteExpr, { }) DEF_TRAVERSE_STMT(ExprWithCleanups, { }) DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, { }) -DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, { +DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, { TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc())); if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo()) TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc())); @@ -2018,15 +2019,15 @@ DEF_TRAVERSE_STMT(StmtExpr, { }) DEF_TRAVERSE_STMT(UnresolvedLookupExpr, { TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc())); if (S->hasExplicitTemplateArgs()) { - TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(), + TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(), S->getNumTemplateArgs())); } }) - + DEF_TRAVERSE_STMT(UnresolvedMemberExpr, { TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc())); if (S->hasExplicitTemplateArgs()) { - TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(), + TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(), S->getNumTemplateArgs())); } }) @@ -2061,7 +2062,7 @@ DEF_TRAVERSE_STMT(FloatingLiteral, { }) DEF_TRAVERSE_STMT(ImaginaryLiteral, { }) DEF_TRAVERSE_STMT(StringLiteral, { }) DEF_TRAVERSE_STMT(ObjCStringLiteral, { }) - + // Traverse OpenCL: AsType, Convert. DEF_TRAVERSE_STMT(AsTypeExpr, { }) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 83836b717b2..3dc8a41714f 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -39,11 +39,11 @@ namespace clang { class StringLiteral; class SwitchStmt; - //===----------------------------------------------------------------------===// + //===--------------------------------------------------------------------===// // ExprIterator - Iterators for iterating over Stmt* arrays that contain // only Expr*. This is needed because AST nodes use Stmt* arrays to store // references to children (to be compatible with StmtIterator). - //===----------------------------------------------------------------------===// + //===--------------------------------------------------------------------===// class Stmt; class Expr; @@ -261,7 +261,7 @@ public: if (Stmt::CollectingStats()) Stmt::addStmtClass(SC); } - StmtClass getStmtClass() const { + StmtClass getStmtClass() const { return static_cast<StmtClass>(StmtBits.sClass); } const char *getStmtClassName() const; @@ -497,7 +497,7 @@ public: body_iterator body_begin() { return Body; } body_iterator body_end() { return Body + size(); } Stmt *body_back() { return !body_empty() ? Body[size()-1] : 0; } - + void setLastStmt(Stmt *S) { assert(!body_empty() && "setLastStmt"); Body[size()-1] = S; @@ -545,7 +545,7 @@ public: child_range children() { return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts); } - + const_child_range children() const { return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts); } @@ -679,7 +679,7 @@ public: child_range children() { return child_range(&SubStmt, &SubStmt+1); } }; - + /// LabelStmt - Represents a label, which has a substatement. For example: /// foo: return; /// @@ -724,11 +724,11 @@ class IfStmt : public Stmt { SourceLocation IfLoc; SourceLocation ElseLoc; - + public: - IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond, + IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0); - + /// \brief Build an empty if/then/else statement explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { } @@ -742,13 +742,13 @@ public: /// \endcode VarDecl *getConditionVariable() const; void setConditionVariable(ASTContext &C, VarDecl *V); - + /// If this IfStmt has a condition variable, return the faux DeclStmt /// associated with the creation of that condition variable. const DeclStmt *getConditionVariableDeclStmt() const { return reinterpret_cast<DeclStmt*>(SubExprs[VAR]); } - + const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);} void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); } const Stmt *getThen() const { return SubExprs[THEN]; } @@ -815,7 +815,7 @@ public: /// \endcode VarDecl *getConditionVariable() const; void setConditionVariable(ASTContext &C, VarDecl *V); - + /// If this SwitchStmt has a condition variable, return the faux DeclStmt /// associated with the creation of that condition variable. const DeclStmt *getConditionVariableDeclStmt() const { @@ -846,7 +846,8 @@ public: SwitchLoc = SL; } void addSwitchCase(SwitchCase *SC) { - assert(!SC->getNextSwitchCase() && "case/default already added to a switch"); + assert(!SC->getNextSwitchCase() + && "case/default already added to a switch"); SC->setNextSwitchCase(FirstCase); FirstCase = SC; } @@ -885,7 +886,7 @@ class WhileStmt : public Stmt { Stmt* SubExprs[END_EXPR]; SourceLocation WhileLoc; public: - WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, + WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL); /// \brief Build an empty while statement. @@ -993,14 +994,14 @@ class ForStmt : public Stmt { SourceLocation LParenLoc, RParenLoc; public: - ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, + ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP); /// \brief Build an empty for statement. explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { } Stmt *getInit() { return SubExprs[INIT]; } - + /// \brief Retrieve the variable declared in this "for" statement, if any. /// /// In the following example, "y" is the condition variable. @@ -1011,7 +1012,7 @@ public: /// \endcode VarDecl *getConditionVariable() const; void setConditionVariable(ASTContext &C, VarDecl *V); - + /// If this ForStmt has a condition variable, return the faux DeclStmt /// associated with the creation of that condition variable. const DeclStmt *getConditionVariableDeclStmt() const { @@ -1196,7 +1197,7 @@ class ReturnStmt : public Stmt { Stmt *RetExpr; SourceLocation RetLoc; const VarDecl *NRVOCandidate; - + public: ReturnStmt(SourceLocation RL) : Stmt(ReturnStmtClass), RetExpr(0), RetLoc(RL), NRVOCandidate(0) { } @@ -1222,7 +1223,7 @@ public: /// also marked as an NRVO object. const VarDecl *getNRVOCandidate() const { return NRVOCandidate; } void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; } - + SourceRange getSourceRange() const; static bool classof(const Stmt *T) { @@ -1256,16 +1257,16 @@ class AsmStmt : public Stmt { StringLiteral **Constraints; Stmt **Exprs; StringLiteral **Clobbers; - + public: - AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, + AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, bool msasm, unsigned numoutputs, unsigned numinputs, IdentifierInfo **names, StringLiteral **constraints, Expr **exprs, StringLiteral *asmstr, unsigned numclobbers, StringLiteral **clobbers, SourceLocation rparenloc); /// \brief Build an empty inline-assembly statement. - explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty), + explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty), Names(0), Constraints(0), Exprs(0), Clobbers(0) { } SourceLocation getAsmLoc() const { return AsmLoc; } @@ -1347,7 +1348,7 @@ public: StringRef getOutputName(unsigned i) const { if (IdentifierInfo *II = getOutputIdentifier(i)) return II->getName(); - + return StringRef(); } @@ -1408,7 +1409,7 @@ public: Expr *getInputExpr(unsigned i); void setInputExpr(unsigned i, Expr *E); - + const Expr *getInputExpr(unsigned i) const { return const_cast<AsmStmt*>(this)->getInputExpr(i); } @@ -1418,7 +1419,7 @@ public: StringLiteral **Constraints, Stmt **Exprs, unsigned NumOutputs, - unsigned NumInputs, + unsigned NumInputs, StringLiteral **Clobbers, unsigned NumClobbers); @@ -1511,8 +1512,13 @@ public: SourceLocation getExceptLoc() const { return Loc; } SourceLocation getEndLoc() const { return getBlock()->getLocEnd(); } - Expr *getFilterExpr() const { return reinterpret_cast<Expr*>(Children[FILTER_EXPR]); } - CompoundStmt *getBlock() const { return llvm::cast<CompoundStmt>(Children[BLOCK]); } + Expr *getFilterExpr() const { + return reinterpret_cast<Expr*>(Children[FILTER_EXPR]); + } + + CompoundStmt *getBlock() const { + return llvm::cast<CompoundStmt>(Children[BLOCK]); + } child_range children() { return child_range(Children,Children+2); @@ -1594,7 +1600,11 @@ public: SourceLocation getEndLoc() const { return Children[HANDLER]->getLocEnd(); } bool getIsCXXTry() const { return IsCXXTry; } - CompoundStmt* getTryBlock() const { return llvm::cast<CompoundStmt>(Children[TRY]); } + + CompoundStmt* getTryBlock() const { + return llvm::cast<CompoundStmt>(Children[TRY]); + } + Stmt *getHandler() const { return Children[HANDLER]; } /// Returns 0 if not defined @@ -1611,7 +1621,7 @@ public: static bool classof(SEHTryStmt *) { return true; } }; - + } // end namespace clang #endif diff --git a/include/clang/AST/StmtCXX.h b/include/clang/AST/StmtCXX.h index 056a0a393ca..8c723140809 100644 --- a/include/clang/AST/StmtCXX.h +++ b/include/clang/AST/StmtCXX.h @@ -148,7 +148,9 @@ public: DeclStmt *getRangeStmt() { return cast<DeclStmt>(SubExprs[RANGE]); } - DeclStmt *getBeginEndStmt() { return cast_or_null<DeclStmt>(SubExprs[BEGINEND]); } + DeclStmt *getBeginEndStmt() { + return cast_or_null<DeclStmt>(SubExprs[BEGINEND]); + } Expr *getCond() { return cast_or_null<Expr>(SubExprs[COND]); } Expr *getInc() { return cast_or_null<Expr>(SubExprs[INC]); } DeclStmt *getLoopVarStmt() { return cast<DeclStmt>(SubExprs[LOOPVAR]); } @@ -209,10 +211,10 @@ public: /// example: /// /// \code -/// template<typename T> +/// template<typename T> /// void call_foo(T &t) { /// __if_exists (T::foo) { -/// t.foo(); // okay: only called when T::foo exists. +/// t.foo(); // okay: only called when T::foo exists. /// } /// } /// \endcode @@ -234,56 +236,56 @@ class MSDependentExistsStmt : public Stmt { NestedNameSpecifierLoc QualifierLoc; DeclarationNameInfo NameInfo; Stmt *SubStmt; - + friend class ASTReader; friend class ASTStmtReader; - + public: - MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, + MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, CompoundStmt *SubStmt) : Stmt(MSDependentExistsStmtClass), - KeywordLoc(KeywordLoc), IsIfExists(IsIfExists), + KeywordLoc(KeywordLoc), IsIfExists(IsIfExists), QualifierLoc(QualifierLoc), NameInfo(NameInfo), SubStmt(reinterpret_cast<Stmt *>(SubStmt)) { } - - /// \brief Retrieve the location of the __if_exists or __if_not_exists + + /// \brief Retrieve the location of the __if_exists or __if_not_exists /// keyword. SourceLocation getKeywordLoc() const { return KeywordLoc; } - + /// \brief Determine whether this is an __if_exists statement. bool isIfExists() const { return IsIfExists; } /// \brief Determine whether this is an __if_exists statement. bool isIfNotExists() const { return !IsIfExists; } - + /// \brief Retrieve the nested-name-specifier that qualifies this name, if /// any. NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } - + /// \brief Retrieve the name of the entity we're testing for, along with /// location information DeclarationNameInfo getNameInfo() const { return NameInfo; } - + /// \brief Retrieve the compound statement that will be included in the /// program only if the existence of the symbol matches the initial keyword. - CompoundStmt *getSubStmt() const { - return reinterpret_cast<CompoundStmt *>(SubStmt); + CompoundStmt *getSubStmt() const { + return reinterpret_cast<CompoundStmt *>(SubStmt); } - + SourceRange getSourceRange() const { return SourceRange(KeywordLoc, SubStmt->getLocEnd()); } - + child_range children() { return child_range(&SubStmt, &SubStmt+1); } - + static bool classof(const Stmt *T) { return T->getStmtClass() == MSDependentExistsStmtClass; } - + static bool classof(MSDependentExistsStmt *) { return true; } }; diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 725ccc8eea8..dfa594db1e5 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -95,7 +95,7 @@ namespace clang { class ExtQualsTypeCommonBase; struct PrintingPolicy; - template <typename> class CanQual; + template <typename> class CanQual; typedef CanQual<Type> CanQualType; // Provide forward declarations for all of the *Type classes @@ -266,7 +266,7 @@ public: ObjCLifetime lifetime = getObjCLifetime(); return (lifetime == OCL_Strong || lifetime == OCL_Weak); } - + bool hasAddressSpace() const { return Mask & AddressSpaceMask; } unsigned getAddressSpace() const { return Mask >> AddressSpaceShift; } void setAddressSpace(unsigned space) { @@ -346,7 +346,7 @@ public: /// Generally this answers the question of whether an object with the other /// qualifiers can be safely used as an object with these qualifiers. bool compatiblyIncludes(Qualifiers other) const { - return + return // Address spaces must match exactly. getAddressSpace() == other.getAddressSpace() && // ObjC GC qualifiers can match, be added, or be removed, but can't be @@ -363,24 +363,24 @@ public: /// qualifiers from the narrow perspective of Objective-C ARC lifetime. /// /// One set of Objective-C lifetime qualifiers compatibly includes the other - /// if the lifetime qualifiers match, or if both are non-__weak and the + /// if the lifetime qualifiers match, or if both are non-__weak and the /// including set also contains the 'const' qualifier. bool compatiblyIncludesObjCLifetime(Qualifiers other) const { if (getObjCLifetime() == other.getObjCLifetime()) return true; - + if (getObjCLifetime() == OCL_Weak || other.getObjCLifetime() == OCL_Weak) return false; - + return hasConst(); } - + bool isSupersetOf(Qualifiers Other) const; /// \brief Determine whether this set of qualifiers is a strict superset of /// another set of qualifiers, not considering qualifier compatibility. bool isStrictSupersetOf(Qualifiers Other) const; - + bool operator==(Qualifiers Other) const { return Mask == Other.Mask; } bool operator!=(Qualifiers Other) const { return Mask != Other.Mask; } @@ -397,7 +397,7 @@ public: L += R; return L; } - + Qualifiers &operator-=(Qualifiers R) { Mask = Mask & ~(R.Mask); return *this; @@ -408,7 +408,7 @@ public: L -= R; return L; } - + std::string getAsString() const; std::string getAsString(const PrintingPolicy &Policy) const { std::string Buffer; @@ -501,7 +501,7 @@ public: /// This function requires that the type not be NULL. If the type might be /// NULL, use the (slightly less efficient) \c getTypePtrOrNull(). const Type *getTypePtr() const; - + const Type *getTypePtrOrNull() const; /// Retrieves a pointer to the name of the base type. @@ -534,27 +534,27 @@ public: return Value.getPointer().isNull(); } - /// \brief Determine whether this particular QualType instance has the + /// \brief Determine whether this particular QualType instance has the /// "const" qualifier set, without looking through typedefs that may have /// added "const" at a different level. bool isLocalConstQualified() const { return (getLocalFastQualifiers() & Qualifiers::Const); } - + /// \brief Determine whether this type is const-qualified. bool isConstQualified() const; - - /// \brief Determine whether this particular QualType instance has the + + /// \brief Determine whether this particular QualType instance has the /// "restrict" qualifier set, without looking through typedefs that may have /// added "restrict" at a different level. bool isLocalRestrictQualified() const { return (getLocalFastQualifiers() & Qualifiers::Restrict); } - + /// \brief Determine whether this type is restrict-qualified. bool isRestrictQualified() const; - - /// \brief Determine whether this particular QualType instance has the + + /// \brief Determine whether this particular QualType instance has the /// "volatile" qualifier set, without looking through typedefs that may have /// added "volatile" at a different level. bool isLocalVolatileQualified() const { @@ -563,9 +563,9 @@ public: /// \brief Determine whether this type is volatile-qualified. bool isVolatileQualified() const; - + /// \brief Determine whether this particular QualType instance has any - /// qualifiers, without looking through any typedefs that might add + /// qualifiers, without looking through any typedefs that might add /// qualifiers at a different level. bool hasLocalQualifiers() const { return getLocalFastQualifiers() || hasLocalNonFastQualifiers(); @@ -573,7 +573,7 @@ public: /// \brief Determine whether this type has any qualifiers. bool hasQualifiers() const; - + /// \brief Determine whether this particular QualType instance has any /// "non-fast" qualifiers, e.g., those that are stored in an ExtQualType /// instance. @@ -588,15 +588,15 @@ public: /// \brief Retrieve the set of qualifiers applied to this type. Qualifiers getQualifiers() const; - - /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers + + /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers /// local to this particular QualType instance, not including any qualifiers /// acquired through typedefs or other sugar. unsigned getLocalCVRQualifiers() const { return getLocalFastQualifiers(); } - /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers + /// \brief Retrieve the set of CVR (const-volatile-restrict) qualifiers /// applied to this type. unsigned getCVRQualifiers() const; @@ -612,10 +612,10 @@ public: /// compilation's language. /// (C++0x [basic.types]p9) bool isCXX11PODType(ASTContext &Context) const; - + /// isTrivialType - Return true if this is a trivial type /// (C++0x [basic.types]p9) - bool isTrivialType(ASTContext &Context) const; + bool isTrivialType(ASTContext &Context) const; /// isTriviallyCopyableType - Return true if this is a trivially /// copyable type (C++0x [basic.types]p9) @@ -624,7 +624,7 @@ public: // Don't promise in the API that anything besides 'const' can be // easily added. - /// addConst - add the specified type qualifier to this QualType. + /// addConst - add the specified type qualifier to this QualType. void addConst() { addFastQualifiers(Qualifiers::Const); } @@ -632,7 +632,7 @@ public: return withFastQualifiers(Qualifiers::Const); } - /// addVolatile - add the specified type qualifier to this QualType. + /// addVolatile - add the specified type qualifier to this QualType. void addVolatile() { addFastQualifiers(Qualifiers::Volatile); } @@ -719,7 +719,7 @@ public: /// type. To strip qualifiers even from within an array type, use /// ASTContext::getUnqualifiedArrayType. inline SplitQualType getSplitUnqualifiedType() const; - + /// \brief Determine whether this type is more qualified than the other /// given type, requiring exact equality for non-CVR qualifiers. bool isMoreQualifiedThan(QualType Other) const; @@ -727,19 +727,19 @@ public: /// \brief Determine whether this type is at least as qualified as the other /// given type, requiring exact equality for non-CVR qualifiers. bool isAtLeastAsQualifiedAs(QualType Other) const; - + QualType getNonReferenceType() const; /// \brief Determine the type of a (typically non-lvalue) expression with the /// specified result type. - /// + /// /// This routine should be used for expressions for which the return type is /// explicitly specified (e.g., in a cast or call) and isn't necessarily - /// an lvalue. It removes a top-level reference (since there are no + /// an lvalue. It removes a top-level reference (since there are no /// expressions of reference type) and deletes top-level cvr-qualifiers /// from non-class types (in C++) or all types (in C). QualType getNonLValueExprType(ASTContext &Context) const; - + /// getDesugaredType - Return the specified type with any "sugar" removed from /// the type. This takes off typedefs, typeof's etc. If the outer level of /// the type is already concrete, it returns it unmodified. This is similar @@ -757,12 +757,12 @@ public: } /// \brief Return the specified type with one level of "sugar" removed from - /// the type. + /// the type. /// /// This routine takes off the first typedef, typeof, etc. If the outer level /// of the type is already concrete, it returns it unmodified. QualType getSingleStepDesugaredType(const ASTContext &Context) const; - + /// IgnoreParens - Returns the specified type after dropping any /// outer-level parentheses. QualType IgnoreParens() const { @@ -855,7 +855,7 @@ public: return isDestructedTypeImpl(*this); } - /// \brief Determine whether expressions of the given type are forbidden + /// \brief Determine whether expressions of the given type are forbidden /// from being lvalues in C. /// /// The expression types that are forbidden to be lvalues are: @@ -870,7 +870,7 @@ public: /// \brief Determine whether this type has trivial copy/move-assignment /// semantics. bool hasTrivialAssignment(ASTContext &Context, bool Copying) const; - + private: // These methods are implemented in a separate translation unit; // "static"-ize them to avoid creating temporary QualTypes in the @@ -915,7 +915,7 @@ public: namespace clang { -/// \brief Base class that is common to both the \c ExtQuals and \c Type +/// \brief Base class that is common to both the \c ExtQuals and \c Type /// classes, which allows \c QualType to access the common fields between the /// two. /// @@ -926,7 +926,7 @@ class ExtQualsTypeCommonBase { /// \brief The "base" type of an extended qualifiers type (\c ExtQuals) or /// a self-referential pointer (for \c Type). /// - /// This pointer allows an efficient mapping from a QualType to its + /// This pointer allows an efficient mapping from a QualType to its /// underlying type pointer. const Type *const BaseType; @@ -937,14 +937,14 @@ class ExtQualsTypeCommonBase { friend class Type; friend class ExtQuals; }; - + /// ExtQuals - We can encode up to four bits in the low bits of a /// type pointer, but there are many more type qualifiers that we want /// to be able to apply to an arbitrary type. Therefore we have this /// struct, intended to be heap-allocated and used by QualType to /// store qualifiers. /// -/// The current design tags the 'const', 'restrict', and 'volatile' qualifiers +/// The current design tags the 'const', 'restrict', and 'volatile' qualifiers /// in three low bits on the QualType pointer; a fourth bit records whether /// the pointer is an ExtQuals node. The extended qualifiers (address spaces, /// Objective-C GC attributes) are much more rare. @@ -969,7 +969,7 @@ class ExtQuals : public ExtQualsTypeCommonBase, public llvm::FoldingSetNode { ExtQuals *this_() { return this; } public: - ExtQuals(const Type *baseType, QualType canon, Qualifiers quals) + ExtQuals(const Type *baseType, QualType canon, Qualifiers quals) : ExtQualsTypeCommonBase(baseType, canon.isNull() ? QualType(this_(), 0) : canon), Quals(quals) @@ -1008,8 +1008,8 @@ public: } }; -/// \brief The kind of C++0x ref-qualifier associated with a function type, -/// which determines whether a member function's "this" object can be an +/// \brief The kind of C++0x ref-qualifier associated with a function type, +/// which determines whether a member function's "this" object can be an /// lvalue, rvalue, or neither. enum RefQualifierKind { /// \brief No ref-qualifier was provided. @@ -1019,7 +1019,7 @@ enum RefQualifierKind { /// \brief An rvalue ref-qualifier was provided (\c &&). RQ_RValue }; - + /// Type - This is the base class of the type hierarchy. A central concept /// with types is that each type always has a canonical type. A canonical type /// is the type with any typedef names stripped out of it or the types it @@ -1071,29 +1071,29 @@ private: /// Note that this should stay at the end of the ivars for Type so that /// subclasses can pack their bitfields into the same word. unsigned Dependent : 1; - - /// \brief Whether this type somehow involves a template parameter, even + + /// \brief Whether this type somehow involves a template parameter, even /// if the resolution of the type does not depend on a template parameter. unsigned InstantiationDependent : 1; - + /// \brief Whether this type is a variably-modified type (C99 6.7.5). unsigned VariablyModified : 1; /// \brief Whether this type contains an unexpanded parameter pack /// (for C++0x variadic templates). unsigned ContainsUnexpandedParameterPack : 1; - + /// \brief Nonzero if the cache (i.e. the bitfields here starting /// with 'Cache') is valid. If so, then this is a /// LangOptions::VisibilityMode+1. mutable unsigned CacheValidAndVisibility : 2; - + /// \brief Linkage of this type. mutable unsigned CachedLinkage : 2; - /// \brief Whether this type involves and local or unnamed types. + /// \brief Whether this type involves and local or unnamed types. mutable unsigned CachedLocalOrUnnamed : 1; - + /// \brief FromAST - Whether this type comes from an AST file. mutable unsigned FromAST : 1; @@ -1162,7 +1162,7 @@ protected: /// C++ 8.3.5p4: The return type, the parameter type list and the /// cv-qualifier-seq, [...], are part of the function type. unsigned TypeQuals : 3; - + /// \brief The ref-qualifier associated with a \c FunctionProtoType. /// /// This is a value of type \c RefQualifierKind. @@ -1247,7 +1247,7 @@ protected: private: /// \brief Set whether this type comes from an AST file. - void setFromAST(bool V = true) const { + void setFromAST(bool V = true) const { TypeBits.FromAST = V; } @@ -1256,7 +1256,7 @@ private: protected: // silence VC++ warning C4355: 'this' : used in base member initializer list Type *this_() { return this; } - Type(TypeClass tc, QualType canon, bool Dependent, + Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack) : ExtQualsTypeCommonBase(this, @@ -1273,14 +1273,14 @@ protected: } friend class ASTContext; - void setDependent(bool D = true) { - TypeBits.Dependent = D; + void setDependent(bool D = true) { + TypeBits.Dependent = D; if (D) TypeBits.InstantiationDependent = true; } - void setInstantiationDependent(bool D = true) { + void setInstantiationDependent(bool D = true) { TypeBits.InstantiationDependent = D; } - void setVariablyModified(bool VM = true) { TypeBits.VariablyModified = VM; + void setVariablyModified(bool VM = true) { TypeBits.VariablyModified = VM; } void setContainsUnexpandedParameterPack(bool PP = true) { TypeBits.ContainsUnexpandedParameterPack = PP; @@ -1306,8 +1306,8 @@ public: /// }; /// \endcode /// - /// Note that this routine does not specify which - bool containsUnexpandedParameterPack() const { + /// Note that this routine does not specify which + bool containsUnexpandedParameterPack() const { return TypeBits.ContainsUnexpandedParameterPack; } @@ -1331,11 +1331,11 @@ public: bool isIncompleteOrObjectType() const { return !isFunctionType(); } - + /// \brief Determine whether this type is an object type. bool isObjectType() const { // C++ [basic.types]p8: - // An object type is a (possibly cv-qualified) type that is not a + // An object type is a (possibly cv-qualified) type that is not a // function type, not a reference type, and not a void type. return !isReferenceType() && !isFunctionType() && !isVoidType(); } @@ -1378,13 +1378,13 @@ public: bool isChar32Type() const; bool isAnyCharacterType() const; bool isIntegralType(ASTContext &Ctx) const; - + /// \brief Determine whether this type is an integral or enumeration type. bool isIntegralOrEnumerationType() const; /// \brief Determine whether this type is an integral or unscoped enumeration /// type. bool isIntegralOrUnscopedEnumerationType() const; - + /// Floating point categories. bool isRealFloatingType() const; // C99 6.2.5p10 (float, double, long double) /// isComplexType() does *not* include complex integers (a GCC extension). @@ -1479,32 +1479,32 @@ public: /// that its definition somehow depends on a template parameter /// (C++ [temp.dep.type]). bool isDependentType() const { return TypeBits.Dependent; } - + /// \brief Determine whether this type is an instantiation-dependent type, /// meaning that the type involves a template parameter (even if the /// definition does not actually depend on the type substituted for that /// template parameter). - bool isInstantiationDependentType() const { - return TypeBits.InstantiationDependent; + bool isInstantiationDependentType() const { + return TypeBits.InstantiationDependent; } - + /// \brief Whether this type is a variably-modified type (C99 6.7.5). bool isVariablyModifiedType() const { return TypeBits.VariablyModified; } /// \brief Whether this type involves a variable-length array type /// with a definite size. bool hasSizedVLAType() const; - + /// \brief Whether this type is or contains a local or unnamed type. bool hasUnnamedOrLocalType() const; - + bool isOverloadableType() const; /// \brief Determine wither this type is a C++ elaborated-type-specifier. bool isElaboratedTypeSpecifier() const; bool canDecayToPointerType() const; - + /// hasPointerRepresentation - Whether this type is represented /// natively as a pointer; this includes pointers, references, block /// pointers, and Objective-C interface, qualified id, and qualified @@ -1547,7 +1547,7 @@ public: const CXXRecordDecl *getCXXRecordDeclForPointerType() const; /// \brief Retrieves the CXXRecordDecl that this type refers to, either - /// because the type is a RecordType or because it is the injected-class-name + /// because the type is a RecordType or because it is the injected-class-name /// type of a class template or class template partial specialization. CXXRecordDecl *getAsCXXRecordDecl() const; @@ -1555,7 +1555,7 @@ public: /// an initializer of this type. This looks through declarators like pointer /// types, but not through decltype or typedefs. AutoType *getContainedAutoType() const; - + /// Member-template getAs<specific type>'. Look through sugar for /// an instance of <specific type>. This scheme will eventually /// replace the specific getAsXXXX methods above. @@ -1608,15 +1608,15 @@ public: bool isSignedIntegerType() const; /// isUnsignedIntegerType - Return true if this is an integer type that is - /// unsigned, according to C99 6.2.5p6 [which returns true for _Bool], + /// unsigned, according to C99 6.2.5p6 [which returns true for _Bool], /// or an enum decl which has an unsigned representation. bool isUnsignedIntegerType() const; - /// Determines whether this is an integer type that is signed or an + /// Determines whether this is an integer type that is signed or an /// enumeration types whose underlying type is a signed integer type. bool isSignedIntegerOrEnumerationType() const; - - /// Determines whether this is an integer type that is unsigned or an + + /// Determines whether this is an integer type that is unsigned or an /// enumeration types whose underlying type is a unsigned integer type. bool isUnsignedIntegerOrEnumerationType() const; @@ -1637,10 +1637,10 @@ public: /// \brief Determine the linkage and visibility of this type. std::pair<Linkage,Visibility> getLinkageAndVisibility() const; - + /// \brief Note that the linkage is no longer known. void ClearLinkageCache(); - + const char *getTypeClassName() const; QualType getCanonicalTypeInternal() const { @@ -1801,7 +1801,7 @@ class PointerType : public Type, public llvm::FoldingSetNode { Type(Pointer, CanonicalPtr, Pointee->isDependentType(), Pointee->isInstantiationDependentType(), Pointee->isVariablyModifiedType(), - Pointee->containsUnexpandedParameterPack()), + Pointee->containsUnexpandedParameterPack()), PointeeType(Pointee) { } friend class ASTContext; // ASTContext creates these. @@ -1838,7 +1838,7 @@ class BlockPointerType : public Type, public llvm::FoldingSetNode { PointeeType(Pointee) { } friend class ASTContext; // ASTContext creates these. - + public: // Get the pointee type. Pointee is required to always be a function type. @@ -1871,17 +1871,17 @@ protected: Type(tc, CanonicalRef, Referencee->isDependentType(), Referencee->isInstantiationDependentType(), Referencee->isVariablyModifiedType(), - Referencee->containsUnexpandedParameterPack()), - PointeeType(Referencee) + Referencee->containsUnexpandedParameterPack()), + PointeeType(Referencee) { ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue; ReferenceTypeBits.InnerRef = Referencee->isReferenceType(); } - + public: bool isSpelledAsLValue() const { return ReferenceTypeBits.SpelledAsLValue; } bool isInnerRef() const { return ReferenceTypeBits.InnerRef; } - + QualType getPointeeTypeAsWritten() const { return PointeeType; } QualType getPointeeType() const { // FIXME: this might strip inner qualifiers; okay? @@ -1954,15 +1954,15 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode { MemberPointerType(QualType Pointee, const Type *Cls, QualType CanonicalPtr) : Type(MemberPointer, CanonicalPtr, Cls->isDependentType() || Pointee->isDependentType(), - (Cls->isInstantiationDependentType() || + (Cls->isInstantiationDependentType() || Pointee->isInstantiationDependentType()), Pointee->isVariablyModifiedType(), - (Cls->containsUnexpandedParameterPack() || + (Cls->containsUnexpandedParameterPack() || Pointee->containsUnexpandedParameterPack())), PointeeType(Pointee), Class(Cls) { } friend class ASTContext; // ASTContext creates these. - + public: QualType getPointeeType() const { return PointeeType; } @@ -2069,7 +2069,7 @@ class ConstantArrayType : public ArrayType { protected: ConstantArrayType(TypeClass tc, QualType et, QualType can, const llvm::APInt &size, ArraySizeModifier sm, unsigned tq) - : ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()), + : ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()), Size(size) {} friend class ASTContext; // ASTContext creates these. public: @@ -2077,17 +2077,17 @@ public: bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } - + /// \brief Determine the number of bits required to address a member of // an array with the given element type and number of elements. static unsigned getNumAddressingBits(ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements); - + /// \brief Determine the maximum number of active bits that an array's size /// can require, which limits the maximum size of the array. static unsigned getMaxSizeBits(ASTContext &Context); - + void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, getElementType(), getSize(), getSizeModifier(), getIndexTypeCVRQualifiers()); @@ -2113,7 +2113,7 @@ class IncompleteArrayType : public ArrayType { IncompleteArrayType(QualType et, QualType can, ArraySizeModifier sm, unsigned tq) - : ArrayType(IncompleteArray, et, can, sm, tq, + : ArrayType(IncompleteArray, et, can, sm, tq, et->containsUnexpandedParameterPack()) {} friend class ASTContext; // ASTContext creates these. public: @@ -2165,7 +2165,7 @@ class VariableArrayType : public ArrayType { VariableArrayType(QualType et, QualType can, Expr *e, ArraySizeModifier sm, unsigned tq, SourceRange brackets) - : ArrayType(VariableArray, et, can, sm, tq, + : ArrayType(VariableArray, et, can, sm, tq, et->containsUnexpandedParameterPack()), SizeExpr((Stmt*) e), Brackets(brackets) {} friend class ASTContext; // ASTContext creates these. @@ -2321,12 +2321,12 @@ protected: VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind); - + VectorType(TypeClass tc, QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind); friend class ASTContext; // ASTContext creates these. - + public: QualType getElementType() const { return ElementType; } @@ -2492,7 +2492,7 @@ class FunctionType : public Type { bool getNoReturn() const { return Bits & NoReturnMask; } bool getProducesResult() const { return Bits & ProducesResultMask; } bool getHasRegParm() const { return (Bits >> RegParmOffset) != 0; } - unsigned getRegParm() const { + unsigned getRegParm() const { unsigned RegParm = Bits >> RegParmOffset; if (RegParm > 0) --RegParm; @@ -2544,10 +2544,10 @@ protected: unsigned typeQuals, RefQualifierKind RefQualifier, QualType Canonical, bool Dependent, bool InstantiationDependent, - bool VariablyModified, bool ContainsUnexpandedParameterPack, + bool VariablyModified, bool ContainsUnexpandedParameterPack, ExtInfo Info) - : Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified, - ContainsUnexpandedParameterPack), + : Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified, + ContainsUnexpandedParameterPack), ResultType(res) { FunctionTypeBits.ExtInfo = Info.Bits; FunctionTypeBits.Variadic = variadic; @@ -2556,7 +2556,7 @@ protected: } bool isVariadic() const { return FunctionTypeBits.Variadic; } unsigned getTypeQuals() const { return FunctionTypeBits.TypeQuals; } - + RefQualifierKind getRefQualifier() const { return static_cast<RefQualifierKind>(FunctionTypeBits.RefQualifier); } @@ -2573,7 +2573,7 @@ public: /// \brief Determine the type of an expression that calls a function of /// this type. - QualType getCallResultType(ASTContext &Context) const { + QualType getCallResultType(ASTContext &Context) const { return getResultType().getNonLValueExprType(Context); } @@ -2592,11 +2592,11 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { FunctionNoProtoType(QualType Result, QualType Canonical, ExtInfo Info) : FunctionType(FunctionNoProto, Result, false, 0, RQ_None, Canonical, /*Dependent=*/false, /*InstantiationDependent=*/false, - Result->isVariablyModifiedType(), + Result->isVariablyModifiedType(), /*ContainsUnexpandedParameterPack=*/false, Info) {} friend class ASTContext; // ASTContext creates these. - + public: // No additional state past what FunctionType provides. @@ -2646,7 +2646,7 @@ public: private: /// \brief Determine whether there are any argument types that /// contain an unexpanded parameter pack. - static bool containsAnyUnexpandedParameterPack(const QualType *ArgArray, + static bool containsAnyUnexpandedParameterPack(const QualType *ArgArray, unsigned numArgs) { for (unsigned Idx = 0; Idx < numArgs; ++Idx) if (ArgArray[Idx]->containsUnexpandedParameterPack()) @@ -2777,17 +2777,17 @@ public: /// /// A function template whose last parameter is a parameter pack can be /// called with an arbitrary number of arguments, much like a variadic - /// function. However, + /// function. However, bool isTemplateVariadic() const; - + unsigned getTypeQuals() const { return FunctionType::getTypeQuals(); } - + /// \brief Retrieve the ref-qualifier associated with this function type. RefQualifierKind getRefQualifier() const { return FunctionType::getRefQualifier(); } - + typedef const QualType *arg_type_iterator; arg_type_iterator arg_type_begin() const { return reinterpret_cast<const QualType *>(this+1); @@ -2838,7 +2838,7 @@ class UnresolvedUsingType : public Type { UnresolvedUsingTypenameDecl *Decl; UnresolvedUsingType(const UnresolvedUsingTypenameDecl *D) - : Type(UnresolvedUsing, QualType(), true, true, false, + : Type(UnresolvedUsing, QualType(), true, true, false, /*ContainsUnexpandedParameterPack=*/false), Decl(const_cast<UnresolvedUsingTypenameDecl*>(D)) {} friend class ASTContext; // ASTContext creates these. @@ -2868,9 +2868,9 @@ class TypedefType : public Type { TypedefNameDecl *Decl; protected: TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType can) - : Type(tc, can, can->isDependentType(), + : Type(tc, can, can->isDependentType(), can->isInstantiationDependentType(), - can->isVariablyModifiedType(), + can->isVariablyModifiedType(), /*ContainsUnexpandedParameterPack=*/false), Decl(const_cast<TypedefNameDecl*>(D)) { assert(!isa<TypedefType>(can) && "Invalid canonical type"); @@ -2933,10 +2933,10 @@ public: class TypeOfType : public Type { QualType TOType; TypeOfType(QualType T, QualType can) - : Type(TypeOf, can, T->isDependentType(), + : Type(TypeOf, can, T->isDependentType(), T->isInstantiationDependentType(), - T->isVariablyModifiedType(), - T->containsUnexpandedParameterPack()), + T->isVariablyModifiedType(), + T->containsUnexpandedParameterPack()), TOType(T) { assert(!isa<TypedefType>(can) && "Invalid canonical type"); } @@ -3026,7 +3026,7 @@ public: QualType getBaseType() const { return BaseType; } UTTKind getUTTKind() const { return UKind; } - + static bool classof(const Type *T) { return T->getTypeClass() == UnaryTransform; } @@ -3221,7 +3221,7 @@ class TemplateTypeParmType : public Type, public llvm::FoldingSetNode { /// Build the canonical type. TemplateTypeParmType(unsigned D, unsigned I, bool PP) - : Type(TemplateTypeParm, QualType(this, 0), + : Type(TemplateTypeParm, QualType(this, 0), /*Dependent=*/true, /*InstantiationDependent=*/true, /*VariablyModified=*/false, PP) { @@ -3326,7 +3326,7 @@ public: /// /// When a pack expansion in the source code contains multiple parameter packs /// and those parameter packs correspond to different levels of template -/// parameter lists, this type node is used to represent a template type +/// parameter lists, this type node is used to represent a template type /// parameter pack from an outer level, which has already had its argument pack /// substituted but that still lives within a pack expansion that itself /// could not be instantiated. When actually performing a substitution into @@ -3336,38 +3336,38 @@ public: class SubstTemplateTypeParmPackType : public Type, public llvm::FoldingSetNode { /// \brief The original type parameter. const TemplateTypeParmType *Replaced; - + /// \brief A pointer to the set of template arguments that this /// parameter pack is instantiated with. const TemplateArgument *Arguments; - + /// \brief The number of template arguments in \c Arguments. unsigned NumArguments; - - SubstTemplateTypeParmPackType(const TemplateTypeParmType *Param, + + SubstTemplateTypeParmPackType(const TemplateTypeParmType *Param, QualType Canon, const TemplateArgument &ArgPack); - + friend class ASTContext; - + public: IdentifierInfo *getIdentifier() const { return Replaced->getIdentifier(); } - + /// Gets the template parameter that was substituted for. const TemplateTypeParmType *getReplacedParameter() const { return Replaced; } - + bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } - + TemplateArgument getArgumentPack() const; - + void Profile(llvm::FoldingSetNodeID &ID); static void Profile(llvm::FoldingSetNodeID &ID, const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack); - + static bool classof(const Type *T) { return T->getTypeClass() == SubstTemplateTypeParmPack; } @@ -3583,7 +3583,7 @@ class InjectedClassNameType : public Type { InjectedClassNameType(CXXRecordDecl *D, QualType TST) : Type(InjectedClassName, QualType(), /*Dependent=*/true, /*InstantiationDependent=*/true, - /*VariablyModified=*/false, + /*VariablyModified=*/false, /*ContainsUnexpandedParameterPack=*/false), Decl(D), InjectedType(TST) { assert(isa<TemplateSpecializationType>(TST)); @@ -3645,10 +3645,10 @@ enum ElaboratedTypeKeyword { class TypeWithKeyword : public Type { protected: TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, - QualType Canonical, bool Dependent, - bool InstantiationDependent, bool VariablyModified, + QualType Canonical, bool Dependent, + bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack) - : Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified, + : Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified, ContainsUnexpandedParameterPack) { TypeWithKeywordBits.Keyword = Keyword; } @@ -3752,12 +3752,12 @@ public: }; /// \brief Represents a qualified type name for which the type name is -/// dependent. +/// dependent. /// -/// DependentNameType represents a class of dependent types that involve a -/// dependent nested-name-specifier (e.g., "T::") followed by a (dependent) +/// DependentNameType represents a class of dependent types that involve a +/// dependent nested-name-specifier (e.g., "T::") followed by a (dependent) /// name of a type. The DependentNameType may start with a "typename" (for a -/// typename-specifier), "class", "struct", "union", or "enum" (for a +/// typename-specifier), "class", "struct", "union", or "enum" (for a /// dependent elaborated-type-specifier), or nothing (in contexts where we /// know that we must be referring to a type, e.g., in a base class specifier). class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode { @@ -3768,7 +3768,7 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode { /// \brief The type that this typename specifier refers to. const IdentifierInfo *Name; - DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, + DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType CanonType) : TypeWithKeyword(Keyword, DependentName, CanonType, /*Dependent=*/true, /*InstantiationDependent=*/true, @@ -3885,7 +3885,7 @@ public: } static bool classof(const DependentTemplateSpecializationType *T) { return true; - } + } }; /// \brief Represents a pack expansion of types. @@ -3902,7 +3902,7 @@ public: /// \code /// template<typename ...Types> struct tuple; /// -/// template<typename ...Types> +/// template<typename ...Types> /// struct tuple_of_references { /// typedef tuple<Types&...> type; /// }; @@ -3915,24 +3915,24 @@ class PackExpansionType : public Type, public llvm::FoldingSetNode { QualType Pattern; /// \brief The number of expansions that this pack expansion will - /// generate when substituted (+1), or indicates that + /// generate when substituted (+1), or indicates that /// - /// This field will only have a non-zero value when some of the parameter - /// packs that occur within the pattern have been substituted but others have + /// This field will only have a non-zero value when some of the parameter + /// packs that occur within the pattern have been substituted but others have /// not. unsigned NumExpansions; - + PackExpansionType(QualType Pattern, QualType Canon, llvm::Optional<unsigned> NumExpansions) : Type(PackExpansion, Canon, /*Dependent=*/true, /*InstantiationDependent=*/true, /*VariableModified=*/Pattern->isVariablyModifiedType(), /*ContainsUnexpandedParameterPack=*/false), - Pattern(Pattern), + Pattern(Pattern), NumExpansions(NumExpansions? *NumExpansions + 1: 0) { } friend class ASTContext; // ASTContext creates these - + public: /// \brief Retrieve the pattern of this pack expansion, which is the /// type that will be repeatedly instantiated when instantiating the @@ -3944,10 +3944,10 @@ public: llvm::Optional<unsigned> getNumExpansions() const { if (NumExpansions) return NumExpansions - 1; - + return llvm::Optional<unsigned>(); } - + bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } @@ -3968,7 +3968,7 @@ public: } static bool classof(const PackExpansionType *T) { return true; - } + } }; /// ObjCObjectType - Represents a class type in Objective C. @@ -4012,7 +4012,7 @@ class ObjCObjectType : public Type { ObjCProtocolDecl **getProtocolStorage(); protected: - ObjCObjectType(QualType Canonical, QualType Base, + ObjCObjectType(QualType Canonical, QualType Base, ObjCProtocolDecl * const *Protocols, unsigned NumProtocols); enum Nonce_ObjCInterface { Nonce_ObjCInterface }; @@ -4069,7 +4069,7 @@ public: assert(I < getNumProtocols() && "Out-of-range protocol access"); return qual_begin()[I]; } - + bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } @@ -4090,7 +4090,7 @@ class ObjCObjectTypeImpl : public ObjCObjectType, public llvm::FoldingSetNode { // If anyone adds fields here, ObjCObjectType::getProtocolStorage() // will need to be modified. - ObjCObjectTypeImpl(QualType Canonical, QualType Base, + ObjCObjectTypeImpl(QualType Canonical, QualType Base, ObjCProtocolDecl * const *Protocols, unsigned NumProtocols) : ObjCObjectType(Canonical, Base, Protocols, NumProtocols) {} @@ -4099,8 +4099,8 @@ public: void Profile(llvm::FoldingSetNodeID &ID); static void Profile(llvm::FoldingSetNodeID &ID, QualType Base, - ObjCProtocolDecl *const *protocols, - unsigned NumProtocols); + ObjCProtocolDecl *const *protocols, + unsigned NumProtocols); }; inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorage() { @@ -4237,7 +4237,7 @@ public: bool isObjCClassType() const { return getObjectType()->isObjCUnqualifiedClass(); } - + /// isObjCQualifiedIdType - True if this is equivalent to 'id<P>' for some /// non-empty set of protocols. bool isObjCQualifiedIdType() const { @@ -4274,7 +4274,7 @@ public: ObjCProtocolDecl *getProtocol(unsigned I) const { return getObjectType()->getProtocol(I); } - + bool isSugared() const { return false; } QualType desugar() const { return QualType(this, 0); } @@ -4333,7 +4333,7 @@ public: addFastQualifiers(type.getLocalFastQualifiers()); if (!type.hasLocalNonFastQualifiers()) return type.getTypePtrUnsafe(); - + const ExtQuals *extQuals = type.getExtQualsUnsafe(); addConsistentQualifiers(extQuals->getQualifiers()); return extQuals->getBaseType(); @@ -4400,7 +4400,7 @@ inline bool QualType::isCanonical() const { inline bool QualType::isCanonicalAsParam() const { if (!isCanonical()) return false; if (hasLocalQualifiers()) return false; - + const Type *T = getTypePtr(); if (T->isVariablyModifiedType() && T->hasSizedVLAType()) return false; @@ -4409,21 +4409,21 @@ inline bool QualType::isCanonicalAsParam() const { } inline bool QualType::isConstQualified() const { - return isLocalConstQualified() || + return isLocalConstQualified() || getCommonPtr()->CanonicalType.isLocalConstQualified(); } inline bool QualType::isRestrictQualified() const { - return isLocalRestrictQualified() || + return isLocalRestrictQualified() || getCommonPtr()->CanonicalType.isLocalRestrictQualified(); } inline bool QualType::isVolatileQualified() const { - return isLocalVolatileQualified() || + return isLocalVolatileQualified() || getCommonPtr()->CanonicalType.isLocalVolatileQualified(); } - + inline bool QualType::hasQualifiers() const { return hasLocalQualifiers() || getCommonPtr()->CanonicalType.hasLocalQualifiers(); @@ -4442,7 +4442,7 @@ inline SplitQualType QualType::getSplitUnqualifiedType() const { return getSplitUnqualifiedTypeImpl(*this); } - + inline void QualType::removeLocalConst() { removeLocalFastQualifiers(Qualifiers::Const); } @@ -4553,7 +4553,8 @@ inline bool Type::isCompoundType() const { isReferenceType() || // -- classes containing a sequence of objects of various types, [...]; isRecordType() || - // -- unions, which ar classes capable of containing objects of different types at different times; + // -- unions, which are classes capable of containing objects of different + // types at different times; isUnionType() || // -- enumerations, which comprise a set of named constant values. [...]; isEnumeralType() || @@ -4643,7 +4644,7 @@ inline bool Type::isObjCObjectType() const { return isa<ObjCObjectType>(CanonicalType); } inline bool Type::isObjCObjectOrInterfaceType() const { - return isa<ObjCInterfaceType>(CanonicalType) || + return isa<ObjCInterfaceType>(CanonicalType) || isa<ObjCObjectType>(CanonicalType); } inline bool Type::isAtomicType() const { @@ -4760,15 +4761,15 @@ template<typename T, bool isArrayType = (llvm::is_same<T, ArrayType>::value || llvm::is_base_of<ArrayType, T>::value)> struct ArrayType_cannot_be_used_with_getAs { }; - + template<typename T> struct ArrayType_cannot_be_used_with_getAs<T, true>; - + /// Member-template getAs<specific type>'. template <typename T> const T *Type::getAs() const { ArrayType_cannot_be_used_with_getAs<T> at; (void)at; - + // If this is directly a T type, return it. if (const T *Ty = dyn_cast<T>(this)) return Ty; diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 20acadab7cf..40a9006b78c 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -159,7 +159,8 @@ public: static bool classof(const TypeLoc *TL) { return true; } private: - static void initializeImpl(ASTContext &Context, TypeLoc TL, SourceLocation Loc); + static void initializeImpl(ASTContext &Context, TypeLoc TL, + SourceLocation Loc); static TypeLoc getNextTypeLocImpl(TypeLoc TL); static TypeLoc IgnoreParensImpl(TypeLoc TL); static SourceRange getLocalSourceRangeImpl(TypeLoc TL); @@ -226,7 +227,7 @@ public: /// \brief Returns the size of the type source info data block. unsigned getFullDataSize() const { - return getLocalDataSize() + + return getLocalDataSize() + getFullDataSizeForType(getType().getLocalUnqualifiedType()); } @@ -326,7 +327,7 @@ protected: void *getExtraLocalData() const { return getLocalData() + 1; } - + void *getNonLocalData() const { return static_cast<char*>(Base::Data) + asDerived()->getLocalDataSize(); } @@ -392,7 +393,7 @@ struct TypeSpecLocInfo { /// \brief A reasonable base class for TypeLocs that correspond to /// types that are written as a type-specifier. -class TypeSpecTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, +class TypeSpecTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, TypeSpecTypeLoc, Type, TypeSpecLocInfo> { @@ -566,7 +567,7 @@ class TagTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, public: TagDecl *getDecl() const { return getTypePtr()->getDecl(); } - /// \brief True if the tag was defined in this type specifier. + /// \brief True if the tag was defined in this type specifier. bool isDefinition() const { return getDecl()->isCompleteDefinition() && (getNameLoc().isInvalid() || getNameLoc() == getDecl()->getLocation()); @@ -789,7 +790,7 @@ public: assert(i < getNumProtocols() && "Index is out of bounds!"); return *(this->getTypePtr()->qual_begin() + i); } - + bool hasBaseTypeAsWritten() const { return getLocalData()->HasBaseTypeAsWritten; } @@ -900,11 +901,11 @@ struct PointerLikeLocInfo { SourceLocation StarLoc; }; -/// A base class for +/// A base class for template <class Derived, class TypeClass, class LocalData = PointerLikeLocInfo> class PointerLikeTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, Derived, TypeClass, LocalData> { -public: +public: SourceLocation getSigilLoc() const { return this->getLocalData()->StarLoc; } @@ -1476,9 +1477,9 @@ class AutoTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, struct ElaboratedLocInfo { SourceLocation KeywordLoc; - + /// \brief Opaque data pointer used to reconstruct a nested-name-specifier - /// from + /// from void *QualifierData; }; @@ -1495,12 +1496,12 @@ public: } NestedNameSpecifierLoc getQualifierLoc() const { - return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), + return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), getLocalData()->QualifierData); } - + void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc) { - assert(QualifierLoc.getNestedNameSpecifier() + assert(QualifierLoc.getNestedNameSpecifier() == getTypePtr()->getQualifier() && "Inconsistent nested-name-specifier pointer"); getLocalData()->QualifierData = QualifierLoc.getOpaqueData(); @@ -1537,7 +1538,7 @@ public: // type is some sort of TypeDeclTypeLoc. struct DependentNameLocInfo : ElaboratedLocInfo { SourceLocation NameLoc; - + /// \brief Data associated with the nested-name-specifier location. void *QualifierData; }; @@ -1555,17 +1556,17 @@ public: } NestedNameSpecifierLoc getQualifierLoc() const { - return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), + return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), getLocalData()->QualifierData); } - + void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc) { - assert(QualifierLoc.getNestedNameSpecifier() + assert(QualifierLoc.getNestedNameSpecifier() == getTypePtr()->getQualifier() && "Inconsistent nested-name-specifier pointer"); getLocalData()->QualifierData = QualifierLoc.getOpaqueData(); } - + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } @@ -1612,22 +1613,22 @@ public: NestedNameSpecifierLoc getQualifierLoc() const { if (!getLocalData()->QualifierData) return NestedNameSpecifierLoc(); - - return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), + + return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), getLocalData()->QualifierData); } - + void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc) { if (!QualifierLoc) { - // Even if we have a nested-name-specifier in the dependent + // Even if we have a nested-name-specifier in the dependent // template specialization type, we won't record the nested-name-specifier // location information when this type-source location information is // part of a nested-name-specifier. getLocalData()->QualifierData = 0; return; } - - assert(QualifierLoc.getNestedNameSpecifier() + + assert(QualifierLoc.getNestedNameSpecifier() == getTypePtr()->getQualifier() && "Inconsistent nested-name-specifier pointer"); getLocalData()->QualifierData = QualifierLoc.getOpaqueData(); @@ -1702,7 +1703,7 @@ struct PackExpansionTypeLocInfo { }; class PackExpansionTypeLoc - : public ConcreteTypeLoc<UnqualTypeLoc, PackExpansionTypeLoc, + : public ConcreteTypeLoc<UnqualTypeLoc, PackExpansionTypeLoc, PackExpansionType, PackExpansionTypeLocInfo> { public: SourceLocation getEllipsisLoc() const { @@ -1736,7 +1737,7 @@ struct AtomicTypeLocInfo { class AtomicTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, AtomicTypeLoc, AtomicType, AtomicTypeLocInfo> { -public: +public: TypeLoc getValueLoc() const { return this->getInnerTypeLoc(); } diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h index 59bab038260..2aa9a3dec9a 100644 --- a/include/clang/AST/VTableBuilder.h +++ b/include/clang/AST/VTableBuilder.h @@ -34,16 +34,16 @@ public: CK_OffsetToTop, CK_RTTI, CK_FunctionPointer, - + /// CK_CompleteDtorPointer - A pointer to the complete destructor. CK_CompleteDtorPointer, - + /// CK_DeletingDtorPointer - A pointer to the deleting destructor. CK_DeletingDtorPointer, - + /// CK_UnusedFunctionPointer - In some cases, a vtable function pointer /// will end up never being called. Such vtable function pointers are - /// represented as a CK_UnusedFunctionPointer. + /// represented as a CK_UnusedFunctionPointer. CK_UnusedFunctionPointer }; @@ -60,34 +60,34 @@ public: static VTableComponent MakeOffsetToTop(CharUnits Offset) { return VTableComponent(CK_OffsetToTop, Offset); } - + static VTableComponent MakeRTTI(const CXXRecordDecl *RD) { return VTableComponent(CK_RTTI, reinterpret_cast<uintptr_t>(RD)); } static VTableComponent MakeFunction(const CXXMethodDecl *MD) { - assert(!isa<CXXDestructorDecl>(MD) && + assert(!isa<CXXDestructorDecl>(MD) && "Don't use MakeFunction with destructors!"); - return VTableComponent(CK_FunctionPointer, + return VTableComponent(CK_FunctionPointer, reinterpret_cast<uintptr_t>(MD)); } - + static VTableComponent MakeCompleteDtor(const CXXDestructorDecl *DD) { return VTableComponent(CK_CompleteDtorPointer, reinterpret_cast<uintptr_t>(DD)); } static VTableComponent MakeDeletingDtor(const CXXDestructorDecl *DD) { - return VTableComponent(CK_DeletingDtorPointer, + return VTableComponent(CK_DeletingDtorPointer, reinterpret_cast<uintptr_t>(DD)); } static VTableComponent MakeUnusedFunction(const CXXMethodDecl *MD) { - assert(!isa<CXXDestructorDecl>(MD) && + assert(!isa<CXXDestructorDecl>(MD) && "Don't use MakeUnusedFunction with destructors!"); return VTableComponent(CK_UnusedFunctionPointer, - reinterpret_cast<uintptr_t>(MD)); + reinterpret_cast<uintptr_t>(MD)); } static VTableComponent getFromOpaqueInteger(uint64_t I) { @@ -101,88 +101,88 @@ public: CharUnits getVCallOffset() const { assert(getKind() == CK_VCallOffset && "Invalid component kind!"); - + return getOffset(); } CharUnits getVBaseOffset() const { assert(getKind() == CK_VBaseOffset && "Invalid component kind!"); - + return getOffset(); } CharUnits getOffsetToTop() const { assert(getKind() == CK_OffsetToTop && "Invalid component kind!"); - + return getOffset(); } - + const CXXRecordDecl *getRTTIDecl() const { assert(getKind() == CK_RTTI && "Invalid component kind!"); - + return reinterpret_cast<CXXRecordDecl *>(getPointer()); } - + const CXXMethodDecl *getFunctionDecl() const { assert(getKind() == CK_FunctionPointer); - + return reinterpret_cast<CXXMethodDecl *>(getPointer()); } const CXXDestructorDecl *getDestructorDecl() const { assert((getKind() == CK_CompleteDtorPointer || getKind() == CK_DeletingDtorPointer) && "Invalid component kind!"); - + return reinterpret_cast<CXXDestructorDecl *>(getPointer()); } const CXXMethodDecl *getUnusedFunctionDecl() const { assert(getKind() == CK_UnusedFunctionPointer); - + return reinterpret_cast<CXXMethodDecl *>(getPointer()); } - + private: VTableComponent(Kind ComponentKind, CharUnits Offset) { - assert((ComponentKind == CK_VCallOffset || + assert((ComponentKind == CK_VCallOffset || ComponentKind == CK_VBaseOffset || ComponentKind == CK_OffsetToTop) && "Invalid component kind!"); assert(Offset.getQuantity() <= ((1LL << 56) - 1) && "Offset is too big!"); - + Value = ((Offset.getQuantity() << 3) | ComponentKind); } VTableComponent(Kind ComponentKind, uintptr_t Ptr) { - assert((ComponentKind == CK_RTTI || + assert((ComponentKind == CK_RTTI || ComponentKind == CK_FunctionPointer || ComponentKind == CK_CompleteDtorPointer || ComponentKind == CK_DeletingDtorPointer || ComponentKind == CK_UnusedFunctionPointer) && "Invalid component kind!"); - + assert((Ptr & 7) == 0 && "Pointer not sufficiently aligned!"); - + Value = Ptr | ComponentKind; } - + CharUnits getOffset() const { assert((getKind() == CK_VCallOffset || getKind() == CK_VBaseOffset || getKind() == CK_OffsetToTop) && "Invalid component kind!"); - + return CharUnits::fromQuantity(Value >> 3); } uintptr_t getPointer() const { - assert((getKind() == CK_RTTI || + assert((getKind() == CK_RTTI || getKind() == CK_FunctionPointer || getKind() == CK_CompleteDtorPointer || getKind() == CK_DeletingDtorPointer || getKind() == CK_UnusedFunctionPointer) && "Invalid component kind!"); - + return static_cast<uintptr_t>(Value & ~7ULL); } - + explicit VTableComponent(uint64_t Value) : Value(Value) { } @@ -210,7 +210,7 @@ private: /// VTableThunks - Contains thunks needed by vtables. uint64_t NumVTableThunks; VTableThunkTy *VTableThunks; - + /// Address points - Address points for all vtables. AddressPointsMapTy AddressPoints; @@ -265,10 +265,10 @@ class VTableContext { ASTContext &Context; public: - typedef SmallVector<std::pair<uint64_t, ThunkInfo>, 1> + typedef SmallVector<std::pair<uint64_t, ThunkInfo>, 1> VTableThunksTy; typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; - + private: /// MethodVTableIndices - Contains the index (relative to the vtable address /// point) where the function pointer for a virtual function is stored. @@ -279,22 +279,22 @@ private: VTableLayoutMapTy; VTableLayoutMapTy VTableLayouts; - /// NumVirtualFunctionPointers - Contains the number of virtual function + /// NumVirtualFunctionPointers - Contains the number of virtual function /// pointers in the vtable for a given record decl. llvm::DenseMap<const CXXRecordDecl *, uint64_t> NumVirtualFunctionPointers; typedef std::pair<const CXXRecordDecl *, const CXXRecordDecl *> ClassPairTy; - /// VirtualBaseClassOffsetOffsets - Contains the vtable offset (relative to + /// VirtualBaseClassOffsetOffsets - Contains the vtable offset (relative to /// the address point) in chars where the offsets for virtual bases of a class /// are stored. - typedef llvm::DenseMap<ClassPairTy, CharUnits> + typedef llvm::DenseMap<ClassPairTy, CharUnits> VirtualBaseClassOffsetOffsetsMapTy; VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets; typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy; - + /// Thunks - Contains all thunks that a given method decl will need. ThunksMapTy Thunks; @@ -312,7 +312,7 @@ public: const VTableLayout &getVTableLayout(const CXXRecordDecl *RD) { ComputeVTableRelatedInformation(RD); assert(VTableLayouts.count(RD) && "No layout for this record decl!"); - + return *VTableLayouts[RD]; } @@ -337,14 +337,14 @@ public: /// getNumVirtualFunctionPointers - Return the number of virtual function /// pointers in the vtable for a given record decl. uint64_t getNumVirtualFunctionPointers(const CXXRecordDecl *RD); - + /// getMethodVTableIndex - Return the index (relative to the vtable address /// point) where the function pointer for the given virtual function is /// stored. uint64_t getMethodVTableIndex(GlobalDecl GD); /// getVirtualBaseOffsetOffset - Return the offset in chars (relative to the - /// vtable address point) where the offset of the virtual base that contains + /// vtable address point) where the offset of the virtual base that contains /// the given base is stored, otherwise, if no virtual base contains the given /// class, return 0. Base must be a virtual base class or an unambigious /// base. diff --git a/include/clang/Analysis/Analyses/Dominators.h b/include/clang/Analysis/Analyses/Dominators.h index d8299a431e2..98a9bf12221 100644 --- a/include/clang/Analysis/Analyses/Dominators.h +++ b/include/clang/Analysis/Analyses/Dominators.h @@ -7,7 +7,8 @@ // //===----------------------------------------------------------------------===// // -// This file implements a simple, fast dominance algorithm for source-level CFGs. +// This file implements a simple, fast dominance algorithm for source-level +// CFGs. // //===----------------------------------------------------------------------===// @@ -27,7 +28,7 @@ class DominatorTree : public ManagedAnalysis { typedef llvm::DenseMap<const CFGBlock *, CFGBlock*> CFGBlockMapTy; public: - DominatorTree(AnalysisDeclContext &ac) + DominatorTree(AnalysisDeclContext &ac) : AC(ac) {} virtual ~DominatorTree(); @@ -50,7 +51,7 @@ public: /// Find nearest common dominator for blocks A and B. /// Common dominator always exists, ex: entry block. - const CFGBlock *findNearestCommonDominator(const CFGBlock *A, + const CFGBlock *findNearestCommonDominator(const CFGBlock *A, const CFGBlock *B) const; /// Constructs immediate dominator tree for a given CFG based on the algorithm @@ -61,7 +62,7 @@ public: /// Software-Practice and Expreience, 2001;4:1-10. /// /// This implementation is simple and runs faster in practice than the classis - /// Lengauer-Tarjan algorithm. For detailed discussions, refer to the paper. + /// Lengauer-Tarjan algorithm. For detailed discussions, refer to the paper. void BuildDominatorTree(); /// Dump the immediate dominance tree diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h index ac15cfc64de..b2d45e36cb1 100644 --- a/include/clang/Analysis/Analyses/FormatString.h +++ b/include/clang/Analysis/Analyses/FormatString.h @@ -104,7 +104,7 @@ private: const char *Position; Kind kind; }; - + class ConversionSpecifier { public: enum Kind { @@ -113,14 +113,14 @@ public: cArg, dArg, iArg, - IntArgBeg = cArg, IntArgEnd = iArg, - + IntArgBeg = cArg, IntArgEnd = iArg, + oArg, uArg, xArg, XArg, UIntArgBeg = oArg, UIntArgEnd = XArg, - + fArg, FArg, eArg, @@ -130,44 +130,44 @@ public: aArg, AArg, DoubleArgBeg = fArg, DoubleArgEnd = AArg, - + sArg, pArg, nArg, PercentArg, CArg, SArg, - + // ** Printf-specific ** - + // Objective-C specific specifiers. ObjCObjArg, // '@' ObjCBeg = ObjCObjArg, ObjCEnd = ObjCObjArg, - + // GlibC specific specifiers. PrintErrno, // 'm' - + PrintfConvBeg = ObjCObjArg, PrintfConvEnd = PrintErrno, - - // ** Scanf-specific ** + + // ** Scanf-specific ** ScanListArg, // '[' ScanfConvBeg = ScanListArg, ScanfConvEnd = ScanListArg }; - + ConversionSpecifier(bool isPrintf) : IsPrintf(isPrintf), Position(0), EndScanList(0), kind(InvalidSpecifier) {} - + ConversionSpecifier(bool isPrintf, const char *pos, Kind k) : IsPrintf(isPrintf), Position(pos), EndScanList(0), kind(k) {} - + const char *getStart() const { return Position; } - + StringRef getCharacters() const { return StringRef(getStart(), getLength()); } - + bool consumesDataArgument() const { switch (kind) { case PrintErrno: @@ -178,15 +178,15 @@ public: return true; } } - + Kind getKind() const { return kind; } void setKind(Kind k) { kind = k; } unsigned getLength() const { return EndScanList ? EndScanList - Position : 1; } - + const char *toString() const; - + bool isPrintfKind() const { return IsPrintf; } protected: @@ -337,7 +337,7 @@ public: } bool usesPositionalArg() const { return UsesPositionalArg; } - + bool hasValidLengthModifier() const; }; @@ -348,7 +348,7 @@ public: namespace analyze_printf { -class PrintfConversionSpecifier : +class PrintfConversionSpecifier : public analyze_format_string::ConversionSpecifier { public: PrintfConversionSpecifier() @@ -360,7 +360,7 @@ public: bool isObjCArg() const { return kind >= ObjCBeg && kind <= ObjCEnd; } bool isIntArg() const { return kind >= IntArgBeg && kind <= IntArgEnd; } bool isUIntArg() const { return kind >= UIntArgBeg && kind <= UIntArgEnd; } - bool isDoubleArg() const { return kind >= DoubleArgBeg && + bool isDoubleArg() const { return kind >= DoubleArgBeg && kind <= DoubleArgBeg; } unsigned getLength() const { // Conversion specifiers currently only are represented by @@ -438,7 +438,7 @@ public: const OptionalAmount &getPrecision() const { return Precision; } - + bool consumesDataArgument() const { return getConversionSpecifier().consumesDataArgument(); } @@ -450,7 +450,7 @@ public: /// more than one type. ArgTypeResult getArgType(ASTContext &Ctx) const; - const OptionalFlag &hasThousandsGrouping() const { + const OptionalFlag &hasThousandsGrouping() const { return HasThousandsGrouping; } const OptionalFlag &isLeftJustified() const { return IsLeftJustified; } @@ -467,7 +467,7 @@ public: void toString(raw_ostream &os) const; - // Validation methods - to check if any element results in undefined behavior + // Validation methods - to check if any element results in undefined behavior bool hasValidPlusPrefix() const; bool hasValidAlternativeForm() const; bool hasValidLeadingZeros() const; @@ -495,10 +495,10 @@ public: : ConversionSpecifier(false, pos, k) {} void setEndScanList(const char *pos) { EndScanList = pos; } - + static bool classof(const analyze_format_string::ConversionSpecifier *CS) { return !CS->isPrintfKind(); - } + } }; using analyze_format_string::LengthModifier; @@ -528,7 +528,7 @@ public: const ScanfConversionSpecifier &getConversionSpecifier() const { return cast<ScanfConversionSpecifier>(CS); } - + bool consumesDataArgument() const { return CS.consumesDataArgument() && !SuppressAssignment; } diff --git a/include/clang/Analysis/Analyses/PostOrderCFGView.h b/include/clang/Analysis/Analyses/PostOrderCFGView.h index 6c7eaf90144..57db3980549 100644 --- a/include/clang/Analysis/Analyses/PostOrderCFGView.h +++ b/include/clang/Analysis/Analyses/PostOrderCFGView.h @@ -25,15 +25,15 @@ #include "clang/Analysis/CFG.h" namespace clang { - + class PostOrderCFGView : public ManagedAnalysis { public: /// \brief Implements a set of CFGBlocks using a BitVector. /// /// This class contains a minimal interface, primarily dictated by the SetType - /// template parameter of the llvm::po_iterator template, as used with external - /// storage. We also use this set to keep track of which CFGBlocks we visit - /// during the analysis. + /// template parameter of the llvm::po_iterator template, as used with + /// external storage. We also use this set to keep track of which CFGBlocks we + /// visit during the analysis. class CFGBlockSet { llvm::BitVector VisitedBlockIDs; public: @@ -47,8 +47,8 @@ public: /// \brief Set the bit associated with a particular CFGBlock. /// This is the important method for the SetType template parameter. bool insert(const CFGBlock *Block) { - // Note that insert() is called by po_iterator, which doesn't check to make - // sure that Block is non-null. Moreover, the CFGBlock iterator will + // Note that insert() is called by po_iterator, which doesn't check to + // make sure that Block is non-null. Moreover, the CFGBlock iterator will // occasionally hand out null pointers for pruned edges, so we catch those // here. if (Block == 0) @@ -60,30 +60,30 @@ public: } /// \brief Check if the bit for a CFGBlock has been already set. - /// This method is for tracking visited blocks in the main threadsafety loop. - /// Block must not be null. + /// This method is for tracking visited blocks in the main threadsafety + /// loop. Block must not be null. bool alreadySet(const CFGBlock *Block) { return VisitedBlockIDs.test(Block->getBlockID()); } }; private: - typedef llvm::po_iterator<const CFG*, CFGBlockSet, true> po_iterator; + typedef llvm::po_iterator<const CFG*, CFGBlockSet, true> po_iterator; std::vector<const CFGBlock*> Blocks; - + typedef llvm::DenseMap<const CFGBlock *, unsigned> BlockOrderTy; BlockOrderTy BlockOrder; - + public: typedef std::vector<const CFGBlock*>::reverse_iterator iterator; - + PostOrderCFGView(const CFG *cfg); - + iterator begin() { return Blocks.rbegin(); } iterator end() { return Blocks.rend(); } - + bool empty() { return begin() == end(); } - + struct BlockOrderCompare; friend struct BlockOrderCompare; @@ -91,9 +91,9 @@ public: const PostOrderCFGView &POV; public: BlockOrderCompare(const PostOrderCFGView &pov) : POV(pov) {} - bool operator()(const CFGBlock *b1, const CFGBlock *b2) const; + bool operator()(const CFGBlock *b1, const CFGBlock *b2) const; }; - + BlockOrderCompare getComparator() const { return BlockOrderCompare(*this); } @@ -103,7 +103,7 @@ public: static PostOrderCFGView *create(AnalysisDeclContext &analysisContext); }; - + } // end clang namespace #endif diff --git a/include/clang/Analysis/Analyses/ThreadSafety.h b/include/clang/Analysis/Analyses/ThreadSafety.h index b2e71bca731..6988ec06a8e 100644 --- a/include/clang/Analysis/Analyses/ThreadSafety.h +++ b/include/clang/Analysis/Analyses/ThreadSafety.h @@ -93,7 +93,8 @@ public: /// 3. or when a mutex is locked but not unlocked inside a function. /// \param LockName -- A StringRef name for the lock expression, to be printed /// in the error message. - /// \param Loc -- The location of the lock expression where the mutex is locked + /// \param Loc -- The location of the lock expression where the mutex is + /// locked /// \param LEK -- which of the three above cases we should warn for virtual void handleMutexHeldEndOfScope(Name LockName, SourceLocation Loc, LockErrorKind LEK){} @@ -143,7 +144,8 @@ public: /// We traverse the blocks in the CFG, compute the set of mutexes that are held /// at the end of each block, and issue warnings for thread safety violations. /// Each block in the CFG is traversed exactly once. -void runThreadSafetyAnalysis(AnalysisDeclContext &AC, ThreadSafetyHandler &Handler); +void runThreadSafetyAnalysis(AnalysisDeclContext &AC, + ThreadSafetyHandler &Handler); /// \brief Helper function that returns a LockKind required for the given level /// of access. diff --git a/include/clang/Analysis/Analyses/UninitializedValues.h b/include/clang/Analysis/Analyses/UninitializedValues.h index de057eb4bfe..4ee66986bef 100644 --- a/include/clang/Analysis/Analyses/UninitializedValues.h +++ b/include/clang/Analysis/Analyses/UninitializedValues.h @@ -1,4 +1,4 @@ -//= UninitializedValues.h - Finding uses of uninitialized values --*- C++ -*-==// +//= UninitializedValues.h - Finding uses of uninitialized values -*- C++ -*-==// // // The LLVM Compiler Infrastructure // @@ -18,11 +18,11 @@ namespace clang { class AnalysisDeclContext; -class CFG; +class CFG; class DeclContext; class Expr; class VarDecl; - + class UninitVariablesHandler { public: UninitVariablesHandler() {} @@ -32,7 +32,7 @@ public: virtual void handleUseOfUninitVariable(const Expr *ex, const VarDecl *vd, bool isAlwaysUninit) {} - + /// Called when the uninitialized variable analysis detects the /// idiom 'int x = x'. All other uses of 'x' within the initializer /// are handled by handleUseOfUninitVariable. diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h index 1c7f0755129..a204d83009f 100644 --- a/include/clang/Analysis/AnalysisContext.h +++ b/include/clang/Analysis/AnalysisContext.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// This file defines AnalysisDeclContext, a class that manages the analysis context -// data for path sensitive analysis. +// This file defines AnalysisDeclContext, a class that manages the analysis +// context data for path sensitive analysis. // //===----------------------------------------------------------------------===// @@ -39,7 +39,7 @@ class ImplicitParamDecl; class LocationContextManager; class StackFrameContext; class AnalysisDeclContextManager; -class LocationContext; +class LocationContext; namespace idx { class TranslationUnit; } @@ -50,7 +50,7 @@ protected: ManagedAnalysis() {} public: virtual ~ManagedAnalysis(); - + // Subclasses need to implement: // // static const void *getTag(); @@ -62,15 +62,15 @@ public: // // which creates the analysis object given an AnalysisDeclContext. }; - - -/// AnalysisDeclContext contains the context data for the function or method under -/// analysis. + + +/// AnalysisDeclContext contains the context data for the function or method +/// under analysis. class AnalysisDeclContext { - /// Backpoint to the AnalysisManager object that created this AnalysisDeclContext. - /// This may be null. + /// Backpoint to the AnalysisManager object that created this + /// AnalysisDeclContext. This may be null. AnalysisDeclContextManager *Manager; - + const Decl *D; // TranslationUnit is NULL if we don't have multiple translation units. @@ -81,7 +81,7 @@ class AnalysisDeclContext { CFG::BuildOptions cfgBuildOptions; CFG::BuildOptions::ForcedBlkExprs *forcedBlkExprs; - + bool builtCFG, builtCompleteCFG; llvm::OwningPtr<LiveVariables> liveness; @@ -122,12 +122,12 @@ public: const CFG::BuildOptions &getCFGBuildOptions() const { return cfgBuildOptions; } - + /// getAddEHEdges - Return true iff we are adding exceptional edges from /// callExprs. If this is false, then try/catch statements and blocks /// reachable from them can appear to be dead in the CFG, analysis passes must /// cope with that. - bool getAddEHEdges() const { return cfgBuildOptions.AddEHEdges; } + bool getAddEHEdges() const { return cfgBuildOptions.AddEHEdges; } bool getUseUnoptimizedCFG() const { return !cfgBuildOptions.PruneTriviallyFalseEdges; } @@ -136,14 +136,14 @@ public: void registerForcedBlockExpression(const Stmt *stmt); const CFGBlock *getBlockForRegisteredExpression(const Stmt *stmt); - + Stmt *getBody() const; CFG *getCFG(); - + CFGStmtMap *getCFGStmtMap(); CFGReverseBlockReachabilityAnalysis *getCFGReachablityAnalysis(); - + /// Return a version of the CFG without any edges pruned. CFG *getUnoptimizedCFG(); @@ -165,12 +165,12 @@ public: /// Return the ImplicitParamDecl* associated with 'self' if this /// AnalysisDeclContext wraps an ObjCMethodDecl. Returns NULL otherwise. const ImplicitParamDecl *getSelfDecl() const; - + const StackFrameContext *getStackFrame(LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, - unsigned Idx); - + unsigned Idx); + /// Return the specified analysis object, lazily running the analysis if /// necessary. Return NULL if the analysis could not run. template <typename T> @@ -184,7 +184,7 @@ public: } private: ManagedAnalysis *&getAnalysisImpl(const void* tag); - + LocationContextManager &getLocationContextManager(); }; @@ -195,7 +195,8 @@ public: private: ContextKind Kind; - // AnalysisDeclContext can't be const since some methods may modify its member. + // AnalysisDeclContext can't be const since some methods may modify its + // member. AnalysisDeclContext *Ctx; const LocationContext *Parent; @@ -212,8 +213,8 @@ public: AnalysisDeclContext *getAnalysisDeclContext() const { return Ctx; } - idx::TranslationUnit *getTranslationUnit() const { - return Ctx->getTranslationUnit(); + idx::TranslationUnit *getTranslationUnit() const { + return Ctx->getTranslationUnit(); } const LocationContext *getParent() const { return Parent; } @@ -265,7 +266,7 @@ class StackFrameContext : public LocationContext { friend class LocationContextManager; StackFrameContext(AnalysisDeclContext *ctx, const LocationContext *parent, - const Stmt *s, const CFGBlock *blk, + const Stmt *s, const CFGBlock *blk, unsigned idx) : LocationContext(StackFrame, ctx, parent), CallSite(s), Block(blk), Index(idx) {} @@ -324,7 +325,8 @@ class BlockInvocationContext : public LocationContext { friend class LocationContextManager; - BlockInvocationContext(AnalysisDeclContext *ctx, const LocationContext *parent, + BlockInvocationContext(AnalysisDeclContext *ctx, + const LocationContext *parent, const BlockDecl *bd) : LocationContext(Block, ctx, parent), BD(bd) {} @@ -370,28 +372,28 @@ private: class AnalysisDeclContextManager { typedef llvm::DenseMap<const Decl*, AnalysisDeclContext*> ContextMap; - + ContextMap Contexts; LocationContextManager LocContexts; CFG::BuildOptions cfgBuildOptions; - + public: AnalysisDeclContextManager(bool useUnoptimizedCFG = false, bool addImplicitDtors = false, bool addInitializers = false); - + ~AnalysisDeclContextManager(); - + AnalysisDeclContext *getContext(const Decl *D, idx::TranslationUnit *TU = 0); - + bool getUseUnoptimizedCFG() const { return !cfgBuildOptions.PruneTriviallyFalseEdges; } - + CFG::BuildOptions &getCFGBuildOptions() { return cfgBuildOptions; } - + const StackFrameContext *getStackFrame(AnalysisDeclContext *Ctx, LocationContext const *Parent, const Stmt *S, @@ -399,15 +401,15 @@ public: unsigned Idx) { return LocContexts.getStackFrame(Ctx, Parent, S, Blk, Idx); } - + // Get the top level stack frame. - const StackFrameContext *getStackFrame(Decl const *D, + const StackFrameContext *getStackFrame(Decl const *D, idx::TranslationUnit *TU) { return LocContexts.getStackFrame(getContext(D, TU), 0, 0, 0, 0); } - + // Get a stack frame with parent. - StackFrameContext const *getStackFrame(const Decl *D, + StackFrameContext const *getStackFrame(const Decl *D, LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, @@ -415,7 +417,7 @@ public: return LocContexts.getStackFrame(getContext(D), Parent, S, Blk, Idx); } - + /// Discard all previously created AnalysisDeclContexts. void clear(); diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index f191c802818..66b7a6de642 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -67,22 +67,22 @@ protected: CFGElement(Kind kind, const void *Ptr1, const void *Ptr2 = 0) : Data1(const_cast<void*>(Ptr1), ((unsigned) kind) & 0x3), - Data2(const_cast<void*>(Ptr2), (((unsigned) kind) >> 2) & 0x3) {} + Data2(const_cast<void*>(Ptr2), (((unsigned) kind) >> 2) & 0x3) {} public: CFGElement() {} - Kind getKind() const { + Kind getKind() const { unsigned x = Data2.getInt(); x <<= 2; x |= Data1.getInt(); return (Kind) x; } - + bool isValid() const { return getKind() != Invalid; } operator bool() const { return isValid(); } - + template<class ElemTy> const ElemTy *getAs() const { if (llvm::isa<ElemTy>(this)) return static_cast<const ElemTy*>(this); @@ -96,7 +96,7 @@ class CFGStmt : public CFGElement { public: CFGStmt(Stmt *S) : CFGElement(Statement, S) {} - const Stmt *getStmt() const { + const Stmt *getStmt() const { return static_cast<const Stmt *>(Data1.getPointer()); } @@ -125,9 +125,9 @@ public: /// by compiler on various occasions. class CFGImplicitDtor : public CFGElement { protected: - CFGImplicitDtor(Kind kind, const void *data1, const void *data2 = 0) + CFGImplicitDtor(Kind kind, const void *data1, const void *data2 = 0) : CFGElement(kind, data1, data2) { - assert(kind >= DTOR_BEGIN && kind <= DTOR_END); + assert(kind >= DTOR_BEGIN && kind <= DTOR_END); } public: @@ -272,12 +272,12 @@ class CFGBlock { ImplTy Impl; public: ElementList(BumpVectorContext &C) : Impl(C, 4) {} - + typedef std::reverse_iterator<ImplTy::iterator> iterator; typedef std::reverse_iterator<ImplTy::const_iterator> const_iterator; typedef ImplTy::iterator reverse_iterator; - typedef ImplTy::const_iterator const_reverse_iterator; - + typedef ImplTy::const_iterator const_reverse_iterator; + void push_back(CFGElement e, BumpVectorContext &C) { Impl.push_back(e, C); } reverse_iterator insert(reverse_iterator I, size_t Cnt, CFGElement E, BumpVectorContext &C) { @@ -286,7 +286,7 @@ class CFGBlock { CFGElement front() const { return Impl.back(); } CFGElement back() const { return Impl.front(); } - + iterator begin() { return Impl.rbegin(); } iterator end() { return Impl.rend(); } const_iterator begin() const { return Impl.rbegin(); } @@ -300,7 +300,7 @@ class CFGBlock { assert(i < Impl.size()); return Impl[Impl.size() - 1 - i]; } - + size_t size() const { return Impl.size(); } bool empty() const { return Impl.empty(); } }; @@ -492,13 +492,13 @@ public: void dump(const CFG *cfg, const LangOptions &LO) const; void print(raw_ostream &OS, const CFG* cfg, const LangOptions &LO) const; void printTerminator(raw_ostream &OS, const LangOptions &LO) const; - + void addSuccessor(CFGBlock *Block, BumpVectorContext &C) { if (Block) Block->Preds.push_back(this, C); Succs.push_back(Block, C); } - + void appendStmt(Stmt *statement, BumpVectorContext &C) { Elements.push_back(CFGStmt(statement), C); } @@ -515,7 +515,7 @@ public: void appendMemberDtor(FieldDecl *FD, BumpVectorContext &C) { Elements.push_back(CFGMemberDtor(FD), C); } - + void appendTemporaryDtor(CXXBindTemporaryExpr *E, BumpVectorContext &C) { Elements.push_back(CFGTemporaryDtor(E), C); } @@ -554,22 +554,22 @@ public: llvm::BitVector alwaysAddMask; public: typedef llvm::DenseMap<const Stmt *, const CFGBlock*> ForcedBlkExprs; - ForcedBlkExprs **forcedBlkExprs; + ForcedBlkExprs **forcedBlkExprs; bool PruneTriviallyFalseEdges; bool AddEHEdges; bool AddInitializers; bool AddImplicitDtors; - + bool alwaysAdd(const Stmt *stmt) const { return alwaysAddMask[stmt->getStmtClass()]; } - + BuildOptions &setAlwaysAdd(Stmt::StmtClass stmtClass, bool val = true) { alwaysAddMask[stmtClass] = val; return *this; } - + BuildOptions &setAllAlwaysAdd() { alwaysAddMask.set(); return *this; @@ -605,7 +605,7 @@ public: // Block Iterators //===--------------------------------------------------------------------===// - typedef BumpVector<CFGBlock*> CFGBlockListTy; + typedef BumpVector<CFGBlock*> CFGBlockListTy; typedef CFGBlockListTy::iterator iterator; typedef CFGBlockListTy::const_iterator const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; @@ -631,7 +631,7 @@ public: CFGBlock * getIndirectGotoBlock() { return IndirectGotoBlock; } const CFGBlock * getIndirectGotoBlock() const { return IndirectGotoBlock; } - + typedef std::vector<const CFGBlock*>::const_iterator try_block_iterator; try_block_iterator try_blocks_begin() const { return TryDispatchBlocks.begin(); @@ -639,7 +639,7 @@ public: try_block_iterator try_blocks_end() const { return TryDispatchBlocks.end(); } - + void addTryDispatchBlock(const CFGBlock *block) { TryDispatchBlocks.push_back(block); } @@ -701,7 +701,7 @@ public: llvm::BumpPtrAllocator& getAllocator() { return BlkBVC.getAllocator(); } - + BumpVectorContext &getBumpVectorContext() { return BlkBVC; } @@ -717,11 +717,11 @@ private: // It represents a map from Expr* to integers to record the set of // block-level expressions and their "statement number" in the CFG. void * BlkExprMap; - + BumpVectorContext BlkBVC; - + CFGBlockListTy Blocks; - + /// C++ 'try' statements are modeled with an indirect dispatch block. /// This is the collection of such blocks present in the CFG. std::vector<const CFGBlock *> TryDispatchBlocks; diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 929beb079ef..6a81459800d 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -66,7 +66,8 @@ void InitializePreprocessor(Preprocessor &PP, /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. -void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts); +void ProcessWarningOptions(DiagnosticsEngine &Diags, + const DiagnosticOptions &Opts); /// DoPrintPreprocessedInput - Implement -E mode. void DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream* OS, diff --git a/include/clang/Index/ASTLocation.h b/include/clang/Index/ASTLocation.h index 7b66e7ea4fe..5fc2be2dbea 100644 --- a/include/clang/Index/ASTLocation.h +++ b/include/clang/Index/ASTLocation.h @@ -42,7 +42,7 @@ public: struct NamedRef { NamedDecl *ND; SourceLocation Loc; - + NamedRef() : ND(0) { } NamedRef(NamedDecl *nd, SourceLocation loc) : ND(nd), Loc(loc) { } }; @@ -95,14 +95,14 @@ public: bool isValid() const { return ParentDecl.getPointer() != 0; } bool isInvalid() const { return !isValid(); } - + NodeKind getKind() const { assert(isValid()); return (NodeKind)ParentDecl.getInt(); } - + Decl *getParentDecl() const { return ParentDecl.getPointer(); } - + Decl *AsDecl() const { assert(getKind() == N_Decl); return D; @@ -121,14 +121,16 @@ public: } Decl *dyn_AsDecl() const { return isValid() && getKind() == N_Decl ? D : 0; } - Stmt *dyn_AsStmt() const { return isValid() && getKind() == N_Stmt ? Stm : 0; } + Stmt *dyn_AsStmt() const { + return isValid() && getKind() == N_Stmt ? Stm : 0; + } NamedRef dyn_AsNamedRef() const { return getKind() == N_Type ? AsNamedRef() : NamedRef(); } TypeLoc dyn_AsTypeLoc() const { return getKind() == N_Type ? AsTypeLoc() : TypeLoc(); } - + bool isDecl() const { return isValid() && getKind() == N_Decl; } bool isStmt() const { return isValid() && getKind() == N_Stmt; } bool isNamedRef() const { return isValid() && getKind() == N_NamedRef; } diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 50d6a2adc9d..bcd3c4b274b 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -50,7 +50,7 @@ class CodeCompletionHandler; class DirectoryLookup; class PreprocessingRecord; class ModuleLoader; - + /// Preprocessor - This object engages in a tight little dance with the lexer to /// efficiently preprocess tokens. Lexers know only about tokens within a /// single source file, and don't know anything about preprocessor-level issues @@ -69,7 +69,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// \brief External source of macros. ExternalPreprocessorSource *ExternalSource; - + /// PTH - An optional PTHManager object used for getting tokens from /// a token cache rather than lexing the original source file. llvm::OwningPtr<PTHManager> PTH; @@ -108,7 +108,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { bool KeepMacroComments : 1; bool SuppressIncludeNotFoundError : 1; bool AutoModuleImport : 1; - + // State that changes while the preprocessor runs: bool InMacroArgs : 1; // True if parsing fn macro invocation args. @@ -147,7 +147,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// \brief The code-completion handler. CodeCompletionHandler *CodeComplete; - + /// \brief The file that we're performing code-completion for, if any. const FileEntry *CodeCompletionFile; @@ -170,7 +170,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// \brief The source location of the currently-active /// #pragma clang arc_cf_code_audited begin. SourceLocation PragmaARCCFCodeAuditedLoc; - + /// \brief True if we hit the code-completion point. bool CodeCompletionReached; @@ -179,7 +179,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// with a flag that indicates whether skipping this number of bytes will /// place the lexer at the start of a line. std::pair<unsigned, bool> SkipMainFilePreamble; - + /// CurLexer - This is the current top of the stack that we're lexing from if /// not expanding a macro and we are lexing directly from source code. /// Only one of CurLexer, CurPTHLexer, or CurTokenLexer will be non-null. @@ -194,7 +194,7 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// if not expanding a macro. This is an alias for either CurLexer or /// CurPTHLexer. PreprocessorLexer *CurPPLexer; - + /// CurLookup - The DirectoryLookup structure used to find the current /// FileEntry, if CurLexer is non-null and if applicable. This allows us to /// implement #include_next and find directory-specific properties. @@ -205,10 +205,10 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { llvm::OwningPtr<TokenLexer> CurTokenLexer; /// \brief The kind of lexer we're currently working with. - enum CurLexerKind { - CLK_Lexer, - CLK_PTHLexer, - CLK_TokenLexer, + enum CurLexerKind { + CLK_Lexer, + CLK_PTHLexer, + CLK_TokenLexer, CLK_CachingLexer, CLK_LexAfterModuleImport } CurLexerKind; @@ -224,10 +224,10 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { TokenLexer *TheTokenLexer; const DirectoryLookup *TheDirLookup; - IncludeStackInfo(enum CurLexerKind K, Lexer *L, PTHLexer* P, + IncludeStackInfo(enum CurLexerKind K, Lexer *L, PTHLexer* P, PreprocessorLexer* PPL, TokenLexer* TL, const DirectoryLookup *D) - : CurLexerKind(K), TheLexer(L), ThePTHLexer(P), ThePPLexer(PPL), + : CurLexerKind(K), TheLexer(L), ThePTHLexer(P), ThePPLexer(PPL), TheTokenLexer(TL), TheDirLookup(D) {} }; std::vector<IncludeStackInfo> IncludeMacroStack; @@ -254,9 +254,9 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { /// reused for quick allocation. MacroArgs *MacroArgCache; friend class MacroArgs; - - /// PragmaPushMacroInfo - For each IdentifierInfo used in a #pragma - /// push_macro directive, we keep a MacroInfo stack used to restore + + /// PragmaPushMacroInfo - For each IdentifierInfo used in a #pragma + /// push_macro directive, we keep a MacroInfo stack used to restore /// previous macro value. llvm::DenseMap<IdentifierInfo*, std::vector<MacroInfo*> > PragmaPushMacroInfo; @@ -286,12 +286,12 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> { std::vector<std::pair<TokenLexer *, size_t> > MacroExpandingLexersStack; /// \brief A record of the macro definitions and expansions that - /// occurred during preprocessing. + /// occurred during preprocessing. /// /// This is an optional side structure that can be enabled with /// \c createPreprocessingRecord() prior to preprocessing. PreprocessingRecord *Record; - + private: // Cached tokens state. typedef SmallVector<Token, 1> CachedTokensTy; @@ -325,7 +325,7 @@ private: // Cached tokens state. MacroInfoChain *MICache; MacroInfo *getInfoForMacro(IdentifierInfo *II) const; - + public: Preprocessor(DiagnosticsEngine &diags, LangOptions &opts, const TargetInfo *target, @@ -342,7 +342,7 @@ public: /// /// \param Target Information about the target. void Initialize(const TargetInfo &Target); - + DiagnosticsEngine &getDiagnostics() const { return *Diags; } void setDiagnostics(DiagnosticsEngine &D) { Diags = &D; } @@ -371,7 +371,7 @@ public: /// \brief Retrieve the module loader associated with this preprocessor. ModuleLoader &getModuleLoader() const { return TheModuleLoader; } - + /// SetCommentRetentionState - Control whether or not the preprocessor retains /// comments in output. void SetCommentRetentionState(bool KeepComments, bool KeepMacroComments) { @@ -393,7 +393,7 @@ public: void setAutoModuleImport(bool AutoModuleImport = true) { this->AutoModuleImport = AutoModuleImport; } - + /// isCurrentLexer - Return true if we are lexing directly from the specified /// lexer. bool isCurrentLexer(const PreprocessorLexer *L) const { @@ -425,7 +425,7 @@ public: MacroInfo *getMacroInfo(IdentifierInfo *II) const { if (!II->hasMacroDefinition()) return 0; - + return getInfoForMacro(II); } @@ -484,29 +484,29 @@ public: void setCodeCompletionHandler(CodeCompletionHandler &Handler) { CodeComplete = &Handler; } - + /// \brief Retrieve the current code-completion handler. CodeCompletionHandler *getCodeCompletionHandler() const { return CodeComplete; } - + /// \brief Clear out the code completion handler. void clearCodeCompletionHandler() { CodeComplete = 0; } - + /// \brief Hook used by the lexer to invoke the "natural language" code /// completion point. void CodeCompleteNaturalLanguage(); - + /// \brief Retrieve the preprocessing record, or NULL if there is no /// preprocessing record. PreprocessingRecord *getPreprocessingRecord() const { return Record; } - - /// \brief Create a new preprocessing record, which will keep track of + + /// \brief Create a new preprocessing record, which will keep track of /// all macro expansions, macro definitions, etc. void createPreprocessingRecord(bool IncludeNestedMacroExpansions); - + /// EnterMainSourceFile - Enter the specified FileID as the main source file, /// which implicitly adds the builtin defines etc. void EnterMainSourceFile(); @@ -588,7 +588,7 @@ public: } void LexAfterModuleImport(Token &Result); - + /// LexNonComment - Lex a token. If it's a comment, keep lexing until we get /// something not a comment. This is useful in -E -C mode where comments /// would foul up preprocessor directive handling. @@ -745,11 +745,11 @@ public: /// /// \brief StartOfLine Whether skipping these bytes puts the lexer at the /// start of a line. - void setSkipMainFilePreamble(unsigned Bytes, bool StartOfLine) { + void setSkipMainFilePreamble(unsigned Bytes, bool StartOfLine) { SkipMainFilePreamble.first = Bytes; SkipMainFilePreamble.second = StartOfLine; } - + /// Diag - Forwarding function for diagnostics. This emits a diagnostic at /// the specified Token's location, translating the token's start /// position in the current buffer into a SourcePosition object for rendering. @@ -795,7 +795,7 @@ public: /// to point to a constant buffer with the data already in it (avoiding a /// copy). The caller is not allowed to modify the returned buffer pointer /// if an internal buffer is returned. - unsigned getSpelling(const Token &Tok, const char *&Buffer, + unsigned getSpelling(const Token &Tok, const char *&Buffer, bool *Invalid = 0) const { return Lexer::getSpelling(Tok, Buffer, SourceMgr, Features, Invalid); } @@ -804,12 +804,12 @@ public: /// SmallVector. Note that the returned StringRef may not point to the /// supplied buffer if a copy can be avoided. StringRef getSpelling(const Token &Tok, - SmallVectorImpl<char> &Buffer, + SmallVectorImpl<char> &Buffer, bool *Invalid = 0) const; /// getSpellingOfSingleCharacterNumericConstant - Tok is a numeric constant /// with length 1, return the character. - char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, + char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bool *Invalid = 0) const { assert(Tok.is(tok::numeric_constant) && Tok.getLength() == 1 && "Called on unsupported token"); @@ -930,9 +930,18 @@ public: private: /// Identifiers used for SEH handling in Borland. These are only /// allowed in particular circumstances - IdentifierInfo *Ident__exception_code, *Ident___exception_code, *Ident_GetExceptionCode; // __except block - IdentifierInfo *Ident__exception_info, *Ident___exception_info, *Ident_GetExceptionInfo; // __except filter expression - IdentifierInfo *Ident__abnormal_termination, *Ident___abnormal_termination, *Ident_AbnormalTermination; // __finally + // __except block + IdentifierInfo *Ident__exception_code, + *Ident___exception_code, + *Ident_GetExceptionCode; + // __except filter expression + IdentifierInfo *Ident__exception_info, + *Ident___exception_info, + *Ident_GetExceptionInfo; + // __finally + IdentifierInfo *Ident__abnormal_termination, + *Ident___abnormal_termination, + *Ident_AbnormalTermination; public: void PoisonSEHIdentifiers(bool Poison = true); // Borland @@ -1163,7 +1172,7 @@ private: bool InCachingLexMode() const { // If the Lexer pointers are 0 and IncludeMacroStack is empty, it means // that we are past EOF, not that we are in CachingLex mode. - return CurPPLexer == 0 && CurTokenLexer == 0 && CurPTHLexer == 0 && + return CurPPLexer == 0 && CurTokenLexer == 0 && CurPTHLexer == 0 && !IncludeMacroStack.empty(); } void EnterCachingLexMode(); @@ -1184,7 +1193,7 @@ private: void HandleIdentSCCSDirective(Token &Tok); void HandleMacroExportDirective(Token &Tok); void HandleMacroPrivateDirective(Token &Tok); - + // File inclusion. void HandleIncludeDirective(SourceLocation HashLoc, Token &Tok, diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index 69003d0b4e4..7bf05910c31 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -24,14 +24,14 @@ namespace clang { class Decl; - + /// \brief Default priority values for code-completion results based /// on their kind. enum { /// \brief Priority for the next initialization in a constructor initializer /// list. CCP_NextInitializer = 7, - /// \brief Priority for an enumeration constant inside a switch whose + /// \brief Priority for an enumeration constant inside a switch whose /// condition is of the enumeration type. CCP_EnumInCase = 7, /// \brief Priority for a send-to-super completion. @@ -59,7 +59,7 @@ enum { /// \brief Priority for a result that isn't likely to be what the user wants, /// but is included for completeness. CCP_Unlikely = 80, - + /// \brief Priority for the Objective-C "_cmd" implicit parameter. CCP_ObjC_cmd = CCP_Unlikely }; @@ -76,15 +76,15 @@ enum { /// of the current method, which might imply that some kind of delegation /// is occurring. CCD_SelectorMatch = -3, - + /// \brief Adjustment to the "bool" type in Objective-C, where the typedef /// "BOOL" is preferred. CCD_bool_in_ObjC = 1, - + /// \brief Adjustment for KVC code pattern priorities when it doesn't look /// like the CCD_ProbablyNotObjCCollection = 15, - + /// \brief An Objective-C method being used as a property. CCD_MethodAsProperty = 2 }; @@ -114,14 +114,14 @@ enum SimplifiedTypeClass { STC_Record, STC_Void }; - + /// \brief Determine the simplified type class of the given canonical type. SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T); - + /// \brief Determine the type that this declaration will have if it is used /// as a type or in an expression. QualType getDeclUsageType(ASTContext &C, NamedDecl *ND); - + /// \brief Determine the priority to be given to a macro code completion result /// with the given name. /// @@ -131,14 +131,14 @@ QualType getDeclUsageType(ASTContext &C, NamedDecl *ND); /// /// \param PreferredTypeIsPointer Whether the preferred type for the context /// of this macro is a pointer type. -unsigned getMacroUsagePriority(StringRef MacroName, +unsigned getMacroUsagePriority(StringRef MacroName, const LangOptions &LangOpts, bool PreferredTypeIsPointer = false); /// \brief Determine the libclang cursor kind associated with the given /// declaration. CXCursorKind getCursorKindForDecl(Decl *D); - + class FunctionDecl; class FunctionType; class FunctionTemplateDecl; @@ -182,22 +182,22 @@ public: /// \brief Code completion occurred on the right-hand side of a member /// access expression using the dot operator. /// - /// The results of this completion are the members of the type being - /// accessed. The type itself is available via + /// The results of this completion are the members of the type being + /// accessed. The type itself is available via /// \c CodeCompletionContext::getType(). CCC_DotMemberAccess, /// \brief Code completion occurred on the right-hand side of a member /// access expression using the arrow operator. /// - /// The results of this completion are the members of the type being - /// accessed. The type itself is available via + /// The results of this completion are the members of the type being + /// accessed. The type itself is available via /// \c CodeCompletionContext::getType(). CCC_ArrowMemberAccess, /// \brief Code completion occurred on the right-hand side of an Objective-C /// property access expression. /// - /// The results of this completion are the members of the type being - /// accessed. The type itself is available via + /// The results of this completion are the members of the type being + /// accessed. The type itself is available via /// \c CodeCompletionContext::getType(). CCC_ObjCPropertyAccess, /// \brief Code completion occurred after the "enum" keyword, to indicate @@ -228,7 +228,7 @@ public: CCC_MacroNameUse, /// \brief Code completion occurred within a preprocessor expression. CCC_PreprocessorExpression, - /// \brief Code completion occurred where a preprocessor directive is + /// \brief Code completion occurred where a preprocessor directive is /// expected. CCC_PreprocessorDirective, /// \brief Code completion occurred in a context where natural language is @@ -246,14 +246,14 @@ public: CCC_ParenthesizedExpression, /// \brief Code completion where an Objective-C instance message is expcted. CCC_ObjCInstanceMessage, - /// \brief Code completion where an Objective-C class message is expected. + /// \brief Code completion where an Objective-C class message is expected. CCC_ObjCClassMessage, /// \brief Code completion where the name of an Objective-C class is /// expected. CCC_ObjCInterfaceName, /// \brief Code completion where an Objective-C category name is expected. CCC_ObjCCategoryName, - /// \brief An unknown context, in which we are recovering from a parsing + /// \brief An unknown context, in which we are recovering from a parsing /// error and don't know which completions we should give. CCC_Recovery }; @@ -264,27 +264,27 @@ private: /// \brief The type that would prefer to see at this point (e.g., the type /// of an initializer or function parameter). QualType PreferredType; - + /// \brief The type of the base object in a member access expression. QualType BaseType; - + /// \brief The identifiers for Objective-C selector parts. IdentifierInfo **SelIdents; - + /// \brief The number of Objective-C selector parts. unsigned NumSelIdents; - + public: /// \brief Construct a new code-completion context of the given kind. - CodeCompletionContext(enum Kind Kind) : Kind(Kind), SelIdents(NULL), + CodeCompletionContext(enum Kind Kind) : Kind(Kind), SelIdents(NULL), NumSelIdents(0) { } - + /// \brief Construct a new code-completion context of the given kind. CodeCompletionContext(enum Kind Kind, QualType T, IdentifierInfo **SelIdents = NULL, unsigned NumSelIdents = 0) : Kind(Kind), SelIdents(SelIdents), - NumSelIdents(NumSelIdents) { + NumSelIdents(NumSelIdents) { if (Kind == CCC_DotMemberAccess || Kind == CCC_ArrowMemberAccess || Kind == CCC_ObjCPropertyAccess || Kind == CCC_ObjCClassMessage || Kind == CCC_ObjCInstanceMessage) @@ -292,22 +292,22 @@ public: else PreferredType = T; } - + /// \brief Retrieve the kind of code-completion context. enum Kind getKind() const { return Kind; } - + /// \brief Retrieve the type that this expression would prefer to have, e.g., /// if the expression is a variable initializer or a function argument, the /// type of the corresponding variable or function parameter. QualType getPreferredType() const { return PreferredType; } - - /// \brief Retrieve the type of the base object in a member-access + + /// \brief Retrieve the type of the base object in a member-access /// expression. QualType getBaseType() const { return BaseType; } - + /// \brief Retrieve the Objective-C selector identifiers. IdentifierInfo **getSelIdents() const { return SelIdents; } - + /// \brief Retrieve the number of Objective-C selector identifiers. unsigned getNumSelIdents() const { return NumSelIdents; } @@ -320,10 +320,10 @@ public: /// \brief A "string" used to describe how code completion can /// be performed for an entity. /// -/// A code completion string typically shows how a particular entity can be +/// A code completion string typically shows how a particular entity can be /// used. For example, the code completion string for a function would show -/// the syntax to call it, including the parentheses, placeholders for the -/// arguments, etc. +/// the syntax to call it, including the parentheses, placeholders for the +/// arguments, etc. class CodeCompletionString { public: /// \brief The different kinds of "chunks" that can occur within a code @@ -340,7 +340,7 @@ public: /// an optional code completion string that describes the default arguments /// in a function call. CK_Optional, - /// \brief A string that acts as a placeholder for, e.g., a function + /// \brief A string that acts as a placeholder for, e.g., a function /// call argument. CK_Placeholder, /// \brief A piece of text that describes something about the result but @@ -383,30 +383,30 @@ public: /// platform). CK_VerticalSpace }; - + /// \brief One piece of the code completion string. struct Chunk { - /// \brief The kind of data stored in this piece of the code completion + /// \brief The kind of data stored in this piece of the code completion /// string. ChunkKind Kind; - + union { /// \brief The text string associated with a CK_Text, CK_Placeholder, /// CK_Informative, or CK_Comma chunk. - /// The string is owned by the chunk and will be deallocated + /// The string is owned by the chunk and will be deallocated /// (with delete[]) when the chunk is destroyed. const char *Text; - + /// \brief The code completion string associated with a CK_Optional chunk. /// The optional code completion string is owned by the chunk, and will /// be deallocated (with delete) when the chunk is destroyed. CodeCompletionString *Optional; }; - + Chunk() : Kind(CK_Text), Text(0) { } - + Chunk(ChunkKind Kind, const char *Text = ""); - + /// \brief Create a new text chunk. static Chunk CreateText(const char *Text); @@ -425,49 +425,49 @@ public: /// \brief Create a new current-parameter chunk. static Chunk CreateCurrentParameter(const char *CurrentParameter); }; - + private: /// \brief The number of chunks stored in this string. unsigned NumChunks : 16; - + /// \brief The number of annotations for this code-completion result. unsigned NumAnnotations : 16; /// \brief The priority of this code-completion string. unsigned Priority : 30; - + /// \brief The availability of this code-completion result. unsigned Availability : 2; CodeCompletionString(const CodeCompletionString &); // DO NOT IMPLEMENT CodeCompletionString &operator=(const CodeCompletionString &); // DITTO - + CodeCompletionString(const Chunk *Chunks, unsigned NumChunks, unsigned Priority, CXAvailabilityKind Availability, const char **Annotations, unsigned NumAnnotations); ~CodeCompletionString() { } - + friend class CodeCompletionBuilder; friend class CodeCompletionResult; - + public: typedef const Chunk *iterator; iterator begin() const { return reinterpret_cast<const Chunk *>(this + 1); } iterator end() const { return begin() + NumChunks; } bool empty() const { return NumChunks == 0; } unsigned size() const { return NumChunks; } - + const Chunk &operator[](unsigned I) const { assert(I < size() && "Chunk index out-of-range"); return begin()[I]; } - + /// \brief Returns the text in the TypedText chunk. const char *getTypedText() const; /// \brief Retrieve the priority of this code completion result. unsigned getPriority() const { return Priority; } - + /// \brief Retrieve the availability of this code completion result. unsigned getAvailability() const { return Availability; } @@ -476,26 +476,26 @@ public: /// \brief Retrieve the annotation string specified by \c AnnotationNr. const char *getAnnotation(unsigned AnnotationNr) const; - + /// \brief Retrieve a string representation of the code completion string, /// which is mainly useful for debugging. - std::string getAsString() const; + std::string getAsString() const; }; /// \brief An allocator used specifically for the purpose of code completion. -class CodeCompletionAllocator : public llvm::BumpPtrAllocator { +class CodeCompletionAllocator : public llvm::BumpPtrAllocator { public: /// \brief Copy the given string into this allocator. const char *CopyString(StringRef String); /// \brief Copy the given string into this allocator. const char *CopyString(Twine String); - + // \brief Copy the given string into this allocator. const char *CopyString(const char *String) { return CopyString(StringRef(String)); } - + /// \brief Copy the given string into this allocator. const char *CopyString(const std::string &String) { return CopyString(StringRef(String)); @@ -514,78 +514,78 @@ namespace clang { /// \brief A builder class used to construct new code-completion strings. class CodeCompletionBuilder { -public: +public: typedef CodeCompletionString::Chunk Chunk; - + private: CodeCompletionAllocator &Allocator; unsigned Priority; CXAvailabilityKind Availability; - + /// \brief The chunks stored in this string. SmallVector<Chunk, 4> Chunks; SmallVector<const char *, 2> Annotations; - + public: - CodeCompletionBuilder(CodeCompletionAllocator &Allocator) + CodeCompletionBuilder(CodeCompletionAllocator &Allocator) : Allocator(Allocator), Priority(0), Availability(CXAvailability_Available){ } - + CodeCompletionBuilder(CodeCompletionAllocator &Allocator, - unsigned Priority, CXAvailabilityKind Availability) + unsigned Priority, CXAvailabilityKind Availability) : Allocator(Allocator), Priority(Priority), Availability(Availability) { } /// \brief Retrieve the allocator into which the code completion /// strings should be allocated. CodeCompletionAllocator &getAllocator() const { return Allocator; } - - /// \brief Take the resulting completion string. + + /// \brief Take the resulting completion string. /// /// This operation can only be performed once. CodeCompletionString *TakeString(); - + /// \brief Add a new typed-text chunk. - void AddTypedTextChunk(const char *Text) { + void AddTypedTextChunk(const char *Text) { Chunks.push_back(Chunk(CodeCompletionString::CK_TypedText, Text)); } - + /// \brief Add a new text chunk. - void AddTextChunk(const char *Text) { - Chunks.push_back(Chunk::CreateText(Text)); + void AddTextChunk(const char *Text) { + Chunks.push_back(Chunk::CreateText(Text)); } /// \brief Add a new optional chunk. void AddOptionalChunk(CodeCompletionString *Optional) { Chunks.push_back(Chunk::CreateOptional(Optional)); } - + /// \brief Add a new placeholder chunk. void AddPlaceholderChunk(const char *Placeholder) { Chunks.push_back(Chunk::CreatePlaceholder(Placeholder)); } - + /// \brief Add a new informative chunk. void AddInformativeChunk(const char *Text) { Chunks.push_back(Chunk::CreateInformative(Text)); } - + /// \brief Add a new result-type chunk. void AddResultTypeChunk(const char *ResultType) { Chunks.push_back(Chunk::CreateResultType(ResultType)); } - + /// \brief Add a new current-parameter chunk. void AddCurrentParameterChunk(const char *CurrentParameter) { Chunks.push_back(Chunk::CreateCurrentParameter(CurrentParameter)); } - + /// \brief Add a new chunk. void AddChunk(Chunk C) { Chunks.push_back(C); } void AddAnnotation(const char *A) { Annotations.push_back(A); } }; - + /// \brief Captures a result of code completion. class CodeCompletionResult { public: @@ -596,23 +596,23 @@ public: RK_Macro, //< Refers to a macro RK_Pattern //< Refers to a precomputed pattern. }; - + /// \brief The kind of result stored here. ResultKind Kind; - + union { /// \brief When Kind == RK_Declaration, the declaration we are referring /// to. NamedDecl *Declaration; - - /// \brief When Kind == RK_Keyword, the string representing the keyword + + /// \brief When Kind == RK_Keyword, the string representing the keyword /// or symbol's spelling. const char *Keyword; - + /// \brief When Kind == RK_Pattern, the code-completion string that /// describes the completion text to insert. CodeCompletionString *Pattern; - + /// \brief When Kind == RK_Macro, the identifier that refers to a macro. IdentifierInfo *Macro; }; @@ -622,21 +622,21 @@ public: /// \brief The cursor kind that describes this result. CXCursorKind CursorKind; - + /// \brief The availability of this result. CXAvailabilityKind Availability; - + /// \brief Specifies which parameter (of a function, Objective-C method, /// macro, etc.) we should start with when formatting the result. unsigned StartParameter; - + /// \brief Whether this result is hidden by another name. bool Hidden : 1; - + /// \brief Whether this result was found via lookup into a base class. bool QualifierIsInformative : 1; - - /// \brief Whether this declaration is the beginning of a + + /// \brief Whether this declaration is the beginning of a /// nested-name-specifier and, therefore, should be followed by '::'. bool StartsNestedNameSpecifier : 1; @@ -647,43 +647,43 @@ public: /// \brief Whether we're completing a declaration of the given entity, /// rather than a use of that entity. bool DeclaringEntity : 1; - + /// \brief If the result should have a nested-name-specifier, this is it. - /// When \c QualifierIsInformative, the nested-name-specifier is + /// When \c QualifierIsInformative, the nested-name-specifier is /// informative rather than required. NestedNameSpecifier *Qualifier; - + /// \brief Build a result that refers to a declaration. - CodeCompletionResult(NamedDecl *Declaration, + CodeCompletionResult(NamedDecl *Declaration, NestedNameSpecifier *Qualifier = 0, bool QualifierIsInformative = false, bool Accessible = true) - : Kind(RK_Declaration), Declaration(Declaration), - Priority(getPriorityFromDecl(Declaration)), - Availability(CXAvailability_Available), StartParameter(0), + : Kind(RK_Declaration), Declaration(Declaration), + Priority(getPriorityFromDecl(Declaration)), + Availability(CXAvailability_Available), StartParameter(0), Hidden(false), QualifierIsInformative(QualifierIsInformative), StartsNestedNameSpecifier(false), AllParametersAreInformative(false), - DeclaringEntity(false), Qualifier(Qualifier) { + DeclaringEntity(false), Qualifier(Qualifier) { computeCursorKindAndAvailability(Accessible); } - + /// \brief Build a result that refers to a keyword or symbol. CodeCompletionResult(const char *Keyword, unsigned Priority = CCP_Keyword) - : Kind(RK_Keyword), Keyword(Keyword), Priority(Priority), - Availability(CXAvailability_Available), - StartParameter(0), Hidden(false), QualifierIsInformative(0), + : Kind(RK_Keyword), Keyword(Keyword), Priority(Priority), + Availability(CXAvailability_Available), + StartParameter(0), Hidden(false), QualifierIsInformative(0), StartsNestedNameSpecifier(false), AllParametersAreInformative(false), DeclaringEntity(false), Qualifier(0) { computeCursorKindAndAvailability(); } - + /// \brief Build a result that refers to a macro. CodeCompletionResult(IdentifierInfo *Macro, unsigned Priority = CCP_Macro) - : Kind(RK_Macro), Macro(Macro), Priority(Priority), - Availability(CXAvailability_Available), StartParameter(0), - Hidden(false), QualifierIsInformative(0), + : Kind(RK_Macro), Macro(Macro), Priority(Priority), + Availability(CXAvailability_Available), StartParameter(0), + Hidden(false), QualifierIsInformative(0), StartsNestedNameSpecifier(false), AllParametersAreInformative(false), - DeclaringEntity(false), Qualifier(0) { + DeclaringEntity(false), Qualifier(0) { computeCursorKindAndAvailability(); } @@ -692,26 +692,26 @@ public: unsigned Priority = CCP_CodePattern, CXCursorKind CursorKind = CXCursor_NotImplemented, CXAvailabilityKind Availability = CXAvailability_Available) - : Kind(RK_Pattern), Pattern(Pattern), Priority(Priority), - CursorKind(CursorKind), Availability(Availability), StartParameter(0), - Hidden(false), QualifierIsInformative(0), - StartsNestedNameSpecifier(false), AllParametersAreInformative(false), - DeclaringEntity(false), Qualifier(0) - { + : Kind(RK_Pattern), Pattern(Pattern), Priority(Priority), + CursorKind(CursorKind), Availability(Availability), StartParameter(0), + Hidden(false), QualifierIsInformative(0), + StartsNestedNameSpecifier(false), AllParametersAreInformative(false), + DeclaringEntity(false), Qualifier(0) + { } - + /// \brief Retrieve the declaration stored in this result. NamedDecl *getDeclaration() const { assert(Kind == RK_Declaration && "Not a declaration result"); return Declaration; } - + /// \brief Retrieve the keyword stored in this result. const char *getKeyword() const { assert(Kind == RK_Keyword && "Not a keyword result"); return Keyword; } - + /// \brief Create a new code-completion string that describes how to insert /// this result into a program. /// @@ -721,36 +721,36 @@ public: /// string itself. CodeCompletionString *CreateCodeCompletionString(Sema &S, CodeCompletionAllocator &Allocator); - + /// \brief Determine a base priority for the given declaration. static unsigned getPriorityFromDecl(NamedDecl *ND); - + private: void computeCursorKindAndAvailability(bool Accessible = true); }; - + bool operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y); - -inline bool operator>(const CodeCompletionResult &X, + +inline bool operator>(const CodeCompletionResult &X, const CodeCompletionResult &Y) { return Y < X; } - -inline bool operator<=(const CodeCompletionResult &X, + +inline bool operator<=(const CodeCompletionResult &X, const CodeCompletionResult &Y) { return !(Y < X); } -inline bool operator>=(const CodeCompletionResult &X, +inline bool operator>=(const CodeCompletionResult &X, const CodeCompletionResult &Y) { return !(X < Y); } - -raw_ostream &operator<<(raw_ostream &OS, + +raw_ostream &operator<<(raw_ostream &OS, const CodeCompletionString &CCS); -/// \brief Abstract interface for a consumer of code-completion +/// \brief Abstract interface for a consumer of code-completion /// information. class CodeCompleteConsumer { protected: @@ -760,15 +760,15 @@ protected: /// \brief Whether to include code patterns (such as for loops) within /// the completion results. bool IncludeCodePatterns; - + /// \brief Whether to include global (top-level) declarations and names in /// the completion results. bool IncludeGlobals; - + /// \brief Whether the output format for the code-completion consumer is /// binary. bool OutputIsBinary; - + public: class OverloadCandidate { public: @@ -782,25 +782,25 @@ public: /// for which we only have a function prototype. CK_FunctionType }; - + private: /// \brief The kind of overload candidate. CandidateKind Kind; - + union { - /// \brief The function overload candidate, available when + /// \brief The function overload candidate, available when /// Kind == CK_Function. FunctionDecl *Function; - + /// \brief The function template overload candidate, available when /// Kind == CK_FunctionTemplate. FunctionTemplateDecl *FunctionTemplate; - + /// \brief The function type that describes the entity being called, /// when Kind == CK_FunctionType. const FunctionType *Type; }; - + public: OverloadCandidate(FunctionDecl *Function) : Kind(CK_Function), Function(Function) { } @@ -813,55 +813,55 @@ public: /// \brief Determine the kind of overload candidate. CandidateKind getKind() const { return Kind; } - - /// \brief Retrieve the function overload candidate or the templated + + /// \brief Retrieve the function overload candidate or the templated /// function declaration for a function template. FunctionDecl *getFunction() const; - + /// \brief Retrieve the function template overload candidate. FunctionTemplateDecl *getFunctionTemplate() const { assert(getKind() == CK_FunctionTemplate && "Not a function template"); return FunctionTemplate; } - + /// \brief Retrieve the function type of the entity, regardless of how the /// function is stored. const FunctionType *getFunctionType() const; - + /// \brief Create a new code-completion string that describes the function /// signature of this overload candidate. - CodeCompletionString *CreateSignatureString(unsigned CurrentArg, + CodeCompletionString *CreateSignatureString(unsigned CurrentArg, Sema &S, CodeCompletionAllocator &Allocator) const; }; - + CodeCompleteConsumer() : IncludeMacros(false), IncludeCodePatterns(false), IncludeGlobals(true), OutputIsBinary(false) { } - + CodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns, bool IncludeGlobals, bool OutputIsBinary) : IncludeMacros(IncludeMacros), IncludeCodePatterns(IncludeCodePatterns), IncludeGlobals(IncludeGlobals), OutputIsBinary(OutputIsBinary) { } - + /// \brief Whether the code-completion consumer wants to see macros. bool includeMacros() const { return IncludeMacros; } /// \brief Whether the code-completion consumer wants to see code patterns. bool includeCodePatterns() const { return IncludeCodePatterns; } - + /// \brief Whether to include global (top-level) declaration results. bool includeGlobals() const { return IncludeGlobals; } - + /// \brief Determine whether the output of this consumer is binary. bool isOutputBinary() const { return OutputIsBinary; } - + /// \brief Deregisters and destroys this code-completion consumer. virtual ~CodeCompleteConsumer(); /// \name Code-completion callbacks //@{ /// \brief Process the finalized code-completion results. - virtual void ProcessCodeCompleteResults(Sema &S, + virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) { } @@ -878,20 +878,20 @@ public: OverloadCandidate *Candidates, unsigned NumCandidates) { } //@} - + /// \brief Retrieve the allocator that will be used to allocate /// code completion strings. virtual CodeCompletionAllocator &getAllocator() = 0; }; -/// \brief A simple code-completion consumer that prints the results it +/// \brief A simple code-completion consumer that prints the results it /// receives in a simple format. class PrintingCodeCompleteConsumer : public CodeCompleteConsumer { /// \brief The raw output stream. raw_ostream &OS; - + CodeCompletionAllocator Allocator; - + public: /// \brief Create a new printing code-completion consumer that prints its /// results to the given raw output stream. @@ -900,20 +900,20 @@ public: raw_ostream &OS) : CodeCompleteConsumer(IncludeMacros, IncludeCodePatterns, IncludeGlobals, false), OS(OS) {} - + /// \brief Prints the finalized code-completion results. - virtual void ProcessCodeCompleteResults(Sema &S, + virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults); - + virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, - unsigned NumCandidates); - + unsigned NumCandidates); + virtual CodeCompletionAllocator &getAllocator() { return Allocator; } }; - + } // end namespace clang #endif // LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H diff --git a/include/clang/Sema/LocInfoType.h b/include/clang/Sema/LocInfoType.h index e1d3ae90517..93cb8cbda45 100644 --- a/include/clang/Sema/LocInfoType.h +++ b/include/clang/Sema/LocInfoType.h @@ -36,16 +36,16 @@ class LocInfoType : public Type { TypeSourceInfo *DeclInfo; LocInfoType(QualType ty, TypeSourceInfo *TInfo) - : Type((TypeClass)LocInfo, ty, ty->isDependentType(), + : Type((TypeClass)LocInfo, ty, ty->isDependentType(), ty->isInstantiationDependentType(), ty->isVariablyModifiedType(), - ty->containsUnexpandedParameterPack()), - DeclInfo(TInfo) { - assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?"); - } + ty->containsUnexpandedParameterPack()), + DeclInfo(TInfo) { + assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?"); + } friend class Sema; - public: +public: QualType getType() const { return getCanonicalTypeInternal(); } TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; } diff --git a/include/clang/Sema/PrettyDeclStackTrace.h b/include/clang/Sema/PrettyDeclStackTrace.h index a31312cdc6d..aa557052633 100644 --- a/include/clang/Sema/PrettyDeclStackTrace.h +++ b/include/clang/Sema/PrettyDeclStackTrace.h @@ -33,9 +33,10 @@ class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry { Decl *TheDecl; SourceLocation Loc; const char *Message; - + public: - PrettyDeclStackTraceEntry(Sema &S, Decl *D, SourceLocation Loc, const char *Msg) + PrettyDeclStackTraceEntry(Sema &S, Decl *D, SourceLocation Loc, + const char *Msg) : S(S), TheDecl(D), Loc(Loc), Message(Msg) {} virtual void print(raw_ostream &OS) const; diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 9113f7ab2e3..4c87dd6d3c7 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -156,7 +156,7 @@ namespace clang { class VisibilityAttr; class VisibleDeclConsumer; class IndirectFieldDecl; - + namespace sema { class AccessedEntity; class BlockScopeInfo; @@ -213,7 +213,7 @@ public: /// PackContext - Manages the stack for #pragma pack. An alignment /// of 0 indicates default alignment. void *PackContext; // Really a "PragmaPackStack*" - + bool MSStructPragmaOn; // True when #pragma ms_struct on /// VisContext - Manages the stack for #pragma GCC visibility. @@ -235,7 +235,7 @@ public: /// the current full expression. SmallVector<CXXTemporary*, 8> ExprTemporaries; - typedef LazyVector<TypedefNameDecl *, ExternalSemaSource, + typedef LazyVector<TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2> ExtVectorDeclsType; @@ -284,27 +284,27 @@ public: /// we find this declaration of "foo" and complain that it is /// not visible. llvm::DenseMap<DeclarationName, NamedDecl *> LocallyScopedExternalDecls; - + /// \brief Look for a locally scoped external declaration by the given name. llvm::DenseMap<DeclarationName, NamedDecl *>::iterator findLocallyScopedExternalDecl(DeclarationName Name); - - typedef LazyVector<VarDecl *, ExternalSemaSource, + + typedef LazyVector<VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2> TentativeDefinitionsType; /// \brief All the tentative definitions encountered in the TU. TentativeDefinitionsType TentativeDefinitions; - typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource, + typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2> UnusedFileScopedDeclsType; - + /// \brief The set of file scoped decls seen so far that have not been used /// and must warn if not used. Only contains the first declaration. UnusedFileScopedDeclsType UnusedFileScopedDecls; - typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource, + typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2> DelegatingCtorDeclsType; @@ -322,11 +322,11 @@ public: /// \brief Callback to the parser to parse templated functions when needed. typedef void LateTemplateParserCB(void *P, const FunctionDecl *FD); LateTemplateParserCB *LateTemplateParser; - void *OpaqueParser; + void *OpaqueParser; void SetLateTemplateParser(LateTemplateParserCB *LTP, void *P) { LateTemplateParser = LTP; - OpaqueParser = P; + OpaqueParser = P; } class DelayedDiagnostics; @@ -418,7 +418,7 @@ public: assert(ParsingDepth == 0); ActiveStackBase = state.SavedActiveStackBase; ParsingDepth = state.SavedParsingDepth; - } + } } DelayedDiagnostics; /// A RAII object to temporarily push a declaration context. @@ -427,11 +427,11 @@ public: Sema &S; DeclContext *SavedContext; ProcessingContextState SavedContextState; - + public: ContextRAII(Sema &S, DeclContext *ContextToPush) - : S(S), SavedContext(S.CurContext), - SavedContextState(S.DelayedDiagnostics.pushContext()) + : S(S), SavedContext(S.CurContext), + SavedContextState(S.DelayedDiagnostics.pushContext()) { assert(ContextToPush && "pushing null context"); S.CurContext = ContextToPush; @@ -456,7 +456,7 @@ public: /// \brief Load weak undeclared identifiers from the external source. void LoadExternalWeakUndeclaredIdentifiers(); - + /// WeakTopLevelDecl - Translation-unit scoped declarations generated by /// #pragma weak during processing of other Decls. /// I couldn't figure out a clean way to generate these in-line, so @@ -480,7 +480,7 @@ public: /// \brief The C++ "type_info" declaration, which is defined in <typeinfo>. RecordDecl *CXXTypeInfoDecl; - + /// \brief The MSVC "_GUID" struct, which is defined in MSVC header files. RecordDecl *MSVCGuidDecl; @@ -526,7 +526,7 @@ public: /// \c typeid expression, whose argument is potentially evaluated only when /// it is an lvalue of polymorphic class type (C++ [basic.def.odr]p2). PotentiallyPotentiallyEvaluated, - + /// \brief The current expression is potentially evaluated, but any /// declarations referenced inside that expression are only used if /// in fact the current expression is used. @@ -648,16 +648,16 @@ public: typedef llvm::DenseMap<ParmVarDecl *, SmallVector<ParmVarDecl *, 1> > UnparsedDefaultArgInstantiationsMap; - + /// \brief A mapping from parameters with unparsed default arguments to the /// set of instantiations of each parameter. /// /// This mapping is a temporary data structure used when parsing /// nested class templates or nested classes of class templates, /// where we might end up instantiating an inner class before the - /// default arguments of its methods have been parsed. + /// default arguments of its methods have been parsed. UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations; - + // Contains the locations of the beginning of unparsed default // argument locations. llvm::DenseMap<ParmVarDecl *,SourceLocation> UnparsedDefaultArgLocs; @@ -675,7 +675,7 @@ public: /// of selectors are "overloaded"). GlobalMethodPool MethodPool; - /// Method selectors used in a @selector expression. Used for implementation + /// Method selectors used in a @selector expression. Used for implementation /// of -Wselector. llvm::DenseMap<Selector, SourceLocation> ReferencedSelectors; @@ -688,11 +688,11 @@ public: TranslationUnitKind TUKind = TU_Complete, CodeCompleteConsumer *CompletionConsumer = 0); ~Sema(); - + /// \brief Perform initialization that occurs after the parser has been /// initialized but before it parses anything. void Initialize(); - + const LangOptions &getLangOptions() const { return LangOpts; } OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; } FPOptions &getFPOptions() { return FPFeatures; } @@ -787,7 +787,7 @@ public: SourceLocation AttrLoc); QualType BuildFunctionType(QualType T, QualType *ParamTypes, unsigned NumParamTypes, - bool Variadic, unsigned Quals, + bool Variadic, unsigned Quals, RefQualifierKind RefQualifier, SourceLocation Loc, DeclarationName Entity, FunctionType::ExtInfo Info); @@ -831,11 +831,11 @@ public: const FunctionProtoType *Source, SourceLocation SourceLoc); TypeResult ActOnTypeName(Scope *S, Declarator &D); - + /// \brief The parser has parsed the context-sensitive type 'instancetype' /// in an Objective-C message declaration. Return the appropriate type. ParsedType ActOnObjCInstanceType(SourceLocation Loc); - + bool RequireCompleteType(SourceLocation Loc, QualType T, const PartialDiagnostic &PD, std::pair<SourceLocation, PartialDiagnostic> Note); @@ -895,36 +895,36 @@ public: NC_TypeTemplate, NC_FunctionTemplate }; - + class NameClassification { NameClassificationKind Kind; ExprResult Expr; TemplateName Template; ParsedType Type; const IdentifierInfo *Keyword; - + explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {} - + public: NameClassification(ExprResult Expr) : Kind(NC_Expression), Expr(Expr) {} - + NameClassification(ParsedType Type) : Kind(NC_Type), Type(Type) {} - - NameClassification(const IdentifierInfo *Keyword) + + NameClassification(const IdentifierInfo *Keyword) : Kind(NC_Keyword), Keyword(Keyword) { } - - static NameClassification Error() { - return NameClassification(NC_Error); + + static NameClassification Error() { + return NameClassification(NC_Error); } - - static NameClassification Unknown() { - return NameClassification(NC_Unknown); + + static NameClassification Unknown() { + return NameClassification(NC_Unknown); } - + static NameClassification NestedNameSpecifier() { return NameClassification(NC_NestedNameSpecifier); } - + static NameClassification TypeTemplate(TemplateName Name) { NameClassification Result(NC_TypeTemplate); Result.Template = Name; @@ -936,19 +936,19 @@ public: Result.Template = Name; return Result; } - + NameClassificationKind getKind() const { return Kind; } - + ParsedType getType() const { assert(Kind == NC_Type); return Type; } - + ExprResult getExpression() const { assert(Kind == NC_Expression); return Expr; } - + TemplateName getTemplateName() const { assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate); return Template; @@ -959,7 +959,7 @@ public: return Kind == NC_TypeTemplate? TNK_Type_template : TNK_Function_template; } }; - + /// \brief Perform name lookup on the given name, classifying it based on /// the results of name lookup and the following token. /// @@ -976,14 +976,14 @@ public: /// /// \param NameLoc The location of the identifier. /// - /// \param NextToken The token following the identifier. Used to help + /// \param NextToken The token following the identifier. Used to help /// disambiguate the name. NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken); - + Decl *ActOnDeclarator(Scope *S, Declarator &D); Decl *HandleDeclarator(Scope *S, Declarator &D, @@ -1029,7 +1029,8 @@ public: /// \brief Produce notes explaining why an instantiation was not constexpr. CCK_NoteNonConstexprInstantiation }; - bool CheckConstexprFunctionDecl(const FunctionDecl *FD, CheckConstexprKind CCK); + bool CheckConstexprFunctionDecl(const FunctionDecl *FD, + CheckConstexprKind CCK); bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body); void DiagnoseHiddenVirtualMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); @@ -1113,13 +1114,13 @@ public: DeclResult ActOnModuleImport(SourceLocation ImportLoc, IdentifierInfo &ModuleName, SourceLocation ModuleNameLoc); - + /// \brief Diagnose that \p New is a module-private redeclaration of /// \p Old. void diagnoseModulePrivateRedeclaration(NamedDecl *New, NamedDecl *Old, SourceLocation ModulePrivateKeyword = SourceLocation()); - + /// \brief Retrieve a suitable printing policy. PrintingPolicy getPrintingPolicy() const; @@ -1132,14 +1133,14 @@ public: Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, MultiTemplateParamsArg TemplateParams); - + StmtResult ActOnVlaStmt(const DeclSpec &DS); Decl *BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record); - Decl *BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, + Decl *BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record); bool isAcceptableTagRedeclaration(const TagDecl *Previous, @@ -1208,7 +1209,7 @@ public: bool CheckNontrivialField(FieldDecl *FD); void DiagnoseNontrivial(const RecordType* Record, CXXSpecialMember mem); CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD); - void ActOnLastBitfield(SourceLocation DeclStart, + void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl<Decl *> &AllIvarDecls); Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, @@ -1309,7 +1310,7 @@ public: /// /// \param Name The name of the externally-produced declaration. void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name); - + /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns /// true if 'D' belongs to the given declaration context. @@ -1363,7 +1364,7 @@ public: Ovl_NonFunction }; OverloadKind CheckOverload(Scope *S, - FunctionDecl *New, + FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl); @@ -1396,9 +1397,9 @@ public: QualType &ConvertedType); bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType& ConvertedType); - bool FunctionArgTypesAreEqual(const FunctionProtoType *OldType, + bool FunctionArgTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType); - + CastKind PrepareCastToObjCObjectPointer(ExprResult &E); bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, @@ -1438,7 +1439,7 @@ public: ExprResult PerformContextuallyConvertToBool(Expr *From); ExprResult PerformContextuallyConvertToObjCPointer(Expr *From); - ExprResult + ExprResult ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *FromE, const PartialDiagnostic &NotIntDiag, const PartialDiagnostic &IncompleteDiag, @@ -1447,7 +1448,7 @@ public: const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &AmbigNote, const PartialDiagnostic &ConvDiag); - + ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, @@ -1541,11 +1542,11 @@ public: // Emit as a 'note' the specific overload candidate void NoteOverloadCandidate(FunctionDecl *Fn); - + // Emit as a series of 'note's all template and non-templates // identified by the expression Expr void NoteAllOverloadCandidates(Expr* E); - + // [PossiblyAFunctionType] --> [Return] // NonFunctionType --> NonFunctionType // R (A) --> R(A) @@ -1554,7 +1555,8 @@ public: // R (S::*)(A) --> R (A) QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType); - FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, + FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, + QualType TargetType, bool Complain, DeclAccessPair &Found); @@ -1565,9 +1567,9 @@ public: bool ResolveAndFixSingleFunctionTemplateSpecialization( ExprResult &SrcExpr, bool DoFunctionPointerConverion = false, - bool Complain = false, - const SourceRange& OpRangeForComplaining = SourceRange(), - QualType DestTypeForComplaining = QualType(), + bool Complain = false, + const SourceRange& OpRangeForComplaining = SourceRange(), + QualType DestTypeForComplaining = QualType(), unsigned DiagIDForComplaining = 0); @@ -1730,7 +1732,7 @@ private: /// \brief Whether we have already loaded known namespaces from an extenal /// source. bool LoadedExternalKnownNamespaces; - + public: /// \brief Look up a name, looking for a single declaration. Return /// null if the results were absent, ambiguous, or overloaded. @@ -1782,7 +1784,7 @@ public: void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope = true); - + /// \brief The context in which typo-correction occurs. /// /// The typo-correction context affects which keywords (if any) are @@ -1860,7 +1862,7 @@ public: void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl); - + void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl); @@ -1876,7 +1878,7 @@ public: typedef llvm::DenseSet<Selector, llvm::DenseMapInfo<Selector> > SelectorSet; typedef llvm::DenseMap<Selector, ObjCMethodDecl*> ProtocolsMethodsMap; - + /// CheckProtocolMethodDefs - This routine checks unimplemented /// methods declared in protocol, and those referenced by it. /// \param IDecl - Used for checking for methods which may have been @@ -1906,18 +1908,18 @@ public: ObjCContainerDecl *CDecl, const SelectorSet &InsMap); - /// DefaultSynthesizeProperties - This routine default synthesizes all + /// DefaultSynthesizeProperties - This routine default synthesizes all /// properties which must be synthesized in class's @implementation. void DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl, ObjCInterfaceDecl *IDecl); void DefaultSynthesizeProperties(Scope *S, Decl *D); - + /// CollectImmediateProperties - This routine collects all properties in /// the class and its conforming protocols; but not those it its super class. void CollectImmediateProperties(ObjCContainerDecl *CDecl, llvm::DenseMap<IdentifierInfo *, ObjCPropertyDecl*>& PropMap, llvm::DenseMap<IdentifierInfo *, ObjCPropertyDecl*>& SuperPropMap); - + /// LookupPropertyDecl - Looks up a property in the current class and all /// its protocols. @@ -1990,7 +1992,7 @@ public: /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in /// category matches with those implemented in its primary class and - /// warns each time an exact match is found. + /// warns each time an exact match is found. void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP); private: @@ -2027,7 +2029,7 @@ public: ObjCMethodDecl *LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false, bool warn=true) { - return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass, + return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass, warn, /*instance*/true); } @@ -2055,7 +2057,7 @@ public: class FullExprArg { public: FullExprArg(Sema &actions) : E(0) { } - + // FIXME: The const_cast here is ugly. RValue references would make this // much nicer (or we could duplicate a bunch of the move semantics // emulation code from Ownership.h). @@ -2107,7 +2109,7 @@ public: Stmt *SubStmt, Scope *CurScope); StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt); - + StmtResult ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar, Stmt *ThenVal, @@ -2161,7 +2163,7 @@ public: const VarDecl *getCopyElisionCandidate(QualType ReturnType, Expr *E, bool AllowFunctionParameters); - + StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); StmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp); @@ -2230,7 +2232,7 @@ public: void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock); bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const; - + /// \brief If it's a file scoped decl that must warn if not used, keep track /// of it. void MarkUnusedFileScopedDecl(const DeclaratorDecl *D); @@ -2239,7 +2241,7 @@ public: /// whose result is unused, warn. void DiagnoseUnusedExprResult(const Stmt *S); void DiagnoseUnusedDecl(const NamedDecl *ND); - + ParsingDeclState PushParsingDeclaration() { return DelayedDiagnostics.pushParsingDecl(); } @@ -2256,7 +2258,7 @@ public: } void EmitDeprecationWarning(NamedDecl *D, StringRef Message, - SourceLocation Loc, + SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=0); void HandleDelayedDeprecationCheck(sema::DelayedDiagnostic &DD, Decl *Ctx); @@ -2310,7 +2312,7 @@ public: // Primary Expressions. SourceRange getExprRange(Expr *E) const; - + ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand); @@ -2558,7 +2560,7 @@ public: /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl); - + ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); // "({..})" @@ -2606,25 +2608,25 @@ public: enum IfExistsResult { /// \brief The symbol exists. IER_Exists, - + /// \brief The symbol does not exist. IER_DoesNotExist, - + /// \brief The name is a dependent name, so the results will differ /// from one instantiation to the next. IER_Dependent, - + /// \brief An error occurred. IER_Error }; - IfExistsResult - CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, + IfExistsResult + CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo); - IfExistsResult + IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, SourceLocation KeywordLoc, - bool IsIfExists, CXXScopeSpec &SS, + bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name); StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, @@ -2632,11 +2634,11 @@ public: NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested); - StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, + StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested); - + //===------------------------- "Block" Extension ------------------------===// /// ActOnBlockStart - This callback is invoked when a block literal is @@ -2657,12 +2659,12 @@ public: Scope *CurScope); //===---------------------------- OpenCL Features -----------------------===// - + /// __builtin_astype(...) ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, - SourceLocation BuiltinLoc, + SourceLocation BuiltinLoc, SourceLocation RParenLoc); - + //===---------------------------- C++ Features --------------------------===// // Act on C++ namespaces @@ -2784,7 +2786,7 @@ public: /// constructed variable. void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType); - /// \brief Helper class that collects exception specifications for + /// \brief Helper class that collects exception specifications for /// implicitly-declared special member functions. class ImplicitExceptionSpecification { // Pointer to allow copying @@ -2812,7 +2814,7 @@ public: } public: - explicit ImplicitExceptionSpecification(ASTContext &Context) + explicit ImplicitExceptionSpecification(ASTContext &Context) : Context(&Context), ComputedEST(EST_BasicNoexcept) { if (!Context.getLangOptions().CPlusPlus0x) ComputedEST = EST_DynamicNone; @@ -2901,13 +2903,13 @@ public: /// \brief Declare the implicit default constructor for the given class. /// - /// \param ClassDecl The class declaration into which the implicit + /// \param ClassDecl The class declaration into which the implicit /// default constructor will be added. /// /// \returns The implicitly-declared default constructor. CXXConstructorDecl *DeclareImplicitDefaultConstructor( CXXRecordDecl *ClassDecl); - + /// DefineImplicitDefaultConstructor - Checks for feasibility of /// defining this constructor as the default constructor. void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, @@ -2915,12 +2917,12 @@ public: /// \brief Declare the implicit destructor for the given class. /// - /// \param ClassDecl The class declaration into which the implicit + /// \param ClassDecl The class declaration into which the implicit /// destructor will be added. /// /// \returns The implicitly-declared destructor. CXXDestructorDecl *DeclareImplicitDestructor(CXXRecordDecl *ClassDecl); - + /// DefineImplicitDestructor - Checks for feasibility of /// defining this destructor as the default destructor. void DefineImplicitDestructor(SourceLocation CurrentLocation, @@ -2941,12 +2943,12 @@ public: /// \brief Declare the implicit copy constructor for the given class. /// - /// \param ClassDecl The class declaration into which the implicit + /// \param ClassDecl The class declaration into which the implicit /// copy constructor will be added. /// /// \returns The implicitly-declared copy constructor. CXXConstructorDecl *DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl); - + /// DefineImplicitCopyConstructor - Checks for feasibility of /// defining this constructor as the copy constructor. void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, @@ -2960,7 +2962,7 @@ public: /// \returns The implicitly-declared move constructor, or NULL if it wasn't /// declared. CXXConstructorDecl *DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl); - + /// DefineImplicitMoveConstructor - Checks for feasibility of /// defining this constructor as the move constructor. void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, @@ -2968,12 +2970,12 @@ public: /// \brief Declare the implicit copy assignment operator for the given class. /// - /// \param ClassDecl The class declaration into which the implicit + /// \param ClassDecl The class declaration into which the implicit /// copy assignment operator will be added. /// /// \returns The implicitly-declared copy assignment operator. CXXMethodDecl *DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl); - + /// \brief Defines an implicitly-declared copy assignment operator. void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl); @@ -2986,7 +2988,7 @@ public: /// \returns The implicitly-declared move assignment operator, or NULL if it /// wasn't declared. CXXMethodDecl *DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl); - + /// \brief Defines an implicitly-declared move assignment operator. void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl); @@ -2994,7 +2996,7 @@ public: /// \brief Force the declaration of any implicitly-declared members of this /// class. void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class); - + /// 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. @@ -3081,9 +3083,9 @@ public: //// ActOnCXXThrow - Parse throw expressions. ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr); - ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, + ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope); - ExprResult CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *E, + ExprResult CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *E, bool IsThrownVarInScope); /// ActOnCXXTypeConstructExpr - Parse construction of a specified type. @@ -3271,7 +3273,7 @@ public: /// \returns true if an error occurred, false otherwise. bool ActOnCXXGlobalScopeSpecifier(Scope *S, SourceLocation CCLoc, CXXScopeSpec &SS); - + bool isAcceptableNestedNameSpecifier(NamedDecl *SD); NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS); @@ -3300,7 +3302,7 @@ public: /// /// \param CCLoc The location of the '::'. /// - /// \param ObjectType The type of the object, if we're parsing + /// \param ObjectType The type of the object, if we're parsing /// nested-name-specifier in a member access expression. /// /// \param EnteringContext Whether we're entering the context nominated by @@ -3327,7 +3329,7 @@ public: ParsedType ObjectType, bool EnteringContext); - /// \brief The parser has parsed a nested-name-specifier + /// \brief The parser has parsed a nested-name-specifier /// 'template[opt] template-name < template-args >::'. /// /// \param S The scope in which this nested-name-specifier occurs. @@ -3338,7 +3340,7 @@ public: /// parameter (the nested-name-specifier before this type) and an /// output parameter (containing the full nested-name-specifier, /// including this new type). - /// + /// /// \param TemplateLoc the location of the 'template' keyword, if any. /// \param TemplateName The template name. /// \param TemplateNameLoc The location of the template name. @@ -3346,15 +3348,15 @@ public: /// \param TemplateArgs The template arguments. /// \param RAngleLoc The location of the closing angle bracket ('>'). /// \param CCLoc The location of the '::'. - - /// \param EnteringContext Whether we're entering the context of the + + /// \param EnteringContext Whether we're entering the context of the /// nested-name-specifier. /// /// /// \returns true if an error occurred, false otherwise. bool ActOnCXXNestedNameSpecifier(Scope *S, - SourceLocation TemplateLoc, - CXXScopeSpec &SS, + SourceLocation TemplateLoc, + CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, @@ -3364,29 +3366,29 @@ public: bool EnteringContext); /// \brief Given a C++ nested-name-specifier, produce an annotation value - /// that the parser can use later to reconstruct the given + /// that the parser can use later to reconstruct the given /// nested-name-specifier. /// /// \param SS A nested-name-specifier. /// - /// \returns A pointer containing all of the information in the + /// \returns A pointer containing all of the information in the /// nested-name-specifier \p SS. void *SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS); - - /// \brief Given an annotation pointer for a nested-name-specifier, restore + + /// \brief Given an annotation pointer for a nested-name-specifier, restore /// the nested-name-specifier structure. /// - /// \param Annotation The annotation pointer, produced by + /// \param Annotation The annotation pointer, produced by /// \c SaveNestedNameSpecifierAnnotation(). /// /// \param AnnotationRange The source range corresponding to the annotation. /// /// \param SS The nested-name-specifier that will be updated with the contents /// of the annotation pointer. - void RestoreNestedNameSpecifierAnnotation(void *Annotation, + void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS); - + bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS); /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global @@ -3528,9 +3530,9 @@ public: bool SetCtorInitializers(CXXConstructorDecl *Constructor, CXXCtorInitializer **Initializers, unsigned NumInitializers, bool AnyErrors); - + void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation); - + /// MarkBaseAndMemberDestructorsReferenced - Given a record decl, /// mark all the non-trivial destructors of its members and bases as @@ -3555,8 +3557,8 @@ public: /// \brief Load any externally-stored vtable uses. void LoadExternalVTableUses(); - - typedef LazyVector<CXXRecordDecl *, ExternalSemaSource, + + typedef LazyVector<CXXRecordDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDynamicClasses, 2, 2> DynamicClassesType; @@ -3652,7 +3654,7 @@ public: BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, - ParsedType basetype, + ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc); @@ -3702,7 +3704,7 @@ public: /// C++0x [class.virtual]p3. bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old); - + //===--------------------------------------------------------------------===// // C++ Access Control @@ -3771,7 +3773,7 @@ public: /// \brief When true, access checking violations are treated as SFINAE /// failures rather than hard errors. bool AccessCheckingSFINAE; - + void ActOnStartSuppressingAccessChecks(); void ActOnStopSuppressingAccessChecks(); @@ -3804,7 +3806,7 @@ public: // void FilterAcceptableTemplateNames(LookupResult &R); bool hasAnyAcceptableTemplateNames(LookupResult &R); - + void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization); @@ -3891,7 +3893,7 @@ public: IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, - AccessSpecifier AS, + AccessSpecifier AS, SourceLocation ModulePrivateLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists); @@ -3900,7 +3902,7 @@ public: TemplateArgumentListInfo &Out); void NoteAllFoundTemplates(TemplateName Name); - + QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs); @@ -3915,18 +3917,18 @@ public: /// \brief Parsed an elaborated-type-specifier that refers to a template-id, /// such as \c class T::template apply<U>. /// - /// \param TUK + /// \param TUK TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, - TemplateTy TemplateD, + TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc); - + ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, LookupResult &R, bool RequiresADL, @@ -4081,7 +4083,7 @@ public: ExprResult CheckTemplateArgument(NonTypeTemplateParmDecl *Param, QualType InstantiatedParamType, Expr *Arg, TemplateArgument &Converted, - CheckTemplateArgumentKind CTAK = CTAK_Specified); + CheckTemplateArgumentKind CTAK = CTAK_Specified); bool CheckTemplateArgument(TemplateTemplateParmDecl *Param, const TemplateArgumentLoc &Arg); @@ -4145,8 +4147,8 @@ public: /// \param II the identifier we're retrieving (e.g., 'type' in the example). /// \param IdLoc the location of the identifier. TypeResult - ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, - const CXXScopeSpec &SS, const IdentifierInfo &II, + ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, + const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc); /// \brief Called when the parser has parsed a C++ typename @@ -4163,9 +4165,9 @@ public: /// \param TemplateArgs The template arguments. /// \param RAngleLoc The location of the closing angle bracket ('>'). TypeResult - ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, - const CXXScopeSpec &SS, - SourceLocation TemplateLoc, + ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, + const CXXScopeSpec &SS, + SourceLocation TemplateLoc, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, @@ -4186,7 +4188,7 @@ public: ExprResult RebuildExprInCurrentInstantiation(Expr *E); bool RebuildTemplateParamsInCurrentInstantiation( TemplateParameterList *Params); - + std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args); @@ -4241,19 +4243,19 @@ public: /// \brief An initializer. UPPC_Initializer, - + /// \brief A default argument. UPPC_DefaultArgument, - + /// \brief The type of a non-type template parameter. UPPC_NonTypeTemplateParameterType, /// \brief The type of an exception. UPPC_ExceptionType, - + /// \brief Partial specialization. UPPC_PartialSpecialization, - + /// \brief Microsoft __if_exists. UPPC_IfExists, @@ -4265,7 +4267,7 @@ public: /// /// \param Loc The location at which we should emit the diagnostic. /// - /// \param UPPC The context in which we are diagnosing unexpanded + /// \param UPPC The context in which we are diagnosing unexpanded /// parameter packs. /// /// \param Unexpanded the set of unexpanded parameter packs. @@ -4320,7 +4322,7 @@ public: /// /// \param Loc The location of the template name. /// - /// \param Template The template name that is being checked for unexpanded + /// \param Template The template name that is being checked for unexpanded /// parameter packs. /// /// \returns true if an error occurred, false otherwise. @@ -4328,18 +4330,18 @@ public: TemplateName Template, UnexpandedParameterPackContext UPPC); - /// \brief If the given template argument contains an unexpanded parameter + /// \brief If the given template argument contains an unexpanded parameter /// pack, diagnose the error. /// - /// \param Arg The template argument that is being checked for unexpanded + /// \param Arg The template argument that is being checked for unexpanded /// parameter packs. /// /// \returns true if an error occurred, false otherwise. bool DiagnoseUnexpandedParameterPack(TemplateArgumentLoc Arg, UnexpandedParameterPackContext UPPC); - + /// \brief Collect the set of unexpanded parameter packs within the given - /// template argument. + /// template argument. /// /// \param Arg The template argument that will be traversed to find /// unexpanded parameter packs. @@ -4347,7 +4349,7 @@ public: SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); /// \brief Collect the set of unexpanded parameter packs within the given - /// template argument. + /// template argument. /// /// \param Arg The template argument that will be traversed to find /// unexpanded parameter packs. @@ -4355,7 +4357,7 @@ public: SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); /// \brief Collect the set of unexpanded parameter packs within the given - /// type. + /// type. /// /// \param T The type that will be traversed to find /// unexpanded parameter packs. @@ -4363,7 +4365,7 @@ public: SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); /// \brief Collect the set of unexpanded parameter packs within the given - /// type. + /// type. /// /// \param TL The type that will be traversed to find /// unexpanded parameter packs. @@ -4371,7 +4373,7 @@ public: SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); /// \brief Collect the set of unexpanded parameter packs within the given - /// nested-name-specifier. + /// nested-name-specifier. /// /// \param SS The nested-name-specifier that will be traversed to find /// unexpanded parameter packs. @@ -4379,7 +4381,7 @@ public: SmallVectorImpl<UnexpandedParameterPack> &Unexpanded); /// \brief Collect the set of unexpanded parameter packs within the given - /// name. + /// name. /// /// \param NameInfo The name that will be traversed to find /// unexpanded parameter packs. @@ -4447,7 +4449,7 @@ public: /// \param PatternRange The source range that covers the entire pattern of /// the pack expansion. /// - /// \param Unexpanded The set of unexpanded parameter packs within the + /// \param Unexpanded The set of unexpanded parameter packs within the /// pattern. /// /// \param NumUnexpanded The number of unexpanded parameter packs in @@ -4470,9 +4472,9 @@ public: /// The callee must set this value when \c ShouldExpand is \c true; it may /// set this value in other cases. /// - /// \returns true if an error occurred (e.g., because the parameter packs - /// are to be instantiated with arguments of different lengths), false - /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions) + /// \returns true if an error occurred (e.g., because the parameter packs + /// are to be instantiated with arguments of different lengths), false + /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions) /// must be set. bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, @@ -4488,9 +4490,9 @@ public: /// This routine already assumes that the pack expansion type can be /// expanded and that the number of arguments in the expansion is /// consistent across all of the unexpanded parameter packs in its pattern. - unsigned getNumArgumentsInExpansion(QualType T, + unsigned getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs); - + /// \brief Determine whether the given declarator contains any unexpanded /// parameter packs. /// @@ -4507,11 +4509,11 @@ public: /// \returns true if the declarator contains any unexpanded parameter packs, /// false otherwise. bool containsUnexpandedParameterPacks(Declarator &D); - + //===--------------------------------------------------------------------===// // C++ Template Argument Deduction (C++ [temp.deduct]) //===--------------------------------------------------------------------===// - + /// \brief Describes the result of template argument deduction. /// /// The TemplateDeductionResult enumeration describes the result of @@ -4573,20 +4575,20 @@ public: QualType *FunctionType, sema::TemplateDeductionInfo &Info); - /// brief A function argument from which we performed template argument + /// brief A function argument from which we performed template argument // deduction for a call. struct OriginalCallArg { OriginalCallArg(QualType OriginalParamType, unsigned ArgIdx, QualType OriginalArgType) - : OriginalParamType(OriginalParamType), ArgIdx(ArgIdx), + : OriginalParamType(OriginalParamType), ArgIdx(ArgIdx), OriginalArgType(OriginalArgType) { } - + QualType OriginalParamType; unsigned ArgIdx; QualType OriginalArgType; }; - + TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl<DeducedTemplateArgument> &Deduced, @@ -4705,8 +4707,8 @@ public: /// \brief The point of instantiation within the source code. SourceLocation PointOfInstantiation; - /// \brief The template (or partial specialization) in which we are - /// performing the instantiation, for substitutions of prior template + /// \brief The template (or partial specialization) in which we are + /// performing the instantiation, for substitutions of prior template /// arguments. NamedDecl *Template; @@ -4720,7 +4722,7 @@ public: /// \brief The number of template arguments in TemplateArgs. unsigned NumTemplateArgs; - /// \brief The template deduction info object associated with the + /// \brief The template deduction info object associated with the /// substitution or checking of explicit or deduced template arguments. sema::TemplateDeductionInfo *DeductionInfo; @@ -4788,7 +4790,7 @@ public: /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside /// of a template instantiation or template argument deduction. bool InNonInstantiationSFINAEContext; - + /// \brief The number of ActiveTemplateInstantiation entries in /// \c ActiveTemplateInstantiations that are not actual instantiations and, /// therefore, should not be counted as part of the instantiation depth. @@ -4806,7 +4808,7 @@ public: /// \brief The current index into pack expansion arguments that will be /// used for substitution of parameter packs. /// - /// The pack expansion index will be -1 to indicate that parameter packs + /// The pack expansion index will be -1 to indicate that parameter packs /// should be instantiated as themselves. Otherwise, the index specifies /// which argument within the parameter pack will be used for substitution. int ArgumentPackSubstitutionIndex; @@ -4818,26 +4820,26 @@ public: class ArgumentPackSubstitutionIndexRAII { Sema &Self; int OldSubstitutionIndex; - + public: ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex) : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) { Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex; } - + ~ArgumentPackSubstitutionIndexRAII() { Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex; } }; - + friend class ArgumentPackSubstitutionRAII; - + /// \brief The stack of calls expression undergoing template instantiation. /// /// The top of this stack is used by a fixit instantiating unresolved /// function calls to fix the AST to match the textual change it prints. SmallVector<CallExpr *, 8> CallsUndergoingInstantiation; - + /// \brief For each declaration that involved template argument deduction, the /// set of diagnostics that were suppressed during that template argument /// deduction. @@ -4845,7 +4847,7 @@ public: /// FIXME: Serialize this structure to the AST file. llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> > SuppressedDiagnostics; - + /// \brief A stack object to be created when performing template /// instantiation. /// @@ -4947,15 +4949,15 @@ public: }; void PrintInstantiationStack(); - + /// \brief Determines whether we are currently in a context where /// template argument substitution failures are not considered /// errors. /// /// \returns An empty \c llvm::Optional if we're not in a SFINAE context. - /// Otherwise, contains a pointer that, if non-NULL, contains the nearest - /// template-deduction context object, which can be used to capture - /// diagnostics that will be suppressed. + /// Otherwise, contains a pointer that, if non-NULL, contains the nearest + /// template-deduction context object, which can be used to capture + /// diagnostics that will be suppressed. llvm::Optional<sema::TemplateDeductionInfo *> isSFINAEContext() const; /// \brief RAII class used to determine whether SFINAE has @@ -4966,22 +4968,22 @@ public: unsigned PrevSFINAEErrors; bool PrevInNonInstantiationSFINAEContext; bool PrevAccessCheckingSFINAE; - + public: explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false) : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors), PrevInNonInstantiationSFINAEContext( SemaRef.InNonInstantiationSFINAEContext), PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE) - { + { if (!SemaRef.isSFINAEContext()) SemaRef.InNonInstantiationSFINAEContext = true; SemaRef.AccessCheckingSFINAE = AccessCheckingSFINAE; } - ~SFINAETrap() { - SemaRef.NumSFINAEErrors = PrevSFINAEErrors; - SemaRef.InNonInstantiationSFINAEContext + ~SFINAETrap() { + SemaRef.NumSFINAEErrors = PrevSFINAEErrors; + SemaRef.InNonInstantiationSFINAEContext = PrevInNonInstantiationSFINAEContext; SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE; } @@ -5001,7 +5003,7 @@ public: typedef llvm::DenseMap<IdentifierInfo *, TypoCorrection> UnqualifiedTyposCorrectedMap; - + /// \brief A cache containing the results of typo correction for unqualified /// name lookup. /// @@ -5009,7 +5011,7 @@ public: /// there was no correction), while the boolean will be true when the /// string represents a keyword. UnqualifiedTyposCorrectedMap UnqualifiedTyposCorrected; - + /// \brief Worker object for performing CFG-based warnings. sema::AnalysisBasedWarnings AnalysisWarnings; @@ -5058,14 +5060,14 @@ public: const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, llvm::Optional<unsigned> NumExpansions); - bool SubstParmTypes(SourceLocation Loc, + bool SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl<QualType> &ParamTypes, SmallVectorImpl<ParmVarDecl *> *OutParams = 0); ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs); - + /// \brief Substitute the given template arguments into a list of /// expressions, expanding pack expansions if required. /// @@ -5130,7 +5132,7 @@ public: SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs); TemplateName - SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, + SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs); bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, @@ -5239,7 +5241,7 @@ public: /// setters and getters as needed. /// \param property The property declaration being processed /// \param DC The semantic container for the property - /// \param redeclaredProperty Declaration for property if redeclared + /// \param redeclaredProperty Declaration for property if redeclared /// in class extension. /// \param lexicalDC Container for redeclaredProperty. void ProcessPropertyDecl(ObjCPropertyDecl *property, @@ -5334,7 +5336,7 @@ public: bool IsInstance); bool inferObjCARCLifetime(ValueDecl *decl); - + ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, @@ -5363,7 +5365,7 @@ public: /// name. ObjCClassMessage }; - + ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, @@ -5419,7 +5421,7 @@ public: SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr); - + ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, @@ -5427,19 +5429,19 @@ public: ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr); - + bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall); - + /// \brief Check whether the given new method is a valid override of the /// given overridden method, and set any properties that should be inherited. - void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, + void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden, bool IsImplementation); /// \brief Check whether the given method overrides any methods in its class, /// calling \c CheckObjCMethodOverride for each overridden method. bool CheckObjCMethodOverrides(ObjCMethodDecl *NewMethod, DeclContext *DC); - + enum PragmaOptionsAlignKind { POAK_Native, // #pragma options align=native POAK_Natural, // #pragma options align=natural @@ -5473,7 +5475,7 @@ public: SourceLocation PragmaLoc, SourceLocation LParenLoc, SourceLocation RParenLoc); - + /// ActOnPragmaMSStruct - Called on well formed #pragms ms_struct [on|off]. void ActOnPragmaMSStruct(PragmaMSStructKind Kind); @@ -5558,7 +5560,7 @@ public: ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK = VK_RValue, const CXXCastPath *BasePath = 0, - CheckedConversionKind CCK + CheckedConversionKind CCK = CCK_ImplicitConversion); /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding @@ -5652,9 +5654,9 @@ public: IncompatiblePointer, /// IncompatiblePointer - The assignment is between two pointers types which - /// point to integers which have a different sign, but are otherwise identical. - /// This is a subset of the above, but broken out because it's by far the most - /// common case of incompatible pointers. + /// point to integers which have a different sign, but are otherwise + /// identical. This is a subset of the above, but broken out because it's by + /// far the most common case of incompatible pointers. IncompatiblePointerSign, /// CompatiblePointerDiscardsQualifiers - The assignment discards @@ -5797,7 +5799,7 @@ public: BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS); ExprResult checkPseudoObjectRValue(Expr *E); - + QualType CheckConditionalOperands( // C99 6.5.15 ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc); @@ -5806,10 +5808,12 @@ public: ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool *NonStandardCompositeType = 0); - QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, + QualType FindCompositePointerType(SourceLocation Loc, + ExprResult &E1, ExprResult &E2, bool *NonStandardCompositeType = 0) { Expr *E1Tmp = E1.take(), *E2Tmp = E2.take(); - QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp, NonStandardCompositeType); + QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp, + NonStandardCompositeType); E1 = Owned(E1Tmp); E2 = Owned(E2Tmp); return Composite; @@ -5893,7 +5897,7 @@ public: Expr *stripARCUnbridgedCast(Expr *e); void diagnoseARCUnbridgedCast(Expr *e); - + bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType); @@ -5931,7 +5935,7 @@ public: /// \brief If the given expression involves a message send to a method /// with a related result type, emit a note describing what happened. void EmitRelatedResultTypeNote(const Expr *E); - + /// CheckBooleanCondition - Diagnose problems involving the use of /// the given expression as a boolean condition (e.g. in an if /// statement). Also performs the standard function and array @@ -5944,7 +5948,7 @@ public: ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc, Expr *SubExpr); - + /// DiagnoseAssignmentAsCondition - Given that an expression is /// being used as a boolean condition, warn if it's an assignment. void DiagnoseAssignmentAsCondition(Expr *E); @@ -6032,7 +6036,7 @@ public: /// \brief Code completion occurs within the condition of an if, /// while, switch, or for statement. PCC_Condition, - /// \brief Code completion occurs within the body of a function on a + /// \brief Code completion occurs within the body of a function on a /// recovery path, where we do not have a specific handle on our position /// in the grammar. PCC_RecoveryInFunction, @@ -6041,7 +6045,7 @@ public: /// \brief Code completion occurs in a parenthesized expression, which /// might also be a type cast. PCC_ParenthesizedExpression, - /// \brief Code completion occurs within a sequence of declaration + /// \brief Code completion occurs within a sequence of declaration /// specifiers within a function, method, or block. PCC_LocalDeclarationSpecifiers }; @@ -6051,9 +6055,9 @@ public: void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers); - + struct CodeCompleteExpressionData; - void CodeCompleteExpression(Scope *S, + void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data); void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, SourceLocation OpLoc, @@ -6067,7 +6071,7 @@ public: void CodeCompleteReturn(Scope *S); void CodeCompleteAfterIf(Scope *S); void CodeCompleteAssignmentRHS(Scope *S, Expr *LHS); - + void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext); void CodeCompleteUsing(Scope *S); @@ -6078,7 +6082,7 @@ public: void CodeCompleteConstructorInitializer(Decl *Constructor, CXXCtorInitializer** Initializers, unsigned NumInitializers); - + void CodeCompleteObjCAtDirective(Scope *S); void CodeCompleteObjCAtVisibility(Scope *S); void CodeCompleteObjCAtStatement(Scope *S); @@ -6086,7 +6090,7 @@ public: void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS); void CodeCompleteObjCPropertyGetter(Scope *S); void CodeCompleteObjCPropertySetter(Scope *S); - void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, + void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter); void CodeCompleteObjCMessageReceiver(Scope *S); void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, @@ -6103,7 +6107,7 @@ public: unsigned NumSelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super = 0); - void CodeCompleteObjCForCollection(Scope *S, + void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar); void CodeCompleteObjCSelector(Scope *S, IdentifierInfo **SelIdents, @@ -6128,7 +6132,7 @@ public: void CodeCompleteObjCMethodDecl(Scope *S, bool IsInstanceMethod, ParsedType ReturnType); - void CodeCompleteObjCMethodDeclSelector(Scope *S, + void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, @@ -6154,7 +6158,7 @@ public: SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const; -private: +private: void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr, bool isSubscript=false, bool AllowOnePastEnd=true); void CheckArrayAccess(const Expr *E); @@ -6216,7 +6220,7 @@ private: CMF_Strncat, CMF_Strndup }; - + void CheckMemaccessArguments(const CallExpr *Call, CheckedMemoryFunction CMF, IdentifierInfo *FnName); @@ -6235,13 +6239,13 @@ private: /// /// The parser maintains this state here. Scope *CurScope; - + protected: friend class Parser; - friend class InitializationSequence; + friend class InitializationSequence; friend class ASTReader; friend class ASTWriter; - + public: /// \brief Retrieve the parser's current scope. /// @@ -6252,7 +6256,7 @@ public: /// itself and in routines directly invoked from the parser and *never* from /// template substitution or instantiation. Scope *getCurScope() const { return CurScope; } - + Decl *getObjCDeclContext() const; DeclContext *getCurLexicalContext() const { diff --git a/include/clang/Sema/TemplateDeduction.h b/include/clang/Sema/TemplateDeduction.h index 690129ab34d..100d56ed331 100644 --- a/include/clang/Sema/TemplateDeduction.h +++ b/include/clang/Sema/TemplateDeduction.h @@ -23,7 +23,7 @@ class ASTContext; class TemplateArgumentList; namespace sema { - + /// \brief Provides information about an attempted template argument /// deduction, whose success or failure was described by a /// TemplateDeductionResult value. @@ -39,10 +39,10 @@ class TemplateDeductionInfo { /// deduction is occurring. SourceLocation Loc; - /// \brief Warnings (and follow-on notes) that were suppressed due to + /// \brief Warnings (and follow-on notes) that were suppressed due to /// SFINAE while performing template argument deduction. SmallVector<PartialDiagnosticAt, 4> SuppressedDiagnostics; - + // do not implement these TemplateDeductionInfo(const TemplateDeductionInfo&); TemplateDeductionInfo &operator=(const TemplateDeductionInfo&); @@ -75,23 +75,24 @@ public: Deduced = NewDeduced; } - /// \brief Add a new diagnostic to the set of diagnostics - void addSuppressedDiagnostic(SourceLocation Loc, const PartialDiagnostic &PD) { + /// \brief Add a new diagnostic to the set of diagnostics + void addSuppressedDiagnostic(SourceLocation Loc, + const PartialDiagnostic &PD) { SuppressedDiagnostics.push_back(std::make_pair(Loc, PD)); } - + /// \brief Iterator over the set of suppressed diagnostics. - typedef SmallVectorImpl<PartialDiagnosticAt>::const_iterator + typedef SmallVectorImpl<PartialDiagnosticAt>::const_iterator diag_iterator; - + /// \brief Returns an iterator at the beginning of the sequence of suppressed /// diagnostics. diag_iterator diag_begin() const { return SuppressedDiagnostics.begin(); } - + /// \brief Returns an iterator at the end of the sequence of suppressed /// diagnostics. diag_iterator diag_end() const { return SuppressedDiagnostics.end(); } - + /// \brief The template parameter to which a template argument /// deduction failure refers. /// diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index d10f9ba18f8..bef02f0d958 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -162,16 +162,16 @@ private: void Error(const char *Msg); }; -namespace serialization { +namespace serialization { class ReadMethodPoolVisitor; - + namespace reader { class ASTIdentifierLookupTrait; } - + } // end namespace serialization - + /// \brief Reads an AST files chain containing the contents of a translation /// unit. /// @@ -191,7 +191,7 @@ class ASTReader public ExternalSemaSource, public IdentifierInfoLookup, public ExternalIdentifierLookup, - public ExternalSLocEntrySource + public ExternalSLocEntrySource { public: enum ASTReadResult { Success, Failure, IgnorePCH }; @@ -205,11 +205,11 @@ public: friend class ASTWriter; friend class ASTUnit; // ASTUnit needs to remap source locations. friend class serialization::ReadMethodPoolVisitor; - + typedef serialization::Module Module; typedef serialization::ModuleKind ModuleKind; typedef serialization::ModuleManager ModuleManager; - + typedef ModuleManager::ModuleIterator ModuleIterator; typedef ModuleManager::ModuleConstIterator ModuleConstIterator; typedef ModuleManager::ModuleReverseIterator ModuleReverseIterator; @@ -224,7 +224,7 @@ private: SourceManager &SourceMgr; FileManager &FileMgr; DiagnosticsEngine &Diags; - + /// \brief The semantic analysis object that will be processing the /// AST files and the translation unit that uses it. Sema *SemaObj; @@ -234,7 +234,7 @@ private: /// \brief The AST context into which we'll read the AST files. ASTContext &Context; - + /// \brief The AST consumer. ASTConsumer *Consumer; @@ -249,11 +249,11 @@ private: ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocEntryMap; typedef ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocOffsetMapType; - + /// \brief A map of reversed (SourceManager::MaxLoadedOffset - SLocOffset) /// SourceLocation offsets to the modules containing them. GlobalSLocOffsetMapType GlobalSLocOffsetMap; - + /// \brief Types that have already been loaded from the chain. /// /// When the pointer at index I is non-NULL, the type with @@ -274,18 +274,18 @@ private: /// = I + 1 has already been loaded. std::vector<Decl *> DeclsLoaded; - typedef ContinuousRangeMap<serialization::DeclID, Module *, 4> + typedef ContinuousRangeMap<serialization::DeclID, Module *, 4> GlobalDeclMapType; - + /// \brief Mapping from global declaration IDs to the module in which the /// declaration resides. GlobalDeclMapType GlobalDeclMap; - + typedef std::pair<Module *, uint64_t> FileOffset; typedef SmallVector<FileOffset, 2> FileOffsetsTy; typedef llvm::DenseMap<serialization::DeclID, FileOffsetsTy> DeclUpdateOffsetsMap; - + /// \brief Declarations that have modifications residing in a later file /// in the chain. DeclUpdateOffsetsMap DeclUpdateOffsets; @@ -348,7 +348,7 @@ private: llvm::DenseSet<serialization::GlobalDeclID> ObjCChainedCategoriesInterfaces; /// \brief Read the records that describe the contents of declcontexts. - bool ReadDeclContextStorage(Module &M, + bool ReadDeclContextStorage(Module &M, llvm::BitstreamCursor &Cursor, const std::pair<uint64_t, uint64_t> &Offsets, serialization::DeclContextInfo &Info); @@ -361,9 +361,9 @@ private: /// been loaded. std::vector<IdentifierInfo *> IdentifiersLoaded; - typedef ContinuousRangeMap<serialization::IdentID, Module *, 4> + typedef ContinuousRangeMap<serialization::IdentID, Module *, 4> GlobalIdentifierMapType; - + /// \brief Mapping from global identifer IDs to the module in which the /// identifier resides along with the offset that should be added to the /// global identifier ID to produce a local ID. @@ -376,9 +376,9 @@ private: /// been loaded. SmallVector<Selector, 16> SelectorsLoaded; - typedef ContinuousRangeMap<serialization::SelectorID, Module *, 4> + typedef ContinuousRangeMap<serialization::SelectorID, Module *, 4> GlobalSelectorMapType; - + /// \brief Mapping from global selector IDs to the module in which the /// selector resides along with the offset that should be added to the /// global selector ID to produce a local ID. @@ -389,14 +389,14 @@ private: /// record resides. llvm::DenseMap<IdentifierInfo *, uint64_t> UnreadMacroRecordOffsets; - typedef ContinuousRangeMap<unsigned, Module *, 4> + typedef ContinuousRangeMap<unsigned, Module *, 4> GlobalPreprocessedEntityMapType; - + /// \brief Mapping from global preprocessing entity IDs to the module in /// which the preprocessed entity resides along with the offset that should be /// added to the global preprocessing entitiy ID to produce a local ID. GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap; - + /// \name CodeGen-relevant special data /// \brief Fields containing data that is relevant to CodeGen. //@{ @@ -444,7 +444,7 @@ private: /// \brief A list of all the delegating constructors we've seen, to diagnose /// cycles. SmallVector<uint64_t, 4> DelegatingCtorDecls; - + /// \brief Method selectors used in a @selector expression. Used for /// implementation of -Wselector. SmallVector<uint64_t, 64> ReferencedSelectorsData; @@ -514,7 +514,7 @@ private: /// \brief The file ID for the original file that was used to build the /// primary AST file. FileID OriginalFileID; - + /// \brief The directory that the PCH was originally created in. Used to /// allow resolving headers even after headers+PCH was moved to a new path. std::string OriginalDir; @@ -532,7 +532,7 @@ private: /// \brief Whether to disable the normal validation performed on precompiled /// headers when they are loaded. bool DisableValidation; - + /// \brief Whether to disable the use of stat caches in AST files. bool DisableStatCache; @@ -588,7 +588,7 @@ private: /// Number of visible decl contexts read/total. unsigned NumVisibleDeclContextsRead, TotalVisibleDeclContexts; - + /// Total size of modules, in bits, currently loaded uint64_t TotalModulesSizeInBits; @@ -635,7 +635,7 @@ private: Read_Decl, Read_Type, Read_Stmt }; - /// \brief What kind of records we are reading. + /// \brief What kind of records we are reading. ReadingKind ReadingKind; /// \brief RAII object to change the reading kind. @@ -705,7 +705,7 @@ private: void loadDeclUpdateRecords(serialization::DeclID ID, Decl *D); void loadObjCChainedCategories(serialization::GlobalDeclID ID, ObjCInterfaceDecl *D); - + RecordLocation getLocalBitOffset(uint64_t GlobalOffset); uint64_t getGlobalBitOffset(Module &M, uint32_t LocalOffset); @@ -713,7 +713,8 @@ private: serialization::PreprocessedEntityID findBeginPreprocessedEntity(SourceLocation BLoc) const; - /// \brief Returns the first preprocessed entity ID that begins after \arg ELoc. + /// \brief Returns the first preprocessed entity ID that begins after \arg + /// ELoc. serialization::PreprocessedEntityID findEndPreprocessedEntity(SourceLocation ELoc) const; @@ -773,7 +774,7 @@ public: ~ASTReader(); SourceManager &getSourceManager() const { return SourceMgr; } - + /// \brief Load the AST file designated by the given file name. ASTReadResult ReadAST(const std::string &FileName, ModuleKind Type); @@ -802,7 +803,7 @@ public: /// \brief Retrieve the preprocessor. Preprocessor &getPreprocessor() const { return PP; } - + /// \brief Retrieve the name of the original source file name const std::string &getOriginalSourceFile() { return OriginalFileName; } @@ -827,7 +828,7 @@ public: /// preprocessed entities that \arg Range encompasses. virtual std::pair<unsigned, unsigned> findPreprocessedEntitiesInRange(SourceRange Range); - + /// \brief Optionally returns true or false if the preallocated preprocessed /// entity with index \arg Index came from file \arg FID. virtual llvm::Optional<bool> isPreprocessedEntityInFileID(unsigned Index, @@ -871,15 +872,15 @@ public: E = ModuleMgr.end(); I != E; ++I) { Result += (*I)->NumPreprocessedEntities; } - + return Result; } - + /// \brief Returns the number of C++ base specifiers found in the chain. unsigned getTotalNumCXXBaseSpecifiers() const { return NumCXXBaseSpecifiersLoaded; } - + /// \brief Reads a TemplateArgumentLocInfo appropriate for the /// given TemplateArgument kind. TemplateArgumentLocInfo @@ -901,20 +902,20 @@ public: /// \brief Resolve a local type ID within a given AST file into a type. QualType getLocalType(Module &F, unsigned LocalID); - + /// \brief Map a local type ID within a given AST file into a global type ID. serialization::TypeID getGlobalTypeID(Module &F, unsigned LocalID) const; - - /// \brief Read a type from the current position in the given record, which + + /// \brief Read a type from the current position in the given record, which /// was read from the given AST file. QualType readType(Module &F, const RecordData &Record, unsigned &Idx) { if (Idx >= Record.size()) return QualType(); - + return getLocalType(F, Record[Idx++]); } - - /// \brief Map from a local declaration ID within a given module to a + + /// \brief Map from a local declaration ID within a given module to a /// global declaration ID. serialization::DeclID getGlobalDeclID(Module &F, unsigned LocalID) const; @@ -924,7 +925,7 @@ public: /// \brief Returns the source location for the decl \arg ID. SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID); - + /// \brief Resolve a declaration ID into a declaration, potentially /// building a new declaration. Decl *GetDecl(serialization::DeclID ID); @@ -943,19 +944,19 @@ public: return cast_or_null<T>(GetLocalDecl(F, LocalID)); } - /// \brief Reads a declaration ID from the given position in a record in the + /// \brief Reads a declaration ID from the given position in a record in the /// given module. /// /// \returns The declaration ID read from the record, adjusted to a global ID. serialization::DeclID ReadDeclID(Module &F, const RecordData &Record, unsigned &Idx); - + /// \brief Reads a declaration from the given position in a record in the /// given module. Decl *ReadDecl(Module &F, const RecordData &R, unsigned &I) { return GetDecl(ReadDeclID(F, R, I)); } - + /// \brief Reads a declaration from the given position in a record in the /// given module. /// @@ -968,11 +969,11 @@ public: /// \brief Read a CXXBaseSpecifiers ID form the given record and /// return its global bit offset. - uint64_t readCXXBaseSpecifiers(Module &M, const RecordData &Record, + uint64_t readCXXBaseSpecifiers(Module &M, const RecordData &Record, unsigned &Idx); - + virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset); - + /// \brief Resolve the offset of a statement into a statement. /// /// This operation will read a new statement from the external @@ -1011,7 +1012,7 @@ public: /// \brief Get the decls that are contained in a file in the Offset/Length /// range. \arg Length can be 0 to indicate a point at \arg Offset instead of - /// a range. + /// a range. virtual void FindFileRegionDecls(FileID File, unsigned Offset,unsigned Length, SmallVectorImpl<Decl *> &Decls); @@ -1036,7 +1037,7 @@ public: /// \brief Dump information about the AST reader to standard error. void dump(); - + /// Return the amount of memory used by memory buffers, breaking down /// by heap-backed versus mmap'ed memory. virtual void getMemoryBufferSizes(MemoryBufferSizes &sizes) const; @@ -1092,7 +1093,7 @@ public: virtual void ReadLocallyScopedExternalDecls( SmallVectorImpl<NamedDecl *> &Decls); - + virtual void ReadReferencedSelectors( SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels); @@ -1102,7 +1103,7 @@ public: virtual void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables); virtual void ReadPendingInstantiations( - SmallVectorImpl<std::pair<ValueDecl *, + SmallVectorImpl<std::pair<ValueDecl *, SourceLocation> > &Pending); /// \brief Load a selector from disk, registering its ID if it exists. @@ -1121,7 +1122,7 @@ public: IdentifierInfo *DecodeIdentifierInfo(serialization::IdentifierID ID); - IdentifierInfo *GetIdentifierInfo(Module &M, const RecordData &Record, + IdentifierInfo *GetIdentifierInfo(Module &M, const RecordData &Record, unsigned &Idx) { return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++])); } @@ -1131,10 +1132,10 @@ public: } IdentifierInfo *getLocalIdentifier(Module &M, unsigned LocalID); - - serialization::IdentifierID getGlobalIdentifierID(Module &M, + + serialization::IdentifierID getGlobalIdentifierID(Module &M, unsigned LocalID); - + /// \brief Read the source location entry with index ID. virtual bool ReadSLocEntry(int ID); @@ -1150,14 +1151,14 @@ public: Selector ReadSelector(Module &M, const RecordData &Record, unsigned &Idx) { return getLocalSelector(M, Record[Idx++]); } - + /// \brief Retrieve the global selector ID that corresponds to this /// the local selector ID in a given module. - serialization::SelectorID getGlobalSelectorID(Module &F, + serialization::SelectorID getGlobalSelectorID(Module &F, unsigned LocalID) const; /// \brief Read a declaration name. - DeclarationName ReadDeclarationName(Module &F, + DeclarationName ReadDeclarationName(Module &F, const RecordData &Record, unsigned &Idx); void ReadDeclarationNameLoc(Module &F, DeclarationNameLoc &DNLoc, DeclarationName Name, @@ -1172,23 +1173,23 @@ public: const RecordData &Record, unsigned &Idx); - NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(Module &F, + NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(Module &F, const RecordData &Record, unsigned &Idx); /// \brief Read a template name. - TemplateName ReadTemplateName(Module &F, const RecordData &Record, + TemplateName ReadTemplateName(Module &F, const RecordData &Record, unsigned &Idx); /// \brief Read a template argument. TemplateArgument ReadTemplateArgument(Module &F, const RecordData &Record,unsigned &Idx); - + /// \brief Read a template parameter list. TemplateParameterList *ReadTemplateParameterList(Module &F, const RecordData &Record, unsigned &Idx); - + /// \brief Read a template argument array. void ReadTemplateArgumentList(SmallVector<TemplateArgument, 8> &TemplArgs, @@ -1242,9 +1243,9 @@ public: /// \brief Read a version tuple. VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx); - CXXTemporary *ReadCXXTemporary(Module &F, const RecordData &Record, + CXXTemporary *ReadCXXTemporary(Module &F, const RecordData &Record, unsigned &Idx); - + /// \brief Reads attributes from the current stream position. void ReadAttributes(Module &F, AttrVec &Attrs, const RecordData &Record, unsigned &Idx); @@ -1270,17 +1271,17 @@ public: /// \brief Reads the macro record located at the given offset. void ReadMacroRecord(Module &F, uint64_t Offset); - + /// \brief Determine the global preprocessed entity ID that corresponds to /// the given local ID within the given module. - serialization::PreprocessedEntityID + serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(Module &M, unsigned LocalID) const; - + /// \brief Note that the identifier is a macro whose record will be loaded /// from the given AST file at the given (file-local) offset. void SetIdentifierIsMacro(IdentifierInfo *II, Module &F, uint64_t Offset); - + /// \brief Read the set of macros defined by this external macro source. virtual void ReadDefinedMacros(); @@ -1294,7 +1295,7 @@ public: /// into the unread macro record offsets table. void LoadMacroDefinition( llvm::DenseMap<IdentifierInfo *, uint64_t>::iterator Pos); - + /// \brief Retrieve the AST context that this AST reader supplements. ASTContext &getContext() { return Context; } diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 8c0ea4fc33c..f6a8812b206 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -84,7 +84,7 @@ private: /// allow for the const/volatile qualifiers. /// /// Keys in the map never have const/volatile qualifiers. - typedef llvm::DenseMap<QualType, serialization::TypeIdx, + typedef llvm::DenseMap<QualType, serialization::TypeIdx, serialization::UnsafeQualTypeDenseMapInfo> TypeIdxMap; @@ -93,33 +93,33 @@ private: /// \brief The ASTContext we're writing. ASTContext *Context; - + /// \brief The reader of existing AST files, if we're chaining. ASTReader *Chain; - - /// \brief Indicates when the AST writing is actively performing + + /// \brief Indicates when the AST writing is actively performing /// serialization, rather than just queueing updates. bool WritingAST; - + /// \brief Stores a declaration or a type to be written to the AST file. class DeclOrType { public: DeclOrType(Decl *D) : Stored(D), IsType(false) { } DeclOrType(QualType T) : Stored(T.getAsOpaquePtr()), IsType(true) { } - + bool isType() const { return IsType; } bool isDecl() const { return !IsType; } - + QualType getType() const { assert(isType() && "Not a type!"); return QualType::getFromOpaquePtr(Stored); } - + Decl *getDecl() const { assert(isDecl() && "Not a decl!"); return static_cast<Decl *>(Stored); } - + private: void *Stored; bool IsType; @@ -215,7 +215,7 @@ private: /// \brief Offset of each selector within the method pool/selector /// table, indexed by the Selector ID (-1). std::vector<uint32_t> SelectorOffsets; - + /// \brief Offsets of each of the macro identifiers into the /// bitstream. /// @@ -226,7 +226,7 @@ private: /// \brief The set of identifiers that had macro definitions at some point. std::vector<const IdentifierInfo *> DeserializedMacroNames; - + /// \brief Mapping from macro definitions (as they occur in the preprocessing /// record) to the macro IDs. llvm::DenseMap<const MacroDefinition *, serialization::PreprocessedEntityID> @@ -242,7 +242,7 @@ private: /// \brief Map of first declarations from a chained PCH that point to the /// most recent declarations in another PCH. FirstLatestDeclMap FirstLatestDecls; - + /// \brief Declarations encountered that might be external /// definitions. /// @@ -260,9 +260,10 @@ private: /// \brief DeclContexts that have received extensions since their serialized /// form. /// - /// For namespaces, when we're chaining and encountering a namespace, we check if - /// its primary namespace comes from the chain. If it does, we add the primary - /// to this set, so that we can write out lexical content updates for it. + /// For namespaces, when we're chaining and encountering a namespace, we check + /// if its primary namespace comes from the chain. If it does, we add the + /// primary to this set, so that we can write out lexical content updates for + /// it. llvm::SmallPtrSet<const DeclContext *, 16> UpdatedDeclContexts; typedef llvm::SmallPtrSet<const Decl *, 16> DeclsToRewriteTy; @@ -275,10 +276,10 @@ private: /// \brief The local tail category ID that got chained to the imported /// interface. const ObjCCategoryDecl *TailCategory; - + /// \brief ID corresponding to \c Interface. serialization::DeclID InterfaceID; - + /// \brief ID corresponding to TailCategoryID. serialization::DeclID TailCategoryID; }; @@ -310,7 +311,7 @@ private: SmallVector<Stmt *, 16> StmtsToEmit; /// \brief Statements collection to use for ASTWriter::AddStmt(). - /// It will point to StmtsToEmit unless it is overriden. + /// It will point to StmtsToEmit unless it is overriden. SmallVector<Stmt *, 16> *CollectedStmts; /// \brief Mapping from SwitchCase statements to IDs. @@ -335,33 +336,33 @@ private: /// \brief The offset of each CXXBaseSpecifier set within the AST. SmallVector<uint32_t, 4> CXXBaseSpecifiersOffsets; - + /// \brief The first ID number we can use for our own base specifiers. serialization::CXXBaseSpecifiersID FirstCXXBaseSpecifiersID; - - /// \brief The base specifiers ID that will be assigned to the next new + + /// \brief The base specifiers ID that will be assigned to the next new /// set of C++ base specifiers. serialization::CXXBaseSpecifiersID NextCXXBaseSpecifiersID; - /// \brief A set of C++ base specifiers that is queued to be written into the - /// AST file. + /// \brief A set of C++ base specifiers that is queued to be written into the + /// AST file. struct QueuedCXXBaseSpecifiers { QueuedCXXBaseSpecifiers() : ID(), Bases(), BasesEnd() { } - + QueuedCXXBaseSpecifiers(serialization::CXXBaseSpecifiersID ID, CXXBaseSpecifier const *Bases, CXXBaseSpecifier const *BasesEnd) : ID(ID), Bases(Bases), BasesEnd(BasesEnd) { } - + serialization::CXXBaseSpecifiersID ID; CXXBaseSpecifier const * Bases; CXXBaseSpecifier const * BasesEnd; }; - + /// \brief Queue of C++ base specifiers to be written to the AST file, /// in the order they should be written. SmallVector<QueuedCXXBaseSpecifiers, 2> CXXBaseSpecifiersToWrite; - + /// \brief Write the given subexpression to the bitstream. void WriteSubStmt(Stmt *S, llvm::DenseMap<Stmt *, uint64_t> &SubStmtEntries, @@ -419,13 +420,13 @@ private: void WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, StringRef isysroot, const std::string &OutputFile, bool IsModule); - + public: /// \brief Create a new precompiled header writer that outputs to /// the given bitstream. ASTWriter(llvm::BitstreamWriter &Stream); ~ASTWriter(); - + /// \brief Write a precompiled header for the given semantic analysis. /// /// \param SemaRef a reference to the semantic analysis object that processed @@ -448,7 +449,7 @@ public: /// \brief Emit a source range. void AddSourceRange(SourceRange Range, RecordDataImpl &Record); - + /// \brief Emit an integral value. void AddAPInt(const llvm::APInt &Value, RecordDataImpl &Record); @@ -471,10 +472,10 @@ public: void AddCXXBaseSpecifiersRef(CXXBaseSpecifier const *Bases, CXXBaseSpecifier const *BasesEnd, RecordDataImpl &Record); - + /// \brief Get the unique number used to refer to the given selector. serialization::SelectorID getSelectorRef(Selector Sel); - + /// \brief Get the unique number used to refer to the given identifier. serialization::IdentID getIdentifierRef(const IdentifierInfo *II); @@ -487,7 +488,7 @@ public: "Identifier does not name a macro"); return MacroOffsets[II]; } - + /// \brief Emit a reference to a type. void AddTypeRef(QualType T, RecordDataImpl &Record); @@ -521,7 +522,7 @@ public: /// \brief Emit a reference to a declaration. void AddDeclRef(const Decl *D, RecordDataImpl &Record); - + /// \brief Force a declaration to be emitted and get its ID. serialization::DeclID GetDeclRef(const Decl *D); @@ -542,9 +543,9 @@ public: void AddNestedNameSpecifier(NestedNameSpecifier *NNS, RecordDataImpl &Record); /// \brief Emit a nested name specifier with source-location information. - void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, + void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, RecordDataImpl &Record); - + /// \brief Emit a template name. void AddTemplateName(TemplateName Name, RecordDataImpl &Record); @@ -563,7 +564,8 @@ public: void AddUnresolvedSet(const UnresolvedSetImpl &Set, RecordDataImpl &Record); /// \brief Emit a C++ base specifier. - void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base, RecordDataImpl &Record); + void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base, + RecordDataImpl &Record); /// \brief Emit a CXXCtorInitializer array. void AddCXXCtorInitializers( @@ -614,10 +616,10 @@ public: /// been added to the queue via AddStmt(). void FlushStmts(); - /// \brief Flush all of the C++ base specifier sets that have been added + /// \brief Flush all of the C++ base specifier sets that have been added /// via \c AddCXXBaseSpecifiersRef(). void FlushCXXBaseSpecifiers(); - + /// \brief Record an ID for the given switch-case statement. unsigned RecordSwitchCaseID(SwitchCase *S); @@ -684,7 +686,7 @@ protected: const ASTWriter &getWriter() const { return Writer; } public: - PCHGenerator(const Preprocessor &PP, StringRef OutputFile, + PCHGenerator(const Preprocessor &PP, StringRef OutputFile, bool IsModule, StringRef isysroot, raw_ostream *Out); ~PCHGenerator(); diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h index 43687f46dde..ca2046bf27a 100644 --- a/include/clang/Serialization/Module.h +++ b/include/clang/Serialization/Module.h @@ -23,12 +23,12 @@ #include "llvm/Bitcode/BitstreamReader.h" #include <string> -namespace clang { +namespace clang { class DeclContext; - + namespace serialization { - + /// \brief Specifies the kind of module that has been loaded. enum ModuleKind { MK_Module, ///< File is a module proper. @@ -39,9 +39,9 @@ enum ModuleKind { /// \brief Information about the contents of a DeclContext. struct DeclContextInfo { - DeclContextInfo() + DeclContextInfo() : NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {} - + void *NameLookupTableData; // an ASTDeclContextNameLookupTable. const KindDeclIDPair *LexicalDecls; unsigned NumLexicalDecls; @@ -49,216 +49,216 @@ struct DeclContextInfo { /// \brief Information about a module that has been loaded by the ASTReader. /// -/// Each instance of the Module class corresponds to a single AST file, which -/// may be a precompiled header, precompiled preamble, a module, or an AST file -/// of some sort loaded as the main file, all of which are specific formulations of -/// the general notion of a "module". A module may depend on any number of +/// Each instance of the Module class corresponds to a single AST file, which +/// may be a precompiled header, precompiled preamble, a module, or an AST file +/// of some sort loaded as the main file, all of which are specific formulations +/// of the general notion of a "module". A module may depend on any number of /// other modules. class Module { -public: +public: Module(ModuleKind Kind); ~Module(); - + // === General information === - + /// \brief The type of this module. ModuleKind Kind; - + /// \brief The file name of the module file. std::string FileName; - + /// \brief Whether this module has been directly imported by the /// user. bool DirectlyImported; - + /// \brief The memory buffer that stores the data associated with /// this AST file. llvm::OwningPtr<llvm::MemoryBuffer> Buffer; - + /// \brief The size of this file, in bits. uint64_t SizeInBits; - + /// \brief The global bit offset (or base) of this module uint64_t GlobalBitOffset; - + /// \brief The bitstream reader from which we'll read the AST file. llvm::BitstreamReader StreamFile; - + /// \brief The main bitstream cursor for the main block. llvm::BitstreamCursor Stream; - + /// \brief The source location where this module was first imported. SourceLocation ImportLoc; - + /// \brief The first source location in this module. SourceLocation FirstLoc; - + // === Source Locations === - + /// \brief Cursor used to read source location entries. llvm::BitstreamCursor SLocEntryCursor; - + /// \brief The number of source location entries in this AST file. unsigned LocalNumSLocEntries; - + /// \brief The base ID in the source manager's view of this module. int SLocEntryBaseID; - + /// \brief The base offset in the source manager's view of this module. unsigned SLocEntryBaseOffset; - + /// \brief Offsets for all of the source location entries in the /// AST file. const uint32_t *SLocEntryOffsets; - + /// \brief SLocEntries that we're going to preload. SmallVector<uint64_t, 4> PreloadSLocEntries; /// \brief The number of source location file entries in this AST file. unsigned LocalNumSLocFileEntries; - + /// \brief Offsets for all of the source location file entries in the /// AST file. const uint32_t *SLocFileOffsets; - + /// \brief Remapping table for source locations in this module. ContinuousRangeMap<uint32_t, int, 2> SLocRemap; - + // === Identifiers === - + /// \brief The number of identifiers in this AST file. unsigned LocalNumIdentifiers; - + /// \brief Offsets into the identifier table data. /// /// This array is indexed by the identifier ID (-1), and provides /// the offset into IdentifierTableData where the string data is /// stored. const uint32_t *IdentifierOffsets; - + /// \brief Base identifier ID for identifiers local to this module. serialization::IdentID BaseIdentifierID; - + /// \brief Remapping table for identifier IDs in this module. ContinuousRangeMap<uint32_t, int, 2> IdentifierRemap; - + /// \brief Actual data for the on-disk hash table of identifiers. /// /// This pointer points into a memory buffer, where the on-disk hash /// table for identifiers actually lives. const char *IdentifierTableData; - + /// \brief A pointer to an on-disk hash table of opaque type /// IdentifierHashTable. void *IdentifierLookupTable; - + // === Macros === - + /// \brief The cursor to the start of the preprocessor block, which stores /// all of the macro definitions. llvm::BitstreamCursor MacroCursor; - + /// \brief The offset of the start of the set of defined macros. uint64_t MacroStartOffset; - + // === Detailed PreprocessingRecord === - - /// \brief The cursor to the start of the (optional) detailed preprocessing + + /// \brief The cursor to the start of the (optional) detailed preprocessing /// record block. llvm::BitstreamCursor PreprocessorDetailCursor; - + /// \brief The offset of the start of the preprocessor detail cursor. uint64_t PreprocessorDetailStartOffset; - - /// \brief Base preprocessed entity ID for preprocessed entities local to + + /// \brief Base preprocessed entity ID for preprocessed entities local to /// this module. serialization::PreprocessedEntityID BasePreprocessedEntityID; - + /// \brief Remapping table for preprocessed entity IDs in this module. ContinuousRangeMap<uint32_t, int, 2> PreprocessedEntityRemap; - + const PPEntityOffset *PreprocessedEntityOffsets; unsigned NumPreprocessedEntities; - + // === Header search information === - + /// \brief The number of local HeaderFileInfo structures. unsigned LocalNumHeaderFileInfos; - - /// \brief Actual data for the on-disk hash table of header file + + /// \brief Actual data for the on-disk hash table of header file /// information. /// /// This pointer points into a memory buffer, where the on-disk hash /// table for header file information actually lives. const char *HeaderFileInfoTableData; - + /// \brief The on-disk hash table that contains information about each of /// the header files. void *HeaderFileInfoTable; - + /// \brief Actual data for the list of framework names used in the header /// search information. const char *HeaderFileFrameworkStrings; - + // === Selectors === - + /// \brief The number of selectors new to this file. /// /// This is the number of entries in SelectorOffsets. unsigned LocalNumSelectors; - + /// \brief Offsets into the selector lookup table's data array /// where each selector resides. const uint32_t *SelectorOffsets; - + /// \brief Base selector ID for selectors local to this module. serialization::SelectorID BaseSelectorID; - + /// \brief Remapping table for selector IDs in this module. ContinuousRangeMap<uint32_t, int, 2> SelectorRemap; - + /// \brief A pointer to the character data that comprises the selector table /// /// The SelectorOffsets table refers into this memory. const unsigned char *SelectorLookupTableData; - + /// \brief A pointer to an on-disk hash table of opaque type /// ASTSelectorLookupTable. /// /// This hash table provides the IDs of all selectors, and the associated /// instance and factory methods. void *SelectorLookupTable; - + // === Declarations === - + /// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It /// has read all the abbreviations at the start of the block and is ready to /// jump around with these in context. llvm::BitstreamCursor DeclsCursor; - + /// \brief The number of declarations in this AST file. unsigned LocalNumDecls; - + /// \brief Offset of each declaration within the bitstream, indexed /// by the declaration ID (-1). const DeclOffset *DeclOffsets; - + /// \brief Base declaration ID for declarations local to this module. serialization::DeclID BaseDeclID; - + /// \brief Remapping table for declaration IDs in this module. ContinuousRangeMap<uint32_t, int, 2> DeclRemap; - + /// \brief The number of C++ base specifier sets in this AST file. unsigned LocalNumCXXBaseSpecifiers; - + /// \brief Offset of each C++ base specifier set within the bitstream, /// indexed by the C++ base specifier set ID (-1). const uint32_t *CXXBaseSpecifiersOffsets; - + typedef llvm::DenseMap<const DeclContext *, DeclContextInfo> DeclContextInfosMap; - + /// \brief Information about the lexical and visible declarations /// for each DeclContext. DeclContextInfosMap DeclContextInfos; @@ -274,43 +274,43 @@ public: /// \brief Array of file-level DeclIDs sorted by file. const serialization::DeclID *FileSortedDecls; - + // === Types === - + /// \brief The number of types in this AST file. unsigned LocalNumTypes; - + /// \brief Offset of each type within the bitstream, indexed by the /// type ID, or the representation of a Type*. const uint32_t *TypeOffsets; - - /// \brief Base type ID for types local to this module as represented in + + /// \brief Base type ID for types local to this module as represented in /// the global type ID space. serialization::TypeID BaseTypeIndex; - + /// \brief Remapping table for type IDs in this module. ContinuousRangeMap<uint32_t, int, 2> TypeRemap; - + // === Miscellaneous === - + /// \brief Diagnostic IDs and their mappings that the user changed. SmallVector<uint64_t, 8> PragmaDiagMappings; - + /// \brief The AST stat cache installed for this file, if any. /// /// The dynamic type of this stat cache is always ASTStatCache void *StatCache; - + /// \brief List of modules which depend on this module llvm::SetVector<Module *> ImportedBy; - + /// \brief List of modules which this module depends on llvm::SetVector<Module *> Imports; - + /// \brief Determine whether this module was directly imported at /// any point during translation. bool isDirectlyImported() const { return DirectlyImported; } - + /// \brief Dump debugging output for this module. void dump(); }; -- GitLab