svn commit: r195341 - in vendor/clang/dist: include/clang/AST
include/clang/Analysis/PathSensitive include/clang/Basic
include/clang/CodeGen include/clang/Driver
include/clang/Frontend include/clan...
Ed Schouten
ed at FreeBSD.org
Sat Jul 4 13:58:55 UTC 2009
Author: ed
Date: Sat Jul 4 13:58:54 2009
New Revision: 195341
URL: http://svn.freebsd.org/changeset/base/195341
Log:
Import Clang r74788.
Added:
vendor/clang/dist/test/Analysis/concrete-address.c
vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p1.cpp
vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
vendor/clang/dist/test/CodeGen/stack-protector.c
vendor/clang/dist/test/CodeGenCXX/function-template-specialization.cpp
vendor/clang/dist/test/Driver/openbsd.c
vendor/clang/dist/test/Index/comments.c
vendor/clang/dist/test/PCH/pr4489.c
vendor/clang/dist/test/Parser/offsetof.c
vendor/clang/dist/test/Sema/format-attr-pr4470.c
vendor/clang/dist/test/SemaCXX/class-base-member-init.cpp
vendor/clang/dist/test/SemaCXX/decltype-overloaded-functions.cpp
vendor/clang/dist/test/SemaTemplate/class-template-ctor-initializer.cpp
vendor/clang/dist/test/SemaTemplate/recursive-template-instantiation.cpp
Modified:
vendor/clang/dist/include/clang/AST/ASTContext.h
vendor/clang/dist/include/clang/AST/CFG.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/DeclObjC.h
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/ExternalASTSource.h
vendor/clang/dist/include/clang/AST/NestedNameSpecifier.h
vendor/clang/dist/include/clang/AST/PrettyPrinter.h
vendor/clang/dist/include/clang/AST/Stmt.h
vendor/clang/dist/include/clang/AST/StmtNodes.def
vendor/clang/dist/include/clang/AST/Type.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/ValueManager.h
vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td
vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
vendor/clang/dist/include/clang/Basic/LangOptions.h
vendor/clang/dist/include/clang/Basic/TargetInfo.h
vendor/clang/dist/include/clang/Basic/TokenKinds.def
vendor/clang/dist/include/clang/CodeGen/ModuleBuilder.h
vendor/clang/dist/include/clang/Driver/Action.h
vendor/clang/dist/include/clang/Driver/ArgList.h
vendor/clang/dist/include/clang/Driver/Compilation.h
vendor/clang/dist/include/clang/Driver/Driver.h
vendor/clang/dist/include/clang/Driver/HostInfo.h
vendor/clang/dist/include/clang/Driver/Job.h
vendor/clang/dist/include/clang/Driver/Options.def
vendor/clang/dist/include/clang/Frontend/ASTConsumers.h
vendor/clang/dist/include/clang/Frontend/PCHBitCodes.h
vendor/clang/dist/include/clang/Frontend/PCHReader.h
vendor/clang/dist/include/clang/Frontend/PCHWriter.h
vendor/clang/dist/include/clang/Lex/Preprocessor.h
vendor/clang/dist/include/clang/Parse/Action.h
vendor/clang/dist/include/clang/Parse/Ownership.h
vendor/clang/dist/include/clang/Parse/Parser.h
vendor/clang/dist/lib/AST/ASTContext.cpp
vendor/clang/dist/lib/AST/CFG.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/DeclObjC.cpp
vendor/clang/dist/lib/AST/DeclPrinter.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/ExprConstant.cpp
vendor/clang/dist/lib/AST/NestedNameSpecifier.cpp
vendor/clang/dist/lib/AST/StmtDumper.cpp
vendor/clang/dist/lib/AST/StmtPrinter.cpp
vendor/clang/dist/lib/AST/TemplateName.cpp
vendor/clang/dist/lib/AST/Type.cpp
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/CheckObjCDealloc.cpp
vendor/clang/dist/lib/Analysis/CheckObjCInstMethSignature.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/GRState.cpp
vendor/clang/dist/lib/Analysis/LiveVariables.cpp
vendor/clang/dist/lib/Analysis/MemRegion.cpp
vendor/clang/dist/lib/Analysis/RegionStore.cpp
vendor/clang/dist/lib/Analysis/SVals.cpp
vendor/clang/dist/lib/Analysis/Store.cpp
vendor/clang/dist/lib/Basic/IdentifierTable.cpp
vendor/clang/dist/lib/Basic/TargetInfo.cpp
vendor/clang/dist/lib/Basic/Targets.cpp
vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp
vendor/clang/dist/lib/CodeGen/CGCXX.cpp
vendor/clang/dist/lib/CodeGen/CGCall.cpp
vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp
vendor/clang/dist/lib/CodeGen/CGDecl.cpp
vendor/clang/dist/lib/CodeGen/CGExpr.cpp
vendor/clang/dist/lib/CodeGen/CGExprAgg.cpp
vendor/clang/dist/lib/CodeGen/CGExprConstant.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/CodeGenModule.h
vendor/clang/dist/lib/CodeGen/CodeGenTypes.cpp
vendor/clang/dist/lib/CodeGen/Mangle.cpp
vendor/clang/dist/lib/CodeGen/ModuleBuilder.cpp
vendor/clang/dist/lib/CodeGen/TargetABIInfo.cpp
vendor/clang/dist/lib/Driver/ArgList.cpp
vendor/clang/dist/lib/Driver/Compilation.cpp
vendor/clang/dist/lib/Driver/Driver.cpp
vendor/clang/dist/lib/Driver/HostInfo.cpp
vendor/clang/dist/lib/Driver/Job.cpp
vendor/clang/dist/lib/Driver/ToolChains.cpp
vendor/clang/dist/lib/Driver/ToolChains.h
vendor/clang/dist/lib/Driver/Tools.cpp
vendor/clang/dist/lib/Driver/Tools.h
vendor/clang/dist/lib/Frontend/ASTConsumers.cpp
vendor/clang/dist/lib/Frontend/AnalysisConsumer.cpp
vendor/clang/dist/lib/Frontend/Backend.cpp
vendor/clang/dist/lib/Frontend/DeclXML.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/ResolveLocation.cpp
vendor/clang/dist/lib/Frontend/RewriteBlocks.cpp
vendor/clang/dist/lib/Frontend/RewriteObjC.cpp
vendor/clang/dist/lib/Lex/Lexer.cpp
vendor/clang/dist/lib/Lex/Pragma.cpp
vendor/clang/dist/lib/Lex/Preprocessor.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/Parse/Parser.cpp
vendor/clang/dist/lib/Rewrite/Rewriter.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/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/SemaInherit.cpp
vendor/clang/dist/lib/Sema/SemaInit.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/SemaTemplateInstantiateDecl.cpp
vendor/clang/dist/lib/Sema/SemaTemplateInstantiateExpr.cpp
vendor/clang/dist/lib/Sema/SemaType.cpp
vendor/clang/dist/test/Analysis/array-struct.c
vendor/clang/dist/test/Analysis/misc-ps.m
vendor/clang/dist/test/Analysis/stack-addr-ps.c
vendor/clang/dist/test/Analysis/xfail_regionstore_wine_crash.c
vendor/clang/dist/test/CMakeLists.txt
vendor/clang/dist/test/CXX/basic/basic.def.odr/p2-typeid.cpp
vendor/clang/dist/test/CodeGen/attributes.c
vendor/clang/dist/test/CodeGen/unwind-attr.c
vendor/clang/dist/test/Sema/compare.c
vendor/clang/dist/test/Sema/ext_vector_casts.c
vendor/clang/dist/test/SemaCXX/constructor-initializer.cpp
vendor/clang/dist/test/SemaCXX/exception-spec.cpp
vendor/clang/dist/test/SemaCXX/member-pointer.cpp
vendor/clang/dist/test/SemaTemplate/operator-template.cpp
vendor/clang/dist/test/cxx-sections.data
vendor/clang/dist/tools/clang-cc/clang-cc.cpp
vendor/clang/dist/tools/driver/driver.cpp
vendor/clang/dist/tools/index-test/index-test.cpp
vendor/clang/dist/utils/test/TestRunner.py
vendor/clang/dist/www/analyzer/latest_checker.html.incl
vendor/clang/dist/www/cxx_status.html
Modified: vendor/clang/dist/include/clang/AST/ASTContext.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/ASTContext.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/ASTContext.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -141,10 +141,19 @@ class ASTContext {
/// this ASTContext object.
LangOptions LangOpts;
+ /// \brief Whether we have already loaded comment source ranges from an
+ /// external source.
+ bool LoadedExternalComments;
+
/// MallocAlloc/BumpAlloc - The allocator objects used to create AST objects.
bool FreeMemory;
llvm::MallocAllocator MallocAlloc;
llvm::BumpPtrAllocator BumpAlloc;
+
+ /// \brief Mapping from declarations to their comments, once we have
+ /// already looked up the comment associated with a given declaration.
+ llvm::DenseMap<const Decl *, std::string> DeclComments;
+
public:
TargetInfo &Target;
IdentifierTable &Idents;
@@ -154,6 +163,10 @@ public:
llvm::OwningPtr<ExternalASTSource> ExternalSource;
clang::PrintingPolicy PrintingPolicy;
+ /// \brief Source ranges for all of the comments in the source file,
+ /// sorted in order of appearance in the translation unit.
+ std::vector<SourceRange> Comments;
+
SourceManager& getSourceManager() { return SourceMgr; }
const SourceManager& getSourceManager() const { return SourceMgr; }
void *Allocate(unsigned Size, unsigned Align = 8) {
@@ -178,7 +191,8 @@ public:
TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
-
+ const char *getCommentForDecl(const Decl *D);
+
// Builtin Types.
QualType VoidTy;
QualType BoolTy;
@@ -351,12 +365,6 @@ public:
ObjCProtocolDecl **ProtocolList,
unsigned NumProtocols);
- /// getObjCQualifiedIdType - Return an ObjCQualifiedIdType for a
- /// given 'id' and conforming protocol list.
- QualType getObjCQualifiedIdType(ObjCProtocolDecl **ProtocolList,
- unsigned NumProtocols);
-
-
/// getTypeOfType - GCC extension.
QualType getTypeOfExprType(Expr *e);
QualType getTypeOfType(QualType t);
Modified: vendor/clang/dist/include/clang/AST/CFG.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/CFG.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/CFG.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -17,17 +17,20 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/Support/Allocator.h"
-#include "llvm/Support/raw_ostream.h"
#include <list>
#include <vector>
#include <cassert>
+namespace llvm {
+ class raw_ostream;
+}
namespace clang {
class Stmt;
class Expr;
class CFG;
class PrinterHelper;
class BlockEdge;
+ class LangOptions;
/// CFGBlock - Represents a single basic block in a source-level CFG.
/// It consists of:
@@ -181,9 +184,9 @@ public:
unsigned getBlockID() const { return BlockID; }
- void dump(const CFG* cfg) const;
- void print(llvm::raw_ostream& OS, const CFG* cfg) const;
- void printTerminator(llvm::raw_ostream& OS) const;
+ void dump(const CFG *cfg, const LangOptions &LO) const;
+ void print(llvm::raw_ostream &OS, const CFG* cfg, const LangOptions &LO) const;
+ void printTerminator(llvm::raw_ostream &OS, const LangOptions &LO) const;
};
@@ -283,9 +286,9 @@ public:
// CFG Debugging: Pretty-Printing and Visualization.
//===--------------------------------------------------------------------===//
- void viewCFG() const;
- void print(llvm::raw_ostream& OS) const;
- void dump() const;
+ void viewCFG(const LangOptions &LO) const;
+ void print(llvm::raw_ostream& OS, const LangOptions &LO) const;
+ void dump(const LangOptions &LO) const;
//===--------------------------------------------------------------------===//
// Internal: constructors and data.
Modified: vendor/clang/dist/include/clang/AST/Decl.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Decl.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/Decl.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -26,13 +26,19 @@ class Stmt;
class CompoundStmt;
class StringLiteral;
class TemplateArgumentList;
+class FunctionTemplateSpecializationInfo;
/// TranslationUnitDecl - The top declaration context.
class TranslationUnitDecl : public Decl, public DeclContext {
- TranslationUnitDecl()
+ ASTContext &Ctx;
+
+ explicit TranslationUnitDecl(ASTContext &ctx)
: Decl(TranslationUnit, 0, SourceLocation()),
- DeclContext(TranslationUnit) {}
+ DeclContext(TranslationUnit),
+ Ctx(ctx) {}
public:
+ ASTContext &getASTContext() const { return Ctx; }
+
static TranslationUnitDecl *Create(ASTContext &C);
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return D->getKind() == TranslationUnit; }
@@ -621,15 +627,8 @@ public:
enum StorageClass {
None, Extern, Static, PrivateExtern
};
-private:
- /// \brief Provides information about a function template specialization,
- /// which is a FunctionDecl that has been explicitly specialization or
- /// instantiated from a function template.
- struct TemplateSpecializationInfo {
- FunctionTemplateDecl *Template;
- const TemplateArgumentList *TemplateArguments;
- };
+private:
/// ParamInfo - new[]'d array of pointers to VarDecls for the formal
/// parameters of this function. This is null if a prototype or if there are
/// no formals.
@@ -684,7 +683,8 @@ private:
/// the template being specialized and the template arguments involved in
/// that specialization.
llvm::PointerUnion3<FunctionTemplateDecl*, FunctionDecl*,
- TemplateSpecializationInfo*> TemplateOrSpecialization;
+ FunctionTemplateSpecializationInfo*>
+ TemplateOrSpecialization;
protected:
FunctionDecl(Kind DK, DeclContext *DC, SourceLocation L,
@@ -724,11 +724,11 @@ public:
/// function. The variant that accepts a FunctionDecl pointer will
/// set that function declaration to the actual declaration
/// containing the body (if there is one).
- Stmt *getBody(ASTContext &Context, const FunctionDecl *&Definition) const;
+ Stmt *getBody(const FunctionDecl *&Definition) const;
- virtual Stmt *getBody(ASTContext &Context) const {
+ virtual Stmt *getBody() const {
const FunctionDecl* Definition;
- return getBody(Context, Definition);
+ return getBody(Definition);
}
/// \brief If the function has a body that is immediately available,
@@ -809,9 +809,7 @@ public:
return PreviousDeclaration;
}
- void setPreviousDeclaration(FunctionDecl * PrevDecl) {
- PreviousDeclaration = PrevDecl;
- }
+ void setPreviousDeclaration(FunctionDecl * PrevDecl);
unsigned getBuiltinID(ASTContext &Context) const;
@@ -940,27 +938,14 @@ public:
///
/// If this function declaration is not a function template specialization,
/// returns NULL.
- FunctionTemplateDecl *getPrimaryTemplate() const {
- if (TemplateSpecializationInfo *Info
- = TemplateOrSpecialization.dyn_cast<TemplateSpecializationInfo*>()) {
- return Info->Template;
- }
- return 0;
- }
+ FunctionTemplateDecl *getPrimaryTemplate() const;
/// \brief Retrieve the template arguments used to produce this function
/// template specialization from the primary template.
///
/// If this function declaration is not a function template specialization,
/// returns NULL.
- const TemplateArgumentList *getTemplateSpecializationArgs() const {
- if (TemplateSpecializationInfo *Info
- = TemplateOrSpecialization.dyn_cast<TemplateSpecializationInfo*>()) {
- return Info->TemplateArguments;
- }
- return 0;
- }
-
+ const TemplateArgumentList *getTemplateSpecializationArgs() const;
/// \brief Specify that this function declaration is actually a function
/// template specialization.
@@ -974,8 +959,17 @@ public:
/// function template specialization from the template.
void setFunctionTemplateSpecialization(ASTContext &Context,
FunctionTemplateDecl *Template,
- const TemplateArgumentList *TemplateArgs);
-
+ const TemplateArgumentList *TemplateArgs,
+ void *InsertPos);
+
+ /// \brief Determine whether this is an explicit specialization of a
+ /// function template or a member function of a class template.
+ bool isExplicitSpecialization() const;
+
+ /// \brief Note that this is an explicit specialization of a function template
+ /// or a member function of a class template.
+ void setExplicitSpecialization(bool ES);
+
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
return D->getKind() >= FunctionFirst && D->getKind() <= FunctionLast;
@@ -1268,12 +1262,12 @@ public:
// enumeration.
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
- enumerator_iterator enumerator_begin(ASTContext &Context) const {
- return enumerator_iterator(this->decls_begin(Context));
+ enumerator_iterator enumerator_begin() const {
+ return enumerator_iterator(this->decls_begin());
}
- enumerator_iterator enumerator_end(ASTContext &Context) const {
- return enumerator_iterator(this->decls_end(Context));
+ enumerator_iterator enumerator_end() const {
+ return enumerator_iterator(this->decls_end());
}
/// getIntegerType - Return the integer type this enum decl corresponds to.
@@ -1376,17 +1370,17 @@ public:
// data members, functions, constructors, destructors, etc.
typedef specific_decl_iterator<FieldDecl> field_iterator;
- field_iterator field_begin(ASTContext &Context) const {
- return field_iterator(decls_begin(Context));
+ field_iterator field_begin() const {
+ return field_iterator(decls_begin());
}
- field_iterator field_end(ASTContext &Context) const {
- return field_iterator(decls_end(Context));
+ field_iterator field_end() const {
+ return field_iterator(decls_end());
}
// field_empty - Whether there are any fields (non-static data
// members) in this record.
- bool field_empty(ASTContext &Context) const {
- return field_begin(Context) == field_end(Context);
+ bool field_empty() const {
+ return field_begin() == field_end();
}
/// completeDefinition - Notes that the definition of this type is
@@ -1448,8 +1442,8 @@ public:
bool IsVariadic() const { return isVariadic; }
void setIsVariadic(bool value) { isVariadic = value; }
- CompoundStmt *getBody() const { return (CompoundStmt*) Body; }
- Stmt *getBody(ASTContext &C) const { return (Stmt*) Body; }
+ CompoundStmt *getCompoundBody() const { return (CompoundStmt*) Body; }
+ Stmt *getBody() const { return (Stmt*) Body; }
void setBody(CompoundStmt *B) { Body = (Stmt*) B; }
// Iterator access to formal parameters.
Modified: vendor/clang/dist/include/clang/AST/DeclBase.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclBase.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/DeclBase.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -213,6 +213,13 @@ public:
const DeclContext *getDeclContext() const {
return const_cast<Decl*>(this)->getDeclContext();
}
+
+ TranslationUnitDecl *getTranslationUnitDecl();
+ const TranslationUnitDecl *getTranslationUnitDecl() const {
+ return const_cast<Decl*>(this)->getTranslationUnitDecl();
+ }
+
+ ASTContext &getASTContext() const;
void setAccess(AccessSpecifier AS) {
Access = AS;
@@ -225,23 +232,23 @@ public:
}
bool hasAttrs() const { return HasAttrs; }
- void addAttr(ASTContext &Context, Attr *attr);
- const Attr *getAttrs(ASTContext &Context) const {
+ void addAttr(Attr *attr);
+ const Attr *getAttrs() const {
if (!HasAttrs) return 0; // common case, no attributes.
- return getAttrsImpl(Context); // Uncommon case, out of line hash lookup.
+ return getAttrsImpl(); // Uncommon case, out of line hash lookup.
}
- void swapAttrs(ASTContext &Context, Decl *D);
- void invalidateAttrs(ASTContext &Context);
+ void swapAttrs(Decl *D);
+ void invalidateAttrs();
- template<typename T> const T *getAttr(ASTContext &Context) const {
- for (const Attr *attr = getAttrs(Context); attr; attr = attr->getNext())
+ template<typename T> const T *getAttr() const {
+ for (const Attr *attr = getAttrs(); attr; attr = attr->getNext())
if (const T *V = dyn_cast<T>(attr))
return V;
return 0;
}
- template<typename T> bool hasAttr(ASTContext &Context) const {
- return getAttr<T>(Context) != 0;
+ template<typename T> bool hasAttr() const {
+ return getAttr<T>() != 0;
}
/// setInvalidDecl - Indicates the Decl had a semantic error. This
@@ -307,14 +314,14 @@ public:
/// getBody - If this Decl represents a declaration for a body of code,
/// such as a function or method definition, this method returns the
/// top-level Stmt* of that body. Otherwise this method returns null.
- virtual Stmt* getBody(ASTContext &Context) const { return 0; }
+ virtual Stmt* getBody() const { return 0; }
/// getCompoundBody - Returns getBody(), dyn_casted to a CompoundStmt.
- CompoundStmt* getCompoundBody(ASTContext &Context) const;
+ CompoundStmt* getCompoundBody() const;
/// getBodyRBrace - Gets the right brace of the body, if a body exists.
/// This works whether the body is a CompoundStmt or a CXXTryStmt.
- SourceLocation getBodyRBrace(ASTContext &Context) const;
+ SourceLocation getBodyRBrace() const;
// global temp stats (until we have a per-module visitor)
static void addDeclKind(Kind k);
@@ -340,18 +347,16 @@ public:
/// Destroy - Call destructors and release memory.
virtual void Destroy(ASTContext& C);
- void print(llvm::raw_ostream &Out, ASTContext &Context,
+ void print(llvm::raw_ostream &Out, unsigned Indentation = 0);
+ void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation = 0);
- void print(llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy, unsigned Indentation = 0);
static void printGroup(Decl** Begin, unsigned NumDecls,
- llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy,
+ llvm::raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation = 0);
- void dump(ASTContext &Context);
+ void dump();
private:
- const Attr *getAttrsImpl(ASTContext &Context) const;
+ const Attr *getAttrsImpl() const;
};
@@ -454,7 +459,11 @@ public:
const DeclContext *getLexicalParent() const {
return const_cast<DeclContext*>(this)->getLexicalParent();
}
-
+
+ ASTContext &getParentASTContext() const {
+ return cast<Decl>(this)->getASTContext();
+ }
+
bool isFunctionOrMethod() const {
switch (DeclKind) {
case Decl::Block:
@@ -592,9 +601,9 @@ public:
/// decls_begin/decls_end - Iterate over the declarations stored in
/// this context.
- decl_iterator decls_begin(ASTContext &Context) const;
- decl_iterator decls_end(ASTContext &Context) const;
- bool decls_empty(ASTContext &Context) const;
+ decl_iterator decls_begin() const;
+ decl_iterator decls_end() const;
+ bool decls_empty() const;
/// specific_decl_iterator - Iterates over a subrange of
/// declarations stored in a DeclContext, providing only those that
@@ -750,7 +759,7 @@ public:
///
/// If D is also a NamedDecl, it will be made visible within its
/// semantic context via makeDeclVisibleInContext.
- void addDecl(ASTContext &Context, Decl *D);
+ void addDecl(Decl *D);
/// lookup_iterator - An iterator that provides access to the results
/// of looking up a name within this context.
@@ -769,8 +778,8 @@ public:
/// the declarations with this name, with object, function, member,
/// and enumerator names preceding any tag name. Note that this
/// routine will not look into parent contexts.
- lookup_result lookup(ASTContext &Context, DeclarationName Name);
- lookup_const_result lookup(ASTContext &Context, DeclarationName Name) const;
+ lookup_result lookup(DeclarationName Name);
+ lookup_const_result lookup(DeclarationName Name) const;
/// @brief Makes a declaration visible within this context.
///
@@ -786,7 +795,7 @@ public:
/// visible from this context, as determined by
/// NamedDecl::declarationReplaces, the previous declaration will be
/// replaced with D.
- void makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D);
+ void makeDeclVisibleInContext(NamedDecl *D);
/// udir_iterator - Iterates through the using-directives stored
/// within this context.
@@ -794,14 +803,14 @@ public:
typedef std::pair<udir_iterator, udir_iterator> udir_iterator_range;
- udir_iterator_range getUsingDirectives(ASTContext &Context) const;
+ udir_iterator_range getUsingDirectives() const;
- udir_iterator using_directives_begin(ASTContext &Context) const {
- return getUsingDirectives(Context).first;
+ udir_iterator using_directives_begin() const {
+ return getUsingDirectives().first;
}
- udir_iterator using_directives_end(ASTContext &Context) const {
- return getUsingDirectives(Context).second;
+ udir_iterator using_directives_end() const {
+ return getUsingDirectives().second;
}
// Low-level accessors
@@ -836,11 +845,11 @@ public:
#include "clang/AST/DeclNodes.def"
private:
- void LoadLexicalDeclsFromExternalStorage(ASTContext &Context) const;
- void LoadVisibleDeclsFromExternalStorage(ASTContext &Context) const;
+ void LoadLexicalDeclsFromExternalStorage() const;
+ void LoadVisibleDeclsFromExternalStorage() const;
- void buildLookup(ASTContext &Context, DeclContext *DCtx);
- void makeDeclVisibleInContextImpl(ASTContext &Context, NamedDecl *D);
+ void buildLookup(DeclContext *DCtx);
+ void makeDeclVisibleInContextImpl(NamedDecl *D);
};
inline bool Decl::isTemplateParameter() const {
Modified: vendor/clang/dist/include/clang/AST/DeclCXX.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclCXX.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/DeclCXX.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -32,6 +32,8 @@ class ClassTemplateSpecializationDecl;
class AnyFunctionDecl {
NamedDecl *Function;
+ AnyFunctionDecl(NamedDecl *ND) : Function(ND) { }
+
public:
AnyFunctionDecl(FunctionDecl *FD) : Function(FD) { }
AnyFunctionDecl(FunctionTemplateDecl *FTD);
@@ -42,6 +44,10 @@ public:
/// \brief Retrieve the underlying function or function template.
NamedDecl *get() const { return Function; }
+
+ static AnyFunctionDecl getFromNamedDecl(NamedDecl *ND) {
+ return AnyFunctionDecl(ND);
+ }
};
} // end namespace clang
@@ -57,6 +63,22 @@ namespace llvm {
};
template<> struct simplify_type< ::clang::AnyFunctionDecl>
: public simplify_type<const ::clang::AnyFunctionDecl> {};
+
+ // Provide PointerLikeTypeTraits for non-cvr pointers.
+ template<>
+ class PointerLikeTypeTraits< ::clang::AnyFunctionDecl> {
+ public:
+ static inline void *getAsVoidPointer(::clang::AnyFunctionDecl F) {
+ return F.get();
+ }
+ static inline ::clang::AnyFunctionDecl getFromVoidPointer(void *P) {
+ return ::clang::AnyFunctionDecl::getFromNamedDecl(
+ static_cast< ::clang::NamedDecl*>(P));
+ }
+
+ enum { NumLowBitsAvailable = 2 };
+ };
+
} // end namespace llvm
namespace clang {
@@ -91,24 +113,10 @@ public:
static OverloadedFunctionDecl *Create(ASTContext &C, DeclContext *DC,
DeclarationName N);
- /// addOverload - Add an overloaded function FD to this set of
- /// overloaded functions.
- void addOverload(FunctionDecl *FD) {
- assert((FD->getDeclName() == getDeclName() ||
- isa<CXXConversionDecl>(FD) || isa<CXXConstructorDecl>(FD)) &&
- "Overloaded functions must have the same name");
- Functions.push_back(FD);
-
- // An overloaded function declaration always has the location of
- // the most-recently-added function declaration.
- if (FD->getLocation().isValid())
- this->setLocation(FD->getLocation());
- }
-
- /// addOverload - Add an overloaded function template FTD to this set of
- /// overloaded functions.
- void addOverload(FunctionTemplateDecl *FTD);
-
+ /// \brief Add a new overloaded function or function template to the set
+ /// of overloaded function templates.
+ void addOverload(AnyFunctionDecl F);
+
function_iterator function_begin() { return Functions.begin(); }
function_iterator function_end() { return Functions.end(); }
function_const_iterator function_begin() const { return Functions.begin(); }
@@ -289,8 +297,11 @@ public:
CXXRecordDecl* PrevDecl=0,
bool DelayTypeCreation = false);
+ virtual void Destroy(ASTContext& C);
+
/// setBases - Sets the base classes of this struct or class.
- void setBases(CXXBaseSpecifier const * const *Bases, unsigned NumBases);
+ void setBases(ASTContext &C,
+ CXXBaseSpecifier const * const *Bases, unsigned NumBases);
/// getNumBases - Retrieves the number of base classes of this
/// class.
@@ -580,15 +591,20 @@ class CXXBaseOrMemberInitializer {
/// Args - The arguments used to initialize the base or member.
Expr **Args;
unsigned NumArgs;
+
+ /// IdLoc - Location of the id in ctor-initializer list.
+ SourceLocation IdLoc;
public:
/// CXXBaseOrMemberInitializer - Creates a new base-class initializer.
explicit
- CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs);
+ CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
+ SourceLocation L);
/// CXXBaseOrMemberInitializer - Creates a new member initializer.
explicit
- CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs);
+ CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs,
+ SourceLocation L);
/// ~CXXBaseOrMemberInitializer - Destroy the base or member initializer.
~CXXBaseOrMemberInitializer();
@@ -601,6 +617,10 @@ public:
/// arguments.
typedef Expr * const * arg_const_iterator;
+ /// getBaseOrMember - get the generic 'member' representing either the field
+ /// or a base class.
+ void* getBaseOrMember() const { return reinterpret_cast<void*>(BaseOrMember); }
+
/// isBaseInitializer - Returns true when this initializer is
/// initializing a base class.
bool isBaseInitializer() const { return (BaseOrMember & 0x1) != 0; }
@@ -641,6 +661,8 @@ public:
return 0;
}
+ SourceLocation getSourceLocation() const { return IdLoc; }
+
/// begin() - Retrieve an iterator to the first initializer argument.
arg_iterator begin() { return Args; }
/// begin() - Retrieve an iterator to the first initializer argument.
@@ -677,16 +699,22 @@ class CXXConstructorDecl : public CXXMet
/// @c !Implicit && ImplicitlyDefined.
bool ImplicitlyDefined : 1;
- /// FIXME: Add support for base and member initializers.
-
+ /// Support for base and member initializers.
+ /// BaseOrMemberInitializers - The arguments used to initialize the base
+ /// or member.
+ CXXBaseOrMemberInitializer **BaseOrMemberInitializers;
+ unsigned NumBaseOrMemberInitializers;
+
CXXConstructorDecl(CXXRecordDecl *RD, SourceLocation L,
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),
+ BaseOrMemberInitializers(0), NumBaseOrMemberInitializers(0) {
setImplicit(isImplicitlyDeclared);
}
-
+ virtual void Destroy(ASTContext& C);
+
public:
static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
@@ -702,7 +730,8 @@ public:
/// already been defined.
bool isImplicitlyDefined(ASTContext &C) const {
assert(isThisDeclarationADefinition() &&
- "Can only get the implicit-definition flag once the constructor has been defined");
+ "Can only get the implicit-definition flag once the "
+ "constructor has been defined");
return ImplicitlyDefined;
}
@@ -710,10 +739,41 @@ public:
/// implicitly defined or not.
void setImplicitlyDefined(bool ID) {
assert(isThisDeclarationADefinition() &&
- "Can only set the implicit-definition flag once the constructor has been defined");
+ "Can only set the implicit-definition flag once the constructor "
+ "has been defined");
ImplicitlyDefined = ID;
}
+ /// init_iterator - Iterates through the member/base initializer list.
+ typedef CXXBaseOrMemberInitializer **init_iterator;
+
+ /// init_const_iterator - Iterates through the memberbase initializer list.
+ typedef CXXBaseOrMemberInitializer * const * init_const_iterator;
+
+ /// begin() - Retrieve an iterator to the first initializer.
+ init_iterator begin() { return BaseOrMemberInitializers; }
+ /// begin() - Retrieve an iterator to the first initializer.
+ init_const_iterator begin() const { return BaseOrMemberInitializers; }
+
+ /// end() - Retrieve an iterator past the last initializer.
+ init_iterator end() {
+ return BaseOrMemberInitializers + NumBaseOrMemberInitializers;
+ }
+ /// end() - Retrieve an iterator past the last initializer.
+ init_const_iterator end() const {
+ return BaseOrMemberInitializers + NumBaseOrMemberInitializers;
+ }
+
+ /// getNumArgs - Determine the number of arguments used to
+ /// initialize the member or base.
+ unsigned getNumBaseOrMemberInitializers() const {
+ return NumBaseOrMemberInitializers;
+ }
+
+ void setBaseOrMemberInitializers(ASTContext &C,
+ CXXBaseOrMemberInitializer **Initializers,
+ unsigned NumInitializers);
+
/// isDefaultConstructor - Whether this constructor is a default
/// constructor (C++ [class.ctor]p5), which can be used to
/// default-initialize a class of this type.
Modified: vendor/clang/dist/include/clang/AST/DeclObjC.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclObjC.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/DeclObjC.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -242,10 +242,10 @@ public:
return ImplementationControl(DeclImplementation);
}
- virtual Stmt *getBody(ASTContext &C) const {
+ virtual Stmt *getBody() const {
return (Stmt*) Body;
}
- CompoundStmt *getBody() { return (CompoundStmt*)Body; }
+ CompoundStmt *getCompoundBody() { return (CompoundStmt*)Body; }
void setBody(Stmt *B) { Body = B; }
// Implement isa/cast/dyncast/etc.
@@ -291,55 +291,52 @@ public:
// Iterator access to properties.
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
- prop_iterator prop_begin(ASTContext &Context) const {
- return prop_iterator(decls_begin(Context));
+ prop_iterator prop_begin() const {
+ return prop_iterator(decls_begin());
}
- prop_iterator prop_end(ASTContext &Context) const {
- return prop_iterator(decls_end(Context));
+ prop_iterator prop_end() const {
+ return prop_iterator(decls_end());
}
// Iterator access to instance/class methods.
typedef specific_decl_iterator<ObjCMethodDecl> method_iterator;
- method_iterator meth_begin(ASTContext &Context) const {
- return method_iterator(decls_begin(Context));
+ method_iterator meth_begin() const {
+ return method_iterator(decls_begin());
}
- method_iterator meth_end(ASTContext &Context) const {
- return method_iterator(decls_end(Context));
+ method_iterator meth_end() const {
+ return method_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isInstanceMethod>
instmeth_iterator;
- instmeth_iterator instmeth_begin(ASTContext &Context) const {
- return instmeth_iterator(decls_begin(Context));
+ instmeth_iterator instmeth_begin() const {
+ return instmeth_iterator(decls_begin());
}
- instmeth_iterator instmeth_end(ASTContext &Context) const {
- return instmeth_iterator(decls_end(Context));
+ instmeth_iterator instmeth_end() const {
+ return instmeth_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isClassMethod>
classmeth_iterator;
- classmeth_iterator classmeth_begin(ASTContext &Context) const {
- return classmeth_iterator(decls_begin(Context));
+ classmeth_iterator classmeth_begin() const {
+ return classmeth_iterator(decls_begin());
}
- classmeth_iterator classmeth_end(ASTContext &Context) const {
- return classmeth_iterator(decls_end(Context));
+ classmeth_iterator classmeth_end() const {
+ return classmeth_iterator(decls_end());
}
// Get the local instance/class method declared in this interface.
- ObjCMethodDecl *getInstanceMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getClassMethod(ASTContext &Context, Selector Sel) const;
- ObjCIvarDecl *getIvarDecl(ASTContext &Context, IdentifierInfo *Id) const;
-
- ObjCMethodDecl *
- getMethod(ASTContext &Context, Selector Sel, bool isInstance) const {
- return isInstance ? getInstanceMethod(Context, Sel)
- : getClassMethod(Context, Sel);
+ ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
+ ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCIvarDecl *getIvarDecl(IdentifierInfo *Id) const;
+
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel) : getClassMethod(Sel);
}
- ObjCPropertyDecl *FindPropertyDeclaration(ASTContext &Context,
- IdentifierInfo *PropertyId) const;
+ ObjCPropertyDecl *FindPropertyDeclaration(IdentifierInfo *PropertyId) const;
// Marks the end of the container.
SourceLocation getAtEndLoc() const { return AtEndLoc; }
@@ -474,19 +471,17 @@ public:
return false;
}
- ObjCIvarDecl *lookupInstanceVariable(ASTContext &Context,
- IdentifierInfo *IVarName,
+ ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
ObjCInterfaceDecl *&ClassDeclared);
- ObjCIvarDecl *lookupInstanceVariable(ASTContext &Context,
- IdentifierInfo *IVarName) {
+ ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {
ObjCInterfaceDecl *ClassDeclared;
- return lookupInstanceVariable(Context, IVarName, ClassDeclared);
+ return lookupInstanceVariable(IVarName, ClassDeclared);
}
// Lookup a method. First, we search locally. If a method isn't
// found, we search referenced protocols and class categories.
- ObjCMethodDecl *lookupInstanceMethod(ASTContext &Context, Selector Sel);
- ObjCMethodDecl *lookupClassMethod(ASTContext &Context, Selector Sel);
+ ObjCMethodDecl *lookupInstanceMethod(Selector Sel);
+ ObjCMethodDecl *lookupClassMethod(Selector Sel);
ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
// Location information, modeled after the Stmt API.
@@ -648,8 +643,8 @@ public:
// Lookup a method. First, we search locally. If a method isn't
// found, we search referenced protocols and class categories.
- ObjCMethodDecl *lookupInstanceMethod(ASTContext &Context, Selector Sel);
- ObjCMethodDecl *lookupClassMethod(ASTContext &Context, Selector Sel);
+ ObjCMethodDecl *lookupInstanceMethod(Selector Sel);
+ ObjCMethodDecl *lookupClassMethod(Selector Sel);
bool isForwardDecl() const { return isForwardProtoDecl; }
void setForwardDecl(bool val) { isForwardProtoDecl = val; }
@@ -831,61 +826,57 @@ public:
ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
void setClassInterface(ObjCInterfaceDecl *IFace) { ClassInterface = IFace; }
- void addInstanceMethod(ASTContext &Context, ObjCMethodDecl *method) {
+ void addInstanceMethod(ObjCMethodDecl *method) {
// FIXME: Context should be set correctly before we get here.
method->setLexicalDeclContext(this);
- addDecl(Context, method);
+ addDecl(method);
}
- void addClassMethod(ASTContext &Context, ObjCMethodDecl *method) {
+ void addClassMethod(ObjCMethodDecl *method) {
// FIXME: Context should be set correctly before we get here.
method->setLexicalDeclContext(this);
- addDecl(Context, method);
+ addDecl(method);
}
// Get the local instance/class method declared in this interface.
- ObjCMethodDecl *getInstanceMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getClassMethod(ASTContext &Context, Selector Sel) const;
- ObjCMethodDecl *getMethod(ASTContext &Context, Selector Sel,
- bool isInstance) const {
- return isInstance ? getInstanceMethod(Context, Sel)
- : getClassMethod(Context, Sel);
+ ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
+ ObjCMethodDecl *getClassMethod(Selector Sel) const;
+ ObjCMethodDecl *getMethod(Selector Sel, bool isInstance) const {
+ return isInstance ? getInstanceMethod(Sel)
+ : getClassMethod(Sel);
}
- void addPropertyImplementation(ASTContext &Context,
- ObjCPropertyImplDecl *property);
-
- ObjCPropertyImplDecl *FindPropertyImplDecl(ASTContext &Context,
- IdentifierInfo *propertyId) const;
- ObjCPropertyImplDecl *FindPropertyImplIvarDecl(ASTContext &Context,
- IdentifierInfo *ivarId) const;
+ void addPropertyImplementation(ObjCPropertyImplDecl *property);
+
+ ObjCPropertyImplDecl *FindPropertyImplDecl(IdentifierInfo *propertyId) const;
+ ObjCPropertyImplDecl *FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const;
// Iterator access to properties.
typedef specific_decl_iterator<ObjCPropertyImplDecl> propimpl_iterator;
- propimpl_iterator propimpl_begin(ASTContext &Context) const {
- return propimpl_iterator(decls_begin(Context));
+ propimpl_iterator propimpl_begin() const {
+ return propimpl_iterator(decls_begin());
}
- propimpl_iterator propimpl_end(ASTContext &Context) const {
- return propimpl_iterator(decls_end(Context));
+ propimpl_iterator propimpl_end() const {
+ return propimpl_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isInstanceMethod>
instmeth_iterator;
- instmeth_iterator instmeth_begin(ASTContext &Context) const {
- return instmeth_iterator(decls_begin(Context));
+ instmeth_iterator instmeth_begin() const {
+ return instmeth_iterator(decls_begin());
}
- instmeth_iterator instmeth_end(ASTContext &Context) const {
- return instmeth_iterator(decls_end(Context));
+ instmeth_iterator instmeth_end() const {
+ return instmeth_iterator(decls_end());
}
typedef filtered_decl_iterator<ObjCMethodDecl,
&ObjCMethodDecl::isClassMethod>
classmeth_iterator;
- classmeth_iterator classmeth_begin(ASTContext &Context) const {
- return classmeth_iterator(decls_begin(Context));
+ classmeth_iterator classmeth_begin() const {
+ return classmeth_iterator(decls_begin());
}
- classmeth_iterator classmeth_end(ASTContext &Context) const {
- return classmeth_iterator(decls_end(Context));
+ classmeth_iterator classmeth_end() const {
+ return classmeth_iterator(decls_end());
}
// Location information, modeled after the Stmt API.
@@ -1002,17 +993,17 @@ public:
void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
- ivar_iterator ivar_begin(ASTContext &Context) const {
- return ivar_iterator(decls_begin(Context));
+ ivar_iterator ivar_begin() const {
+ return ivar_iterator(decls_begin());
}
- ivar_iterator ivar_end(ASTContext &Context) const {
- return ivar_iterator(decls_end(Context));
+ ivar_iterator ivar_end() const {
+ return ivar_iterator(decls_end());
}
- unsigned ivar_size(ASTContext &Context) const {
- return std::distance(ivar_begin(Context), ivar_end(Context));
+ unsigned ivar_size() const {
+ return std::distance(ivar_begin(), ivar_end());
}
- bool ivar_empty(ASTContext &Context) const {
- return ivar_begin(Context) == ivar_end(Context);
+ bool ivar_empty() const {
+ return ivar_begin() == ivar_end();
}
static bool classof(const Decl *D) {
Modified: vendor/clang/dist/include/clang/AST/DeclTemplate.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclTemplate.h Sat Jul 4 13:58:26 2009 (r195340)
+++ vendor/clang/dist/include/clang/AST/DeclTemplate.h Sat Jul 4 13:58:54 2009 (r195341)
@@ -100,6 +100,352 @@ public:
}
};
+/// \brief Represents a template argument within a class template
+/// specialization.
+class TemplateArgument {
+ union {
+ uintptr_t TypeOrValue;
+ struct {
+ 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.
+ SourceLocation StartLoc;
+
+public:
+ /// \brief The type of template argument we're storing.
+ enum ArgKind {
+ Null = 0,
+ /// The template argument is a type. Its value is stored in the
+ /// TypeOrValue field.
+ Type = 1,
+ /// The template argument is a declaration
+ Declaration = 2,
+ /// The template argument is an integral value stored in an llvm::APSInt.
+ Integral = 3,
+ /// The template argument is a value- or type-dependent expression
+ /// stored in an Expr*.
+ 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.
+ TemplateArgument() : TypeOrValue(0), StartLoc(), Kind(Null) { }
+
+ /// \brief Construct a template type argument.
+ TemplateArgument(SourceLocation Loc, QualType T) : Kind(Type) {
+ TypeOrValue = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
+ StartLoc = Loc;
+ }
+
+ /// \brief Construct a template argument that refers to a
+ /// declaration, which is either an external declaration or a
+ /// template declaration.
+ TemplateArgument(SourceLocation Loc, Decl *D) : Kind(Declaration) {
+ // FIXME: Need to be sure we have the "canonical" declaration!
+ TypeOrValue = reinterpret_cast<uintptr_t>(D);
+ StartLoc = Loc;
+ }
+
+ /// \brief Construct an integral constant template argument.
+ TemplateArgument(SourceLocation Loc, const llvm::APSInt &Value,
+ QualType Type)
+ : Kind(Integral) {
+ new (Integer.Value) llvm::APSInt(Value);
+ Integer.Type = Type.getAsOpaquePtr();
+ StartLoc = Loc;
+ }
+
+ /// \brief Construct a template argument that is an expression.
+ ///
+ /// This form of template argument only occurs in template argument
+ /// lists used for dependent types and for expression; it will not
+ /// occur in a non-dependent, canonical template argument list.
+ TemplateArgument(Expr *E);
+
+ /// \brief Copy constructor for a template argument.
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list