Date: Mon, 22 Jun 2009 08:08:36 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r194613 - in vendor/clang/dist: . include/clang/AST include/clang/Analysis/PathSensitive include/clang/Basic include/clang/Driver include/clang/Frontend include/clang/Parse lib/AST lib/... Message-ID: <200906220808.n5M88ahv031412@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Mon Jun 22 08:08:35 2009 New Revision: 194613 URL: http://svn.freebsd.org/changeset/base/194613 Log: Update Clang sources to r73879. Added: vendor/clang/dist/include/clang/AST/TypeVisitor.h vendor/clang/dist/include/clang/Frontend/ASTUnit.h vendor/clang/dist/include/clang/Frontend/DeclContextXML.def vendor/clang/dist/include/clang/Frontend/DeclXML.def vendor/clang/dist/include/clang/Frontend/DocumentXML.def vendor/clang/dist/include/clang/Frontend/StmtXML.def vendor/clang/dist/include/clang/Frontend/TypeXML.def vendor/clang/dist/lib/Frontend/ASTUnit.cpp vendor/clang/dist/lib/Frontend/DeclXML.cpp vendor/clang/dist/lib/Frontend/TypeXML.cpp vendor/clang/dist/test/Analysis/elementtype.c vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp vendor/clang/dist/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp vendor/clang/dist/test/CodeGen/2009-06-14-anonymous-union-init.c vendor/clang/dist/test/CodeGen/2009-06-16-inc_test.c vendor/clang/dist/test/CodeGen/2009-06-16-test.c vendor/clang/dist/test/CodeGen/call-knr-indirect.c vendor/clang/dist/test/CodeGenCXX/default-arg-temps.cpp vendor/clang/dist/test/Driver/default-toolchain.c vendor/clang/dist/test/Lexer/token-concat-2.c vendor/clang/dist/test/Parser/cxx-using-declaration.cpp vendor/clang/dist/test/Parser/namespace-alias-attr.cpp vendor/clang/dist/test/Preprocessor/_Pragma-dependency2.c vendor/clang/dist/test/Preprocessor/pragma_sysheader.c vendor/clang/dist/test/Preprocessor/pragma_sysheader.h vendor/clang/dist/test/Preprocessor/print_line_count.c vendor/clang/dist/test/Sema/warn-unused-parameters.c vendor/clang/dist/test/SemaCXX/default-constructor-initializers.cpp vendor/clang/dist/test/SemaObjC/undeclared-selector.m vendor/clang/dist/test/SemaObjC/warn-unused-parameters.m vendor/clang/dist/test/SemaTemplate/ext-vector-type.cpp Deleted: vendor/clang/dist/test/Preprocessor/_Pragma-syshdr2.c Modified: vendor/clang/dist/CMakeLists.txt vendor/clang/dist/include/clang/AST/ASTContext.h vendor/clang/dist/include/clang/AST/Decl.h vendor/clang/dist/include/clang/AST/DeclBase.h vendor/clang/dist/include/clang/AST/DeclCXX.h vendor/clang/dist/include/clang/AST/DeclNodes.def vendor/clang/dist/include/clang/AST/DeclTemplate.h vendor/clang/dist/include/clang/AST/Expr.h vendor/clang/dist/include/clang/AST/ExprCXX.h vendor/clang/dist/include/clang/AST/ExprObjC.h vendor/clang/dist/include/clang/AST/Type.h vendor/clang/dist/include/clang/AST/TypeNodes.def vendor/clang/dist/include/clang/Analysis/PathSensitive/ConstraintManager.h vendor/clang/dist/include/clang/Analysis/PathSensitive/Environment.h vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngine.h vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngineBuilders.h vendor/clang/dist/include/clang/Analysis/PathSensitive/GRState.h vendor/clang/dist/include/clang/Analysis/PathSensitive/GRTransferFuncs.h vendor/clang/dist/include/clang/Analysis/PathSensitive/MemRegion.h vendor/clang/dist/include/clang/Analysis/PathSensitive/SVals.h vendor/clang/dist/include/clang/Analysis/PathSensitive/Store.h vendor/clang/dist/include/clang/Analysis/PathSensitive/SymbolManager.h vendor/clang/dist/include/clang/Analysis/PathSensitive/ValueManager.h vendor/clang/dist/include/clang/Basic/Builtins.h vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/SourceLocation.h vendor/clang/dist/include/clang/Basic/SourceManager.h vendor/clang/dist/include/clang/Driver/Options.def vendor/clang/dist/include/clang/Driver/ToolChain.h vendor/clang/dist/include/clang/Frontend/DocumentXML.h vendor/clang/dist/include/clang/Frontend/PCHBitCodes.h vendor/clang/dist/include/clang/Frontend/PCHReader.h vendor/clang/dist/include/clang/Parse/Action.h vendor/clang/dist/include/clang/Parse/Parser.h vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclBase.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/DeclTemplate.cpp vendor/clang/dist/lib/AST/Expr.cpp vendor/clang/dist/lib/AST/ExprCXX.cpp vendor/clang/dist/lib/AST/StmtPrinter.cpp vendor/clang/dist/lib/AST/Type.cpp vendor/clang/dist/lib/Analysis/BasicConstraintManager.cpp vendor/clang/dist/lib/Analysis/BasicObjCFoundationChecks.cpp vendor/clang/dist/lib/Analysis/BasicObjCFoundationChecks.h vendor/clang/dist/lib/Analysis/BasicStore.cpp vendor/clang/dist/lib/Analysis/BugReporter.cpp vendor/clang/dist/lib/Analysis/CFRefCount.cpp vendor/clang/dist/lib/Analysis/CheckDeadStores.cpp vendor/clang/dist/lib/Analysis/CheckNSError.cpp vendor/clang/dist/lib/Analysis/CheckObjCDealloc.cpp vendor/clang/dist/lib/Analysis/CheckObjCUnusedIVars.cpp vendor/clang/dist/lib/Analysis/Environment.cpp vendor/clang/dist/lib/Analysis/GRExprEngine.cpp vendor/clang/dist/lib/Analysis/GRExprEngineInternalChecks.cpp vendor/clang/dist/lib/Analysis/GRSimpleVals.cpp vendor/clang/dist/lib/Analysis/GRState.cpp vendor/clang/dist/lib/Analysis/GRTransferFuncs.cpp vendor/clang/dist/lib/Analysis/MemRegion.cpp vendor/clang/dist/lib/Analysis/RangeConstraintManager.cpp vendor/clang/dist/lib/Analysis/RegionStore.cpp vendor/clang/dist/lib/Analysis/SVals.cpp vendor/clang/dist/lib/Analysis/SimpleConstraintManager.cpp vendor/clang/dist/lib/Analysis/SimpleConstraintManager.h vendor/clang/dist/lib/Analysis/Store.cpp vendor/clang/dist/lib/Analysis/SymbolManager.cpp vendor/clang/dist/lib/Basic/Builtins.cpp vendor/clang/dist/lib/Basic/Diagnostic.cpp vendor/clang/dist/lib/Basic/SourceManager.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/CodeGen/CGCXXTemp.cpp vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.h vendor/clang/dist/lib/CodeGen/CGDecl.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGExprComplex.cpp vendor/clang/dist/lib/CodeGen/CGExprConstant.cpp vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp vendor/clang/dist/lib/CodeGen/CGObjC.cpp vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenTypes.cpp vendor/clang/dist/lib/CodeGen/Mangle.cpp vendor/clang/dist/lib/Driver/CMakeLists.txt vendor/clang/dist/lib/Driver/Driver.cpp vendor/clang/dist/lib/Driver/HostInfo.cpp vendor/clang/dist/lib/Frontend/ASTConsumers.cpp vendor/clang/dist/lib/Frontend/CMakeLists.txt vendor/clang/dist/lib/Frontend/DocumentXML.cpp vendor/clang/dist/lib/Frontend/InitHeaderSearch.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Frontend/PCHReader.cpp vendor/clang/dist/lib/Frontend/PCHReaderDecl.cpp vendor/clang/dist/lib/Frontend/PCHReaderStmt.cpp vendor/clang/dist/lib/Frontend/PCHWriter.cpp vendor/clang/dist/lib/Frontend/PCHWriterDecl.cpp vendor/clang/dist/lib/Frontend/PCHWriterStmt.cpp vendor/clang/dist/lib/Frontend/PrintPreprocessedOutput.cpp vendor/clang/dist/lib/Frontend/RewriteBlocks.cpp vendor/clang/dist/lib/Frontend/RewriteObjC.cpp vendor/clang/dist/lib/Frontend/StmtXML.cpp vendor/clang/dist/lib/Frontend/TextDiagnosticPrinter.cpp vendor/clang/dist/lib/Headers/CMakeLists.txt vendor/clang/dist/lib/Lex/HeaderSearch.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Lex/Preprocessor.cpp vendor/clang/dist/lib/Lex/TokenConcatenation.cpp vendor/clang/dist/lib/Parse/MinimalAction.cpp vendor/clang/dist/lib/Parse/ParseDecl.cpp vendor/clang/dist/lib/Parse/ParseDeclCXX.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/ParseExprCXX.cpp vendor/clang/dist/lib/Sema/JumpDiagnostics.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/Sema.h vendor/clang/dist/lib/Sema/SemaAttr.cpp vendor/clang/dist/lib/Sema/SemaCXXScopeSpec.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaDeclObjC.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/SemaExprObjC.cpp vendor/clang/dist/lib/Sema/SemaLookup.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaStmt.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/lib/Sema/SemaTemplateDeduction.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiate.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiateExpr.cpp vendor/clang/dist/lib/Sema/SemaType.cpp vendor/clang/dist/test/Analysis/casts.c vendor/clang/dist/test/Analysis/fields.c vendor/clang/dist/test/Analysis/func.c vendor/clang/dist/test/Analysis/retain-release.m vendor/clang/dist/test/CMakeLists.txt vendor/clang/dist/test/CodeGen/2009-05-22-callingconv.c vendor/clang/dist/test/CodeGen/libcalls.c vendor/clang/dist/test/CodeGenObjC/encode-test-5.m vendor/clang/dist/test/Driver/analyze.c vendor/clang/dist/test/Driver/darwin-cc.c vendor/clang/dist/test/Driver/darwin-ld.c vendor/clang/dist/test/Parser/cxx-template-decl.cpp vendor/clang/dist/test/Parser/cxx-using-directive.cpp vendor/clang/dist/test/Sema/block-return.c vendor/clang/dist/test/SemaCXX/using-directive.cpp vendor/clang/dist/test/SemaTemplate/nested-template.cpp vendor/clang/dist/tools/clang-cc/clang-cc.cpp vendor/clang/dist/tools/driver/CMakeLists.txt vendor/clang/dist/utils/test/MultiTestRunner.py vendor/clang/dist/utils/test/TestRunner.py vendor/clang/dist/www/OpenProjects.html vendor/clang/dist/www/analyzer/index.html vendor/clang/dist/www/analyzer/latest_checker.html.incl vendor/clang/dist/www/cxx_status.html Modified: vendor/clang/dist/CMakeLists.txt ============================================================================== --- vendor/clang/dist/CMakeLists.txt Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/CMakeLists.txt Mon Jun 22 08:08:35 2009 (r194613) @@ -1,11 +1,14 @@ macro(add_clang_library name) set(srcs ${ARGN}) if(MSVC_IDE OR XCODE) - file( GLOB_RECURSE headers *.h) + file( GLOB_RECURSE headers *.h *.td *.def) set(srcs ${srcs} ${headers}) string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR}) list( GET split_path -1 dir) - file( GLOB_RECURSE headers ../../include/clang${dir}/*.h) + file( GLOB_RECURSE headers + ../../include/clang${dir}/*.h + ../../include/clang${dir}/*.td + ../../include/clang${dir}/*.def) set(srcs ${srcs} ${headers}) endif(MSVC_IDE OR XCODE) add_library( ${name} ${srcs} ) @@ -29,7 +32,7 @@ endmacro(add_clang_library) macro(add_clang_executable name) set(srcs ${ARGN}) if(MSVC_IDE) - file( GLOB_RECURSE headers *.h) + file( GLOB_RECURSE headers *.h *.td *.def) set(srcs ${srcs} ${headers}) endif(MSVC_IDE) add_llvm_executable( ${name} ${srcs} ) Modified: vendor/clang/dist/include/clang/AST/ASTContext.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTContext.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/ASTContext.h Mon Jun 22 08:08:35 2009 (r194613) @@ -71,6 +71,7 @@ class ASTContext { llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes; std::vector<VariableArrayType*> VariableArrayTypes; std::vector<DependentSizedArrayType*> DependentSizedArrayTypes; + std::vector<DependentSizedExtVectorType*> DependentSizedExtVectorTypes; llvm::FoldingSet<VectorType> VectorTypes; llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes; llvm::FoldingSet<FunctionProtoType> FunctionProtoTypes; @@ -79,7 +80,7 @@ class ASTContext { llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes; llvm::FoldingSet<TypenameType> TypenameTypes; llvm::FoldingSet<ObjCQualifiedInterfaceType> ObjCQualifiedInterfaceTypes; - llvm::FoldingSet<ObjCQualifiedIdType> ObjCQualifiedIdTypes; + llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes; llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames; llvm::FoldingSet<DependentTemplateName> DependentTemplateNames; @@ -103,7 +104,7 @@ class ASTContext { /// This is initially null and set by Sema::LazilyCreateBuiltin when /// a builtin that takes a valist is encountered. QualType BuiltinVaListType; - + /// ObjCIdType - a pseudo built-in typedef type (set by Sema). QualType ObjCIdType; const RecordType *IdStructType; @@ -125,6 +126,12 @@ class ASTContext { RecordDecl *ObjCFastEnumerationStateTypeDecl; + /// \brief Keeps track of all declaration attributes. + /// + /// Since so few decls have attrs, we keep them in a hash map instead of + /// wasting space in the Decl class. + llvm::DenseMap<const Decl*, Attr*> DeclAttrs; + TranslationUnitDecl *TUDecl; /// SourceMgr - The associated SourceManager object. @@ -163,6 +170,12 @@ public: return FullSourceLoc(Loc,SourceMgr); } + /// \brief Retrieve the attributes for the given declaration. + Attr*& getDeclAttrs(const Decl *D) { return DeclAttrs[D]; } + + /// \brief Erase the attributes corresponding to the given declaration. + void eraseDeclAttrs(const Decl *D) { DeclAttrs.erase(D); } + TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; } @@ -277,6 +290,14 @@ public: /// type. QualType getExtVectorType(QualType VectorType, unsigned NumElts); + /// getDependentSizedExtVectorType - Returns a non-unique reference to + /// the type for a dependently-sized vector of the specified element + /// type. FIXME: We will need these to be uniqued, or at least + /// comparable, at some point. + QualType getDependentSizedExtVectorType(QualType VectorType, + Expr *SizeExpr, + SourceLocation AttrLoc); + /// getFunctionNoProtoType - Return a K&R style C function type like 'int()'. /// QualType getFunctionNoProtoType(QualType ResultTy); @@ -299,6 +320,7 @@ public: QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl); QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, + bool ParameterPack, IdentifierInfo *Name = 0); QualType getTemplateSpecializationType(TemplateName T, @@ -315,6 +337,12 @@ public: const TemplateSpecializationType *TemplateId, QualType Canon = QualType()); + /// getObjCObjectPointerType - Return a ObjCObjectPointerType type for the + /// given interface decl and the conforming protocol list. + QualType getObjCObjectPointerType(ObjCInterfaceDecl *Decl, + ObjCProtocolDecl **ProtocolList = 0, + unsigned NumProtocols = 0); + /// getObjCQualifiedInterfaceType - Return a /// ObjCQualifiedInterfaceType type for the given interface decl and /// the conforming protocol list. @@ -416,7 +444,7 @@ public: /// getObjCEncodingTypeSize returns size of type for objective-c encoding /// purpose. int getObjCEncodingTypeSize(QualType t); - + /// This setter/getter represents the ObjC 'id' type. It is setup lazily, by /// Sema. id is always a (typedef for a) pointer type, a pointer to a struct. QualType getObjCIdType() const { return ObjCIdType; } Modified: vendor/clang/dist/include/clang/AST/Decl.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Decl.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/Decl.h Mon Jun 22 08:08:35 2009 (r194613) @@ -146,8 +146,8 @@ public: } void setOriginalNamespace(NamespaceDecl *ND) { OrigNamespace = ND; } - SourceRange getSourceRange() const { - return SourceRange(LBracLoc, RBracLoc); + virtual SourceRange getSourceRange() const { + return SourceRange(getLocation(), RBracLoc); } SourceLocation getLBracLoc() const { return LBracLoc; } @@ -259,6 +259,8 @@ public: StorageClass getStorageClass() const { return (StorageClass)SClass; } void setStorageClass(StorageClass SC) { SClass = SC; } + + virtual SourceRange getSourceRange() const; SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; } void setTypeSpecStartLoc(SourceLocation SL) { @@ -644,6 +646,8 @@ private: // Move to DeclGroup when it is implemented. SourceLocation TypeSpecStartLoc; + + SourceLocation EndRangeLoc; /// \brief The template or declaration that this declaration /// describes or was instantiated from, respectively. @@ -667,7 +671,7 @@ protected: SClass(S), IsInline(isInline), C99InlineDefinition(false), IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true), IsDeleted(false), TypeSpecStartLoc(TSSL), - TemplateOrInstantiation() {} + EndRangeLoc(L), TemplateOrInstantiation() {} virtual ~FunctionDecl() {} virtual void Destroy(ASTContext& C); @@ -677,7 +681,15 @@ public: DeclarationName N, QualType T, StorageClass S = None, bool isInline = false, bool hasWrittenPrototype = true, - SourceLocation TSStartLoc = SourceLocation()); + SourceLocation TSStartLoc = SourceLocation()); + + virtual SourceRange getSourceRange() const { + return SourceRange(getLocation(), EndRangeLoc); + } + void setLocEnd(SourceLocation E) { + assert(getLocation() <= E && "Invalid end location"); + EndRangeLoc = E; + } SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; } void setTypeSpecStartLoc(SourceLocation TS) { TypeSpecStartLoc = TS; } @@ -706,7 +718,7 @@ public: /// CodeGenModule.cpp uses it, and I don't know if this would break it. bool isThisDeclarationADefinition() const { return Body; } - void setBody(Stmt *B) { Body = B; } + void setBody(Stmt *B); void setLazyBody(uint64_t Offset) { Body = Offset; } /// Whether this function is marked as virtual explicitly. @@ -832,12 +844,12 @@ public: /// The gnu_inline attribute only introduces GNU inline semantics /// when all of the inline declarations of the function are marked /// gnu_inline. - bool hasActiveGNUInlineAttribute() const; + bool hasActiveGNUInlineAttribute(ASTContext &Context) const; /// \brief Determines whether this function is a GNU "extern /// inline", which is roughly the opposite of a C99 "extern inline" /// function. - bool isExternGNUInline() const; + bool isExternGNUInline(ASTContext &Context) const; /// isOverloadedOperator - Whether this function declaration /// represents an C++ overloaded operator, e.g., "operator+". Modified: vendor/clang/dist/include/clang/AST/DeclBase.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclBase.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/DeclBase.h Mon Jun 22 08:08:35 2009 (r194613) @@ -156,9 +156,15 @@ private: /// the implementation rather than explicitly written by the user. bool Implicit : 1; + /// \brief Whether this declaration was "used", meaning that a definition is + /// required. + bool Used : 1; + +protected: /// IdentifierNamespace - This specifies what IDNS_* namespace this lives in. unsigned IdentifierNamespace : 8; +private: #ifndef NDEBUG void CheckAccessDeclContext() const; #else @@ -174,7 +180,7 @@ protected: Decl(Kind DK, DeclContext *DC, SourceLocation L) : NextDeclInContext(0), DeclCtx(DC), Loc(L), DeclKind(DK), InvalidDecl(0), - HasAttrs(false), Implicit(false), + HasAttrs(false), Implicit(false), Used(false), IdentifierNamespace(getIdentifierNamespaceForKind(DK)), Access(AS_none) { if (Decl::CollectingStats()) addDeclKind(DK); } @@ -182,6 +188,14 @@ protected: virtual ~Decl(); public: + + /// \brief Source range that this declaration covers. + virtual SourceRange getSourceRange() const { + return SourceRange(getLocation(), getLocation()); + } + SourceLocation getLocStart() const { return getSourceRange().getBegin(); } + SourceLocation getLocEnd() const { return getSourceRange().getEnd(); } + SourceLocation getLocation() const { return Loc; } void setLocation(SourceLocation L) { Loc = L; } @@ -211,23 +225,23 @@ public: } bool hasAttrs() const { return HasAttrs; } - void addAttr(Attr *attr); - const Attr *getAttrs() const { + void addAttr(ASTContext &Context, Attr *attr); + const Attr *getAttrs(ASTContext &Context) const { if (!HasAttrs) return 0; // common case, no attributes. - return getAttrsImpl(); // Uncommon case, out of line hash lookup. + return getAttrsImpl(Context); // Uncommon case, out of line hash lookup. } - void swapAttrs(Decl *D); - void invalidateAttrs(); + void swapAttrs(ASTContext &Context, Decl *D); + void invalidateAttrs(ASTContext &Context); - template<typename T> const T *getAttr() const { - for (const Attr *attr = getAttrs(); attr; attr = attr->getNext()) + template<typename T> const T *getAttr(ASTContext &Context) const { + for (const Attr *attr = getAttrs(Context); attr; attr = attr->getNext()) if (const T *V = dyn_cast<T>(attr)) return V; return 0; } - template<typename T> bool hasAttr() const { - return getAttr<T>() != 0; + template<typename T> bool hasAttr(ASTContext &Context) const { + return getAttr<T>(Context) != 0; } /// setInvalidDecl - Indicates the Decl had a semantic error. This @@ -241,6 +255,11 @@ public: bool isImplicit() const { return Implicit; } void setImplicit(bool I = true) { Implicit = I; } + /// \brief Whether this declaration was used, meaning that a definition + /// is required. + bool isUsed() const { return Used; } + void setUsed(bool U = true) { Used = U; } + unsigned getIdentifierNamespace() const { return IdentifierNamespace; } @@ -268,6 +287,10 @@ public: const DeclContext *getLexicalDeclContext() const { return const_cast<Decl*>(this)->getLexicalDeclContext(); } + + bool isOutOfLine() const { + return getLexicalDeclContext() != getDeclContext(); + } /// setDeclContext - Set both the semantic and lexical DeclContext /// to DC. @@ -325,7 +348,7 @@ public: void dump(ASTContext &Context); private: - const Attr *getAttrsImpl() const; + const Attr *getAttrsImpl(ASTContext &Context) const; }; Modified: vendor/clang/dist/include/clang/AST/DeclCXX.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclCXX.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/DeclCXX.h Mon Jun 22 08:08:35 2009 (r194613) @@ -439,6 +439,9 @@ public: TemplateOrInstantiation = Template; } + /// getDefaultConstructor - Returns the default constructor for this class + CXXConstructorDecl *getDefaultConstructor(ASTContext &Context); + /// getDestructor - Returns the destructor decl for this class. const CXXDestructorDecl *getDestructor(ASTContext &Context); @@ -477,10 +480,6 @@ public: bool isStatic() const { return getStorageClass() == Static; } bool isInstance() const { return !isStatic(); } - bool isOutOfLineDefinition() const { - return getLexicalDeclContext() != getDeclContext(); - } - bool isVirtual() const { return isVirtualAsWritten() || (begin_overridden_methods() != end_overridden_methods()); @@ -535,6 +534,7 @@ public: /// public: /// B(A& a) : A(a), f(3.14159) { } /// }; +/// @endcode class CXXBaseOrMemberInitializer { /// BaseOrMember - This points to the entity being initialized, /// which is either a base class (a Type) or a non-static data @@ -641,6 +641,10 @@ class CXXConstructorDecl : public CXXMet /// explicitly defaulted (i.e., defined with " = default") will have /// @c !Implicit && ImplicitlyDefined. bool ImplicitlyDefined : 1; + + /// ImplicitMustBeDefined - Implicit constructor was used to create an + /// object of its class type. It must be defined. + bool ImplicitMustBeDefined : 1; /// FIXME: Add support for base and member initializers. @@ -648,7 +652,8 @@ class CXXConstructorDecl : public CXXMet DeclarationName N, QualType T, bool isExplicit, bool isInline, bool isImplicitlyDeclared) : CXXMethodDecl(CXXConstructor, RD, L, N, T, false, isInline), - Explicit(isExplicit), ImplicitlyDefined(false) { + Explicit(isExplicit), ImplicitlyDefined(false), + ImplicitMustBeDefined(false) { setImplicit(isImplicitlyDeclared); } @@ -679,6 +684,17 @@ public: ImplicitlyDefined = ID; } + /// isImplicitMustBeDefined - Whether a definition must be synthesized for + /// the implicit constructor. + bool isImplicitMustBeDefined() const { + return isImplicit() && ImplicitMustBeDefined; + } + + /// setImplicitMustBeDefined - constructor must be implicitly defined. + void setImplicitMustBeDefined() { + ImplicitMustBeDefined = true; + } + /// isDefaultConstructor - Whether this constructor is a default /// constructor (C++ [class.ctor]p5), which can be used to /// default-initialize a class of this type. @@ -1033,6 +1049,61 @@ public: } static bool classof(const NamespaceAliasDecl *D) { return true; } }; + +/// UsingDecl - Represents a C++ using-declaration. For example: +/// using someNameSpace::someIdentifier; +class UsingDecl : public NamedDecl { + + /// \brief The source range that covers the nested-name-specifier + /// preceding the declaration name. + SourceRange NestedNameRange; + /// \brief The source location of the target declaration name. + SourceLocation TargetNameLocation; + /// \brief The source location of the "using" location itself. + SourceLocation UsingLocation; + /// \brief Target declaration. + NamedDecl* TargetDecl; + /// \brief Target declaration. + NestedNameSpecifier* TargetNestedNameDecl; + + // Had 'typename' keyword. + bool IsTypeName; + + UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR, + SourceLocation TargetNL, SourceLocation UL, NamedDecl* Target, + NestedNameSpecifier* TargetNNS, bool IsTypeNameArg) + : NamedDecl(Decl::Using, DC, L, Target->getDeclName()), + NestedNameRange(NNR), TargetNameLocation(TargetNL), + UsingLocation(UL), TargetDecl(Target), + TargetNestedNameDecl(TargetNNS), IsTypeName(IsTypeNameArg) { + this->IdentifierNamespace = TargetDecl->getIdentifierNamespace(); + } + +public: + /// \brief Returns the source range that covers the nested-name-specifier + /// preceding the namespace name. + SourceRange getNestedNameRange() { return(NestedNameRange); } + /// \brief Returns the source location of the target declaration name. + SourceLocation getTargetNameLocation() { return(TargetNameLocation); } + /// \brief Returns the source location of the "using" location itself. + SourceLocation getUsingLocation() { return(UsingLocation); } + /// \brief getTargetDecl - Returns target specified by using-decl. + NamedDecl *getTargetDecl() { return(TargetDecl); } + /// \brief Get target nested name declaration. + NestedNameSpecifier* getTargetNestedNameDecl() { return(TargetNestedNameDecl); } + /// isTypeName - Return true if using decl had 'typename'. + bool isTypeName() const { return(IsTypeName); } + + static UsingDecl *Create(ASTContext &C, DeclContext *DC, + SourceLocation L, SourceRange NNR, SourceLocation TargetNL, + SourceLocation UL, NamedDecl* Target, + NestedNameSpecifier* TargetNNS, bool IsTypeNameArg); + + static bool classof(const Decl *D) { + return D->getKind() == Decl::Using; + } + static bool classof(const UsingDecl *D) { return true; } +}; /// StaticAssertDecl - Represents a C++0x static_assert declaration. class StaticAssertDecl : public Decl { Modified: vendor/clang/dist/include/clang/AST/DeclNodes.def ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclNodes.def Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/DeclNodes.def Mon Jun 22 08:08:35 2009 (r194613) @@ -108,6 +108,7 @@ ABSTRACT_DECL(Named, Decl) DECL(FunctionTemplate, TemplateDecl) DECL(ClassTemplate, TemplateDecl) DECL(TemplateTemplateParm, TemplateDecl) + DECL(Using, NamedDecl) DECL(ObjCMethod, NamedDecl) DECL(ObjCContainer, NamedDecl) DECL(ObjCCategory, ObjCContainerDecl) Modified: vendor/clang/dist/include/clang/AST/DeclTemplate.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclTemplate.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/DeclTemplate.h Mon Jun 22 08:08:35 2009 (r194613) @@ -18,6 +18,7 @@ #include "llvm/ADT/APSInt.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerUnion.h" +#include <limits> namespace clang { @@ -404,6 +405,11 @@ class TemplateArgument { char Value[sizeof(llvm::APSInt)]; void *Type; } Integer; + struct { + TemplateArgument *Args; + unsigned NumArgs; + bool CopyArgs; + } Args; }; /// \brief Location of the beginning of this template argument. @@ -413,7 +419,7 @@ public: /// \brief The type of template argument we're storing. enum ArgKind { Null = 0, - /// The template argument is a type. It's value is stored in the + /// The template argument is a type. Its value is stored in the /// TypeOrValue field. Type = 1, /// The template argument is a declaration @@ -422,7 +428,11 @@ public: Integral = 3, /// The template argument is a value- or type-dependent expression /// stored in an Expr*. - Expression = 4 + Expression = 4, + + /// The template argument is actually a parameter pack. Arguments are stored + /// in the Args struct. + Pack = 5 } Kind; /// \brief Construct an empty, invalid template argument. @@ -459,11 +469,20 @@ public: /// occur in a non-dependent, canonical template argument list. TemplateArgument(Expr *E); + /// \brief Construct a template argument pack. + TemplateArgument(SourceLocation Loc, TemplateArgument *Args, + unsigned NumArgs, bool CopyArgs); + /// \brief Copy constructor for a template argument. TemplateArgument(const TemplateArgument &Other) : Kind(Other.Kind) { if (Kind == Integral) { new (Integer.Value) llvm::APSInt(*Other.getAsIntegral()); Integer.Type = Other.Integer.Type; + } else if (Kind == Pack) { + Args.NumArgs = Other.Args.NumArgs; + Args.Args = new TemplateArgument[Args.NumArgs]; + for (unsigned I = 0; I != Args.NumArgs; ++I) + Args.Args[I] = Other.Args.Args[I]; } else TypeOrValue = Other.TypeOrValue; @@ -475,6 +494,10 @@ public: // safety. using llvm::APSInt; + // FIXME: Handle Packs + assert(Kind != Pack && "FIXME: Handle packs"); + assert(Other.Kind != Pack && "FIXME: Handle packs"); + if (Kind == Other.Kind && Kind == Integral) { // Copy integral values. *this->getAsIntegral() = *Other.getAsIntegral(); @@ -502,6 +525,8 @@ public: if (Kind == Integral) getAsIntegral()->~APSInt(); + else if (Kind == Pack && Args.CopyArgs) + delete[] Args.Args; } /// \brief Return the kind of stored template argument. @@ -586,34 +611,44 @@ public: // FIXME: We need a canonical representation of expressions. ID.AddPointer(getAsExpr()); break; + + case Pack: + ID.AddInteger(Args.NumArgs); + for (unsigned I = 0; I != Args.NumArgs; ++I) + Args.Args[I].Profile(ID); } } }; /// \brief A helper class for making template argument lists. class TemplateArgumentListBuilder { - /// Args - contains the template arguments. - llvm::SmallVector<TemplateArgument, 16> Args; + /// FlatArgs - contains the template arguments in flat form. + llvm::SmallVector<TemplateArgument, 16> FlatArgs; - llvm::SmallVector<unsigned, 32> Indices; + llvm::SmallVector<TemplateArgument, 16> StructuredArgs; ASTContext &Context; + unsigned PackBeginIndex; + /// isAddingFromParameterPack - Returns whether we're adding arguments from /// a parameter pack. - bool isAddingFromParameterPack() const { return Indices.size() % 2; } + bool isAddingFromParameterPack() const { + return PackBeginIndex != std::numeric_limits<unsigned>::max(); + } public: - TemplateArgumentListBuilder(ASTContext &Context) : Context(Context) { } + TemplateArgumentListBuilder(ASTContext &Context) : Context(Context), + PackBeginIndex(std::numeric_limits<unsigned>::max()) { } - size_t size() const { + size_t structuredSize() const { assert(!isAddingFromParameterPack() && "Size is not valid when adding from a parameter pack"); - return Indices.size() / 2; + return StructuredArgs.size(); } - size_t flatSize() const { return Args.size(); } + size_t flatSize() const { return FlatArgs.size(); } void push_back(const TemplateArgument& Arg); @@ -623,8 +658,12 @@ public: /// EndParameterPack - Finish adding arguments from a parameter pack. void EndParameterPack(); - const TemplateArgument *getFlatArgumentList() const { return Args.data(); } - TemplateArgument *getFlatArgumentList() { return Args.data(); } + const TemplateArgument *getFlatArgumentList() const { + return FlatArgs.data(); + } + TemplateArgument *getFlatArgumentList() { + return FlatArgs.data(); + } }; /// \brief A template argument list. @@ -657,13 +696,6 @@ public: } /// \brief Retrieve the template argument at a given index. - TemplateArgument &get(unsigned Idx) { - assert(Idx < NumArguments && "Invalid template argument index"); - return getFlatArgumentList()[Idx]; - } - - /// \brief Retrieve the template argument at a given index. - TemplateArgument &operator[](unsigned Idx) { return get(Idx); } const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); } /// \brief Retrieve the number of template arguments in this @@ -675,9 +707,6 @@ public: unsigned flat_size() const { return NumArguments; } /// \brief Retrieve the flattened template argument list. - TemplateArgument *getFlatArgumentList() { - return Arguments.getPointer(); - } const TemplateArgument *getFlatArgumentList() const { return Arguments.getPointer(); } Modified: vendor/clang/dist/include/clang/AST/Expr.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Expr.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/Expr.h Mon Jun 22 08:08:35 2009 (r194613) @@ -124,7 +124,7 @@ public: /// with location to warn on and the source range[s] to report with the /// warning. bool isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, - SourceRange &R2) const; + SourceRange &R2, ASTContext &Context) const; /// isLvalue - C99 6.3.2.1: an lvalue is an expression with an object type or /// incomplete type other than void. Nonarray expressions that can be lvalues: @@ -2463,10 +2463,13 @@ public: class BlockDeclRefExpr : public Expr { ValueDecl *D; SourceLocation Loc; - bool IsByRef; + bool IsByRef : 1; + bool ConstQualAdded : 1; public: - BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef) : - Expr(BlockDeclRefExprClass, t), D(d), Loc(l), IsByRef(ByRef) {} + BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef, + bool constAdded = false) : + Expr(BlockDeclRefExprClass, t), D(d), Loc(l), IsByRef(ByRef), + ConstQualAdded(constAdded) {} // \brief Build an empty reference to a declared variable in a // block. @@ -2484,6 +2487,9 @@ public: bool isByRef() const { return IsByRef; } void setByRef(bool BR) { IsByRef = BR; } + + bool isConstQualAdded() const { return ConstQualAdded; } + void setConstQualAdded(bool C) { ConstQualAdded = C; } static bool classof(const Stmt *T) { return T->getStmtClass() == BlockDeclRefExprClass; Modified: vendor/clang/dist/include/clang/AST/ExprCXX.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ExprCXX.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/ExprCXX.h Mon Jun 22 08:08:35 2009 (r194613) @@ -1023,17 +1023,16 @@ class CXXExprWithTemporaries : public Ex CXXTemporary **Temps; unsigned NumTemps; - bool DestroyTemps; + bool ShouldDestroyTemps; CXXExprWithTemporaries(Expr *SubExpr, CXXTemporary **Temps, - unsigned NumTemps, bool DestroyTemps); + unsigned NumTemps, bool ShouldDestroyTemps); ~CXXExprWithTemporaries(); public: static CXXExprWithTemporaries *Create(ASTContext &C, Expr *SubExpr, - CXXTemporary **Temps, - unsigned NumTemps, - bool DestroyTems); + CXXTemporary **Temps, unsigned NumTemps, + bool ShouldDestroyTemporaries); void Destroy(ASTContext &C); unsigned getNumTemporaries() const { return NumTemps; } @@ -1046,6 +1045,8 @@ public: return Temps[i]; } + bool shouldDestroyTemporaries() const { return ShouldDestroyTemps; } + void removeLastTemporary() { NumTemps--; } Expr *getSubExpr() { return cast<Expr>(SubExpr); } Modified: vendor/clang/dist/include/clang/AST/ExprObjC.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ExprObjC.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/ExprObjC.h Mon Jun 22 08:08:35 2009 (r194613) @@ -138,20 +138,20 @@ public: /// obj conformsToProtocol:@protocol(foo)] /// The return type is "Protocol*". class ObjCProtocolExpr : public Expr { - ObjCProtocolDecl *Protocol; + ObjCProtocolDecl *TheProtocol; SourceLocation AtLoc, RParenLoc; public: ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, SourceLocation at, SourceLocation rp) - : Expr(ObjCProtocolExprClass, T), Protocol(protocol), + : Expr(ObjCProtocolExprClass, T), TheProtocol(protocol), AtLoc(at), RParenLoc(rp) {} explicit ObjCProtocolExpr(EmptyShell Empty) : Expr(ObjCProtocolExprClass, Empty) {} ObjCProtocolExpr *Clone(ASTContext &C) const; - ObjCProtocolDecl *getProtocol() const { return Protocol; } - void setProtocol(ObjCProtocolDecl *P) { Protocol = P; } + ObjCProtocolDecl *getProtocol() const { return TheProtocol; } + void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; } SourceLocation getAtLoc() const { return AtLoc; } SourceLocation getRParenLoc() const { return RParenLoc; } Modified: vendor/clang/dist/include/clang/AST/Type.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Type.h Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/Type.h Mon Jun 22 08:08:35 2009 (r194613) @@ -393,6 +393,7 @@ public: bool isComplexIntegerType() const; // GCC _Complex integer type. bool isVectorType() const; // GCC vector type. bool isExtVectorType() const; // Extended vector type. + bool isObjCObjectPointerType() const; // Pointer to *any* ObjC object. bool isObjCInterfaceType() const; // NSString or NSString<foo> bool isObjCQualifiedInterfaceType() const; // NSString<foo> bool isObjCQualifiedIdType() const; // id<foo> @@ -439,9 +440,10 @@ public: const ComplexType *getAsComplexType() const; const ComplexType *getAsComplexIntegerType() const; // GCC complex int type. const ExtVectorType *getAsExtVectorType() const; // Extended vector type. + const ObjCObjectPointerType *getAsObjCObjectPointerType() const; const ObjCInterfaceType *getAsObjCInterfaceType() const; const ObjCQualifiedInterfaceType *getAsObjCQualifiedInterfaceType() const; - const ObjCQualifiedIdType *getAsObjCQualifiedIdType() const; + const ObjCObjectPointerType *getAsObjCQualifiedIdType() const; const TemplateTypeParmType *getAsTemplateTypeParmType() const; const TemplateSpecializationType * @@ -992,6 +994,41 @@ public: } }; +/// DependentSizedExtVectorType - This type represent an extended vector type +/// where either the type or size is dependent. For example: +/// @code +/// template<typename T, int Size> +/// class vector { +/// typedef T __attribute__((ext_vector_type(Size))) type; +/// } +/// @endcode +class DependentSizedExtVectorType : public Type { + Expr *SizeExpr; + /// ElementType - The element type of the array. + QualType ElementType; + SourceLocation loc; + + DependentSizedExtVectorType(QualType ElementType, QualType can, + Expr *SizeExpr, SourceLocation loc) + : Type (DependentSizedExtVector, can, true), + SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {} + friend class ASTContext; + virtual void Destroy(ASTContext& C); + +public: + const Expr *getSizeExpr() const { return SizeExpr; } + QualType getElementType() const { return ElementType; } + SourceLocation getAttributeLoc() const { return loc; } + + virtual void getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const; + + static bool classof(const Type *T) { + return T->getTypeClass() == DependentSizedExtVector; + } + static bool classof(const DependentSizedExtVectorType *) { return true; } +}; + + /// VectorType - GCC generic vector type. This type is created using /// __attribute__((vector_size(n)), where "n" specifies the vector size in /// bytes. Since the constructor takes the number of vector elements, the @@ -1403,36 +1440,40 @@ public: }; class TemplateTypeParmType : public Type, public llvm::FoldingSetNode { - unsigned Depth : 16; + unsigned Depth : 15; unsigned Index : 16; + unsigned ParameterPack : 1; IdentifierInfo *Name; - TemplateTypeParmType(unsigned D, unsigned I, IdentifierInfo *N, + TemplateTypeParmType(unsigned D, unsigned I, bool PP, IdentifierInfo *N, QualType Canon) : Type(TemplateTypeParm, Canon, /*Dependent=*/true), - Depth(D), Index(I), Name(N) { } + Depth(D), Index(I), ParameterPack(PP), Name(N) { } - TemplateTypeParmType(unsigned D, unsigned I) + TemplateTypeParmType(unsigned D, unsigned I, bool PP) : Type(TemplateTypeParm, QualType(this, 0), /*Dependent=*/true), - Depth(D), Index(I), Name(0) { } + Depth(D), Index(I), ParameterPack(PP), Name(0) { } friend class ASTContext; // ASTContext creates these public: unsigned getDepth() const { return Depth; } unsigned getIndex() const { return Index; } + bool isParameterPack() const { return ParameterPack; } IdentifierInfo *getName() const { return Name; } virtual void getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const; void Profile(llvm::FoldingSetNodeID &ID) { - Profile(ID, Depth, Index, Name); + Profile(ID, Depth, Index, ParameterPack, Name); } static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, - unsigned Index, IdentifierInfo *Name) { + unsigned Index, bool ParameterPack, + IdentifierInfo *Name) { ID.AddInteger(Depth); ID.AddInteger(Index); + ID.AddBoolean(ParameterPack); ID.AddPointer(Name); } @@ -1644,6 +1685,53 @@ public: static bool classof(const TypenameType *T) { return true; } }; +/// ObjCObjectPointerType - Used to represent 'id', 'Interface *', 'id <p>', +/// and 'Interface <p> *'. +/// +/// Duplicate protocols are removed and protocol list is canonicalized to be in +/// alphabetical order. +class ObjCObjectPointerType : public Type, public llvm::FoldingSetNode { + ObjCInterfaceDecl *Decl; + // List of protocols for this protocol conforming object type + // List is sorted on protocol name. No protocol is entered more than once. + llvm::SmallVector<ObjCProtocolDecl*, 8> Protocols; + + ObjCObjectPointerType(ObjCInterfaceDecl *D, + ObjCProtocolDecl **Protos, unsigned NumP) : + Type(ObjCObjectPointer, QualType(), /*Dependent=*/false), + Decl(D), Protocols(Protos, Protos+NumP) { } + friend class ASTContext; // ASTContext creates these. + +public: + ObjCInterfaceDecl *getDecl() const { return Decl; } + + /// isObjCQualifiedIdType - true for "id <p>". + bool isObjCQualifiedIdType() const { return Decl == 0 && Protocols.size(); } + + /// qual_iterator and friends: this provides access to the (potentially empty) + /// list of protocols qualifying this interface. + typedef llvm::SmallVector<ObjCProtocolDecl*, 8>::const_iterator qual_iterator; + + qual_iterator qual_begin() const { return Protocols.begin(); } + qual_iterator qual_end() const { return Protocols.end(); } + bool qual_empty() const { return Protocols.size() == 0; } + + /// getNumProtocols - Return the number of qualifying protocols in this + /// interface type, or 0 if there are none. + unsigned getNumProtocols() const { return Protocols.size(); } + + void Profile(llvm::FoldingSetNodeID &ID); + static void Profile(llvm::FoldingSetNodeID &ID, + const ObjCInterfaceDecl *Decl, + ObjCProtocolDecl **protocols, unsigned NumProtocols); + virtual void getAsStringInternal(std::string &InnerString, + const PrintingPolicy &Policy) const; + static bool classof(const Type *T) { + return T->getTypeClass() == ObjCObjectPointer; + } + static bool classof(const ObjCObjectPointerType *) { return true; } +}; + /// ObjCInterfaceType - Interfaces are the core concept in Objective-C for /// object oriented design. They basically correspond to C++ classes. There /// are two kinds of interface types, normal interfaces like "NSString" and @@ -1742,44 +1830,6 @@ inline unsigned ObjCInterfaceType::getNu return 0; } -/// ObjCQualifiedIdType - to represent id<protocol-list>. -/// -/// Duplicate protocols are removed and protocol list is canonicalized to be in -/// alphabetical order. -class ObjCQualifiedIdType : public Type, - public llvm::FoldingSetNode { - // List of protocols for this protocol conforming 'id' type - // List is sorted on protocol name. No protocol is enterred more than once. - llvm::SmallVector<ObjCProtocolDecl*, 8> Protocols; - - ObjCQualifiedIdType(ObjCProtocolDecl **Protos, unsigned NumP) - : Type(ObjCQualifiedId, QualType()/*these are always canonical*/, - /*Dependent=*/false), - Protocols(Protos, Protos+NumP) { } - friend class ASTContext; // ASTContext creates these. -public: - - unsigned getNumProtocols() const { - return Protocols.size(); - } - - typedef llvm::SmallVector<ObjCProtocolDecl*, 8>::const_iterator qual_iterator; - qual_iterator qual_begin() const { return Protocols.begin(); } - qual_iterator qual_end() const { return Protocols.end(); } - - virtual void getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const; - - void Profile(llvm::FoldingSetNodeID &ID); - static void Profile(llvm::FoldingSetNodeID &ID, - ObjCProtocolDecl **protocols, unsigned NumProtocols); - - static bool classof(const Type *T) { - return T->getTypeClass() == ObjCQualifiedId; - } - static bool classof(const ObjCQualifiedIdType *) { return true; } - -}; - // Inline function definitions. /// getUnqualifiedType - Return the type without any qualifiers. @@ -1926,6 +1976,9 @@ inline bool Type::isVectorType() const { inline bool Type::isExtVectorType() const { return isa<ExtVectorType>(CanonicalType.getUnqualifiedType()); } +inline bool Type::isObjCObjectPointerType() const { + return isa<ObjCObjectPointerType>(CanonicalType.getUnqualifiedType()); +} inline bool Type::isObjCInterfaceType() const { return isa<ObjCInterfaceType>(CanonicalType.getUnqualifiedType()); } @@ -1933,7 +1986,10 @@ inline bool Type::isObjCQualifiedInterfa return isa<ObjCQualifiedInterfaceType>(CanonicalType.getUnqualifiedType()); } inline bool Type::isObjCQualifiedIdType() const { - return isa<ObjCQualifiedIdType>(CanonicalType.getUnqualifiedType()); + if (const ObjCObjectPointerType *OPT = getAsObjCObjectPointerType()) { + return OPT->isObjCQualifiedIdType(); + } + return false; } inline bool Type::isTemplateTypeParmType() const { return isa<TemplateTypeParmType>(CanonicalType.getUnqualifiedType()); Modified: vendor/clang/dist/include/clang/AST/TypeNodes.def ============================================================================== --- vendor/clang/dist/include/clang/AST/TypeNodes.def Mon Jun 22 08:08:12 2009 (r194612) +++ vendor/clang/dist/include/clang/AST/TypeNodes.def Mon Jun 22 08:08:35 2009 (r194613) @@ -60,6 +60,7 @@ TYPE(ConstantArray, ArrayType) TYPE(IncompleteArray, ArrayType) TYPE(VariableArray, ArrayType) DEPENDENT_TYPE(DependentSizedArray, ArrayType) +DEPENDENT_TYPE(DependentSizedExtVector, Type) TYPE(Vector, Type) TYPE(ExtVector, VectorType) ABSTRACT_TYPE(Function, Type) @@ -76,8 +77,8 @@ TYPE(TemplateSpecialization, Type) NON_CANONICAL_TYPE(QualifiedName, Type) DEPENDENT_TYPE(Typename, Type) TYPE(ObjCInterface, Type) +TYPE(ObjCObjectPointer, Type) TYPE(ObjCQualifiedInterface, ObjCInterfaceType) -TYPE(ObjCQualifiedId, Type) #undef DEPENDENT_TYPE #undef NON_CANONICAL_TYPE Added: vendor/clang/dist/include/clang/AST/TypeVisitor.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/include/clang/AST/TypeVisitor.h Mon Jun 22 08:08:35 2009 (r194613) @@ -0,0 +1,50 @@ +//===--- TypeVisitor.h - Visitor for Stmt subclasses ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the TypeVisitor interface. +// +//===----------------------------------------------------------------------===// *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906220808.n5M88ahv031412>