diff options
Diffstat (limited to 'include')
22 files changed, 204 insertions, 87 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 7bc290d..da186f6 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -888,6 +888,12 @@ CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); */ CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); +/*** + * \brief Determine whether the given cursor represents a currently + * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). + */ +CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); + /** * \brief Describe the linkage of the entity referred to by a cursor. */ diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 0838a3d..cf9aa50 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -405,6 +405,8 @@ private: /// getExtQualType - Return a type with extended qualifiers. QualType getExtQualType(const Type *Base, Qualifiers Quals); + QualType getTypeDeclTypeSlow(const TypeDecl *Decl); + public: /// getAddSpaceQualType - Return the uniqued reference to the type for an /// address space qualified type with the specified type and address space. @@ -580,12 +582,26 @@ public: /// getTypeDeclType - Return the unique reference to the type for /// the specified type declaration. - QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl* PrevDecl=0); + QualType getTypeDeclType(const TypeDecl *Decl, + const TypeDecl *PrevDecl = 0) { + assert(Decl && "Passed null for Decl param"); + if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); + + if (PrevDecl) { + assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl"); + Decl->TypeForDecl = PrevDecl->TypeForDecl; + return QualType(PrevDecl->TypeForDecl, 0); + } + + return getTypeDeclTypeSlow(Decl); + } /// getTypedefType - Return the unique reference to the type for the /// specified typename decl. QualType getTypedefType(const TypedefDecl *Decl); + QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST); + QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement); @@ -602,6 +618,11 @@ public: const TemplateArgumentListInfo &Args, QualType Canon = QualType()); + TypeSourceInfo * + getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, + const TemplateArgumentListInfo &Args, + QualType Canon = QualType()); + QualType getQualifiedNameType(NestedNameSpecifier *NNS, QualType NamedType); QualType getTypenameType(NestedNameSpecifier *NNS, diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 91aeff3..bd9f01b 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1429,7 +1429,6 @@ class TypeDecl : public NamedDecl { friend class DeclContext; friend class TagDecl; friend class TemplateTypeParmDecl; - friend class ClassTemplateSpecializationDecl; friend class TagType; protected: diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 26656bf..889e0d6 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -136,8 +136,12 @@ private: /// in, inout, etc. unsigned objcDeclQualifier : 6; - // Type of this method. + // Result type of this method. QualType MethodDeclType; + + // Type source information for the result type. + TypeSourceInfo *ResultTInfo; + /// ParamInfo - List of pointers to VarDecls for the formal parameters of this /// Method. ObjCList<ParmVarDecl> ParamInfo; @@ -158,6 +162,7 @@ private: ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, + TypeSourceInfo *ResultTInfo, DeclContext *contextDecl, bool isInstance = true, bool isVariadic = false, @@ -168,7 +173,7 @@ private: IsInstance(isInstance), IsVariadic(isVariadic), IsSynthesized(isSynthesized), DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None), - MethodDeclType(T), + MethodDeclType(T), ResultTInfo(ResultTInfo), EndLoc(endLoc), Body(0), SelfDecl(0), CmdDecl(0) {} virtual ~ObjCMethodDecl() {} @@ -186,7 +191,9 @@ public: static ObjCMethodDecl *Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, - QualType T, DeclContext *contextDecl, + QualType T, + TypeSourceInfo *ResultTInfo, + DeclContext *contextDecl, bool isInstance = true, bool isVariadic = false, bool isSynthesized = false, @@ -220,6 +227,9 @@ public: QualType getResultType() const { return MethodDeclType; } void setResultType(QualType T) { MethodDeclType = T; } + TypeSourceInfo *getResultTypeSourceInfo() const { return ResultTInfo; } + void setResultTypeSourceInfo(TypeSourceInfo *TInfo) { ResultTInfo = TInfo; } + // Iterator access to formal parameters. unsigned param_size() const { return ParamInfo.size(); } typedef ObjCList<ParmVarDecl>::iterator param_iterator; diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index ced1747..560ce46 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -771,6 +771,10 @@ class ClassTemplateSpecializationDecl llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *> SpecializedTemplate; + /// \brief The type-as-written of an explicit template specialization. + /// Does not apply to implicit specializations. + TypeSourceInfo *TypeAsWritten; + /// \brief The template arguments used to describe this specialization. TemplateArgumentList TemplateArgs; @@ -883,8 +887,14 @@ public: /// \brief Sets the type of this specialization as it was written by /// the user. This will be a class template specialization type. - void setTypeAsWritten(QualType T) { - TypeForDecl = T.getTypePtr(); + void setTypeAsWritten(TypeSourceInfo *T) { + TypeAsWritten = T; + } + + /// \brief Gets the type of this specialization as it was written by + /// the user, if it was so written. + TypeSourceInfo *getTypeAsWritten() const { + return TypeAsWritten; } void Profile(llvm::FoldingSetNodeID &ID) const { @@ -921,6 +931,7 @@ class ClassTemplatePartialSpecializationDecl TemplateParameterList* TemplateParams; /// \brief The source info for the template arguments as written. + /// FIXME: redundant with TypeAsWritten? TemplateArgumentLoc *ArgsAsWritten; unsigned NumArgsAsWritten; @@ -954,6 +965,7 @@ public: ClassTemplateDecl *SpecializedTemplate, TemplateArgumentListBuilder &Builder, const TemplateArgumentListInfo &ArgInfos, + QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl); /// Get the list of template parameters @@ -1139,8 +1151,8 @@ public: /// the type \p T, or NULL if no such partial specialization exists. ClassTemplatePartialSpecializationDecl *findPartialSpecialization(QualType T); - /// \brief Retrieve the type of the injected-class-name for this - /// class template. + /// \brief Retrieve the template specialization type of the + /// injected-class-name for this class template. /// /// The injected-class-name for a class template \c X is \c /// X<template-args>, where \c template-args is formed from the @@ -1153,7 +1165,7 @@ public: /// typedef array this_type; // "array" is equivalent to "array<T, N>" /// }; /// \endcode - QualType getInjectedClassNameType(ASTContext &Context); + QualType getInjectedClassNameSpecialization(ASTContext &Context); /// \brief Retrieve the member class template that this class template was /// derived from. diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index df39b53..6f43973 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -347,6 +347,9 @@ class ObjCMessageExpr : public Expr { // message expression. unsigned NumArgs; + /// \brief The location of the class name in a class message. + SourceLocation ClassNameLoc; + // A unigue name for this message. Selector SelName; @@ -367,7 +370,8 @@ class ObjCMessageExpr : public Expr { public: /// This constructor is used to represent class messages where the /// ObjCInterfaceDecl* of the receiver is not known. - ObjCMessageExpr(ASTContext &C, IdentifierInfo *clsName, Selector selInfo, + ObjCMessageExpr(ASTContext &C, IdentifierInfo *clsName, + SourceLocation clsNameLoc, Selector selInfo, QualType retType, ObjCMethodDecl *methDecl, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned NumArgs); @@ -375,7 +379,8 @@ public: /// This constructor is used to represent class messages where the /// ObjCInterfaceDecl* of the receiver is known. // FIXME: clsName should be typed to ObjCInterfaceType - ObjCMessageExpr(ASTContext &C, ObjCInterfaceDecl *cls, Selector selInfo, + ObjCMessageExpr(ASTContext &C, ObjCInterfaceDecl *cls, + SourceLocation clsNameLoc, Selector selInfo, QualType retType, ObjCMethodDecl *methDecl, SourceLocation LBrac, SourceLocation RBrac, Expr **ArgExprs, unsigned NumArgs); @@ -411,7 +416,24 @@ public: ObjCMethodDecl *getMethodDecl() { return MethodProto; } void setMethodDecl(ObjCMethodDecl *MD) { MethodProto = MD; } - typedef std::pair<ObjCInterfaceDecl*, IdentifierInfo*> ClassInfo; + /// \brief Describes the class receiver of a message send. + struct ClassInfo { + /// \brief The interface declaration for the class that is + /// receiving the message. May be NULL. + ObjCInterfaceDecl *Decl; + + /// \brief The name of the class that is receiving the + /// message. This will never be NULL. + IdentifierInfo *Name; + + /// \brief The source location of the class name. + SourceLocation Loc; + + ClassInfo() : Decl(0), Name(0), Loc() { } + + ClassInfo(ObjCInterfaceDecl *Decl, IdentifierInfo *Name, SourceLocation Loc) + : Decl(Decl), Name(Name), Loc(Loc) { } + }; /// getClassInfo - For class methods, this returns both the ObjCInterfaceDecl* /// and IdentifierInfo* of the invoked class. Both can be NULL if this @@ -423,7 +445,7 @@ public: /// getClassName - For class methods, this returns the invoked class, /// and returns NULL otherwise. For instance methods, use getReceiver. IdentifierInfo *getClassName() const { - return getClassInfo().second; + return getClassInfo().Name; } /// getNumArgs - Return the number of actual arguments to this call. diff --git a/include/clang/AST/PrettyPrinter.h b/include/clang/AST/PrettyPrinter.h index 0635ec5..587b5c2 100644 --- a/include/clang/AST/PrettyPrinter.h +++ b/include/clang/AST/PrettyPrinter.h @@ -36,7 +36,7 @@ struct PrintingPolicy { /// \brief Create a default printing policy for C. PrintingPolicy(const LangOptions &LO) : Indentation(2), LangOpts(LO), SuppressSpecifiers(false), - SuppressTag(false), SuppressTagKind(false), SuppressScope(false), + SuppressTag(false), SuppressScope(false), Dump(false), ConstantArraySizeAsWritten(false) { } /// \brief The number of spaces to use to indent each line. @@ -71,10 +71,6 @@ struct PrintingPolicy { /// \endcode bool SuppressTag : 1; - /// \brief If we are printing a tag type, suppresses printing of the - /// kind of tag, e.g., "struct", "union", "enum". - bool SuppressTagKind : 1; - /// \brief Suppresses printing of scope specifiers. bool SuppressScope : 1; @@ -101,6 +97,7 @@ struct PrintingPolicy { /// char a[9] = "A string"; /// \endcode bool ConstantArraySizeAsWritten : 1; + }; } // end namespace clang diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h index e8d1788..cd25969 100644 --- a/include/clang/AST/RecordLayout.h +++ b/include/clang/AST/RecordLayout.h @@ -128,47 +128,24 @@ private: friend class ASTContext; friend class ASTRecordLayoutBuilder; - ASTRecordLayout(uint64_t size, unsigned alignment, unsigned datasize, - const uint64_t *fieldoffsets, unsigned fieldcount) - : Size(size), DataSize(datasize), FieldOffsets(0), Alignment(alignment), - FieldCount(fieldcount), CXXInfo(0) { - if (FieldCount > 0) { - FieldOffsets = new uint64_t[FieldCount]; - for (unsigned i = 0; i < FieldCount; ++i) - FieldOffsets[i] = fieldoffsets[i]; - } - } + ASTRecordLayout(ASTContext &Ctx, uint64_t size, unsigned alignment, + unsigned datasize, const uint64_t *fieldoffsets, + unsigned fieldcount); // Constructor for C++ records. - ASTRecordLayout(uint64_t size, unsigned alignment, uint64_t datasize, + ASTRecordLayout(ASTContext &Ctx, + uint64_t size, unsigned alignment, uint64_t datasize, const uint64_t *fieldoffsets, unsigned fieldcount, uint64_t nonvirtualsize, unsigned nonvirtualalign, const PrimaryBaseInfo &PrimaryBase, const std::pair<const CXXRecordDecl *, uint64_t> *bases, unsigned numbases, const std::pair<const CXXRecordDecl *, uint64_t> *vbases, - unsigned numvbases) - : Size(size), DataSize(datasize), FieldOffsets(0), Alignment(alignment), - FieldCount(fieldcount), CXXInfo(new CXXRecordLayoutInfo) { - if (FieldCount > 0) { - FieldOffsets = new uint64_t[FieldCount]; - for (unsigned i = 0; i < FieldCount; ++i) - FieldOffsets[i] = fieldoffsets[i]; - } + unsigned numvbases); - CXXInfo->PrimaryBase = PrimaryBase; - CXXInfo->NonVirtualSize = nonvirtualsize; - CXXInfo->NonVirtualAlign = nonvirtualalign; - for (unsigned i = 0; i != numbases; ++i) - CXXInfo->BaseOffsets[bases[i].first] = bases[i].second; - for (unsigned i = 0; i != numvbases; ++i) - CXXInfo->VBaseOffsets[vbases[i].first] = vbases[i].second; - } + ~ASTRecordLayout() {} - ~ASTRecordLayout() { - delete [] FieldOffsets; - delete CXXInfo; - } + void Destroy(ASTContext &Ctx); ASTRecordLayout(const ASTRecordLayout&); // DO NOT IMPLEMENT void operator=(const ASTRecordLayout&); // DO NOT IMPLEMENT diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index bd8a6bc..111be55 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -2440,6 +2440,47 @@ public: static bool classof(const TemplateSpecializationType *T) { return true; } }; +/// \brief The injected class name of a C++ class template. Used to +/// record that a type was spelled with a bare identifier rather than +/// as a template-id; the equivalent for non-templated classes is just +/// RecordType. +/// +/// For consistency, template instantiation turns these into RecordTypes. +/// +/// The desugared form is always a unqualified TemplateSpecializationType. +/// The canonical form is always either a TemplateSpecializationType +/// (when dependent) or a RecordType (otherwise). +class InjectedClassNameType : public Type { + CXXRecordDecl *Decl; + + QualType UnderlyingType; + + friend class ASTContext; // ASTContext creates these. + InjectedClassNameType(CXXRecordDecl *D, QualType TST, QualType Canon) + : Type(InjectedClassName, Canon, Canon->isDependentType()), + Decl(D), UnderlyingType(TST) { + assert(isa<TemplateSpecializationType>(TST)); + assert(!TST.hasQualifiers()); + assert(TST->getCanonicalTypeInternal() == Canon); + } + +public: + QualType getUnderlyingType() const { return UnderlyingType; } + const TemplateSpecializationType *getUnderlyingTST() const { + return cast<TemplateSpecializationType>(UnderlyingType.getTypePtr()); + } + + CXXRecordDecl *getDecl() const { return Decl; } + + bool isSugared() const { return true; } + QualType desugar() const { return UnderlyingType; } + + static bool classof(const Type *T) { + return T->getTypeClass() == InjectedClassName; + } + static bool classof(const InjectedClassNameType *T) { return true; } +}; + /// \brief Represents a type that was referred to via a qualified /// name, e.g., N::M::type. /// diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 6fb51ed..27659bd 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -488,6 +488,14 @@ public: } }; +/// \brief Wrapper for source info for injected class names of class +/// templates. +class InjectedClassNameTypeLoc : + public InheritingConcreteTypeLoc<TypeSpecTypeLoc, + InjectedClassNameTypeLoc, + InjectedClassNameType> { +}; + /// \brief Wrapper for source info for unresolved typename using decls. class UnresolvedUsingTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, diff --git a/include/clang/AST/TypeNodes.def b/include/clang/AST/TypeNodes.def index 8187cad..e75202e 100644 --- a/include/clang/AST/TypeNodes.def +++ b/include/clang/AST/TypeNodes.def @@ -91,6 +91,7 @@ DEPENDENT_TYPE(TemplateTypeParm, Type) NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type) NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type) NON_CANONICAL_TYPE(QualifiedName, Type) +NON_CANONICAL_TYPE(InjectedClassName, Type) DEPENDENT_TYPE(Typename, Type) TYPE(ObjCInterface, Type) TYPE(ObjCObjectPointer, Type) diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 5d80528..880b4ba 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -284,6 +284,9 @@ BUILTIN(__builtin_ia32_roundps, "V4fV4fi", "") BUILTIN(__builtin_ia32_roundss, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_roundsd, "V2dV2dV2di", "") BUILTIN(__builtin_ia32_roundpd, "V2dV2di", "") +BUILTIN(__builtin_ia32_dpps, "V4fV4fV4fi", "") +BUILTIN(__builtin_ia32_dppd, "V2dV2dV2di", "") +BUILTIN(__builtin_ia32_movntdqa, "V2LLiV2LLi*", "") #undef BUILTIN diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 9175bef..2bce12d 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -90,6 +90,7 @@ def warn_drv_missing_resource_library : Warning< def warn_drv_conflicting_deployment_targets : Warning< "conflicting deployment targets, both MACOSX_DEPLOYMENT_TARGET '%0' and IPHONEOS_DEPLOYMENT_TARGET '%1' are present in environment">; def warn_drv_treating_input_as_cxx : Warning< - "treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">; + "treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">, + InGroup<Deprecated>; } diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index c3c0cf5..17bad64 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -24,7 +24,6 @@ def AddressOfTemporary : DiagGroup<"address-of-temporary">; def : DiagGroup<"aggregate-return">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; -def BadLiteral : DiagGroup<"bad-literal">; def : DiagGroup<"c++-compat">; def : DiagGroup<"cast-align">; def : DiagGroup<"cast-qual">; @@ -32,6 +31,7 @@ def : DiagGroup<"char-align">; def Comment : DiagGroup<"comment">; def : DiagGroup<"ctor-dtor-privacy">; def : DiagGroup<"declaration-after-statement">; +def Deprecated : DiagGroup<"deprecated">; def : DiagGroup<"disabled-optimization">; def : DiagGroup<"discard-qual">; def : DiagGroup<"div-by-zero">; @@ -48,7 +48,8 @@ def : DiagGroup<"init-self">; def : DiagGroup<"inline">; def : DiagGroup<"int-to-pointer-cast">; def : DiagGroup<"invalid-pch">; -def : DiagGroup<"missing-braces">; +def LiteralRange : DiagGroup<"literal-range">; +def MissingBraces : DiagGroup<"missing-braces">; def : DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; def : DiagGroup<"missing-include-dirs">; @@ -156,6 +157,7 @@ def Most : DiagGroup<"most", [ Format, Implicit, MismatchedTags, + MissingBraces, MultiChar, ReturnType, Switch, @@ -181,4 +183,4 @@ def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment // A warning group for warnings that we want to have on by default in clang, // but which aren't on by default in GCC. def NonGCC : DiagGroup<"non-gcc", - [SignCompare, Conversion, BadLiteral]>; + [SignCompare, Conversion, LiteralRange]>; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index fb80dcc..80a4eae 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -159,13 +159,13 @@ def err_typename_invalid_functionspec : Error< def err_invalid_decl_spec_combination : Error< "cannot combine with previous '%0' declaration specifier">; def err_invalid_vector_decl_spec_combination : Error< - "cannot combine with previous '%0' declaration specifier. \"__vector\" must be first">; + "cannot combine with previous '%0' declaration specifier. '__vector' must be first">; def err_invalid_pixel_decl_spec_combination : Error< - "\"__pixel\" must be preceded by \"__vector\". '%0' declaration specifier not allowed here">; + "'__pixel' must be preceded by '__vector'. '%0' declaration specifier not allowed here">; def err_invalid_vector_double_decl_spec_combination : Error< - "cannot use \"double\" with \"__vector\"">; + "cannot use 'double' with '__vector'">; def warn_vector_long_decl_spec_combination : Warning< - "Use of \"long\" with \"__vector\" is deprecated">; + "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>; def err_friend_invalid_in_context : Error< "'friend' used outside of class">; def err_unknown_typename : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index badd64c..13ac9ec 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -31,10 +31,10 @@ def ext_predef_outside_function : Warning< "predefined identifier is only valid inside function">; def warn_float_overflow : Warning< "magnitude of floating-point constant too large for type %0; maximum is %1">, - InGroup<BadLiteral>; + InGroup<LiteralRange>; def warn_float_underflow : Warning< "magnitude of floating-point constant too small for type %0; minimum is %1">, - InGroup<BadLiteral>; + InGroup<LiteralRange>; // C99 Designated Initializers def err_array_designator_negative : Error< @@ -141,7 +141,8 @@ def err_using_decl_conflict_reverse : Error< def note_using_decl : Note<"%select{|previous }0using declaration">; def warn_access_decl_deprecated : Warning< - "access declarations are deprecated; use using declarations instead">; + "access declarations are deprecated; use using declarations instead">, + InGroup<Deprecated>; def err_invalid_thread : Error< "'__thread' is only allowed on variable declarations">; @@ -1580,6 +1581,9 @@ def err_bitfield_width_exceeds_type_size : Error< "size of bit-field %0 exceeds size of its type (%1 bits)">; def err_anon_bitfield_width_exceeds_type_size : Error< "size of anonymous bit-field exceeds size of its type (%0 bits)">; +def warn_missing_braces : Warning< + "suggest braces around initialization of subobject">, + InGroup<DiagGroup<"missing-braces">>, DefaultIgnore; def err_redefinition_of_label : Error<"redefinition of label '%0'">; def err_undeclared_label_use : Error<"use of undeclared label '%0'">; @@ -1785,7 +1789,7 @@ def err_array_init_not_init_list : Error< "array initializer must be an initializer " "list%select{| or string literal}0">; def warn_deprecated_string_literal_conversion : Warning< - "conversion from string literal to %0 is deprecated">; + "conversion from string literal to %0 is deprecated">, InGroup<Deprecated>; def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; def err_typecheck_sclass_fscope : Error< "illegal storage class on file-scoped variable">; @@ -2043,11 +2047,11 @@ def note_delete_member_function_declared_here : Note< "%0 declared here">; def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< - "incrementing expression of type bool is deprecated">; -def err_catch_incomplete_ptr : Error< - "cannot catch pointer to incomplete type %0">; -def err_catch_incomplete_ref : Error< - "cannot catch reference to incomplete type %0">; + "incrementing expression of type bool is deprecated">, InGroup<Deprecated>; +def ext_catch_incomplete_ptr : ExtWarn< + "ISO C++ forbids catching a pointer to incomplete type %0">; +def ext_catch_incomplete_ref : ExtWarn< + "ISO C++ forbids catching a reference to incomplete type %0">; def err_catch_incomplete : Error<"cannot catch incomplete type %0">; def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">; def err_qualified_catch_declarator : Error< diff --git a/include/clang/Checker/PathSensitive/SVals.h b/include/clang/Checker/PathSensitive/SVals.h index 65a8a2c..040db83 100644 --- a/include/clang/Checker/PathSensitive/SVals.h +++ b/include/clang/Checker/PathSensitive/SVals.h @@ -112,6 +112,9 @@ public: /// wraps a symbol, return that SymbolRef. Otherwise return a SymbolData* SymbolRef getAsLocSymbol() const; + /// Get the symbol in the SVal or its base region. + SymbolRef getLocSymbolInBase() const; + /// getAsSymbol - If this Sval wraps a symbol return that SymbolRef. /// Otherwise return a SymbolRef where 'isValid()' returns false. SymbolRef getAsSymbol() const; diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 1be4118..828e9b5 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -439,11 +439,11 @@ public: /// \param OS - The output stream, which should be non-null. void addOutputFile(llvm::StringRef Path, llvm::raw_ostream *OS); - /// ClearOutputFiles - Clear the output file list, destroying the contained + /// clearOutputFiles - Clear the output file list, destroying the contained /// output streams. /// /// \param EraseFiles - If true, attempt to erase the files from disk. - void ClearOutputFiles(bool EraseFiles); + void clearOutputFiles(bool EraseFiles); /// } /// @name Construction Utility Methods diff --git a/include/clang/Frontend/DeclXML.def b/include/clang/Frontend/DeclXML.def index c750492..e839a8c 100644 --- a/include/clang/Frontend/DeclXML.def +++ b/include/clang/Frontend/DeclXML.def @@ -103,7 +103,7 @@ NODE_XML(FunctionDecl, "Function") //ATTRIBUTE_OPT_XML(isVariadic(), "variadic") // in the type reference ATTRIBUTE_XML(getNumParams(), "num_args") SUB_NODE_SEQUENCE_XML(ParmVarDecl) - //SUB_NODE_OPT_XML("Body") + SUB_NODE_FN_BODY_XML END_NODE_XML NODE_XML(CXXMethodDecl, "CXXMethodDecl") @@ -118,13 +118,9 @@ NODE_XML(CXXMethodDecl, "CXXMethodDecl") ATTRIBUTE_OPT_XML(isVirtual(), "virtual") ATTRIBUTE_XML(getNumParams(), "num_args") SUB_NODE_SEQUENCE_XML(ParmVarDecl) - //SUB_NODE_OPT_XML("Body") + SUB_NODE_FN_BODY_XML END_NODE_XML -//NODE_XML("Body") -// SUB_NODE_XML(Stmt) -//END_NODE_XML - NODE_XML(NamespaceDecl, "Namespace") ID_ATTRIBUTE_XML ATTRIBUTE_FILE_LOCATION_XML @@ -156,6 +152,16 @@ NODE_XML(RecordDecl, "Record") SUB_NODE_SEQUENCE_XML(FieldDecl) END_NODE_XML +NODE_XML(CXXRecordDecl, "CXXRecord") + ID_ATTRIBUTE_XML + ATTRIBUTE_FILE_LOCATION_XML + ATTRIBUTE_XML(getDeclContext(), "context") + ATTRIBUTE_XML(getNameAsString(), "name") + ATTRIBUTE_OPT_XML(isDefinition() == false, "forward") + ATTRIBUTE_XML(getTypeForDecl(), "type") // refers to the type this decl creates + SUB_NODE_SEQUENCE_XML(FieldDecl) +END_NODE_XML + NODE_XML(EnumDecl, "Enum") ID_ATTRIBUTE_XML ATTRIBUTE_FILE_LOCATION_XML @@ -248,3 +254,4 @@ END_NODE_XML #undef SUB_NODE_XML #undef SUB_NODE_SEQUENCE_XML #undef SUB_NODE_OPT_XML +#undef SUB_NODE_FN_BODY_XML diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h index d4014b3..e234e98 100644 --- a/include/clang/Frontend/PCHBitCodes.h +++ b/include/clang/Frontend/PCHBitCodes.h @@ -408,7 +408,9 @@ namespace clang { /// \brief A SubstTemplateTypeParmType record. TYPE_SUBST_TEMPLATE_TYPE_PARM = 25, /// \brief An UnresolvedUsingType record. - TYPE_UNRESOLVED_USING = 26 + TYPE_UNRESOLVED_USING = 26, + /// \brief An InjectedClassNameType record. + TYPE_INJECTED_CLASS_NAME = 27 }; /// \brief The type IDs for special types constructed by semantic diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index db9c884..532d8e4 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -43,7 +43,7 @@ class ScratchBuffer; class TargetInfo; class PPCallbacks; class DirectoryLookup; - + /// Preprocessor - This object engages in a tight little dance with the lexer to /// efficiently preprocess tokens. Lexers know only about tokens within a /// single source file, and don't know anything about preprocessor-level issues @@ -60,7 +60,7 @@ class Preprocessor { /// \brief External source of macros. ExternalPreprocessorSource *ExternalSource; - + /// PTH - An optional PTHManager object used for getting tokens from /// a token cache rather than lexing the original source file. llvm::OwningPtr<PTHManager> PTH; @@ -105,7 +105,7 @@ class Preprocessor { /// \brief Whether we have already loaded macros from the external source. mutable bool ReadMacrosFromExternalSource : 1; - + /// Identifiers - This is mapping/lookup information for all identifiers in /// the program, including program keywords. mutable IdentifierTable Identifiers; @@ -186,7 +186,7 @@ class Preprocessor { /// allocation. /// FIXME: why not use a singly linked list? std::vector<MacroInfo*> MICache; - + /// MacroArgCache - This is a "freelist" of MacroArg objects that can be /// reused for quick allocation. MacroArgs *MacroArgCache; @@ -257,11 +257,11 @@ public: void setExternalSource(ExternalPreprocessorSource *Source) { ExternalSource = Source; } - + ExternalPreprocessorSource *getExternalSource() const { return ExternalSource; } - + /// SetCommentRetentionState - Control whether or not the preprocessor retains /// comments in output. void SetCommentRetentionState(bool KeepComments, bool KeepMacroComments) { @@ -287,11 +287,11 @@ public: /// expansions going on at the time. PreprocessorLexer *getCurrentFileLexer() const; - /// getPPCallbacks/setPPCallbacks - Accessors for preprocessor callbacks. + /// getPPCallbacks/addPPCallbacks - Accessors for preprocessor callbacks. /// Note that this class takes ownership of any PPCallbacks object given to /// it. PPCallbacks *getPPCallbacks() const { return Callbacks; } - void setPPCallbacks(PPCallbacks *C) { + void addPPCallbacks(PPCallbacks *C) { if (Callbacks) C = new PPChainedCallbacks(C, Callbacks); Callbacks = C; @@ -313,7 +313,7 @@ public: MacroInfo*>::const_iterator macro_iterator; macro_iterator macro_begin(bool IncludeExternalMacros = true) const; macro_iterator macro_end(bool IncludeExternalMacros = true) const; - + const std::string &getPredefines() const { return Predefines; } /// setPredefines - Set the predefines for this Preprocessor. These /// predefines are automatically injected when parsing the main file. @@ -523,7 +523,7 @@ public: /// (1-based). /// /// \returns true if an error occurred, false otherwise. - bool SetCodeCompletionPoint(const FileEntry *File, + bool SetCodeCompletionPoint(const FileEntry *File, unsigned Line, unsigned Column); /// \brief Determine if this source location refers into the file diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index 4fe81a7..f6f1eb9 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -228,7 +228,8 @@ public: AttrList(0), ProtocolQualifiers(0), NumProtocolQualifiers(0), - ProtocolLocs(0) { + ProtocolLocs(0), + writtenBS() { } ~DeclSpec() { delete AttrList; |