svn commit: r198398 - in vendor/clang/dist: include/clang-c
include/clang/AST include/clang/Analysis/PathSensitive
include/clang/Analysis/Support include/clang/Basic
include/clang/Frontend include/...
Roman Divacky
rdivacky at FreeBSD.org
Fri Oct 23 14:22:19 UTC 2009
Author: rdivacky
Date: Fri Oct 23 14:22:18 2009
New Revision: 198398
URL: http://svn.freebsd.org/changeset/base/198398
Log:
Update clang to r84949.
Added:
vendor/clang/dist/include/clang/AST/TypeLocBuilder.h
vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/p5.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p1.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p2.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
vendor/clang/dist/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
vendor/clang/dist/test/CodeGen/2009-10-20-GlobalDebug.c
vendor/clang/dist/test/CodeGenCXX/address-of-fntemplate.cpp
vendor/clang/dist/test/CodeGenCXX/call-arg-zero-temp.cpp
vendor/clang/dist/test/CodeGenCXX/casts.cpp
vendor/clang/dist/test/CodeGenCXX/derived-to-base-conv.cpp
vendor/clang/dist/test/CodeGenCXX/ptr-to-datamember.cpp
vendor/clang/dist/test/CodeGenCXX/temporaries.cpp
vendor/clang/dist/test/Driver/cxx-pth.cpp
vendor/clang/dist/test/Index/c-index-pch.c
vendor/clang/dist/test/Index/c-index-pch.h
vendor/clang/dist/test/SemaCXX/ptrtomember-overload-resolution.cpp
vendor/clang/dist/test/SemaCXX/switch.cpp
vendor/clang/dist/www/UniversalDriver.html
Modified:
vendor/clang/dist/include/clang-c/Index.h
vendor/clang/dist/include/clang/AST/ASTContext.h
vendor/clang/dist/include/clang/AST/Attr.h
vendor/clang/dist/include/clang/AST/CXXInheritance.h
vendor/clang/dist/include/clang/AST/CanonicalType.h
vendor/clang/dist/include/clang/AST/Decl.h
vendor/clang/dist/include/clang/AST/DeclBase.h
vendor/clang/dist/include/clang/AST/DeclObjC.h
vendor/clang/dist/include/clang/AST/Expr.h
vendor/clang/dist/include/clang/AST/Type.h
vendor/clang/dist/include/clang/AST/TypeLoc.h
vendor/clang/dist/include/clang/AST/TypeLocNodes.def
vendor/clang/dist/include/clang/AST/TypeLocVisitor.h
vendor/clang/dist/include/clang/AST/TypeNodes.def
vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisContext.h
vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisManager.h
vendor/clang/dist/include/clang/Analysis/PathSensitive/Store.h
vendor/clang/dist/include/clang/Analysis/Support/BumpVector.h
vendor/clang/dist/include/clang/Basic/Diagnostic.h
vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td
vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
vendor/clang/dist/include/clang/Basic/FileManager.h
vendor/clang/dist/include/clang/Basic/IdentifierTable.h
vendor/clang/dist/include/clang/Basic/OnDiskHashTable.h
vendor/clang/dist/include/clang/Basic/SourceManager.h
vendor/clang/dist/include/clang/Basic/TargetInfo.h
vendor/clang/dist/include/clang/Frontend/ASTUnit.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/Index/ASTLocation.h
vendor/clang/dist/include/clang/Index/Indexer.h
vendor/clang/dist/include/clang/Index/Utils.h
vendor/clang/dist/include/clang/Parse/Action.h
vendor/clang/dist/lib/AST/ASTContext.cpp
vendor/clang/dist/lib/AST/CXXInheritance.cpp
vendor/clang/dist/lib/AST/Decl.cpp
vendor/clang/dist/lib/AST/DeclTemplate.cpp
vendor/clang/dist/lib/AST/DeclarationName.cpp
vendor/clang/dist/lib/AST/Expr.cpp
vendor/clang/dist/lib/AST/Stmt.cpp
vendor/clang/dist/lib/AST/StmtDumper.cpp
vendor/clang/dist/lib/AST/StmtPrinter.cpp
vendor/clang/dist/lib/AST/Type.cpp
vendor/clang/dist/lib/AST/TypeLoc.cpp
vendor/clang/dist/lib/Analysis/AnalysisContext.cpp
vendor/clang/dist/lib/Analysis/BasicObjCFoundationChecks.cpp
vendor/clang/dist/lib/Analysis/BasicStore.cpp
vendor/clang/dist/lib/Analysis/CFG.cpp
vendor/clang/dist/lib/Analysis/CFRefCount.cpp
vendor/clang/dist/lib/Analysis/GRExprEngine.cpp
vendor/clang/dist/lib/Analysis/GRExprEngineInternalChecks.cpp
vendor/clang/dist/lib/Analysis/LiveVariables.cpp
vendor/clang/dist/lib/Analysis/RegionStore.cpp
vendor/clang/dist/lib/Analysis/SimpleSValuator.cpp
vendor/clang/dist/lib/Basic/Diagnostic.cpp
vendor/clang/dist/lib/Basic/FileManager.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/CGBlocks.cpp
vendor/clang/dist/lib/CodeGen/CGBlocks.h
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/CGDebugInfo.h
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/CGExprScalar.cpp
vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp
vendor/clang/dist/lib/CodeGen/CGVtable.cpp
vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp
vendor/clang/dist/lib/CodeGen/CodeGenFunction.h
vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp
vendor/clang/dist/lib/CodeGen/Mangle.cpp
vendor/clang/dist/lib/CodeGen/TargetABIInfo.cpp
vendor/clang/dist/lib/Driver/ToolChains.cpp
vendor/clang/dist/lib/Driver/Tools.cpp
vendor/clang/dist/lib/Frontend/ASTUnit.cpp
vendor/clang/dist/lib/Frontend/AnalysisConsumer.cpp
vendor/clang/dist/lib/Frontend/CacheTokens.cpp
vendor/clang/dist/lib/Frontend/GeneratePCH.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/PCHWriter.cpp
vendor/clang/dist/lib/Frontend/PCHWriterDecl.cpp
vendor/clang/dist/lib/Frontend/PrintPreprocessedOutput.cpp
vendor/clang/dist/lib/Frontend/RewriteMacros.cpp
vendor/clang/dist/lib/Frontend/RewriteObjC.cpp
vendor/clang/dist/lib/Frontend/TextDiagnosticPrinter.cpp
vendor/clang/dist/lib/Index/ASTLocation.cpp
vendor/clang/dist/lib/Index/ASTVisitor.h
vendor/clang/dist/lib/Index/DeclReferenceMap.cpp
vendor/clang/dist/lib/Index/Entity.cpp
vendor/clang/dist/lib/Index/GlobalSelector.cpp
vendor/clang/dist/lib/Index/ResolveLocation.cpp
vendor/clang/dist/lib/Lex/PPDirectives.cpp
vendor/clang/dist/lib/Lex/PTHLexer.cpp
vendor/clang/dist/lib/Lex/Preprocessor.cpp
vendor/clang/dist/lib/Lex/TokenConcatenation.cpp
vendor/clang/dist/lib/Parse/AttributeList.cpp
vendor/clang/dist/lib/Parse/ParseExpr.cpp
vendor/clang/dist/lib/Parse/ParseExprCXX.cpp
vendor/clang/dist/lib/Parse/ParseInit.cpp
vendor/clang/dist/lib/Parse/ParseObjc.cpp
vendor/clang/dist/lib/Parse/ParseStmt.cpp
vendor/clang/dist/lib/Parse/Parser.cpp
vendor/clang/dist/lib/Rewrite/RewriteRope.cpp
vendor/clang/dist/lib/Sema/Sema.cpp
vendor/clang/dist/lib/Sema/Sema.h
vendor/clang/dist/lib/Sema/SemaCXXCast.cpp
vendor/clang/dist/lib/Sema/SemaChecking.cpp
vendor/clang/dist/lib/Sema/SemaCodeComplete.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/SemaExpr.cpp
vendor/clang/dist/lib/Sema/SemaExprCXX.cpp
vendor/clang/dist/lib/Sema/SemaExprObjC.cpp
vendor/clang/dist/lib/Sema/SemaInit.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/SemaType.cpp
vendor/clang/dist/lib/Sema/TreeTransform.h
vendor/clang/dist/test/Analysis/misc-ps-region-store.m
vendor/clang/dist/test/Analysis/misc-ps.m
vendor/clang/dist/test/Analysis/refcnt_naming.m
vendor/clang/dist/test/Analysis/retain-release-region-store.m
vendor/clang/dist/test/Analysis/retain-release.m
vendor/clang/dist/test/CMakeLists.txt
vendor/clang/dist/test/CodeGen/builtins.c
vendor/clang/dist/test/CodeGen/debug-info.c
vendor/clang/dist/test/CodeGen/ext-vector-shuffle.c
vendor/clang/dist/test/CodeGen/vector.c
vendor/clang/dist/test/CodeGenCXX/default-arg-temps.cpp
vendor/clang/dist/test/CodeGenCXX/expr.cpp
vendor/clang/dist/test/CodeGenCXX/mangle-subst.cpp
vendor/clang/dist/test/CodeGenCXX/member-function-pointers.cpp
vendor/clang/dist/test/CodeGenCXX/references.cpp
vendor/clang/dist/test/Driver/darwin-ld.c
vendor/clang/dist/test/Misc/message-length.c
vendor/clang/dist/test/Preprocessor/macro_paste_bcpl_comment.c
vendor/clang/dist/test/Sema/attr-noreturn.c
vendor/clang/dist/test/Sema/exprs.c
vendor/clang/dist/test/Sema/switch.c
vendor/clang/dist/test/Sema/vector-assign.c
vendor/clang/dist/test/Sema/vector-init.c
vendor/clang/dist/test/SemaCXX/abstract.cpp
vendor/clang/dist/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
vendor/clang/dist/test/SemaCXX/bool.cpp
vendor/clang/dist/test/SemaCXX/builtin-ptrtomember-ambig.cpp
vendor/clang/dist/test/SemaCXX/builtin-ptrtomember-overload.cpp
vendor/clang/dist/test/SemaCXX/exception-spec.cpp
vendor/clang/dist/test/SemaCXX/incomplete-call.cpp
vendor/clang/dist/test/SemaCXX/member-expr.cpp
vendor/clang/dist/test/SemaCXX/overloaded-builtin-operators.cpp
vendor/clang/dist/test/SemaCXX/overloaded-operator.cpp
vendor/clang/dist/test/SemaCXX/static-cast.cpp
vendor/clang/dist/test/SemaObjC/objc-string-constant.m
vendor/clang/dist/test/SemaObjC/try-catch.m
vendor/clang/dist/test/SemaTemplate/extern-templates.cpp
vendor/clang/dist/test/SemaTemplate/fun-template-def.cpp
vendor/clang/dist/test/SemaTemplate/instantiate-expr-2.cpp
vendor/clang/dist/test/SemaTemplate/member-access-expr.cpp
vendor/clang/dist/test/SemaTemplate/member-template-access-expr.cpp
vendor/clang/dist/test/SemaTemplate/variadic-class-template-2.cpp
vendor/clang/dist/tools/CIndex/CIndex.cpp
vendor/clang/dist/tools/CIndex/CIndex.exports
vendor/clang/dist/tools/CIndex/CMakeLists.txt
vendor/clang/dist/tools/c-index-test/c-index-test.c
vendor/clang/dist/tools/clang-cc/clang-cc.cpp
vendor/clang/dist/tools/index-test/index-test.cpp
vendor/clang/dist/www/OpenProjects.html
vendor/clang/dist/www/analyzer/latest_checker.html.incl
vendor/clang/dist/www/comparison.html
vendor/clang/dist/www/cxx_status.html
Modified: vendor/clang/dist/include/clang-c/Index.h
==============================================================================
--- vendor/clang/dist/include/clang-c/Index.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang-c/Index.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -99,18 +99,84 @@ typedef struct {
} CXCursor;
/* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */
-typedef void *CXEntity;
+typedef void *CXEntity;
-CXIndex clang_createIndex();
+/**
+ * \brief clang_createIndex() provides a shared context for creating
+ * translation units. It provides two options:
+ *
+ * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
+ * declarations (when loading any new translation units). A "local" declaration
+ * is one that belongs in the translation unit itself and not in a precompiled
+ * header that was used by the translation unit. If zero, all declarations
+ * will be enumerated.
+ *
+ * - displayDiagnostics: when non-zero, diagnostics will be output. If zero,
+ * diagnostics will be ignored.
+ *
+ * Here is an example:
+ *
+ * // excludeDeclsFromPCH = 1, displayDiagnostics = 1
+ * Idx = clang_createIndex(1, 1);
+ *
+ * // IndexTest.pch was produced with the following command:
+ * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
+ * TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
+ *
+ * // This will load all the symbols from 'IndexTest.pch'
+ * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
+ * clang_disposeTranslationUnit(TU);
+ *
+ * // This will load all the symbols from 'IndexTest.c', excluding symbols
+ * // from 'IndexTest.pch'.
+ * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 };
+ * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args);
+ * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
+ * clang_disposeTranslationUnit(TU);
+ *
+ * This process of creating the 'pch', loading it separately, and using it (via
+ * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
+ * (which gives the indexer the same performance benefit as the compiler).
+ */
+CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
+ int displayDiagnostics);
void clang_disposeIndex(CXIndex);
const char *clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
+/*
+ * \brief Create a translation unit from an AST file (-emit-ast).
+ */
CXTranslationUnit clang_createTranslationUnit(
CXIndex, const char *ast_filename
);
+/**
+ * \brief Destroy the specified CXTranslationUnit object.
+ */
void clang_disposeTranslationUnit(CXTranslationUnit);
+/**
+ * \brief Return the CXTranslationUnit for a given source file and the provided
+ * command line arguments one would pass to the compiler.
+ *
+ * Note: The 'source_filename' argument is optional. If the caller provides a NULL pointer,
+ * the name of the source file is expected to reside in the specified command line arguments.
+ *
+ * Note: When encountered in 'clang_command_line_args', the following options are ignored:
+ *
+ * '-c'
+ * '-emit-ast'
+ * '-fsyntax-only'
+ * '-o <output file>' (both '-o' and '<output file>' are ignored)
+ *
+ */
+CXTranslationUnit clang_createTranslationUnitFromSourceFile(
+ CXIndex CIdx,
+ const char *source_filename /* specify NULL if the source file is in clang_command_line_args */,
+ int num_clang_command_line_args,
+ const char **clang_command_line_args
+);
+
/*
Usage: clang_loadTranslationUnit(). Will load the toplevel declarations
within a translation unit, issuing a 'callback' for each one.
@@ -182,9 +248,28 @@ const char *clang_getDeclSource(CXDecl);
/*
* CXCursor Operations.
*/
+/**
+ Usage: clang_getCursor() will translate a source/line/column position
+ into an AST cursor (to derive semantic information from the source code).
+ */
CXCursor clang_getCursor(CXTranslationUnit, const char *source_name,
unsigned line, unsigned column);
+/**
+ Usage: clang_getCursorWithHint() provides the same functionality as
+ clang_getCursor() except that it takes an option 'hint' argument.
+ The 'hint' is a temporary CXLookupHint object (whose lifetime is managed by
+ the caller) that should be initialized with clang_initCXLookupHint().
+
+ FIXME: Add a better comment once getCursorWithHint() has more functionality.
+ */
+typedef CXCursor CXLookupHint;
+CXCursor clang_getCursorWithHint(CXTranslationUnit, const char *source_name,
+ unsigned line, unsigned column,
+ CXLookupHint *hint);
+
+void clang_initCXLookupHint(CXLookupHint *hint);
+
enum CXCursorKind clang_getCursorKind(CXCursor);
unsigned clang_isDeclaration(enum CXCursorKind);
unsigned clang_isReference(enum CXCursorKind);
Modified: vendor/clang/dist/include/clang/AST/ASTContext.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/ASTContext.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/ASTContext.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -81,12 +81,12 @@ class ASTContext {
llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
+ llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes;
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes;
llvm::FoldingSet<TypenameType> TypenameTypes;
llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes;
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
- llvm::FoldingSet<ObjCProtocolListType> ObjCProtocolListTypes;
llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames;
@@ -143,6 +143,12 @@ class ASTContext {
/// \brief The type for the C sigjmp_buf type.
TypeDecl *sigjmp_bufDecl;
+ /// \brief Type for the Block descriptor for Blocks CodeGen.
+ RecordDecl *BlockDescriptorType;
+
+ /// \brief Type for the Block descriptor for Blocks CodeGen.
+ RecordDecl *BlockDescriptorExtendedType;
+
/// \brief Keeps track of all declaration attributes.
///
/// Since so few decls have attrs, we keep them in a hash map instead of
@@ -390,9 +396,47 @@ public:
/// of the specified type.
QualType getBlockPointerType(QualType T);
+ /// This gets the struct used to keep track of the descriptor for pointer to
+ /// blocks.
+ QualType getBlockDescriptorType();
+
+ // Set the type for a Block descriptor type.
+ void setBlockDescriptorType(QualType T);
+ /// Get the BlockDescriptorType type, or NULL if it hasn't yet been built.
+ QualType getRawBlockdescriptorType() {
+ if (BlockDescriptorType)
+ return getTagDeclType(BlockDescriptorType);
+ return QualType();
+ }
+
+ /// This gets the struct used to keep track of the extended descriptor for
+ /// pointer to blocks.
+ QualType getBlockDescriptorExtendedType();
+
+ // Set the type for a Block descriptor extended type.
+ void setBlockDescriptorExtendedType(QualType T);
+ /// Get the BlockDescriptorExtendedType type, or NULL if it hasn't yet been
+ /// built.
+ QualType getRawBlockdescriptorExtendedType() {
+ if (BlockDescriptorExtendedType)
+ return getTagDeclType(BlockDescriptorExtendedType);
+ return QualType();
+ }
+
+ /// This gets the struct used to keep track of pointer to blocks, complete
+ /// with captured variables.
+ QualType getBlockParmType(bool BlockHasCopyDispose,
+ llvm::SmallVector<const Expr *, 8> &BDRDs);
+
+ /// This builds the struct used for __block variables.
+ QualType BuildByRefType(const char *DeclName, QualType Ty);
+
+ /// Returns true iff we need copy/dispose helpers for the given type.
+ bool BlockRequiresCopying(QualType Ty);
+
/// getLValueReferenceType - Return the uniqued reference to the type for an
/// lvalue reference to the specified type.
- QualType getLValueReferenceType(QualType T);
+ QualType getLValueReferenceType(QualType T, bool SpelledAsLValue = true);
/// getRValueReferenceType - Return the uniqued reference to the type for an
/// rvalue reference to the specified type.
@@ -431,22 +475,6 @@ public:
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals);
- /// getConstantArrayWithExprType - Return a reference to the type for a
- /// constant array of the specified element type.
- QualType getConstantArrayWithExprType(QualType EltTy,
- const llvm::APInt &ArySize,
- Expr *ArySizeExpr,
- ArrayType::ArraySizeModifier ASM,
- unsigned EltTypeQuals,
- SourceRange Brackets);
-
- /// getConstantArrayWithoutExprType - Return a reference to the type
- /// for a constant array of the specified element type.
- QualType getConstantArrayWithoutExprType(QualType EltTy,
- const llvm::APInt &ArySize,
- ArrayType::ArraySizeModifier ASM,
- unsigned EltTypeQuals);
-
/// getVectorType - Return the unique reference to a vector type of
/// the specified element type and size. VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts);
@@ -485,6 +513,9 @@ public:
/// specified typename decl.
QualType getTypedefType(TypedefDecl *Decl);
+ QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced,
+ QualType Replacement);
+
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
bool ParameterPack,
IdentifierInfo *Name = 0);
@@ -515,10 +546,6 @@ public:
ObjCProtocolDecl **ProtocolList = 0,
unsigned NumProtocols = 0);
- QualType getObjCProtocolListType(QualType T,
- ObjCProtocolDecl **Protocols,
- unsigned NumProtocols);
-
/// getTypeOfType - GCC extension.
QualType getTypeOfExprType(Expr *e);
QualType getTypeOfType(QualType t);
@@ -815,6 +842,12 @@ public:
return T->getCanonicalTypeInternal().getTypePtr();
}
+ /// getCanonicalParamType - Return the canonical parameter type
+ /// corresponding to the specific potentially non-canonical one.
+ /// Qualifiers are stripped off, functions are turned into function
+ /// pointers, and arrays decay one level into pointers.
+ CanQualType getCanonicalParamType(QualType T);
+
/// \brief Determine whether the given types are equivalent.
bool hasSameType(QualType T1, QualType T2) {
return getCanonicalType(T1) == getCanonicalType(T2);
@@ -1047,7 +1080,10 @@ public:
/// \param T the type that will be the basis for type source info. This type
/// should refer to how the declarator was written in source code, not to
/// what type semantic analysis resolved the declarator to.
- DeclaratorInfo *CreateDeclaratorInfo(QualType T);
+ ///
+ /// \param Size the size of the type info to create, or 0 if the size
+ /// should be calculated based on the type.
+ DeclaratorInfo *CreateDeclaratorInfo(QualType T, unsigned Size = 0);
private:
ASTContext(const ASTContext&); // DO NOT IMPLEMENT
Modified: vendor/clang/dist/include/clang/AST/Attr.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Attr.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/Attr.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -185,7 +185,6 @@ class AlignedAttr : public Attr {
public:
AlignedAttr(unsigned alignment) : Attr(Aligned), Alignment(alignment) {}
- // FIXME: Should use addressable units, not bits, to match llvm
/// getAlignment - The specified alignment in bits.
unsigned getAlignment() const { return Alignment; }
Modified: vendor/clang/dist/include/clang/AST/CXXInheritance.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/CXXInheritance.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/CXXInheritance.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -63,7 +63,8 @@ struct CXXBasePathElement {
/// structure, which captures both the link from a derived class to one of its
/// direct bases and identification describing which base class
/// subobject is being used.
-struct CXXBasePath : public llvm::SmallVector<CXXBasePathElement, 4> {
+class CXXBasePath : public llvm::SmallVector<CXXBasePathElement, 4> {
+public:
/// \brief The set of declarations found inside this base class
/// subobject.
DeclContext::lookup_result Decls;
Modified: vendor/clang/dist/include/clang/AST/CanonicalType.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/CanonicalType.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/CanonicalType.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -487,30 +487,6 @@ struct CanProxyAdaptor<ConstantArrayType
};
template<>
-struct CanProxyAdaptor<ConstantArrayWithExprType>
- : public CanProxyBase<ConstantArrayWithExprType> {
- LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
- getSizeModifier)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getIndexTypeQualifiers)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getSizeExpr)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceRange, getBracketsRange)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getLBracketLoc)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getRBracketLoc)
-};
-
-template<>
-struct CanProxyAdaptor<ConstantArrayWithoutExprType>
- : public CanProxyBase<ConstantArrayWithoutExprType> {
- LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
- getSizeModifier)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getIndexTypeQualifiers)
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
-};
-
-template<>
struct CanProxyAdaptor<IncompleteArrayType>
: public CanProxyBase<IncompleteArrayType> {
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
@@ -684,7 +660,7 @@ CanQual<T> CanQual<T>::getFromOpaquePtr(
template<typename T>
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
- assert((Other.isNull() || Other->isCanonical()) && "Type is not canonical!");
+ assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
"Dynamic type does not meet the static type's requires");
CanQual<T> Result;
Modified: vendor/clang/dist/include/clang/AST/Decl.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Decl.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/Decl.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -47,6 +47,9 @@ class DeclaratorInfo {
friend class ASTContext;
DeclaratorInfo(QualType ty) : Ty(ty) { }
public:
+ /// \brief Return the type wrapped by this type source info.
+ QualType getType() const { return Ty; }
+
/// \brief Return the TypeLoc wrapper for the type source info.
TypeLoc getTypeLoc() const;
};
@@ -93,28 +96,43 @@ public:
/// name (C++ constructor, Objective-C selector, etc.).
IdentifierInfo *getIdentifier() const { return Name.getAsIdentifierInfo(); }
+ /// getName - Get the name of identifier for this declaration as a StringRef.
+ /// This requires that the declaration have a name and that it be a simple
+ /// identifier.
+ llvm::StringRef getName() const {
+ assert(Name.isIdentifier() && "Name is not a simple identifier");
+ return getIdentifier() ? getIdentifier()->getName() : "";
+ }
+
/// getNameAsCString - Get the name of identifier for this declaration as a
/// C string (const char*). This requires that the declaration have a name
/// and that it be a simple identifier.
+ //
+ // FIXME: Deprecated, move clients to getName().
const char *getNameAsCString() const {
- assert(getIdentifier() && "Name is not a simple identifier");
- return getIdentifier()->getName();
+ assert(Name.isIdentifier() && "Name is not a simple identifier");
+ return getIdentifier() ? getIdentifier()->getNameStart() : "";
}
- /// getDeclName - Get the actual, stored name of the declaration,
- /// which may be a special name.
- DeclarationName getDeclName() const { return Name; }
-
- /// \brief Set the name of this declaration.
- void setDeclName(DeclarationName N) { Name = N; }
-
/// getNameAsString - Get a human-readable name for the declaration, even if
/// it is one of the special kinds of names (C++ constructor, Objective-C
/// selector, etc). Creating this name requires expensive string
/// manipulation, so it should be called only when performance doesn't matter.
/// For simple declarations, getNameAsCString() should suffice.
+ //
+ // FIXME: This function should be renamed to indicate that it is not just an
+ // alternate form of getName(), and clients should move as appropriate.
+ //
+ // FIXME: Deprecated, move clients to getName().
std::string getNameAsString() const { return Name.getAsString(); }
+ /// getDeclName - Get the actual, stored name of the declaration,
+ /// which may be a special name.
+ DeclarationName getDeclName() const { return Name; }
+
+ /// \brief Set the name of this declaration.
+ void setDeclName(DeclarationName N) { Name = N; }
+
/// getQualifiedNameAsString - Returns human-readable qualified name for
/// declaration, like A::B::i, for i being member of namespace A::B.
/// If declaration is not member of context which can be named (record,
@@ -604,7 +622,8 @@ public:
/// \brief For a static data member that was instantiated from a static
/// data member of a class template, set the template specialiation kind.
- void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
+ void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
+ SourceLocation PointOfInstantiation = SourceLocation());
/// isFileVarDecl - Returns true for file scoped variable declaration.
bool isFileVarDecl() const {
@@ -1170,7 +1189,16 @@ public:
/// \brief Determine what kind of template instantiation this function
/// represents.
- void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
+ void setTemplateSpecializationKind(TemplateSpecializationKind TSK,
+ SourceLocation PointOfInstantiation = SourceLocation());
+
+ /// \brief Retrieve the (first) point of instantiation of a function template
+ /// specialization or a member of a class template specialization.
+ ///
+ /// \returns the first point of instantiation, if this function was
+ /// instantiated from a template; otherwie, returns an invalid source
+ /// location.
+ SourceLocation getPointOfInstantiation() const;
/// \brief Determine whether this is or was instantiated from an out-of-line
/// definition of a member function.
Modified: vendor/clang/dist/include/clang/AST/DeclBase.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclBase.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/DeclBase.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -166,6 +166,15 @@ private:
bool Used : 1;
protected:
+ /// Access - Used by C++ decls for the access specifier.
+ // NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
+ unsigned Access : 2;
+ friend class CXXClassMemberWrapper;
+
+ // PCHLevel - the "level" of precompiled header/AST file from which this
+ // declaration was built.
+ unsigned PCHLevel : 2;
+
/// IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
unsigned IdentifierNamespace : 16;
@@ -177,16 +186,13 @@ private:
#endif
protected:
- /// Access - Used by C++ decls for the access specifier.
- // NOTE: VC++ treats enums as signed, avoid using the AccessSpecifier enum
- unsigned Access : 2;
- friend class CXXClassMemberWrapper;
Decl(Kind DK, DeclContext *DC, SourceLocation L)
: NextDeclInContext(0), DeclCtx(DC),
Loc(L), DeclKind(DK), InvalidDecl(0),
HasAttrs(false), Implicit(false), Used(false),
- IdentifierNamespace(getIdentifierNamespaceForKind(DK)), Access(AS_none) {
+ Access(AS_none), PCHLevel(0),
+ IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
if (Decl::CollectingStats()) addDeclKind(DK);
}
@@ -274,6 +280,26 @@ public:
bool isUsed() const { return Used; }
void setUsed(bool U = true) { Used = U; }
+ /// \brief Retrieve the level of precompiled header from which this
+ /// declaration was generated.
+ ///
+ /// The PCH level of a declaration describes where the declaration originated
+ /// from. A PCH level of 0 indicates that the declaration was not from a
+ /// precompiled header. A PCH level of 1 indicates that the declaration was
+ /// from a top-level precompiled header; 2 indicates that the declaration
+ /// comes from a precompiled header on which the top-level precompiled header
+ /// depends, and so on.
+ unsigned getPCHLevel() const { return PCHLevel; }
+
+ /// \brief The maximum PCH level that any declaration may have.
+ static const unsigned MaxPCHLevel = 3;
+
+ /// \brief Set the PCH level of this declaration.
+ void setPCHLevel(unsigned Level) {
+ assert(Level < MaxPCHLevel && "PCH level exceeds the maximum");
+ PCHLevel = Level;
+ }
+
unsigned getIdentifierNamespace() const {
return IdentifierNamespace;
}
Modified: vendor/clang/dist/include/clang/AST/DeclObjC.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclObjC.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/DeclObjC.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -944,16 +944,29 @@ public:
ObjCCategoryDecl *getCategoryClass() const;
+ /// getName - Get the name of identifier for the class interface associated
+ /// with this implementation as a StringRef.
+ //
+ // FIXME: This is a bad API, we are overriding the NamedDecl::getName, to mean
+ // something different.
+ llvm::StringRef getName() const {
+ return Id ? Id->getNameStart() : "";
+ }
+
/// getNameAsCString - Get the name of identifier for the class
/// interface associated with this implementation as a C string
/// (const char*).
+ //
+ // FIXME: Deprecated, move clients to getName().
const char *getNameAsCString() const {
- return Id ? Id->getName() : "";
+ return Id ? Id->getNameStart() : "";
}
/// @brief Get the name of the class associated with this interface.
+ //
+ // FIXME: Deprecated, move clients to getName().
std::string getNameAsString() const {
- return Id ? Id->getName() : "";
+ return getName();
}
static bool classof(const Decl *D) { return D->getKind() == ObjCCategoryImpl;}
@@ -995,17 +1008,30 @@ public:
return getClassInterface()->getIdentifier();
}
+ /// getName - Get the name of identifier for the class interface associated
+ /// with this implementation as a StringRef.
+ //
+ // FIXME: This is a bad API, we are overriding the NamedDecl::getName, to mean
+ // something different.
+ llvm::StringRef getName() const {
+ assert(getIdentifier() && "Name is not a simple identifier");
+ return getIdentifier()->getName();
+ }
+
/// getNameAsCString - Get the name of identifier for the class
/// interface associated with this implementation as a C string
/// (const char*).
+ //
+ // FIXME: Move to StringRef API.
const char *getNameAsCString() const {
- assert(getIdentifier() && "Name is not a simple identifier");
- return getIdentifier()->getName();
+ return getName().data();
}
/// @brief Get the name of the class associated with this interface.
+ //
+ // FIXME: Move to StringRef API.
std::string getNameAsString() const {
- return getClassInterface()->getNameAsString();
+ return getName();
}
const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
Modified: vendor/clang/dist/include/clang/AST/Expr.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Expr.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/Expr.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -1399,7 +1399,27 @@ public:
CK_IntegralToPointer,
/// CK_PointerToIntegral - Pointer to integral
- CK_PointerToIntegral
+ CK_PointerToIntegral,
+
+ /// CK_ToVoid - Cast to void.
+ CK_ToVoid,
+
+ /// CK_VectorSplat - Casting from an integer/floating type to an extended
+ /// vector type with the same element type as the src type. Splats the
+ /// src expression into the destination expression.
+ CK_VectorSplat,
+
+ /// CK_IntegralCast - Casting between integral types of different size.
+ CK_IntegralCast,
+
+ /// CK_IntegralToFloating - Integral to floating point.
+ CK_IntegralToFloating,
+
+ /// CK_FloatingToIntegral - Floating point to integral.
+ CK_FloatingToIntegral,
+
+ /// CK_FloatingCast - Casting between floating types of different size.
+ CK_FloatingCast
};
private:
@@ -1665,7 +1685,8 @@ public:
/// predicates to categorize the respective opcodes.
bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
bool isAdditiveOp() const { return Opc == Add || Opc == Sub; }
- bool isShiftOp() const { return Opc == Shl || Opc == Shr; }
+ static bool isShiftOp(Opcode Opc) { return Opc == Shl || Opc == Shr; }
+ bool isShiftOp() const { return isShiftOp(Opc); }
bool isBitwiseOp() const { return Opc >= And && Opc <= Or; }
static bool isRelationalOp(Opcode Opc) { return Opc >= LT && Opc <= GE; }
Modified: vendor/clang/dist/include/clang/AST/Type.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Type.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/Type.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -443,6 +443,9 @@ public:
return getTypePtr();
}
+ bool isCanonical() const;
+ bool isCanonicalAsParam() const;
+
/// isNull - Return true if this QualType doesn't point to a type yet.
bool isNull() const {
return Value.getPointer().isNull();
@@ -702,7 +705,9 @@ protected:
public:
TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
- bool isCanonical() const { return CanonicalType.getTypePtr() == this; }
+ bool isCanonicalUnqualified() const {
+ return CanonicalType.getTypePtr() == this;
+ }
/// Types are partitioned into 3 broad categories (C99 6.2.5p1):
/// object types, function types, and incomplete types.
@@ -1089,19 +1094,50 @@ public:
class ReferenceType : public Type, public llvm::FoldingSetNode {
QualType PointeeType;
+ /// True if the type was originally spelled with an lvalue sigil.
+ /// This is never true of rvalue references but can also be false
+ /// on lvalue references because of C++0x [dcl.typedef]p9,
+ /// as follows:
+ ///
+ /// typedef int &ref; // lvalue, spelled lvalue
+ /// typedef int &&rvref; // rvalue
+ /// ref &a; // lvalue, inner ref, spelled lvalue
+ /// ref &&a; // lvalue, inner ref
+ /// rvref &a; // lvalue, inner ref, spelled lvalue
+ /// rvref &&a; // rvalue, inner ref
+ bool SpelledAsLValue;
+
+ /// True if the inner type is a reference type. This only happens
+ /// in non-canonical forms.
+ bool InnerRef;
+
protected:
- ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef) :
+ ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef,
+ bool SpelledAsLValue) :
Type(tc, CanonicalRef, Referencee->isDependentType()),
- PointeeType(Referencee) {
+ PointeeType(Referencee), SpelledAsLValue(SpelledAsLValue),
+ InnerRef(Referencee->isReferenceType()) {
}
public:
- QualType getPointeeType() const { return PointeeType; }
+ bool isSpelledAsLValue() const { return SpelledAsLValue; }
+
+ QualType getPointeeTypeAsWritten() const { return PointeeType; }
+ QualType getPointeeType() const {
+ // FIXME: this might strip inner qualifiers; okay?
+ const ReferenceType *T = this;
+ while (T->InnerRef)
+ T = T->PointeeType->getAs<ReferenceType>();
+ return T->PointeeType;
+ }
void Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, getPointeeType());
+ Profile(ID, PointeeType, SpelledAsLValue);
}
- static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee) {
+ static void Profile(llvm::FoldingSetNodeID &ID,
+ QualType Referencee,
+ bool SpelledAsLValue) {
ID.AddPointer(Referencee.getAsOpaquePtr());
+ ID.AddBoolean(SpelledAsLValue);
}
static bool classof(const Type *T) {
@@ -1114,9 +1150,10 @@ public:
/// LValueReferenceType - C++ [dcl.ref] - Lvalue reference
///
class LValueReferenceType : public ReferenceType {
- LValueReferenceType(QualType Referencee, QualType CanonicalRef) :
- ReferenceType(LValueReference, Referencee, CanonicalRef) {
- }
+ LValueReferenceType(QualType Referencee, QualType CanonicalRef,
+ bool SpelledAsLValue) :
+ ReferenceType(LValueReference, Referencee, CanonicalRef, SpelledAsLValue)
+ {}
friend class ASTContext; // ASTContext creates these
public:
virtual void getAsStringInternal(std::string &InnerString,
@@ -1135,7 +1172,7 @@ public:
///
class RValueReferenceType : public ReferenceType {
RValueReferenceType(QualType Referencee, QualType CanonicalRef) :
- ReferenceType(RValueReference, Referencee, CanonicalRef) {
+ ReferenceType(RValueReference, Referencee, CanonicalRef, false) {
}
friend class ASTContext; // ASTContext creates these
public:
@@ -1239,8 +1276,6 @@ public:
static bool classof(const Type *T) {
return T->getTypeClass() == ConstantArray ||
- T->getTypeClass() == ConstantArrayWithExpr ||
- T->getTypeClass() == ConstantArrayWithoutExpr ||
T->getTypeClass() == VariableArray ||
T->getTypeClass() == IncompleteArray ||
T->getTypeClass() == DependentSizedArray;
@@ -1285,86 +1320,11 @@ public:
ID.AddInteger(TypeQuals);
}
static bool classof(const Type *T) {
- return T->getTypeClass() == ConstantArray ||
- T->getTypeClass() == ConstantArrayWithExpr ||
- T->getTypeClass() == ConstantArrayWithoutExpr;
+ return T->getTypeClass() == ConstantArray;
}
static bool classof(const ConstantArrayType *) { return true; }
};
-/// ConstantArrayWithExprType - This class represents C arrays with a
-/// constant size specified by means of an integer constant expression.
-/// For example 'int A[sizeof(int)]' has ConstantArrayWithExprType where
-/// the element type is 'int' and the size expression is 'sizeof(int)'.
-/// These types are non-canonical.
-class ConstantArrayWithExprType : public ConstantArrayType {
- /// SizeExpr - The ICE occurring in the concrete syntax.
- Expr *SizeExpr;
- /// Brackets - The left and right array brackets.
- SourceRange Brackets;
-
- ConstantArrayWithExprType(QualType et, QualType can,
- const llvm::APInt &size, Expr *e,
- ArraySizeModifier sm, unsigned tq,
- SourceRange brackets)
- : ConstantArrayType(ConstantArrayWithExpr, et, can, size, sm, tq),
- SizeExpr(e), Brackets(brackets) {}
- friend class ASTContext; // ASTContext creates these.
- virtual void Destroy(ASTContext& C);
-
-public:
- Expr *getSizeExpr() const { return SizeExpr; }
- SourceRange getBracketsRange() const { return Brackets; }
- SourceLocation getLBracketLoc() const { return Brackets.getBegin(); }
- SourceLocation getRBracketLoc() const { return Brackets.getEnd(); }
-
- virtual void getAsStringInternal(std::string &InnerString,
- const PrintingPolicy &Policy) const;
-
- bool isSugared() const { return false; }
- QualType desugar() const { return QualType(this, 0); }
-
- static bool classof(const Type *T) {
- return T->getTypeClass() == ConstantArrayWithExpr;
- }
- static bool classof(const ConstantArrayWithExprType *) { return true; }
-
- void Profile(llvm::FoldingSetNodeID &ID) {
- assert(0 && "Cannot unique ConstantArrayWithExprTypes.");
- }
-};
-
-/// ConstantArrayWithoutExprType - This class represents C arrays with a
-/// constant size that was not specified by an integer constant expression,
-/// but inferred by static semantics.
-/// For example 'int A[] = { 0, 1, 2 }' has ConstantArrayWithoutExprType.
-/// These types are non-canonical: the corresponding canonical type,
-/// having the size specified in an APInt object, is a ConstantArrayType.
-class ConstantArrayWithoutExprType : public ConstantArrayType {
-
- ConstantArrayWithoutExprType(QualType et, QualType can,
- const llvm::APInt &size,
- ArraySizeModifier sm, unsigned tq)
- : ConstantArrayType(ConstantArrayWithoutExpr, et, can, size, sm, tq) {}
- friend class ASTContext; // ASTContext creates these.
-
-public:
- virtual void getAsStringInternal(std::string &InnerString,
- const PrintingPolicy &Policy) const;
-
- bool isSugared() const { return false; }
- QualType desugar() const { return QualType(this, 0); }
-
- static bool classof(const Type *T) {
- return T->getTypeClass() == ConstantArrayWithoutExpr;
- }
- static bool classof(const ConstantArrayWithoutExprType *) { return true; }
-
- void Profile(llvm::FoldingSetNodeID &ID) {
- assert(0 && "Cannot unique ConstantArrayWithoutExprTypes.");
- }
-};
-
/// IncompleteArrayType - This class represents C arrays with an unspecified
/// size. For example 'int A[]' has an IncompleteArrayType where the element
/// type is 'int' and the size is unspecified.
@@ -2219,6 +2179,59 @@ public:
static bool classof(const TemplateTypeParmType *T) { return true; }
};
+/// \brief Represents the result of substituting a type for a template
+/// type parameter.
+///
+/// Within an instantiated template, all template type parameters have
+/// been replaced with these. They are used solely to record that a
+/// type was originally written as a template type parameter;
+/// therefore they are never canonical.
+class SubstTemplateTypeParmType : public Type, public llvm::FoldingSetNode {
+ // The original type parameter.
+ const TemplateTypeParmType *Replaced;
+
+ SubstTemplateTypeParmType(const TemplateTypeParmType *Param, QualType Canon)
+ : Type(SubstTemplateTypeParm, Canon, Canon->isDependentType()),
+ Replaced(Param) { }
+
+ friend class ASTContext;
+
+public:
+ IdentifierInfo *getName() const { return Replaced->getName(); }
+
+ /// Gets the template parameter that was substituted for.
+ const TemplateTypeParmType *getReplacedParameter() const {
+ return Replaced;
+ }
+
+ /// Gets the type that was substituted for the template
+ /// parameter.
+ QualType getReplacementType() const {
+ return getCanonicalTypeInternal();
+ }
+
+ virtual void getAsStringInternal(std::string &InnerString,
+ const PrintingPolicy &Policy) const;
+
+ bool isSugared() const { return true; }
+ QualType desugar() const { return getReplacementType(); }
+
+ void Profile(llvm::FoldingSetNodeID &ID) {
+ Profile(ID, getReplacedParameter(), getReplacementType());
+ }
+ static void Profile(llvm::FoldingSetNodeID &ID,
+ const TemplateTypeParmType *Replaced,
+ QualType Replacement) {
+ ID.AddPointer(Replaced);
+ ID.AddPointer(Replacement.getAsOpaquePtr());
+ }
+
+ static bool classof(const Type *T) {
+ return T->getTypeClass() == SubstTemplateTypeParm;
+ }
+ static bool classof(const SubstTemplateTypeParmType *T) { return true; }
+};
+
/// \brief Represents the type of a template specialization as written
/// in the source code.
///
@@ -2453,9 +2466,9 @@ class ObjCInterfaceType : public Type, p
// List is sorted on protocol name. No protocol is enterred more than once.
llvm::SmallVector<ObjCProtocolDecl*, 4> Protocols;
- ObjCInterfaceType(ObjCInterfaceDecl *D,
+ ObjCInterfaceType(QualType Canonical, ObjCInterfaceDecl *D,
ObjCProtocolDecl **Protos, unsigned NumP) :
- Type(ObjCInterface, QualType(), /*Dependent=*/false),
+ Type(ObjCInterface, Canonical, /*Dependent=*/false),
Decl(D), Protocols(Protos, Protos+NumP) { }
friend class ASTContext; // ASTContext creates these.
public:
@@ -2501,8 +2514,9 @@ class ObjCObjectPointerType : public Typ
// List is sorted on protocol name. No protocol is entered more than once.
llvm::SmallVector<ObjCProtocolDecl*, 8> Protocols;
- ObjCObjectPointerType(QualType T, ObjCProtocolDecl **Protos, unsigned NumP) :
- Type(ObjCObjectPointer, QualType(), /*Dependent=*/false),
+ ObjCObjectPointerType(QualType Canonical, QualType T,
+ ObjCProtocolDecl **Protos, unsigned NumP) :
+ Type(ObjCObjectPointer, Canonical, /*Dependent=*/false),
PointeeType(T), Protocols(Protos, Protos+NumP) { }
friend class ASTContext; // ASTContext creates these.
@@ -2567,49 +2581,6 @@ public:
static bool classof(const ObjCObjectPointerType *) { return true; }
};
-/// \brief An ObjC Protocol list that qualifies a type.
-///
-/// This is used only for keeping detailed type source information, it should
-/// not participate in the semantics of the type system.
-/// The protocol list is not canonicalized.
-class ObjCProtocolListType : public Type, public llvm::FoldingSetNode {
- QualType BaseType;
-
- // List of protocols for this protocol conforming object type.
- llvm::SmallVector<ObjCProtocolDecl*, 4> Protocols;
-
- ObjCProtocolListType(QualType T, ObjCProtocolDecl **Protos, unsigned NumP) :
- Type(ObjCProtocolList, QualType(), /*Dependent=*/false),
- BaseType(T), Protocols(Protos, Protos+NumP) { }
- friend class ASTContext; // ASTContext creates these.
-
-public:
- QualType getBaseType() const { return BaseType; }
-
- /// \brief Provides access to the list of protocols qualifying the base type.
- typedef llvm::SmallVector<ObjCProtocolDecl*, 4>::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; }
-
- /// \brief Return the number of qualifying protocols.
- unsigned getNumProtocols() const { return Protocols.size(); }
-
- bool isSugared() const { return false; }
- QualType desugar() const { return QualType(this, 0); }
-
- void Profile(llvm::FoldingSetNodeID &ID);
- static void Profile(llvm::FoldingSetNodeID &ID, QualType T,
- ObjCProtocolDecl **protocols, unsigned NumProtocols);
- virtual void getAsStringInternal(std::string &InnerString,
- const PrintingPolicy &Policy) const;
- static bool classof(const Type *T) {
- return T->getTypeClass() == ObjCProtocolList;
- }
- static bool classof(const ObjCProtocolListType *) { return true; }
-};
-
/// A qualifier set is used to build a set of qualifiers.
class QualifierCollector : public Qualifiers {
ASTContext *Context;
@@ -2646,6 +2617,20 @@ public:
// Inline function definitions.
+inline bool QualType::isCanonical() const {
+ const Type *T = getTypePtr();
+ if (hasQualifiers())
+ return T->isCanonicalUnqualified() && !isa<ArrayType>(T);
+ return T->isCanonicalUnqualified();
+}
+
+inline bool QualType::isCanonicalAsParam() const {
+ if (hasQualifiers()) return false;
+ const Type *T = getTypePtr();
+ return T->isCanonicalUnqualified() &&
+ !isa<FunctionType>(T) && !isa<ArrayType>(T);
+}
+
inline void QualType::removeConst() {
removeFastQualifiers(Qualifiers::Const);
}
Modified: vendor/clang/dist/include/clang/AST/TypeLoc.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/TypeLoc.h Fri Oct 23 14:21:22 2009 (r198397)
+++ vendor/clang/dist/include/clang/AST/TypeLoc.h Fri Oct 23 14:22:18 2009 (r198398)
@@ -18,10 +18,15 @@
namespace clang {
class ParmVarDecl;
- class TypeSpecLoc;
class DeclaratorInfo;
class UnqualTypeLoc;
+// Predeclare all the type nodes.
+#define ABSTRACT_TYPELOC(Class, Base)
+#define TYPELOC(Class, Base) \
+ class Class##TypeLoc;
+#include "clang/AST/TypeLocNodes.def"
+
/// \brief Base wrapper for a particular "section" of type source info.
///
/// A client should use the TypeLoc subclasses through cast/dyn_cast in order to
@@ -34,12 +39,28 @@ protected:
void *Data;
public:
+ /// The kinds of TypeLocs. Equivalent to the Type::TypeClass enum,
+ /// except it also defines a Qualified enum that corresponds to the
+ /// QualifiedLoc class.
+ enum TypeLocClass {
+#define ABSTRACT_TYPE(Class, Base)
+#define TYPE(Class, Base) \
+ Class = Type::Class,
+#include "clang/AST/TypeNodes.def"
+ Qualified
+ };
+
TypeLoc() : Ty(0), Data(0) { }
TypeLoc(QualType ty, void *opaqueData)
: Ty(ty.getAsOpaquePtr()), Data(opaqueData) { }
TypeLoc(Type *ty, void *opaqueData)
: Ty(ty), Data(opaqueData) { }
+ TypeLocClass getTypeLocClass() const {
+ if (getType().hasQualifiers()) return Qualified;
+ return (TypeLocClass) getType()->getTypeClass();
+ }
+
bool isNull() const { return !Ty; }
operator bool() const { return Ty; }
@@ -48,35 +69,45 @@ public:
/// \brief Get the type for which this source info wrapper provides
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list