mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 04:56:07 +00:00
DeclPtrTy -> Decl *
llvm-svn: 111733
This commit is contained in:
parent
e70b6d17a4
commit
4887165193
@ -147,7 +147,6 @@ public:
|
||||
// different actual classes based on the actions in place.
|
||||
typedef Action::ExprTy ExprTy;
|
||||
typedef Action::StmtTy StmtTy;
|
||||
typedef Action::DeclPtrTy DeclPtrTy;
|
||||
typedef Action::DeclGroupPtrTy DeclGroupPtrTy;
|
||||
typedef Action::TypeTy TypeTy;
|
||||
typedef Action::BaseTy BaseTy;
|
||||
@ -539,7 +538,7 @@ private:
|
||||
// Lexing and parsing of C++ inline methods.
|
||||
|
||||
struct LexedMethod {
|
||||
Action::DeclPtrTy D;
|
||||
Decl *D;
|
||||
CachedTokens Toks;
|
||||
|
||||
/// \brief Whether this member function had an associated template
|
||||
@ -547,7 +546,7 @@ private:
|
||||
/// othewise, it is a member function declaration.
|
||||
bool TemplateScope;
|
||||
|
||||
explicit LexedMethod(Action::DeclPtrTy MD) : D(MD), TemplateScope(false) {}
|
||||
explicit LexedMethod(Decl *MD) : D(MD), TemplateScope(false) {}
|
||||
};
|
||||
|
||||
/// LateParsedDefaultArgument - Keeps track of a parameter that may
|
||||
@ -555,12 +554,12 @@ private:
|
||||
/// occurs within a member function declaration inside the class
|
||||
/// (C++ [class.mem]p2).
|
||||
struct LateParsedDefaultArgument {
|
||||
explicit LateParsedDefaultArgument(Action::DeclPtrTy P,
|
||||
explicit LateParsedDefaultArgument(Decl *P,
|
||||
CachedTokens *Toks = 0)
|
||||
: Param(P), Toks(Toks) { }
|
||||
|
||||
/// Param - The parameter declaration for this parameter.
|
||||
Action::DeclPtrTy Param;
|
||||
Decl *Param;
|
||||
|
||||
/// Toks - The sequence of tokens that comprises the default
|
||||
/// argument expression, not including the '=' or the terminating
|
||||
@ -574,11 +573,11 @@ private:
|
||||
/// until the class itself is completely-defined, such as a default
|
||||
/// argument (C++ [class.mem]p2).
|
||||
struct LateParsedMethodDeclaration {
|
||||
explicit LateParsedMethodDeclaration(Action::DeclPtrTy M)
|
||||
explicit LateParsedMethodDeclaration(Decl *M)
|
||||
: Method(M), TemplateScope(false) { }
|
||||
|
||||
/// Method - The method declaration.
|
||||
Action::DeclPtrTy Method;
|
||||
Decl *Method;
|
||||
|
||||
/// \brief Whether this member function had an associated template
|
||||
/// scope. When true, D is a template declaration.
|
||||
@ -609,7 +608,7 @@ private:
|
||||
/// any member function declarations or definitions that need to be
|
||||
/// parsed after the corresponding top-level class is complete.
|
||||
struct ParsingClass {
|
||||
ParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass)
|
||||
ParsingClass(Decl *TagOrTemplate, bool TopLevelClass)
|
||||
: TopLevelClass(TopLevelClass), TemplateScope(false),
|
||||
TagOrTemplate(TagOrTemplate) { }
|
||||
|
||||
@ -623,7 +622,7 @@ private:
|
||||
bool TemplateScope : 1;
|
||||
|
||||
/// \brief The class or class template whose definition we are parsing.
|
||||
DeclPtrTy TagOrTemplate;
|
||||
Decl *TagOrTemplate;
|
||||
|
||||
/// MethodDecls - Method declarations that contain pieces whose
|
||||
/// parsing will be delayed until the class is fully defined.
|
||||
@ -687,10 +686,10 @@ private:
|
||||
/// Signals that the context was completed without an appropriate
|
||||
/// declaration being parsed.
|
||||
void abort() {
|
||||
pop(DeclPtrTy());
|
||||
pop(0);
|
||||
}
|
||||
|
||||
void complete(DeclPtrTy D) {
|
||||
void complete(Decl *D) {
|
||||
assert(!Popped && "ParsingDeclaration has already been popped!");
|
||||
pop(D);
|
||||
}
|
||||
@ -707,7 +706,7 @@ private:
|
||||
Popped = false;
|
||||
}
|
||||
|
||||
void pop(DeclPtrTy D) {
|
||||
void pop(Decl *D) {
|
||||
if (!Popped) {
|
||||
Actions.PopParsingDeclaration(State, D);
|
||||
Popped = true;
|
||||
@ -725,7 +724,7 @@ private:
|
||||
ParsingDeclSpec(Parser &P, ParsingDeclRAIIObject *RAII)
|
||||
: ParsingRAII(P, RAII) {}
|
||||
|
||||
void complete(DeclPtrTy D) {
|
||||
void complete(Decl *D) {
|
||||
ParsingRAII.complete(D);
|
||||
}
|
||||
|
||||
@ -756,7 +755,7 @@ private:
|
||||
ParsingRAII.reset();
|
||||
}
|
||||
|
||||
void complete(DeclPtrTy D) {
|
||||
void complete(Decl *D) {
|
||||
ParsingRAII.complete(D);
|
||||
}
|
||||
};
|
||||
@ -767,7 +766,7 @@ private:
|
||||
bool Popped;
|
||||
|
||||
public:
|
||||
ParsingClassDefinition(Parser &P, DeclPtrTy TagOrTemplate, bool TopLevelClass)
|
||||
ParsingClassDefinition(Parser &P, Decl *TagOrTemplate, bool TopLevelClass)
|
||||
: P(P), Popped(false) {
|
||||
P.PushParsingClass(TagOrTemplate, TopLevelClass);
|
||||
}
|
||||
@ -833,12 +832,12 @@ private:
|
||||
bool LastParameterListWasEmpty;
|
||||
};
|
||||
|
||||
void PushParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass);
|
||||
void PushParsingClass(Decl *TagOrTemplate, bool TopLevelClass);
|
||||
void DeallocateParsedClasses(ParsingClass *Class);
|
||||
void PopParsingClass();
|
||||
|
||||
DeclPtrTy ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo);
|
||||
Decl *ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo);
|
||||
void ParseLexedMethodDeclarations(ParsingClass &Class);
|
||||
void ParseLexedMethodDefs(ParsingClass &Class);
|
||||
bool ConsumeAndStoreUntil(tok::TokenKind T1,
|
||||
@ -863,7 +862,7 @@ private:
|
||||
AttributeList *Attr,
|
||||
AccessSpecifier AS = AS_none);
|
||||
|
||||
DeclPtrTy ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
Decl *ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
|
||||
void ParseKNRParamDeclarations(Declarator &D);
|
||||
// EndLoc, if non-NULL, is filled with the location of the last token of
|
||||
@ -872,31 +871,31 @@ private:
|
||||
OwningExprResult ParseAsmStringLiteral();
|
||||
|
||||
// Objective-C External Declarations
|
||||
DeclPtrTy ParseObjCAtDirectives();
|
||||
DeclPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc);
|
||||
DeclPtrTy ParseObjCAtInterfaceDeclaration(SourceLocation atLoc,
|
||||
Decl *ParseObjCAtDirectives();
|
||||
Decl *ParseObjCAtClassDeclaration(SourceLocation atLoc);
|
||||
Decl *ParseObjCAtInterfaceDeclaration(SourceLocation atLoc,
|
||||
AttributeList *prefixAttrs = 0);
|
||||
void ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||
void ParseObjCClassInstanceVariables(Decl *interfaceDecl,
|
||||
tok::ObjCKeywordKind visibility,
|
||||
SourceLocation atLoc);
|
||||
bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &P,
|
||||
bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<Decl *> &P,
|
||||
llvm::SmallVectorImpl<SourceLocation> &PLocs,
|
||||
bool WarnOnDeclarations,
|
||||
SourceLocation &LAngleLoc,
|
||||
SourceLocation &EndProtoLoc);
|
||||
void ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||
void ParseObjCInterfaceDeclList(Decl *interfaceDecl,
|
||||
tok::ObjCKeywordKind contextKey);
|
||||
DeclPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
|
||||
Decl *ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
|
||||
AttributeList *prefixAttrs = 0);
|
||||
|
||||
DeclPtrTy ObjCImpDecl;
|
||||
llvm::SmallVector<DeclPtrTy, 4> PendingObjCImpDecl;
|
||||
Decl *ObjCImpDecl;
|
||||
llvm::SmallVector<Decl *, 4> PendingObjCImpDecl;
|
||||
|
||||
DeclPtrTy ParseObjCAtImplementationDeclaration(SourceLocation atLoc);
|
||||
DeclPtrTy ParseObjCAtEndDeclaration(SourceRange atEnd);
|
||||
DeclPtrTy ParseObjCAtAliasDeclaration(SourceLocation atLoc);
|
||||
DeclPtrTy ParseObjCPropertySynthesize(SourceLocation atLoc);
|
||||
DeclPtrTy ParseObjCPropertyDynamic(SourceLocation atLoc);
|
||||
Decl *ParseObjCAtImplementationDeclaration(SourceLocation atLoc);
|
||||
Decl *ParseObjCAtEndDeclaration(SourceRange atEnd);
|
||||
Decl *ParseObjCAtAliasDeclaration(SourceLocation atLoc);
|
||||
Decl *ParseObjCPropertySynthesize(SourceLocation atLoc);
|
||||
Decl *ParseObjCPropertyDynamic(SourceLocation atLoc);
|
||||
|
||||
IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation);
|
||||
// Definitions for Objective-c context sensitive keywords recognition.
|
||||
@ -910,15 +909,15 @@ private:
|
||||
|
||||
TypeTy *ParseObjCTypeName(ObjCDeclSpec &DS);
|
||||
void ParseObjCMethodRequirement();
|
||||
DeclPtrTy ParseObjCMethodPrototype(DeclPtrTy classOrCat,
|
||||
Decl *ParseObjCMethodPrototype(Decl *classOrCat,
|
||||
tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword);
|
||||
DeclPtrTy ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType,
|
||||
DeclPtrTy classDecl,
|
||||
Decl *ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType,
|
||||
Decl *classDecl,
|
||||
tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword);
|
||||
void ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods, unsigned NumMethods);
|
||||
void ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl,
|
||||
Decl **Methods, unsigned NumMethods);
|
||||
|
||||
DeclPtrTy ParseObjCMethodDefinition();
|
||||
Decl *ParseObjCMethodDefinition();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C99 6.5: Expressions.
|
||||
@ -1049,7 +1048,7 @@ private:
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C++ if/switch/while condition expression.
|
||||
bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult,
|
||||
bool ParseCXXCondition(OwningExprResult &ExprResult, Decl *&DeclResult,
|
||||
SourceLocation Loc, bool ConvertToBoolean);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -1107,7 +1106,7 @@ private:
|
||||
bool isStmtExpr = false);
|
||||
OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false);
|
||||
bool ParseParenExprOrCondition(OwningExprResult &ExprResult,
|
||||
DeclPtrTy &DeclResult,
|
||||
Decl *&DeclResult,
|
||||
SourceLocation Loc,
|
||||
bool ConvertToBoolean);
|
||||
OwningStmtResult ParseIfStatement(AttributeList *Attr);
|
||||
@ -1162,10 +1161,10 @@ private:
|
||||
DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context,
|
||||
bool AllowFunctionDefinitions,
|
||||
SourceLocation *DeclEnd = 0);
|
||||
DeclPtrTy ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
Decl *ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
|
||||
DeclPtrTy ParseFunctionStatementBody(DeclPtrTy Decl);
|
||||
DeclPtrTy ParseFunctionTryBlock(DeclPtrTy Decl);
|
||||
Decl *ParseFunctionStatementBody(Decl *Decl);
|
||||
Decl *ParseFunctionTryBlock(Decl *Decl);
|
||||
|
||||
bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
|
||||
const ParsedTemplateInfo &TemplateInfo,
|
||||
@ -1187,12 +1186,12 @@ private:
|
||||
|
||||
void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
|
||||
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), AccessSpecifier AS = AS_none);
|
||||
void ParseEnumBody(SourceLocation StartLoc, DeclPtrTy TagDecl);
|
||||
void ParseEnumBody(SourceLocation StartLoc, Decl *TagDecl);
|
||||
void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType,
|
||||
DeclPtrTy TagDecl);
|
||||
Decl *TagDecl);
|
||||
|
||||
struct FieldCallback {
|
||||
virtual DeclPtrTy invoke(FieldDeclarator &Field) = 0;
|
||||
virtual Decl *invoke(FieldDeclarator &Field) = 0;
|
||||
virtual ~FieldCallback() {}
|
||||
|
||||
private:
|
||||
@ -1408,19 +1407,19 @@ private:
|
||||
bool isCXX0XAttributeSpecifier(bool FullLookahead = false,
|
||||
tok::TokenKind *After = 0);
|
||||
|
||||
DeclPtrTy ParseNamespace(unsigned Context, SourceLocation &DeclEnd);
|
||||
DeclPtrTy ParseLinkage(ParsingDeclSpec &DS, unsigned Context);
|
||||
DeclPtrTy ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||
Decl *ParseNamespace(unsigned Context, SourceLocation &DeclEnd);
|
||||
Decl *ParseLinkage(ParsingDeclSpec &DS, unsigned Context);
|
||||
Decl *ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
CXX0XAttributeList Attrs);
|
||||
DeclPtrTy ParseUsingDirective(unsigned Context, SourceLocation UsingLoc,
|
||||
Decl *ParseUsingDirective(unsigned Context, SourceLocation UsingLoc,
|
||||
SourceLocation &DeclEnd,
|
||||
AttributeList *Attr);
|
||||
DeclPtrTy ParseUsingDeclaration(unsigned Context, SourceLocation UsingLoc,
|
||||
Decl *ParseUsingDeclaration(unsigned Context, SourceLocation UsingLoc,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS = AS_none);
|
||||
DeclPtrTy ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
|
||||
DeclPtrTy ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
|
||||
Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
SourceLocation AliasLoc, IdentifierInfo *Alias,
|
||||
SourceLocation &DeclEnd);
|
||||
|
||||
@ -1434,19 +1433,19 @@ private:
|
||||
AccessSpecifier AS = AS_none,
|
||||
bool SuppressDeclarations = false);
|
||||
void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
|
||||
DeclPtrTy TagDecl);
|
||||
Decl *TagDecl);
|
||||
void ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
|
||||
ParsingDeclRAIIObject *DiagsFromTParams = 0);
|
||||
void ParseConstructorInitializer(DeclPtrTy ConstructorDecl);
|
||||
MemInitResult ParseMemInitializer(DeclPtrTy ConstructorDecl);
|
||||
void ParseConstructorInitializer(Decl *ConstructorDecl);
|
||||
MemInitResult ParseMemInitializer(Decl *ConstructorDecl);
|
||||
void HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
|
||||
DeclPtrTy ThisDecl);
|
||||
Decl *ThisDecl);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C++ 10: Derived classes [class.derived]
|
||||
void ParseBaseClause(DeclPtrTy ClassDecl);
|
||||
BaseResult ParseBaseSpecifier(DeclPtrTy ClassDecl);
|
||||
void ParseBaseClause(Decl *ClassDecl);
|
||||
BaseResult ParseBaseSpecifier(Decl *ClassDecl);
|
||||
AccessSpecifier getAccessSpecifierIfPresent() const;
|
||||
|
||||
bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
||||
@ -1468,16 +1467,16 @@ private:
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C++ 14: Templates [temp]
|
||||
typedef llvm::SmallVector<DeclPtrTy, 4> TemplateParameterList;
|
||||
typedef llvm::SmallVector<Decl *, 4> TemplateParameterList;
|
||||
|
||||
// C++ 14.1: Template Parameters [temp.param]
|
||||
DeclPtrTy ParseDeclarationStartingWithTemplate(unsigned Context,
|
||||
Decl *ParseDeclarationStartingWithTemplate(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS = AS_none);
|
||||
DeclPtrTy ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
Decl *ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS);
|
||||
DeclPtrTy ParseSingleDeclarationAfterTemplate(
|
||||
Decl *ParseSingleDeclarationAfterTemplate(
|
||||
unsigned Context,
|
||||
const ParsedTemplateInfo &TemplateInfo,
|
||||
ParsingDeclRAIIObject &DiagsFromParams,
|
||||
@ -1490,10 +1489,10 @@ private:
|
||||
bool ParseTemplateParameterList(unsigned Depth,
|
||||
TemplateParameterList &TemplateParams);
|
||||
bool isStartOfTemplateTypeParameter();
|
||||
DeclPtrTy ParseTemplateParameter(unsigned Depth, unsigned Position);
|
||||
DeclPtrTy ParseTypeParameter(unsigned Depth, unsigned Position);
|
||||
DeclPtrTy ParseTemplateTemplateParameter(unsigned Depth, unsigned Position);
|
||||
DeclPtrTy ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position);
|
||||
Decl *ParseTemplateParameter(unsigned Depth, unsigned Position);
|
||||
Decl *ParseTypeParameter(unsigned Depth, unsigned Position);
|
||||
Decl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position);
|
||||
Decl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position);
|
||||
// C++ 14.3: Template arguments [temp.arg]
|
||||
typedef llvm::SmallVector<ParsedTemplateArgument, 16> TemplateArgList;
|
||||
|
||||
@ -1515,9 +1514,9 @@ private:
|
||||
bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs);
|
||||
ParsedTemplateArgument ParseTemplateTemplateArgument();
|
||||
ParsedTemplateArgument ParseTemplateArgument();
|
||||
DeclPtrTy ParseExplicitInstantiation(SourceLocation ExternLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation &DeclEnd);
|
||||
Decl *ParseExplicitInstantiation(SourceLocation ExternLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation &DeclEnd);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// GNU G++: Type Traits [Type-Traits.html in the GCC manual]
|
||||
|
@ -42,15 +42,6 @@ namespace clang {
|
||||
class Preprocessor;
|
||||
class Token;
|
||||
|
||||
// We can re-use the low bit of expression, statement, base, and
|
||||
// member-initializer pointers for the "invalid" flag of
|
||||
// ActionResult.
|
||||
template<> struct IsResultPtrLowBitFree<0> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<1> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;};
|
||||
|
||||
/// Action - As the parser reads the input file and recognizes the productions
|
||||
/// of the grammar, it invokes methods on this class to turn the parsed input
|
||||
/// into something useful: e.g. a parse tree.
|
||||
@ -89,12 +80,12 @@ public:
|
||||
/// Expr/Stmt/Type/BaseResult - Provide a unique type to wrap
|
||||
/// ExprTy/StmtTy/TypeTy/BaseTy, providing strong typing and
|
||||
/// allowing for failure.
|
||||
typedef ActionResult<0> ExprResult;
|
||||
typedef ActionResult<1> StmtResult;
|
||||
typedef ActionResult<2> TypeResult;
|
||||
typedef ActionResult<3> BaseResult;
|
||||
typedef ActionResult<4> MemInitResult;
|
||||
typedef ActionResult<5, DeclPtrTy> DeclResult;
|
||||
typedef clang::ExprResult ExprResult;
|
||||
typedef clang::StmtResult StmtResult;
|
||||
typedef clang::TypeResult TypeResult;
|
||||
typedef clang::BaseResult BaseResult;
|
||||
typedef clang::MemInitResult MemInitResult;
|
||||
typedef clang::DeclResult DeclResult;
|
||||
|
||||
/// Same, but with ownership.
|
||||
typedef ASTOwningResult<&ActionBase::DeleteExpr> OwningExprResult;
|
||||
@ -166,7 +157,7 @@ public:
|
||||
|
||||
/// getDeclName - Return a pretty name for the specified decl if possible, or
|
||||
/// an empty string if not. This is used for pretty crash reporting.
|
||||
virtual std::string getDeclName(DeclPtrTy D) { return ""; }
|
||||
virtual std::string getDeclName(Decl *D) { return ""; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Declaration Tracking Callbacks.
|
||||
@ -186,13 +177,13 @@ public:
|
||||
/// processing a declaration of some sort. The decl will be empty
|
||||
/// if the declaration didn't correspond to a full declaration (or
|
||||
/// if the actions module returned an empty decl for it).
|
||||
virtual void PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy D) {
|
||||
virtual void PopParsingDeclaration(ParsingDeclStackState S, Decl *D) {
|
||||
}
|
||||
|
||||
/// ConvertDeclToDeclGroup - If the parser has one decl in a context where it
|
||||
/// needs a decl group, it calls this to convert between the two
|
||||
/// representations.
|
||||
virtual DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr) {
|
||||
virtual DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr) {
|
||||
return DeclGroupPtrTy();
|
||||
}
|
||||
|
||||
@ -470,34 +461,34 @@ public:
|
||||
/// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
|
||||
/// static data member of class X, names should be looked up in the scope of
|
||||
/// class X.
|
||||
virtual void ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
virtual void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl) {
|
||||
}
|
||||
|
||||
/// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
|
||||
/// initializer for the declaration 'Dcl'.
|
||||
virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
virtual void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl) {
|
||||
}
|
||||
|
||||
/// ActOnDeclarator - This callback is invoked when a declarator is parsed and
|
||||
/// 'Init' specifies the initializer if any. This is for things like:
|
||||
/// "int X = 4" or "typedef int foo".
|
||||
///
|
||||
virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ActOnDeclarator(Scope *S, Declarator &D) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnParamDeclarator - This callback is invoked when a parameter
|
||||
/// declarator is parsed. This callback only occurs for functions
|
||||
/// with prototypes. S is the function prototype scope for the
|
||||
/// parameters (C++ [basic.scope.proto]).
|
||||
virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Parsed an exception object declaration within an Objective-C
|
||||
/// @catch statement.
|
||||
virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// AddInitializerToDecl - This action is called immediately after
|
||||
@ -507,7 +498,7 @@ public:
|
||||
/// This allows ActOnDeclarator to register "xx" prior to parsing the
|
||||
/// initializer. The declaration above should still result in a warning,
|
||||
/// since the reference to "xx" is uninitialized.
|
||||
virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) {
|
||||
virtual void AddInitializerToDecl(Decl *Dcl, ExprArg Init) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -515,7 +506,7 @@ public:
|
||||
/// if =delete is parsed. C++0x [dcl.fct.def]p10
|
||||
/// Note that this can be called even for variable declarations. It's the
|
||||
/// action's job to reject it.
|
||||
virtual void SetDeclDeleted(DeclPtrTy Dcl, SourceLocation DelLoc) {
|
||||
virtual void SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -523,21 +514,21 @@ public:
|
||||
/// ActOnDeclarator (when an initializer is *not* present).
|
||||
/// If TypeContainsUndeducedAuto is true, then the type of the declarator
|
||||
/// has an undeduced 'auto' type somewhere.
|
||||
virtual void ActOnUninitializedDecl(DeclPtrTy Dcl,
|
||||
virtual void ActOnUninitializedDecl(Decl *Dcl,
|
||||
bool TypeContainsUndeducedAuto) {
|
||||
return;
|
||||
}
|
||||
|
||||
/// \brief Note that the given declaration had an initializer that could not
|
||||
/// be parsed.
|
||||
virtual void ActOnInitializerError(DeclPtrTy Dcl) {
|
||||
virtual void ActOnInitializerError(Decl *Dcl) {
|
||||
return;
|
||||
}
|
||||
|
||||
/// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
|
||||
/// gives the actions implementation a chance to process the group as a whole.
|
||||
virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
|
||||
DeclPtrTy *Group,
|
||||
Decl **Group,
|
||||
unsigned NumDecls) {
|
||||
return DeclGroupPtrTy();
|
||||
}
|
||||
@ -554,31 +545,26 @@ public:
|
||||
/// ActOnStartOfFunctionDef - This is called at the start of a function
|
||||
/// definition, instead of calling ActOnDeclarator. The Declarator includes
|
||||
/// information about formal arguments that are part of this function.
|
||||
virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
|
||||
// Default to ActOnDeclarator.
|
||||
return ActOnStartOfFunctionDef(FnBodyScope,
|
||||
ActOnDeclarator(FnBodyScope, D));
|
||||
}
|
||||
virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope,
|
||||
Declarator &D) = 0;
|
||||
|
||||
/// ActOnStartOfFunctionDef - This is called at the start of a function
|
||||
/// definition, after the FunctionDecl has already been created.
|
||||
virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
return D;
|
||||
}
|
||||
virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) = 0;
|
||||
|
||||
virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
|
||||
return;
|
||||
}
|
||||
|
||||
/// ActOnFinishFunctionBody - This is called when a function body has
|
||||
/// completed parsing. Decl is returned by ParseStartOfFunctionDef.
|
||||
virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) {
|
||||
virtual Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body) {
|
||||
return Decl;
|
||||
}
|
||||
|
||||
virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc,
|
||||
virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc,
|
||||
ExprArg AsmString) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnPopScope - This callback is called immediately before the specified
|
||||
@ -591,10 +577,10 @@ public:
|
||||
|
||||
/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
|
||||
/// no declarator (e.g. "struct foo;") is parsed.
|
||||
virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S,
|
||||
AccessSpecifier Access,
|
||||
DeclSpec &DS) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ParsedFreeStandingDeclSpec(Scope *S,
|
||||
AccessSpecifier Access,
|
||||
DeclSpec &DS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnStartLinkageSpecification - Parsed the beginning of a C++
|
||||
@ -604,20 +590,20 @@ public:
|
||||
/// by Lang/StrSize. LBraceLoc, if valid, provides the location of
|
||||
/// the '{' brace. Otherwise, this linkage specification does not
|
||||
/// have any braces.
|
||||
virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S,
|
||||
SourceLocation ExternLoc,
|
||||
SourceLocation LangLoc,
|
||||
llvm::StringRef Lang,
|
||||
SourceLocation LBraceLoc) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ActOnStartLinkageSpecification(Scope *S,
|
||||
SourceLocation ExternLoc,
|
||||
SourceLocation LangLoc,
|
||||
llvm::StringRef Lang,
|
||||
SourceLocation LBraceLoc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnFinishLinkageSpecification - Completely the definition of
|
||||
/// the C++ linkage specification LinkageSpec. If RBraceLoc is
|
||||
/// valid, it's the position of the closing '}' brace in a linkage
|
||||
/// specification that uses braces.
|
||||
virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S,
|
||||
DeclPtrTy LinkageSpec,
|
||||
virtual Decl *ActOnFinishLinkageSpecification(Scope *S,
|
||||
Decl *LinkageSpec,
|
||||
SourceLocation RBraceLoc) {
|
||||
return LinkageSpec;
|
||||
}
|
||||
@ -684,13 +670,13 @@ public:
|
||||
/// by the action module.
|
||||
///
|
||||
/// \returns the declaration to which this tag refers.
|
||||
virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
virtual Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
SourceLocation KWLoc, CXXScopeSpec &SS,
|
||||
IdentifierInfo *Name, SourceLocation NameLoc,
|
||||
AttributeList *Attr, AccessSpecifier AS,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
bool &OwnedDecl, bool &IsDependent) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Acts on a reference to a dependent tag name. This arises in
|
||||
@ -719,60 +705,60 @@ public:
|
||||
|
||||
/// Act on @defs() element found when parsing a structure. ClassName is the
|
||||
/// name of the referenced class.
|
||||
virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
|
||||
virtual void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
|
||||
IdentifierInfo *ClassName,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Decls) {}
|
||||
virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD,
|
||||
llvm::SmallVectorImpl<Decl *> &Decls) {}
|
||||
virtual Decl *ActOnField(Scope *S, Decl *TagD,
|
||||
SourceLocation DeclStart,
|
||||
Declarator &D, ExprTy *BitfieldWidth) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
|
||||
DeclPtrTy IntfDecl,
|
||||
virtual Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
|
||||
Decl *IntfDecl,
|
||||
Declarator &D, ExprTy *BitfieldWidth,
|
||||
tok::ObjCKeywordKind visibility) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
|
||||
DeclPtrTy *Fields, unsigned NumFields,
|
||||
virtual void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl,
|
||||
Decl **Fields, unsigned NumFields,
|
||||
SourceLocation LBrac, SourceLocation RBrac,
|
||||
AttributeList *AttrList) {}
|
||||
|
||||
/// ActOnTagStartDefinition - Invoked when we have entered the
|
||||
/// scope of a tag's definition (e.g., for an enumeration, class,
|
||||
/// struct, or union).
|
||||
virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl) { }
|
||||
virtual void ActOnTagStartDefinition(Scope *S, Decl *TagDecl) { }
|
||||
|
||||
/// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
|
||||
/// C++ record definition's base-specifiers clause and are starting its
|
||||
/// member declarations.
|
||||
virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl,
|
||||
virtual void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl,
|
||||
SourceLocation LBraceLoc) { }
|
||||
|
||||
/// ActOnTagFinishDefinition - Invoked once we have finished parsing
|
||||
/// the definition of a tag (enumeration, class, struct, or union).
|
||||
///
|
||||
/// The scope is the scope of the tag definition.
|
||||
virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl,
|
||||
virtual void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl,
|
||||
SourceLocation RBraceLoc) { }
|
||||
|
||||
/// ActOnTagDefinitionError - Invoked if there's an unrecoverable
|
||||
/// error parsing the definition of a tag.
|
||||
///
|
||||
/// The scope is the scope of the tag definition.
|
||||
virtual void ActOnTagDefinitionError(Scope *S, DeclPtrTy TagDecl) { }
|
||||
virtual void ActOnTagDefinitionError(Scope *S, Decl *TagDecl) { }
|
||||
|
||||
virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
|
||||
DeclPtrTy LastEnumConstant,
|
||||
virtual Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl,
|
||||
Decl *LastEnumConstant,
|
||||
SourceLocation IdLoc, IdentifierInfo *Id,
|
||||
SourceLocation EqualLoc, ExprTy *Val) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
|
||||
DeclPtrTy *Elements, unsigned NumElements,
|
||||
SourceLocation RBraceLoc, Decl *EnumDecl,
|
||||
Decl **Elements, unsigned NumElements,
|
||||
Scope *S, AttributeList *AttrList) {}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -844,7 +830,7 @@ public:
|
||||
/// \param ElseVal the "else" statement.
|
||||
virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
|
||||
FullExprArg CondVal,
|
||||
DeclPtrTy CondVar,
|
||||
Decl *CondVar,
|
||||
StmtArg ThenVal,
|
||||
SourceLocation ElseLoc,
|
||||
StmtArg ElseVal) {
|
||||
@ -862,7 +848,7 @@ public:
|
||||
/// variable, the condition variable itself.
|
||||
virtual OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
|
||||
ExprArg Cond,
|
||||
DeclPtrTy CondVar) {
|
||||
Decl *CondVar) {
|
||||
return StmtEmpty();
|
||||
}
|
||||
|
||||
@ -881,7 +867,7 @@ public:
|
||||
///
|
||||
/// \param Body the body of the "while" loop.
|
||||
virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
|
||||
FullExprArg Cond, DeclPtrTy CondVar,
|
||||
FullExprArg Cond, Decl *CondVar,
|
||||
StmtArg Body) {
|
||||
return StmtEmpty();
|
||||
}
|
||||
@ -916,7 +902,7 @@ public:
|
||||
virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
|
||||
SourceLocation LParenLoc,
|
||||
StmtArg First, FullExprArg Second,
|
||||
DeclPtrTy SecondVar, FullExprArg Third,
|
||||
Decl *SecondVar, FullExprArg Third,
|
||||
SourceLocation RParenLoc,
|
||||
StmtArg Body) {
|
||||
return StmtEmpty();
|
||||
@ -980,7 +966,7 @@ public:
|
||||
/// \param Body The body of the @catch block.
|
||||
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
|
||||
SourceLocation RParen,
|
||||
DeclPtrTy Parm, StmtArg Body) {
|
||||
Decl *Parm, StmtArg Body) {
|
||||
return StmtEmpty();
|
||||
}
|
||||
|
||||
@ -1023,12 +1009,12 @@ public:
|
||||
}
|
||||
|
||||
// C++ Statements
|
||||
virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
virtual Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
|
||||
DeclPtrTy ExceptionDecl,
|
||||
Decl *ExceptionDecl,
|
||||
StmtArg HandlerBlock) {
|
||||
return StmtEmpty();
|
||||
}
|
||||
@ -1183,7 +1169,7 @@ public:
|
||||
tok::TokenKind OpKind,
|
||||
CXXScopeSpec &SS,
|
||||
UnqualifiedId &Member,
|
||||
DeclPtrTy ObjCImpDecl,
|
||||
Decl *ObjCImpDecl,
|
||||
bool HasTrailingLParen) {
|
||||
return ExprEmpty();
|
||||
}
|
||||
@ -1352,21 +1338,21 @@ public:
|
||||
|
||||
/// ActOnStartNamespaceDef - This is called at the start of a namespace
|
||||
/// definition.
|
||||
virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
|
||||
virtual Decl *ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
|
||||
IdentifierInfo *Ident,
|
||||
SourceLocation LBrace,
|
||||
AttributeList *AttrList) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnFinishNamespaceDef - This callback is called after a namespace is
|
||||
/// exited. Decl is returned by ActOnStartNamespaceDef.
|
||||
virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace) {
|
||||
virtual void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace) {
|
||||
return;
|
||||
}
|
||||
|
||||
/// ActOnUsingDirective - This is called when using-directive is parsed.
|
||||
virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
|
||||
virtual Decl *ActOnUsingDirective(Scope *CurScope,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation NamespcLoc,
|
||||
CXXScopeSpec &SS,
|
||||
@ -1376,14 +1362,14 @@ public:
|
||||
|
||||
/// ActOnNamespaceAliasDef - This is called when a namespace alias definition
|
||||
/// is parsed.
|
||||
virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope,
|
||||
virtual Decl *ActOnNamespaceAliasDef(Scope *CurScope,
|
||||
SourceLocation NamespaceLoc,
|
||||
SourceLocation AliasLoc,
|
||||
IdentifierInfo *Alias,
|
||||
CXXScopeSpec &SS,
|
||||
SourceLocation IdentLoc,
|
||||
IdentifierInfo *Ident) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Parsed a C++ using-declaration.
|
||||
@ -1422,7 +1408,7 @@ public:
|
||||
/// \param TypenameLoc the location of the 'typename' keyword, if present
|
||||
///
|
||||
/// \returns a representation of the using declaration.
|
||||
virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
|
||||
virtual Decl *ActOnUsingDeclaration(Scope *CurScope,
|
||||
AccessSpecifier AS,
|
||||
bool HasUsingKeyword,
|
||||
SourceLocation UsingLoc,
|
||||
@ -1433,7 +1419,7 @@ public:
|
||||
SourceLocation TypenameLoc);
|
||||
|
||||
/// ActOnParamDefaultArgument - Parse default argument for function parameter
|
||||
virtual void ActOnParamDefaultArgument(DeclPtrTy param,
|
||||
virtual void ActOnParamDefaultArgument(Decl *param,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg defarg) {
|
||||
}
|
||||
@ -1442,18 +1428,18 @@ public:
|
||||
/// argument for a function parameter, but we can't parse it yet
|
||||
/// because we're inside a class definition. Note that this default
|
||||
/// argument will be parsed later.
|
||||
virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
|
||||
virtual void ActOnParamUnparsedDefaultArgument(Decl *param,
|
||||
SourceLocation EqualLoc,
|
||||
SourceLocation ArgLoc) { }
|
||||
|
||||
/// ActOnParamDefaultArgumentError - Parsing or semantic analysis of
|
||||
/// the default argument for the parameter param failed.
|
||||
virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) { }
|
||||
virtual void ActOnParamDefaultArgumentError(Decl *param) { }
|
||||
|
||||
/// AddCXXDirectInitializerToDecl - This action is called immediately after
|
||||
/// ActOnDeclarator, when a C++ direct initializer is present.
|
||||
/// e.g: "int x(1);"
|
||||
virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
|
||||
virtual void AddCXXDirectInitializerToDecl(Decl *Dcl,
|
||||
SourceLocation LParenLoc,
|
||||
MultiExprArg Exprs,
|
||||
SourceLocation *CommaLocs,
|
||||
@ -1476,7 +1462,7 @@ public:
|
||||
///
|
||||
/// \param Template the class template declaration whose template
|
||||
/// parameters should be reintroduced into the current scope.
|
||||
virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template) {
|
||||
virtual void ActOnReenterTemplateScope(Scope *S, Decl *Template) {
|
||||
}
|
||||
|
||||
/// ActOnStartDelayedMemberDeclarations - We have completed parsing
|
||||
@ -1484,7 +1470,7 @@ public:
|
||||
/// member declarations that could not be parsed earlier. Enter
|
||||
/// the appropriate record scope.
|
||||
virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
|
||||
DeclPtrTy Record) {
|
||||
Decl *Record) {
|
||||
}
|
||||
|
||||
/// ActOnStartDelayedCXXMethodDeclaration - We have completed
|
||||
@ -1496,7 +1482,7 @@ public:
|
||||
/// name. However, it should not bring the parameters into scope;
|
||||
/// that will be performed by ActOnDelayedCXXMethodParameter.
|
||||
virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
|
||||
DeclPtrTy Method) {
|
||||
Decl *Method) {
|
||||
}
|
||||
|
||||
/// ActOnDelayedCXXMethodParameter - We've already started a delayed
|
||||
@ -1504,7 +1490,7 @@ public:
|
||||
/// function parameter into scope for use in parsing later parts of
|
||||
/// the method declaration. For example, we could see an
|
||||
/// ActOnParamDefaultArgument event for this parameter.
|
||||
virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param) {
|
||||
virtual void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param) {
|
||||
}
|
||||
|
||||
/// ActOnFinishDelayedCXXMethodDeclaration - We have finished
|
||||
@ -1514,7 +1500,7 @@ public:
|
||||
/// immediately!) for this method, if it was also defined inside the
|
||||
/// class body.
|
||||
virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
|
||||
DeclPtrTy Method) {
|
||||
Decl *Method) {
|
||||
}
|
||||
|
||||
/// ActOnFinishDelayedMemberDeclarations - We have finished parsing
|
||||
@ -1522,30 +1508,30 @@ public:
|
||||
/// member declarations that could not be parsed earlier. Enter the
|
||||
/// appropriate record scope.
|
||||
virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
|
||||
DeclPtrTy Record) {
|
||||
Decl *Record) {
|
||||
}
|
||||
|
||||
/// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
|
||||
virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
virtual Decl *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
ExprArg AssertExpr,
|
||||
ExprArg AssertMessageExpr) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnFriendFunctionDecl - Parsed a friend function declarator.
|
||||
/// The name is actually a slight misnomer, because the declarator
|
||||
/// is not necessarily a function declarator.
|
||||
virtual DeclPtrTy ActOnFriendFunctionDecl(Scope *S,
|
||||
virtual Decl *ActOnFriendFunctionDecl(Scope *S,
|
||||
Declarator &D,
|
||||
bool IsDefinition,
|
||||
MultiTemplateParamsArg TParams) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnFriendTypeDecl - Parsed a friend type declaration.
|
||||
virtual DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
virtual Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
MultiTemplateParamsArg TParams) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===------------------------- C++ Expressions --------------------------===//
|
||||
@ -1630,9 +1616,7 @@ public:
|
||||
/// \param S the scope of the if, switch, or while statement.
|
||||
///
|
||||
/// \param D the declarator that that describes the variable being declared.
|
||||
virtual DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D) {
|
||||
return DeclResult();
|
||||
}
|
||||
virtual DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D) = 0;
|
||||
|
||||
/// \brief Parsed an expression that will be handled as the condition in
|
||||
/// an if/while/for statement.
|
||||
@ -1793,7 +1777,7 @@ public:
|
||||
|
||||
//===---------------------------- C++ Classes ---------------------------===//
|
||||
/// ActOnBaseSpecifier - Parsed a base specifier
|
||||
virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
|
||||
virtual BaseResult ActOnBaseSpecifier(Decl *classdecl,
|
||||
SourceRange SpecifierRange,
|
||||
bool Virtual, AccessSpecifier Access,
|
||||
TypeTy *basetype,
|
||||
@ -1801,17 +1785,17 @@ public:
|
||||
return BaseResult();
|
||||
}
|
||||
|
||||
virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
|
||||
virtual void ActOnBaseSpecifiers(Decl *ClassDecl, BaseTy **Bases,
|
||||
unsigned NumBases) {
|
||||
}
|
||||
|
||||
/// ActOnAccessSpecifier - This is invoked when an access specifier
|
||||
/// (and the colon following it) is found during the parsing of a
|
||||
/// C++ class member declarator.
|
||||
virtual DeclPtrTy ActOnAccessSpecifier(AccessSpecifier AS,
|
||||
virtual Decl *ActOnAccessSpecifier(AccessSpecifier AS,
|
||||
SourceLocation ASLoc,
|
||||
SourceLocation ColonLoc) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
|
||||
@ -1819,17 +1803,17 @@ public:
|
||||
/// specifies the bitfield width if there is one and 'Init' specifies the
|
||||
/// initializer if any. 'Deleted' is true if there's a =delete
|
||||
/// specifier on the function.
|
||||
virtual DeclPtrTy ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
|
||||
virtual Decl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
|
||||
Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
ExprTy *BitfieldWidth,
|
||||
ExprTy *Init,
|
||||
bool IsDefinition,
|
||||
bool Deleted = false) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorDecl,
|
||||
virtual MemInitResult ActOnMemInitializer(Decl *ConstructorDecl,
|
||||
Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
IdentifierInfo *MemberOrBase,
|
||||
@ -1850,18 +1834,18 @@ public:
|
||||
/// contains the individual member (and base) initializers.
|
||||
/// AnyErrors will be true if there were any invalid member initializers
|
||||
/// that are not represented in the list.
|
||||
virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
||||
virtual void ActOnMemInitializers(Decl *ConstructorDecl,
|
||||
SourceLocation ColonLoc,
|
||||
MemInitTy **MemInits, unsigned NumMemInits,
|
||||
bool AnyErrors){
|
||||
}
|
||||
|
||||
virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {}
|
||||
virtual void ActOnDefaultCtorInitializers(Decl *CDtorDecl) {}
|
||||
|
||||
/// ActOnFinishCXXMemberSpecification - Invoked after all member declarators
|
||||
/// are parsed but *before* parsing of inline method definitions.
|
||||
virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||
DeclPtrTy TagDecl,
|
||||
Decl *TagDecl,
|
||||
SourceLocation LBrac,
|
||||
SourceLocation RBrac,
|
||||
AttributeList *AttrList) {
|
||||
@ -1908,7 +1892,7 @@ public:
|
||||
/// argument, if any.
|
||||
///
|
||||
/// \param DefaultArg The default argument, if provided.
|
||||
virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
virtual Decl *ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
SourceLocation EllipsisLoc,
|
||||
SourceLocation KeyLoc,
|
||||
IdentifierInfo *ParamName,
|
||||
@ -1916,7 +1900,7 @@ public:
|
||||
unsigned Depth, unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
TypeTy *DefaultArg) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Called when a C++ non-type template parameter has been parsed.
|
||||
@ -1945,17 +1929,17 @@ public:
|
||||
/// argument, if any.
|
||||
///
|
||||
/// \param DefaultArg The default argument, if provided.
|
||||
virtual DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
virtual Decl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg DefaultArg) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Adds a default argument to the given non-type template
|
||||
/// parameter.
|
||||
virtual void ActOnNonTypeTemplateParameterDefault(DeclPtrTy TemplateParam,
|
||||
virtual void ActOnNonTypeTemplateParameterDefault(Decl *TemplateParam,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg Default) {
|
||||
}
|
||||
@ -1992,7 +1976,7 @@ public:
|
||||
/// argument, if any.
|
||||
///
|
||||
/// \param DefaultArg The default argument, if provided.
|
||||
virtual DeclPtrTy ActOnTemplateTemplateParameter(Scope *S,
|
||||
virtual Decl *ActOnTemplateTemplateParameter(Scope *S,
|
||||
SourceLocation TmpLoc,
|
||||
TemplateParamsTy *Params,
|
||||
IdentifierInfo *ParamName,
|
||||
@ -2001,7 +1985,7 @@ public:
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
const ParsedTemplateArgument &DefaultArg) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnTemplateParameterList - Called when a complete template
|
||||
@ -2038,7 +2022,7 @@ public:
|
||||
SourceLocation ExportLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
DeclPtrTy *Params, unsigned NumParams,
|
||||
Decl **Params, unsigned NumParams,
|
||||
SourceLocation RAngleLoc) {
|
||||
return 0;
|
||||
}
|
||||
@ -2177,9 +2161,7 @@ public:
|
||||
ASTTemplateArgsPtr TemplateArgs,
|
||||
SourceLocation RAngleLoc,
|
||||
AttributeList *Attr,
|
||||
MultiTemplateParamsArg TemplateParameterLists) {
|
||||
return DeclResult();
|
||||
}
|
||||
MultiTemplateParamsArg TemplateParameterLists) = 0;
|
||||
|
||||
/// \brief Invoked when a declarator that has one or more template parameter
|
||||
/// lists has been parsed.
|
||||
@ -2187,18 +2169,18 @@ public:
|
||||
/// This action is similar to ActOnDeclarator(), except that the declaration
|
||||
/// being created somehow involves a template, e.g., it is a template
|
||||
/// declaration or specialization.
|
||||
virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S,
|
||||
virtual Decl *ActOnTemplateDeclarator(Scope *S,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Invoked when the parser is beginning to parse a function template
|
||||
/// or function template specialization definition.
|
||||
virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
virtual Decl *ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Process the explicit instantiation of a class template
|
||||
@ -2391,85 +2373,85 @@ public:
|
||||
// ActOnStartClassInterface - this action is called immediately after parsing
|
||||
// the prologue for a class interface (before parsing the instance
|
||||
// variables). Instance variables are processed by ActOnFields().
|
||||
virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
virtual Decl *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperName,
|
||||
SourceLocation SuperLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc,
|
||||
AttributeList *AttrList) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ActOnCompatiblityAlias - this action is called after complete parsing of
|
||||
/// @compaatibility_alias declaration. It sets up the alias relationships.
|
||||
virtual DeclPtrTy ActOnCompatiblityAlias(
|
||||
virtual Decl *ActOnCompatiblityAlias(
|
||||
SourceLocation AtCompatibilityAliasLoc,
|
||||
IdentifierInfo *AliasName, SourceLocation AliasLocation,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLocation) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ActOnStartProtocolInterface - this action is called immdiately after
|
||||
// parsing the prologue for a protocol interface.
|
||||
virtual DeclPtrTy ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
|
||||
virtual Decl *ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
|
||||
IdentifierInfo *ProtocolName,
|
||||
SourceLocation ProtocolLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc,
|
||||
AttributeList *AttrList) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// ActOnStartCategoryInterface - this action is called immdiately after
|
||||
// parsing the prologue for a category interface.
|
||||
virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
virtual Decl *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *CategoryName,
|
||||
SourceLocation CategoryLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// ActOnStartClassImplementation - this action is called immdiately after
|
||||
// parsing the prologue for a class implementation. Instance variables are
|
||||
// processed by ActOnFields().
|
||||
virtual DeclPtrTy ActOnStartClassImplementation(
|
||||
virtual Decl *ActOnStartClassImplementation(
|
||||
SourceLocation AtClassImplLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperClassname,
|
||||
SourceLocation SuperClassLoc) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// ActOnStartCategoryImplementation - this action is called immdiately after
|
||||
// parsing the prologue for a category implementation.
|
||||
virtual DeclPtrTy ActOnStartCategoryImplementation(
|
||||
virtual Decl *ActOnStartCategoryImplementation(
|
||||
SourceLocation AtCatImplLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *CatName,
|
||||
SourceLocation CatLoc) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// ActOnPropertyImplDecl - called for every property implementation
|
||||
virtual DeclPtrTy ActOnPropertyImplDecl(
|
||||
virtual Decl *ActOnPropertyImplDecl(
|
||||
Scope *S,
|
||||
SourceLocation AtLoc, // location of the @synthesize/@dynamic
|
||||
SourceLocation PropertyNameLoc, // location for the property name
|
||||
bool ImplKind, // true for @synthesize, false for
|
||||
// @dynamic
|
||||
DeclPtrTy ClassImplDecl, // class or category implementation
|
||||
Decl *ClassImplDecl, // class or category implementation
|
||||
IdentifierInfo *propertyId, // name of property
|
||||
IdentifierInfo *propertyIvar) { // name of the ivar
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ObjCArgInfo {
|
||||
@ -2485,11 +2467,11 @@ public:
|
||||
};
|
||||
|
||||
// ActOnMethodDeclaration - called for all method declarations.
|
||||
virtual DeclPtrTy ActOnMethodDeclaration(
|
||||
virtual Decl *ActOnMethodDeclaration(
|
||||
SourceLocation BeginLoc, // location of the + or -.
|
||||
SourceLocation EndLoc, // location of the ; or {.
|
||||
tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
|
||||
DeclPtrTy ClassDecl, // class this methods belongs to.
|
||||
Decl *ClassDecl, // class this methods belongs to.
|
||||
ObjCDeclSpec &ReturnQT, // for return type's in inout etc.
|
||||
TypeTy *ReturnType, // the method return type.
|
||||
Selector Sel, // a unique name for the method.
|
||||
@ -2499,29 +2481,29 @@ public:
|
||||
// tok::objc_not_keyword, tok::objc_optional, tok::objc_required
|
||||
tok::ObjCKeywordKind impKind,
|
||||
bool isVariadic = false) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// ActOnAtEnd - called to mark the @end. For declarations (interfaces,
|
||||
// protocols, categories), the parser passes all methods/properties.
|
||||
// For class implementations, these values default to 0. For implementations,
|
||||
// methods are processed incrementally (by ActOnMethodDeclaration above).
|
||||
virtual void ActOnAtEnd(Scope *S, SourceRange AtEnd,
|
||||
DeclPtrTy classDecl,
|
||||
DeclPtrTy *allMethods = 0,
|
||||
Decl *classDecl,
|
||||
Decl **allMethods = 0,
|
||||
unsigned allNum = 0,
|
||||
DeclPtrTy *allProperties = 0,
|
||||
Decl **allProperties = 0,
|
||||
unsigned pNum = 0,
|
||||
DeclGroupPtrTy *allTUVars = 0,
|
||||
unsigned tuvNum = 0) {
|
||||
}
|
||||
// ActOnProperty - called to build one property AST
|
||||
virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
virtual Decl *ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
FieldDeclarator &FD, ObjCDeclSpec &ODS,
|
||||
Selector GetterSel, Selector SetterSel,
|
||||
DeclPtrTy ClassCategory,
|
||||
Decl *ClassCategory,
|
||||
bool *OverridingProperty,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual OwningExprResult
|
||||
@ -2636,19 +2618,19 @@ public:
|
||||
return OwningExprResult(*this);
|
||||
}
|
||||
|
||||
virtual DeclPtrTy ActOnForwardClassDeclaration(
|
||||
virtual Decl *ActOnForwardClassDeclaration(
|
||||
SourceLocation AtClassLoc,
|
||||
IdentifierInfo **IdentList,
|
||||
SourceLocation *IdentLocs,
|
||||
unsigned NumElts) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
virtual DeclPtrTy ActOnForwardProtocolDeclaration(
|
||||
virtual Decl *ActOnForwardProtocolDeclaration(
|
||||
SourceLocation AtProtocolLoc,
|
||||
const IdentifierLocPair*IdentList,
|
||||
unsigned NumElts,
|
||||
AttributeList *AttrList) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// FindProtocolDeclaration - This routine looks up protocols and
|
||||
@ -2657,7 +2639,7 @@ public:
|
||||
virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
|
||||
const IdentifierLocPair *ProtocolId,
|
||||
unsigned NumProtocols,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &ResProtos) {
|
||||
llvm::SmallVectorImpl<Decl *> &ResProtos) {
|
||||
}
|
||||
|
||||
//===----------------------- Obj-C Expressions --------------------------===//
|
||||
@ -2873,7 +2855,7 @@ public:
|
||||
/// \param S The scope in which the initializer occurs.
|
||||
///
|
||||
/// \param D The declaration being initialized.
|
||||
virtual void CodeCompleteInitializer(Scope *S, DeclPtrTy D) { }
|
||||
virtual void CodeCompleteInitializer(Scope *S, Decl *D) { }
|
||||
|
||||
/// \brief Code completion after the "return" keyword within a function.
|
||||
///
|
||||
@ -2953,7 +2935,7 @@ public:
|
||||
///
|
||||
/// \param InInterface whether we are in an Objective-C interface or
|
||||
/// protocol.
|
||||
virtual void CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl,
|
||||
virtual void CodeCompleteObjCAtDirective(Scope *S, Decl *ObjCImpDecl,
|
||||
bool InInterface) { }
|
||||
|
||||
/// \brief Code completion after the '@' in the list of instance variables.
|
||||
@ -2987,8 +2969,8 @@ public:
|
||||
/// \param Methods the set of methods declared thus far within \p ClassDecl.
|
||||
///
|
||||
/// \param NumMethods the number of methods in \p Methods
|
||||
virtual void CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
virtual void CodeCompleteObjCPropertyGetter(Scope *S, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods) {
|
||||
}
|
||||
|
||||
@ -3006,8 +2988,8 @@ public:
|
||||
/// \param Methods the set of methods declared thus far within \p ClassDecl.
|
||||
///
|
||||
/// \param NumMethods the number of methods in \p Methods
|
||||
virtual void CodeCompleteObjCPropertySetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
virtual void CodeCompleteObjCPropertySetter(Scope *S, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods) {
|
||||
}
|
||||
|
||||
@ -3125,7 +3107,7 @@ public:
|
||||
/// This code completion action is invoked after @synthesize or @dynamic and
|
||||
/// after each "," within one of those definitions.
|
||||
virtual void CodeCompleteObjCPropertyDefinition(Scope *S,
|
||||
DeclPtrTy ObjCImpDecl) {
|
||||
Decl *ObjCImpDecl) {
|
||||
}
|
||||
|
||||
/// \brief Code completion for the instance variable name that should
|
||||
@ -3135,7 +3117,7 @@ public:
|
||||
/// an @synthesized definition.
|
||||
virtual void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
|
||||
IdentifierInfo *PropertyName,
|
||||
DeclPtrTy ObjCImpDecl) {
|
||||
Decl *ObjCImpDecl) {
|
||||
}
|
||||
|
||||
/// \brief Code completion for an Objective-C method declaration or
|
||||
@ -3161,7 +3143,7 @@ public:
|
||||
virtual void CodeCompleteObjCMethodDecl(Scope *S,
|
||||
bool IsInstanceMethod,
|
||||
TypeTy *ReturnType,
|
||||
DeclPtrTy IDecl) {
|
||||
Decl *IDecl) {
|
||||
}
|
||||
|
||||
/// \brief Code completion for a selector identifier or argument name within
|
||||
@ -3196,17 +3178,17 @@ public:
|
||||
/// something related to a virtualized decl, include that virtualized decl in
|
||||
/// the stack trace.
|
||||
class PrettyStackTraceActionsDecl : public llvm::PrettyStackTraceEntry {
|
||||
Action::DeclPtrTy TheDecl;
|
||||
Decl *TheDecl;
|
||||
SourceLocation Loc;
|
||||
Action &Actions;
|
||||
SourceManager &SM;
|
||||
const char *Message;
|
||||
|
||||
public:
|
||||
PrettyStackTraceActionsDecl(Action::DeclPtrTy Decl, SourceLocation L,
|
||||
PrettyStackTraceActionsDecl(Decl *D, SourceLocation L,
|
||||
Action &actions, SourceManager &sm,
|
||||
const char *Msg)
|
||||
: TheDecl(Decl), Loc(L), Actions(actions), SM(sm), Message(Msg) {}
|
||||
: TheDecl(D), Loc(L), Actions(actions), SM(sm), Message(Msg) {}
|
||||
|
||||
virtual void print(llvm::raw_ostream &OS) const;
|
||||
};
|
||||
|
@ -210,7 +210,7 @@ private:
|
||||
// List of protocol qualifiers for objective-c classes. Used for
|
||||
// protocol-qualified interfaces "NString<foo>" and protocol-qualified id
|
||||
// "id<foo>".
|
||||
const ActionBase::DeclPtrTy *ProtocolQualifiers;
|
||||
Decl * const *ProtocolQualifiers;
|
||||
unsigned NumProtocolQualifiers;
|
||||
SourceLocation ProtocolLAngleLoc;
|
||||
SourceLocation *ProtocolLocs;
|
||||
@ -447,7 +447,7 @@ public:
|
||||
return AL;
|
||||
}
|
||||
|
||||
typedef const ActionBase::DeclPtrTy *ProtocolQualifierListTy;
|
||||
typedef Decl * const *ProtocolQualifierListTy;
|
||||
ProtocolQualifierListTy getProtocolQualifiers() const {
|
||||
return ProtocolQualifiers;
|
||||
}
|
||||
@ -456,7 +456,7 @@ public:
|
||||
return NumProtocolQualifiers;
|
||||
}
|
||||
SourceLocation getProtocolLAngleLoc() const { return ProtocolLAngleLoc; }
|
||||
void setProtocolQualifiers(const ActionBase::DeclPtrTy *Protos, unsigned NP,
|
||||
void setProtocolQualifiers(Decl * const *Protos, unsigned NP,
|
||||
SourceLocation *ProtoLocs,
|
||||
SourceLocation LAngleLoc);
|
||||
|
||||
@ -812,7 +812,7 @@ struct DeclaratorChunk {
|
||||
struct ParamInfo {
|
||||
IdentifierInfo *Ident;
|
||||
SourceLocation IdentLoc;
|
||||
ActionBase::DeclPtrTy Param;
|
||||
Decl *Param;
|
||||
|
||||
/// DefaultArgTokens - When the parameter's default argument
|
||||
/// cannot be parsed immediately (because it occurs within the
|
||||
@ -823,7 +823,7 @@ struct DeclaratorChunk {
|
||||
|
||||
ParamInfo() {}
|
||||
ParamInfo(IdentifierInfo *ident, SourceLocation iloc,
|
||||
ActionBase::DeclPtrTy param,
|
||||
Decl *param,
|
||||
CachedTokens *DefArgTokens = 0)
|
||||
: Ident(ident), IdentLoc(iloc), Param(param),
|
||||
DefaultArgTokens(DefArgTokens) {}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
namespace clang {
|
||||
class ActionBase;
|
||||
class Decl;
|
||||
|
||||
/// OpaquePtr - This is a very simple POD type that wraps a pointer that the
|
||||
/// Parser doesn't know about but that Sema or another client does. The UID
|
||||
@ -199,7 +200,6 @@ namespace clang {
|
||||
|
||||
// Types - Though these don't actually enforce strong typing, they document
|
||||
// what types are required to be identical for the actions.
|
||||
typedef OpaquePtr<0> DeclPtrTy;
|
||||
typedef OpaquePtr<1> DeclGroupPtrTy;
|
||||
typedef OpaquePtr<2> TemplateTy;
|
||||
typedef void AttrTy;
|
||||
@ -518,6 +518,23 @@ namespace clang {
|
||||
ASTMultiPtr<Destroyer>& move(ASTMultiPtr<Destroyer> &ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// We can re-use the low bit of expression, statement, base, and
|
||||
// member-initializer pointers for the "invalid" flag of
|
||||
// ActionResult.
|
||||
template<> struct IsResultPtrLowBitFree<0> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<1> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;};
|
||||
template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;};
|
||||
|
||||
typedef ActionBase::ActionResult<0> ExprResult;
|
||||
typedef ActionBase::ActionResult<1> StmtResult;
|
||||
typedef ActionBase::ActionResult<2> TypeResult;
|
||||
typedef ActionBase::ActionResult<3> BaseResult;
|
||||
typedef ActionBase::ActionResult<4> MemInitResult;
|
||||
|
||||
typedef ActionBase::ActionResult<5, Decl*> DeclResult;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -14,11 +14,13 @@
|
||||
#ifndef LLVM_CLANG_SEMA_SCOPE_H
|
||||
#define LLVM_CLANG_SEMA_SCOPE_H
|
||||
|
||||
#include "clang/Sema/Action.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
class Decl;
|
||||
class UsingDirectiveDecl;
|
||||
|
||||
/// Scope - A scope is a transient data structure that is used while parsing the
|
||||
/// program. It assists with resolving identifiers to the appropriate
|
||||
/// declaration.
|
||||
@ -117,7 +119,7 @@ private:
|
||||
/// popped, these declarations are removed from the IdentifierTable's notion
|
||||
/// of current declaration. It is up to the current Action implementation to
|
||||
/// implement these semantics.
|
||||
typedef llvm::SmallPtrSet<Action::DeclPtrTy, 32> DeclSetTy;
|
||||
typedef llvm::SmallPtrSet<Decl *, 32> DeclSetTy;
|
||||
DeclSetTy DeclsInScope;
|
||||
|
||||
/// Entity - The entity with which this scope is associated. For
|
||||
@ -126,7 +128,7 @@ private:
|
||||
/// maintained by the Action implementation.
|
||||
void *Entity;
|
||||
|
||||
typedef llvm::SmallVector<Action::DeclPtrTy, 2> UsingDirectivesTy;
|
||||
typedef llvm::SmallVector<UsingDirectiveDecl *, 2> UsingDirectivesTy;
|
||||
UsingDirectivesTy UsingDirectives;
|
||||
|
||||
/// \brief The number of errors at the start of the given scope.
|
||||
@ -195,17 +197,17 @@ public:
|
||||
decl_iterator decl_end() const { return DeclsInScope.end(); }
|
||||
bool decl_empty() const { return DeclsInScope.empty(); }
|
||||
|
||||
void AddDecl(Action::DeclPtrTy D) {
|
||||
void AddDecl(Decl *D) {
|
||||
DeclsInScope.insert(D);
|
||||
}
|
||||
|
||||
void RemoveDecl(Action::DeclPtrTy D) {
|
||||
void RemoveDecl(Decl *D) {
|
||||
DeclsInScope.erase(D);
|
||||
}
|
||||
|
||||
/// isDeclScope - Return true if this is the scope that the specified decl is
|
||||
/// declared in.
|
||||
bool isDeclScope(Action::DeclPtrTy D) {
|
||||
bool isDeclScope(Decl *D) {
|
||||
return DeclsInScope.count(D) != 0;
|
||||
}
|
||||
|
||||
@ -266,7 +268,7 @@ public:
|
||||
typedef UsingDirectivesTy::iterator udir_iterator;
|
||||
typedef UsingDirectivesTy::const_iterator const_udir_iterator;
|
||||
|
||||
void PushUsingDirective(Action::DeclPtrTy UDir) {
|
||||
void PushUsingDirective(UsingDirectiveDecl *UDir) {
|
||||
UsingDirectives.push_back(UDir);
|
||||
}
|
||||
|
||||
|
@ -838,9 +838,9 @@ public:
|
||||
|
||||
/// getDeclName - Return a pretty name for the specified decl if possible, or
|
||||
/// an empty string if not. This is used for pretty crash reporting.
|
||||
virtual std::string getDeclName(DeclPtrTy D);
|
||||
virtual std::string getDeclName(Decl *D);
|
||||
|
||||
DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr);
|
||||
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr);
|
||||
|
||||
void DiagnoseUseOfUnimplementedSelectors();
|
||||
|
||||
@ -855,11 +855,11 @@ public:
|
||||
CXXScopeSpec *SS,
|
||||
TypeTy *&SuggestedType);
|
||||
|
||||
virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
|
||||
virtual Decl *ActOnDeclarator(Scope *S, Declarator &D) {
|
||||
return HandleDeclarator(S, D, MultiTemplateParamsArg(*this), false);
|
||||
}
|
||||
|
||||
DeclPtrTy HandleDeclarator(Scope *S, Declarator &D,
|
||||
Decl *HandleDeclarator(Scope *S, Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
bool IsFunctionDefinition);
|
||||
void RegisterLocallyScopedExternCDecl(NamedDecl *ND,
|
||||
@ -892,7 +892,7 @@ public:
|
||||
bool &Redeclaration,
|
||||
bool &OverloadableAttrRequired);
|
||||
void CheckMain(FunctionDecl *FD);
|
||||
virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D);
|
||||
virtual Decl *ActOnParamDeclarator(Scope *S, Declarator &D);
|
||||
ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC,
|
||||
SourceLocation Loc,
|
||||
QualType T);
|
||||
@ -902,13 +902,13 @@ public:
|
||||
SourceLocation NameLoc,
|
||||
VarDecl::StorageClass StorageClass,
|
||||
VarDecl::StorageClass StorageClassAsWritten);
|
||||
virtual void ActOnParamDefaultArgument(DeclPtrTy param,
|
||||
virtual void ActOnParamDefaultArgument(Decl *param,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg defarg);
|
||||
virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
|
||||
virtual void ActOnParamUnparsedDefaultArgument(Decl *param,
|
||||
SourceLocation EqualLoc,
|
||||
SourceLocation ArgLoc);
|
||||
virtual void ActOnParamDefaultArgumentError(DeclPtrTy param);
|
||||
virtual void ActOnParamDefaultArgumentError(Decl *param);
|
||||
bool SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
|
||||
SourceLocation EqualLoc);
|
||||
|
||||
@ -917,22 +917,22 @@ public:
|
||||
// argument locations.
|
||||
llvm::DenseMap<ParmVarDecl *,SourceLocation> UnparsedDefaultArgLocs;
|
||||
|
||||
virtual void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init);
|
||||
void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit);
|
||||
void ActOnUninitializedDecl(DeclPtrTy dcl, bool TypeContainsUndeducedAuto);
|
||||
virtual void ActOnInitializerError(DeclPtrTy Dcl);
|
||||
virtual void SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc);
|
||||
virtual void AddInitializerToDecl(Decl *dcl, ExprArg init);
|
||||
void AddInitializerToDecl(Decl *dcl, ExprArg init, bool DirectInit);
|
||||
void ActOnUninitializedDecl(Decl *dcl, bool TypeContainsUndeducedAuto);
|
||||
virtual void ActOnInitializerError(Decl *Dcl);
|
||||
virtual void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
|
||||
virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
||||
DeclPtrTy *Group,
|
||||
Decl **Group,
|
||||
unsigned NumDecls);
|
||||
virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
|
||||
SourceLocation LocAfterDecls);
|
||||
virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *S, Declarator &D);
|
||||
virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *S, DeclPtrTy D);
|
||||
virtual void ActOnStartOfObjCMethodDef(Scope *S, DeclPtrTy D);
|
||||
virtual Decl *ActOnStartOfFunctionDef(Scope *S, Declarator &D);
|
||||
virtual Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D);
|
||||
virtual void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
|
||||
|
||||
virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body);
|
||||
DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body,
|
||||
virtual Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body);
|
||||
Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body,
|
||||
bool IsInstantiation);
|
||||
|
||||
/// \brief Diagnose any unused parameters in the given sequence of
|
||||
@ -958,7 +958,7 @@ public:
|
||||
}
|
||||
|
||||
void DiagnoseInvalidJumps(Stmt *Body);
|
||||
virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr);
|
||||
virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr);
|
||||
|
||||
/// Scope actions.
|
||||
virtual void ActOnPopScope(SourceLocation Loc, Scope *S);
|
||||
@ -966,10 +966,10 @@ public:
|
||||
|
||||
/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
|
||||
/// no declarator (e.g. "struct foo;") is parsed.
|
||||
virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
virtual Decl *ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
DeclSpec &DS);
|
||||
|
||||
virtual DeclPtrTy BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
virtual Decl *BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
AccessSpecifier AS,
|
||||
RecordDecl *Record);
|
||||
|
||||
@ -978,7 +978,7 @@ public:
|
||||
SourceLocation NewTagLoc,
|
||||
const IdentifierInfo &Name);
|
||||
|
||||
virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
virtual Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
SourceLocation KWLoc, CXXScopeSpec &SS,
|
||||
IdentifierInfo *Name, SourceLocation NameLoc,
|
||||
AttributeList *Attr, AccessSpecifier AS,
|
||||
@ -993,10 +993,10 @@ public:
|
||||
SourceLocation TagLoc,
|
||||
SourceLocation NameLoc);
|
||||
|
||||
virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
|
||||
virtual void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
|
||||
IdentifierInfo *ClassName,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Decls);
|
||||
virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD,
|
||||
llvm::SmallVectorImpl<Decl *> &Decls);
|
||||
virtual Decl *ActOnField(Scope *S, Decl *TagD,
|
||||
SourceLocation DeclStart,
|
||||
Declarator &D, ExprTy *BitfieldWidth);
|
||||
|
||||
@ -1023,37 +1023,37 @@ public:
|
||||
void DiagnoseNontrivial(const RecordType* Record, CXXSpecialMember mem);
|
||||
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD);
|
||||
|
||||
virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
|
||||
DeclPtrTy IntfDecl,
|
||||
virtual Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
|
||||
Decl *IntfDecl,
|
||||
Declarator &D, ExprTy *BitfieldWidth,
|
||||
tok::ObjCKeywordKind visibility);
|
||||
|
||||
// This is used for both record definitions and ObjC interface declarations.
|
||||
virtual void ActOnFields(Scope* S,
|
||||
SourceLocation RecLoc, DeclPtrTy TagDecl,
|
||||
DeclPtrTy *Fields, unsigned NumFields,
|
||||
SourceLocation RecLoc, Decl *TagDecl,
|
||||
Decl **Fields, unsigned NumFields,
|
||||
SourceLocation LBrac, SourceLocation RBrac,
|
||||
AttributeList *AttrList);
|
||||
|
||||
/// ActOnTagStartDefinition - Invoked when we have entered the
|
||||
/// scope of a tag's definition (e.g., for an enumeration, class,
|
||||
/// struct, or union).
|
||||
virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl);
|
||||
virtual void ActOnTagStartDefinition(Scope *S, Decl *TagDecl);
|
||||
|
||||
/// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
|
||||
/// C++ record definition's base-specifiers clause and are starting its
|
||||
/// member declarations.
|
||||
virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl,
|
||||
virtual void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl,
|
||||
SourceLocation LBraceLoc);
|
||||
|
||||
/// ActOnTagFinishDefinition - Invoked once we have finished parsing
|
||||
/// the definition of a tag (enumeration, class, struct, or union).
|
||||
virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl,
|
||||
virtual void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl,
|
||||
SourceLocation RBraceLoc);
|
||||
|
||||
/// ActOnTagDefinitionError - Invoked when there was an unrecoverable
|
||||
/// error parsing the definition of a tag.
|
||||
virtual void ActOnTagDefinitionError(Scope *S, DeclPtrTy TagDecl);
|
||||
virtual void ActOnTagDefinitionError(Scope *S, Decl *TagDecl);
|
||||
|
||||
EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum,
|
||||
EnumConstantDecl *LastEnumConst,
|
||||
@ -1061,13 +1061,13 @@ public:
|
||||
IdentifierInfo *Id,
|
||||
ExprArg val);
|
||||
|
||||
virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
|
||||
DeclPtrTy LastEnumConstant,
|
||||
virtual Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl,
|
||||
Decl *LastEnumConstant,
|
||||
SourceLocation IdLoc, IdentifierInfo *Id,
|
||||
SourceLocation EqualLoc, ExprTy *Val);
|
||||
virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
|
||||
DeclPtrTy *Elements, unsigned NumElements,
|
||||
SourceLocation RBraceLoc, Decl *EnumDecl,
|
||||
Decl **Elements, unsigned NumElements,
|
||||
Scope *S, AttributeList *Attr);
|
||||
|
||||
DeclContext *getContainingDC(DeclContext *DC);
|
||||
@ -1651,7 +1651,7 @@ public:
|
||||
|
||||
/// Called by ActOnProperty to handle @property declarations in
|
||||
//// class extensions.
|
||||
DeclPtrTy HandlePropertyInClassExtension(Scope *S,
|
||||
Decl *HandlePropertyInClassExtension(Scope *S,
|
||||
ObjCCategoryDecl *CDecl,
|
||||
SourceLocation AtLoc,
|
||||
FieldDeclarator &FD,
|
||||
@ -1782,17 +1782,17 @@ public:
|
||||
SourceLocation ColonLoc,
|
||||
StmtArg SubStmt);
|
||||
virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
|
||||
FullExprArg CondVal, DeclPtrTy CondVar,
|
||||
FullExprArg CondVal, Decl *CondVar,
|
||||
StmtArg ThenVal,
|
||||
SourceLocation ElseLoc, StmtArg ElseVal);
|
||||
virtual OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
|
||||
ExprArg Cond,
|
||||
DeclPtrTy CondVar);
|
||||
Decl *CondVar);
|
||||
virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
|
||||
StmtArg Switch, StmtArg Body);
|
||||
virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
|
||||
FullExprArg Cond,
|
||||
DeclPtrTy CondVar, StmtArg Body);
|
||||
Decl *CondVar, StmtArg Body);
|
||||
virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
|
||||
SourceLocation WhileLoc,
|
||||
SourceLocation CondLParen, ExprArg Cond,
|
||||
@ -1801,7 +1801,7 @@ public:
|
||||
virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
|
||||
SourceLocation LParenLoc,
|
||||
StmtArg First, FullExprArg Second,
|
||||
DeclPtrTy SecondVar,
|
||||
Decl *SecondVar,
|
||||
FullExprArg Third,
|
||||
SourceLocation RParenLoc,
|
||||
StmtArg Body);
|
||||
@ -1844,11 +1844,11 @@ public:
|
||||
IdentifierInfo *Name, SourceLocation NameLoc,
|
||||
bool Invalid = false);
|
||||
|
||||
virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D);
|
||||
virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D);
|
||||
|
||||
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
|
||||
SourceLocation RParen,
|
||||
DeclPtrTy Parm, StmtArg Body);
|
||||
Decl *Parm, StmtArg Body);
|
||||
|
||||
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
|
||||
StmtArg Body);
|
||||
@ -1872,10 +1872,10 @@ public:
|
||||
IdentifierInfo *Name,
|
||||
SourceLocation Loc,
|
||||
SourceRange Range);
|
||||
virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D);
|
||||
virtual Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D);
|
||||
|
||||
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
|
||||
DeclPtrTy ExDecl,
|
||||
Decl *ExDecl,
|
||||
StmtArg HandlerBlock);
|
||||
virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
|
||||
StmtArg TryBlock,
|
||||
@ -1894,7 +1894,7 @@ public:
|
||||
void DiagnoseUnusedDecl(const NamedDecl *ND);
|
||||
|
||||
ParsingDeclStackState PushParsingDeclaration();
|
||||
void PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy D);
|
||||
void PopParsingDeclaration(ParsingDeclStackState S, Decl *D);
|
||||
void EmitDeprecationWarning(NamedDecl *D, SourceLocation Loc);
|
||||
|
||||
void HandleDelayedDeprecationCheck(DelayedDiagnostic &DD, Decl *Ctx);
|
||||
@ -2049,7 +2049,7 @@ public:
|
||||
OwningExprResult LookupMemberExpr(LookupResult &R, Expr *&Base,
|
||||
bool &IsArrow, SourceLocation OpLoc,
|
||||
CXXScopeSpec &SS,
|
||||
DeclPtrTy ObjCImpDecl,
|
||||
Decl *ObjCImpDecl,
|
||||
bool HasTemplateArgs);
|
||||
|
||||
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
|
||||
@ -2070,10 +2070,10 @@ public:
|
||||
tok::TokenKind OpKind,
|
||||
CXXScopeSpec &SS,
|
||||
UnqualifiedId &Member,
|
||||
DeclPtrTy ObjCImpDecl,
|
||||
Decl *ObjCImpDecl,
|
||||
bool HasTrailingLParen);
|
||||
|
||||
virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl);
|
||||
virtual void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
|
||||
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
|
||||
FunctionDecl *FDecl,
|
||||
const FunctionProtoType *Proto,
|
||||
@ -2215,11 +2215,11 @@ public:
|
||||
//===---------------------------- C++ Features --------------------------===//
|
||||
|
||||
// Act on C++ namespaces
|
||||
virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
|
||||
virtual Decl *ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
|
||||
IdentifierInfo *Ident,
|
||||
SourceLocation LBrace,
|
||||
AttributeList *AttrList);
|
||||
virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace);
|
||||
virtual void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
|
||||
|
||||
NamespaceDecl *getStdNamespace() const {
|
||||
return cast_or_null<NamespaceDecl>(
|
||||
@ -2232,7 +2232,7 @@ public:
|
||||
StdBadAlloc.get(Context.getExternalSource()));
|
||||
}
|
||||
|
||||
virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
|
||||
virtual Decl *ActOnUsingDirective(Scope *CurScope,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation NamespcLoc,
|
||||
CXXScopeSpec &SS,
|
||||
@ -2242,7 +2242,7 @@ public:
|
||||
|
||||
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir);
|
||||
|
||||
virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope,
|
||||
virtual Decl *ActOnNamespaceAliasDef(Scope *CurScope,
|
||||
SourceLocation NamespaceLoc,
|
||||
SourceLocation AliasLoc,
|
||||
IdentifierInfo *Alias,
|
||||
@ -2274,7 +2274,7 @@ public:
|
||||
bool IsTypeName,
|
||||
SourceLocation TypenameLoc);
|
||||
|
||||
virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
|
||||
virtual Decl *ActOnUsingDeclaration(Scope *CurScope,
|
||||
AccessSpecifier AS,
|
||||
bool HasUsingKeyword,
|
||||
SourceLocation UsingLoc,
|
||||
@ -2287,7 +2287,7 @@ public:
|
||||
/// AddCXXDirectInitializerToDecl - This action is called immediately after
|
||||
/// ActOnDeclarator, when a C++ direct initializer is present.
|
||||
/// e.g: "int x(1);"
|
||||
virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
|
||||
virtual void AddCXXDirectInitializerToDecl(Decl *Dcl,
|
||||
SourceLocation LParenLoc,
|
||||
MultiExprArg Exprs,
|
||||
SourceLocation *CommaLocs,
|
||||
@ -2646,11 +2646,11 @@ public:
|
||||
/// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
|
||||
/// static data member of class X, names should be looked up in the scope of
|
||||
/// class X.
|
||||
virtual void ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl);
|
||||
virtual void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl);
|
||||
|
||||
/// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
|
||||
/// initializer for the declaration 'Dcl'.
|
||||
virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl);
|
||||
virtual void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
|
||||
|
||||
// ParseObjCStringLiteral - Parse Objective-C string literals.
|
||||
virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
|
||||
@ -2687,13 +2687,13 @@ public:
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C++ Declarations
|
||||
//
|
||||
virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S,
|
||||
virtual Decl *ActOnStartLinkageSpecification(Scope *S,
|
||||
SourceLocation ExternLoc,
|
||||
SourceLocation LangLoc,
|
||||
llvm::StringRef Lang,
|
||||
SourceLocation LBraceLoc);
|
||||
virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S,
|
||||
DeclPtrTy LinkageSpec,
|
||||
virtual Decl *ActOnFinishLinkageSpecification(Scope *S,
|
||||
Decl *LinkageSpec,
|
||||
SourceLocation RBraceLoc);
|
||||
|
||||
|
||||
@ -2703,18 +2703,18 @@ public:
|
||||
virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
|
||||
const CXXScopeSpec *SS = 0);
|
||||
|
||||
virtual DeclPtrTy ActOnAccessSpecifier(AccessSpecifier Access,
|
||||
virtual Decl *ActOnAccessSpecifier(AccessSpecifier Access,
|
||||
SourceLocation ASLoc,
|
||||
SourceLocation ColonLoc);
|
||||
|
||||
virtual DeclPtrTy ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
|
||||
virtual Decl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
|
||||
Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
ExprTy *BitfieldWidth,
|
||||
ExprTy *Init, bool IsDefinition,
|
||||
bool Deleted = false);
|
||||
|
||||
virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorD,
|
||||
virtual MemInitResult ActOnMemInitializer(Decl *ConstructorD,
|
||||
Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
IdentifierInfo *MemberOrBase,
|
||||
@ -2785,38 +2785,38 @@ public:
|
||||
|
||||
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl);
|
||||
|
||||
virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
||||
virtual void ActOnMemInitializers(Decl *ConstructorDecl,
|
||||
SourceLocation ColonLoc,
|
||||
MemInitTy **MemInits, unsigned NumMemInits,
|
||||
bool AnyErrors);
|
||||
|
||||
void CheckCompletedCXXClass(CXXRecordDecl *Record);
|
||||
virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||
DeclPtrTy TagDecl,
|
||||
Decl *TagDecl,
|
||||
SourceLocation LBrac,
|
||||
SourceLocation RBrac,
|
||||
AttributeList *AttrList);
|
||||
|
||||
virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template);
|
||||
virtual void ActOnReenterTemplateScope(Scope *S, Decl *Template);
|
||||
virtual void ActOnStartDelayedMemberDeclarations(Scope *S,
|
||||
DeclPtrTy Record);
|
||||
Decl *Record);
|
||||
virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
|
||||
DeclPtrTy Method);
|
||||
virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param);
|
||||
Decl *Method);
|
||||
virtual void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
|
||||
virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
|
||||
DeclPtrTy Method);
|
||||
Decl *Method);
|
||||
virtual void ActOnFinishDelayedMemberDeclarations(Scope *S,
|
||||
DeclPtrTy Record);
|
||||
Decl *Record);
|
||||
|
||||
virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
virtual Decl *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
ExprArg AssertExpr,
|
||||
ExprArg AssertMessageExpr);
|
||||
|
||||
FriendDecl *CheckFriendTypeDecl(SourceLocation FriendLoc,
|
||||
TypeSourceInfo *TSInfo);
|
||||
DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
MultiTemplateParamsArg TemplateParams);
|
||||
DeclPtrTy ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
|
||||
Decl *ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
|
||||
MultiTemplateParamsArg TemplateParams);
|
||||
|
||||
QualType CheckConstructorDeclarator(Declarator &D, QualType R,
|
||||
@ -2827,7 +2827,7 @@ public:
|
||||
bool CheckDestructor(CXXDestructorDecl *Destructor);
|
||||
void CheckConversionDeclarator(Declarator &D, QualType &R,
|
||||
FunctionDecl::StorageClass& SC);
|
||||
DeclPtrTy ActOnConversionDeclarator(CXXConversionDecl *Conversion);
|
||||
Decl *ActOnConversionDeclarator(CXXConversionDecl *Conversion);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// C++ Derived Classes
|
||||
@ -2846,7 +2846,7 @@ public:
|
||||
const CXXRecordDecl *BaseClass,
|
||||
bool BaseIsVirtual);
|
||||
|
||||
virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl,
|
||||
virtual BaseResult ActOnBaseSpecifier(Decl *classdecl,
|
||||
SourceRange SpecifierRange,
|
||||
bool Virtual, AccessSpecifier Access,
|
||||
TypeTy *basetype, SourceLocation
|
||||
@ -2854,7 +2854,7 @@ public:
|
||||
|
||||
bool AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases,
|
||||
unsigned NumBases);
|
||||
virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
|
||||
virtual void ActOnBaseSpecifiers(Decl *ClassDecl, BaseTy **Bases,
|
||||
unsigned NumBases);
|
||||
|
||||
bool IsDerivedFrom(QualType Derived, QualType Base);
|
||||
@ -3004,9 +3004,9 @@ public:
|
||||
TemplateNameKind &SuggestedKind);
|
||||
|
||||
bool DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl);
|
||||
TemplateDecl *AdjustDeclIfTemplate(DeclPtrTy &Decl);
|
||||
TemplateDecl *AdjustDeclIfTemplate(Decl *&Decl);
|
||||
|
||||
virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
virtual Decl *ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
SourceLocation EllipsisLoc,
|
||||
SourceLocation KeyLoc,
|
||||
IdentifierInfo *ParamName,
|
||||
@ -3016,12 +3016,12 @@ public:
|
||||
TypeTy *DefaultArg);
|
||||
|
||||
QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc);
|
||||
virtual DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
virtual Decl *ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg DefaultArg);
|
||||
virtual DeclPtrTy ActOnTemplateTemplateParameter(Scope *S,
|
||||
virtual Decl *ActOnTemplateTemplateParameter(Scope *S,
|
||||
SourceLocation TmpLoc,
|
||||
TemplateParamsTy *Params,
|
||||
IdentifierInfo *ParamName,
|
||||
@ -3036,7 +3036,7 @@ public:
|
||||
SourceLocation ExportLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
DeclPtrTy *Params, unsigned NumParams,
|
||||
Decl **Params, unsigned NumParams,
|
||||
SourceLocation RAngleLoc);
|
||||
|
||||
/// \brief The context in which we are checking a template parameter
|
||||
@ -3118,11 +3118,11 @@ public:
|
||||
AttributeList *Attr,
|
||||
MultiTemplateParamsArg TemplateParameterLists);
|
||||
|
||||
virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S,
|
||||
virtual Decl *ActOnTemplateDeclarator(Scope *S,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D);
|
||||
|
||||
virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
virtual Decl *ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D);
|
||||
|
||||
@ -4019,18 +4019,18 @@ public:
|
||||
const MultiLevelTemplateArgumentList &TemplateArgs);
|
||||
|
||||
// Objective-C declarations.
|
||||
virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
virtual Decl *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperName,
|
||||
SourceLocation SuperLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc,
|
||||
AttributeList *AttrList);
|
||||
|
||||
virtual DeclPtrTy ActOnCompatiblityAlias(
|
||||
virtual Decl *ActOnCompatiblityAlias(
|
||||
SourceLocation AtCompatibilityAliasLoc,
|
||||
IdentifierInfo *AliasName, SourceLocation AliasLocation,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLocation);
|
||||
@ -4040,43 +4040,43 @@ public:
|
||||
SourceLocation &PLoc, SourceLocation PrevLoc,
|
||||
const ObjCList<ObjCProtocolDecl> &PList);
|
||||
|
||||
virtual DeclPtrTy ActOnStartProtocolInterface(
|
||||
virtual Decl *ActOnStartProtocolInterface(
|
||||
SourceLocation AtProtoInterfaceLoc,
|
||||
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
|
||||
const DeclPtrTy *ProtoRefNames, unsigned NumProtoRefs,
|
||||
Decl * const *ProtoRefNames, unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc,
|
||||
AttributeList *AttrList);
|
||||
|
||||
virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
virtual Decl *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *CategoryName,
|
||||
SourceLocation CategoryLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc);
|
||||
|
||||
virtual DeclPtrTy ActOnStartClassImplementation(
|
||||
virtual Decl *ActOnStartClassImplementation(
|
||||
SourceLocation AtClassImplLoc,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperClassname,
|
||||
SourceLocation SuperClassLoc);
|
||||
|
||||
virtual DeclPtrTy ActOnStartCategoryImplementation(
|
||||
virtual Decl *ActOnStartCategoryImplementation(
|
||||
SourceLocation AtCatImplLoc,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLoc,
|
||||
IdentifierInfo *CatName,
|
||||
SourceLocation CatLoc);
|
||||
|
||||
virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation Loc,
|
||||
virtual Decl *ActOnForwardClassDeclaration(SourceLocation Loc,
|
||||
IdentifierInfo **IdentList,
|
||||
SourceLocation *IdentLocs,
|
||||
unsigned NumElts);
|
||||
|
||||
virtual DeclPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc,
|
||||
virtual Decl *ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc,
|
||||
const IdentifierLocPair *IdentList,
|
||||
unsigned NumElts,
|
||||
AttributeList *attrList);
|
||||
@ -4084,12 +4084,12 @@ public:
|
||||
virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
|
||||
const IdentifierLocPair *ProtocolId,
|
||||
unsigned NumProtocols,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Protocols);
|
||||
llvm::SmallVectorImpl<Decl *> &Protocols);
|
||||
|
||||
/// Ensure attributes are consistent with type.
|
||||
/// \param [in, out] Attributes The attributes to check; they will
|
||||
/// be modified to be consistent with \arg PropertyTy.
|
||||
void CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy,
|
||||
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
|
||||
SourceLocation Loc,
|
||||
unsigned &Attributes);
|
||||
void ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *DC);
|
||||
@ -4102,7 +4102,7 @@ public:
|
||||
ObjCMethodDecl *MethodDecl,
|
||||
bool IsInstance);
|
||||
|
||||
void CompareProperties(Decl *CDecl, DeclPtrTy MergeProtocols);
|
||||
void CompareProperties(Decl *CDecl, Decl *MergeProtocols);
|
||||
|
||||
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
|
||||
ObjCInterfaceDecl *ID);
|
||||
@ -4111,30 +4111,30 @@ public:
|
||||
ObjCProtocolDecl *PDecl);
|
||||
|
||||
virtual void ActOnAtEnd(Scope *S, SourceRange AtEnd,
|
||||
DeclPtrTy classDecl,
|
||||
DeclPtrTy *allMethods = 0, unsigned allNum = 0,
|
||||
DeclPtrTy *allProperties = 0, unsigned pNum = 0,
|
||||
Decl *classDecl,
|
||||
Decl **allMethods = 0, unsigned allNum = 0,
|
||||
Decl **allProperties = 0, unsigned pNum = 0,
|
||||
DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0);
|
||||
|
||||
virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
virtual Decl *ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
FieldDeclarator &FD, ObjCDeclSpec &ODS,
|
||||
Selector GetterSel, Selector SetterSel,
|
||||
DeclPtrTy ClassCategory,
|
||||
Decl *ClassCategory,
|
||||
bool *OverridingProperty,
|
||||
tok::ObjCKeywordKind MethodImplKind);
|
||||
|
||||
virtual DeclPtrTy ActOnPropertyImplDecl(Scope *S,
|
||||
virtual Decl *ActOnPropertyImplDecl(Scope *S,
|
||||
SourceLocation AtLoc,
|
||||
SourceLocation PropertyLoc,
|
||||
bool ImplKind,DeclPtrTy ClassImplDecl,
|
||||
bool ImplKind,Decl *ClassImplDecl,
|
||||
IdentifierInfo *PropertyId,
|
||||
IdentifierInfo *PropertyIvar);
|
||||
|
||||
virtual DeclPtrTy ActOnMethodDeclaration(
|
||||
virtual Decl *ActOnMethodDeclaration(
|
||||
SourceLocation BeginLoc, // location of the + or -.
|
||||
SourceLocation EndLoc, // location of the ; or {.
|
||||
tok::TokenKind MethodType,
|
||||
DeclPtrTy ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType,
|
||||
Decl *ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType,
|
||||
Selector Sel,
|
||||
// optional arguments. The number of types/arguments is obtained
|
||||
// from the Sel.getNumArgs().
|
||||
@ -4649,7 +4649,7 @@ public:
|
||||
virtual void CodeCompleteCase(Scope *S);
|
||||
virtual void CodeCompleteCall(Scope *S, ExprTy *Fn,
|
||||
ExprTy **Args, unsigned NumArgs);
|
||||
virtual void CodeCompleteInitializer(Scope *S, DeclPtrTy D);
|
||||
virtual void CodeCompleteInitializer(Scope *S, Decl *D);
|
||||
virtual void CodeCompleteReturn(Scope *S);
|
||||
virtual void CodeCompleteAssignmentRHS(Scope *S, ExprTy *LHS);
|
||||
|
||||
@ -4661,17 +4661,17 @@ public:
|
||||
virtual void CodeCompleteNamespaceAliasDecl(Scope *S);
|
||||
virtual void CodeCompleteOperatorName(Scope *S);
|
||||
|
||||
virtual void CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl,
|
||||
virtual void CodeCompleteObjCAtDirective(Scope *S, Decl *ObjCImpDecl,
|
||||
bool InInterface);
|
||||
virtual void CodeCompleteObjCAtVisibility(Scope *S);
|
||||
virtual void CodeCompleteObjCAtStatement(Scope *S);
|
||||
virtual void CodeCompleteObjCAtExpression(Scope *S);
|
||||
virtual void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS);
|
||||
virtual void CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
virtual void CodeCompleteObjCPropertyGetter(Scope *S, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods);
|
||||
virtual void CodeCompleteObjCPropertySetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
virtual void CodeCompleteObjCPropertySetter(Scope *S, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods);
|
||||
virtual void CodeCompleteObjCMessageReceiver(Scope *S);
|
||||
virtual void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
|
||||
@ -4698,14 +4698,14 @@ public:
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassNameLoc);
|
||||
virtual void CodeCompleteObjCPropertyDefinition(Scope *S,
|
||||
DeclPtrTy ObjCImpDecl);
|
||||
Decl *ObjCImpDecl);
|
||||
virtual void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
|
||||
IdentifierInfo *PropertyName,
|
||||
DeclPtrTy ObjCImpDecl);
|
||||
Decl *ObjCImpDecl);
|
||||
virtual void CodeCompleteObjCMethodDecl(Scope *S,
|
||||
bool IsInstanceMethod,
|
||||
TypeTy *ReturnType,
|
||||
DeclPtrTy IDecl);
|
||||
Decl *IDecl);
|
||||
virtual void CodeCompleteObjCMethodDeclSelector(Scope *S,
|
||||
bool IsInstanceMethod,
|
||||
bool AtParameterName,
|
||||
|
@ -20,8 +20,7 @@ using namespace clang;
|
||||
/// ParseCXXInlineMethodDef - We parsed and verified that the specified
|
||||
/// Declarator is a well formed C++ inline method definition. Now lex its body
|
||||
/// and store its tokens for parsing after the C++ class is complete.
|
||||
Parser::DeclPtrTy
|
||||
Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||
Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo) {
|
||||
assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
|
||||
"This isn't a function declarator!");
|
||||
@ -32,7 +31,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||
TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data() : 0,
|
||||
TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
|
||||
|
||||
DeclPtrTy FnD;
|
||||
Decl *FnD;
|
||||
if (D.getDeclSpec().isFriendSpecified())
|
||||
// FIXME: Friend templates
|
||||
FnD = Actions.ActOnFriendFunctionDecl(getCurScope(), D, true,
|
||||
|
@ -313,7 +313,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
|
||||
CXX0XAttributeList Attr) {
|
||||
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
||||
|
||||
DeclPtrTy SingleDecl;
|
||||
Decl *SingleDecl = 0;
|
||||
switch (Tok.getKind()) {
|
||||
case tok::kw_template:
|
||||
case tok::kw_export:
|
||||
@ -368,7 +368,7 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
|
||||
// declaration-specifiers init-declarator-list[opt] ';'
|
||||
if (Tok.is(tok::semi)) {
|
||||
if (RequireSemi) ConsumeToken();
|
||||
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS_none,
|
||||
Decl *TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS_none,
|
||||
DS);
|
||||
DS.complete(TheDecl);
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
@ -412,7 +412,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
|
||||
DS.ClearStorageClassSpecs();
|
||||
}
|
||||
|
||||
DeclPtrTy TheDecl = ParseFunctionDefinition(D);
|
||||
Decl *TheDecl = ParseFunctionDefinition(D);
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
|
||||
@ -429,10 +429,10 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
|
||||
}
|
||||
}
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 8> DeclsInGroup;
|
||||
DeclPtrTy FirstDecl = ParseDeclarationAfterDeclarator(D);
|
||||
llvm::SmallVector<Decl *, 8> DeclsInGroup;
|
||||
Decl *FirstDecl = ParseDeclarationAfterDeclarator(D);
|
||||
D.complete(FirstDecl);
|
||||
if (FirstDecl.get())
|
||||
if (FirstDecl)
|
||||
DeclsInGroup.push_back(FirstDecl);
|
||||
|
||||
// If we don't have a comma, it is either the end of the list (a ';') or an
|
||||
@ -459,9 +459,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
|
||||
|
||||
ParseDeclarator(D);
|
||||
|
||||
DeclPtrTy ThisDecl = ParseDeclarationAfterDeclarator(D);
|
||||
Decl *ThisDecl = ParseDeclarationAfterDeclarator(D);
|
||||
D.complete(ThisDecl);
|
||||
if (ThisDecl.get())
|
||||
if (ThisDecl)
|
||||
DeclsInGroup.push_back(ThisDecl);
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
|
||||
/// According to the standard grammar, =default and =delete are function
|
||||
/// definitions, but that definitely doesn't fit with the parser here.
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
Decl *Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo) {
|
||||
// If a simple-asm-expr is present, parse it.
|
||||
if (Tok.is(tok::kw_asm)) {
|
||||
@ -517,7 +517,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
|
||||
if (AsmLabel.isInvalid()) {
|
||||
SkipUntil(tok::semi, true, true);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
D.setAsmLabel(AsmLabel.release());
|
||||
@ -532,7 +532,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
}
|
||||
|
||||
// Inform the current actions module that we just parsed this declarator.
|
||||
DeclPtrTy ThisDecl;
|
||||
Decl *ThisDecl = 0;
|
||||
switch (TemplateInfo.Kind) {
|
||||
case ParsedTemplateInfo::NonTemplate:
|
||||
ThisDecl = Actions.ActOnDeclarator(getCurScope(), D);
|
||||
@ -548,14 +548,14 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||
break;
|
||||
|
||||
case ParsedTemplateInfo::ExplicitInstantiation: {
|
||||
Action::DeclResult ThisRes
|
||||
DeclResult ThisRes
|
||||
= Actions.ActOnExplicitInstantiation(getCurScope(),
|
||||
TemplateInfo.ExternLoc,
|
||||
TemplateInfo.TemplateLoc,
|
||||
D);
|
||||
if (ThisRes.isInvalid()) {
|
||||
SkipUntil(tok::semi, true, true);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ThisDecl = ThisRes.get();
|
||||
@ -1043,7 +1043,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||
continue;
|
||||
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolDecl;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
ParseObjCProtocolReferences(ProtocolDecl, ProtocolLocs, false,
|
||||
LAngleLoc, EndProtoLoc);
|
||||
@ -1112,7 +1112,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||
continue;
|
||||
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolDecl;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
ParseObjCProtocolReferences(ProtocolDecl, ProtocolLocs, false,
|
||||
LAngleLoc, EndProtoLoc);
|
||||
@ -1385,7 +1385,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||
|
||||
{
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolDecl;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
ParseObjCProtocolReferences(ProtocolDecl, ProtocolLocs, false,
|
||||
LAngleLoc, EndProtoLoc);
|
||||
@ -1513,7 +1513,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid,
|
||||
return true;
|
||||
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolDecl;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
ParseObjCProtocolReferences(ProtocolDecl, ProtocolLocs, false,
|
||||
LAngleLoc, EndProtoLoc);
|
||||
@ -1745,7 +1745,7 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) {
|
||||
}
|
||||
|
||||
// We're done with this declarator; invoke the callback.
|
||||
DeclPtrTy D = Fields.invoke(DeclaratorInfo);
|
||||
Decl *D = Fields.invoke(DeclaratorInfo);
|
||||
PD.complete(D);
|
||||
|
||||
// If we don't have a comma, it is either the end of the list (a ';')
|
||||
@ -1771,7 +1771,7 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) {
|
||||
/// [OBC] '@' 'defs' '(' class-name ')'
|
||||
///
|
||||
void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||
unsigned TagType, DeclPtrTy TagDecl) {
|
||||
unsigned TagType, Decl *TagDecl) {
|
||||
PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
|
||||
PP.getSourceManager(),
|
||||
"parsing struct/union body");
|
||||
@ -1787,7 +1787,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||
Diag(Tok, diag::ext_empty_struct_union)
|
||||
<< (TagType == TST_union);
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 32> FieldDecls;
|
||||
llvm::SmallVector<Decl *, 32> FieldDecls;
|
||||
|
||||
// While we still have something to read, read the declarations in the struct.
|
||||
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
|
||||
@ -1808,16 +1808,16 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||
if (!Tok.is(tok::at)) {
|
||||
struct CFieldCallback : FieldCallback {
|
||||
Parser &P;
|
||||
DeclPtrTy TagDecl;
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &FieldDecls;
|
||||
Decl *TagDecl;
|
||||
llvm::SmallVectorImpl<Decl *> &FieldDecls;
|
||||
|
||||
CFieldCallback(Parser &P, DeclPtrTy TagDecl,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &FieldDecls) :
|
||||
CFieldCallback(Parser &P, Decl *TagDecl,
|
||||
llvm::SmallVectorImpl<Decl *> &FieldDecls) :
|
||||
P(P), TagDecl(TagDecl), FieldDecls(FieldDecls) {}
|
||||
|
||||
virtual DeclPtrTy invoke(FieldDeclarator &FD) {
|
||||
virtual Decl *invoke(FieldDeclarator &FD) {
|
||||
// Install the declarator into the current TagDecl.
|
||||
DeclPtrTy Field = P.Actions.ActOnField(P.getCurScope(), TagDecl,
|
||||
Decl *Field = P.Actions.ActOnField(P.getCurScope(), TagDecl,
|
||||
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
||||
FD.D, FD.BitfieldSize);
|
||||
FieldDecls.push_back(Field);
|
||||
@ -1840,7 +1840,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||
SkipUntil(tok::semi, true);
|
||||
continue;
|
||||
}
|
||||
llvm::SmallVector<DeclPtrTy, 16> Fields;
|
||||
llvm::SmallVector<Decl *, 16> Fields;
|
||||
Actions.ActOnDefs(getCurScope(), TagDecl, Tok.getLocation(),
|
||||
Tok.getIdentifierInfo(), Fields);
|
||||
FieldDecls.insert(FieldDecls.end(), Fields.begin(), Fields.end());
|
||||
@ -1970,11 +1970,11 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||
SourceLocation TSTLoc = NameLoc.isValid()? NameLoc : StartLoc;
|
||||
const char *PrevSpec = 0;
|
||||
unsigned DiagID;
|
||||
DeclPtrTy TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
|
||||
StartLoc, SS, Name, NameLoc, Attr.get(),
|
||||
AS,
|
||||
Action::MultiTemplateParamsArg(Actions),
|
||||
Owned, IsDependent);
|
||||
Decl *TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
|
||||
StartLoc, SS, Name, NameLoc, Attr.get(),
|
||||
AS,
|
||||
Action::MultiTemplateParamsArg(Actions),
|
||||
Owned, IsDependent);
|
||||
if (IsDependent) {
|
||||
// This enum has a dependent nested-name-specifier. Handle it as a
|
||||
// dependent tag.
|
||||
@ -1999,7 +1999,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TagDecl.get()) {
|
||||
if (!TagDecl) {
|
||||
// The action failed to produce an enumeration tag. If this is a
|
||||
// definition, consume the entire definition.
|
||||
if (Tok.is(tok::l_brace)) {
|
||||
@ -2017,7 +2017,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||
// FIXME: The DeclSpec should keep the locations of both the keyword and the
|
||||
// name (if there is one).
|
||||
if (DS.SetTypeSpecType(DeclSpec::TST_enum, TSTLoc, PrevSpec, DiagID,
|
||||
TagDecl.getAs<void>(), Owned))
|
||||
TagDecl, Owned))
|
||||
Diag(StartLoc, DiagID) << PrevSpec;
|
||||
}
|
||||
|
||||
@ -2031,7 +2031,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||
/// enumeration-constant:
|
||||
/// identifier
|
||||
///
|
||||
void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||
void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) {
|
||||
// Enter the scope of the enum body and start the definition.
|
||||
ParseScope EnumScope(this, Scope::DeclScope);
|
||||
Actions.ActOnTagStartDefinition(getCurScope(), EnumDecl);
|
||||
@ -2042,9 +2042,9 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||
if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
|
||||
Diag(Tok, diag::error_empty_enum);
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 32> EnumConstantDecls;
|
||||
llvm::SmallVector<Decl *, 32> EnumConstantDecls;
|
||||
|
||||
DeclPtrTy LastEnumConstDecl;
|
||||
Decl *LastEnumConstDecl = 0;
|
||||
|
||||
// Parse the enumerator-list.
|
||||
while (Tok.is(tok::identifier)) {
|
||||
@ -2061,11 +2061,11 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||
}
|
||||
|
||||
// Install the enumerator constant into EnumDecl.
|
||||
DeclPtrTy EnumConstDecl = Actions.ActOnEnumConstant(getCurScope(), EnumDecl,
|
||||
LastEnumConstDecl,
|
||||
IdentLoc, Ident,
|
||||
EqualLoc,
|
||||
AssignedVal.release());
|
||||
Decl *EnumConstDecl = Actions.ActOnEnumConstant(getCurScope(), EnumDecl,
|
||||
LastEnumConstDecl,
|
||||
IdentLoc, Ident,
|
||||
EqualLoc,
|
||||
AssignedVal.release());
|
||||
EnumConstantDecls.push_back(EnumConstDecl);
|
||||
LastEnumConstDecl = EnumConstDecl;
|
||||
|
||||
@ -3066,7 +3066,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
|
||||
|
||||
// Inform the actions module about the parameter declarator, so it gets
|
||||
// added to the current scope.
|
||||
DeclPtrTy Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||
Decl *Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||
|
||||
// Parse the default argument, if any. We parse the default
|
||||
// arguments in all dialects; the semantic analysis in
|
||||
@ -3215,8 +3215,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc,
|
||||
// The first identifier was already read, and is known to be the first
|
||||
// identifier in the list. Remember this identifier in ParamInfo.
|
||||
ParamsSoFar.insert(FirstIdent);
|
||||
ParamInfo.push_back(DeclaratorChunk::ParamInfo(FirstIdent, FirstIdentLoc,
|
||||
DeclPtrTy()));
|
||||
ParamInfo.push_back(DeclaratorChunk::ParamInfo(FirstIdent, FirstIdentLoc, 0));
|
||||
|
||||
while (Tok.is(tok::comma)) {
|
||||
// Eat the comma.
|
||||
@ -3242,7 +3241,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc,
|
||||
// Remember this identifier in ParamInfo.
|
||||
ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
|
||||
Tok.getLocation(),
|
||||
DeclPtrTy()));
|
||||
0));
|
||||
}
|
||||
|
||||
// Eat the identifier.
|
||||
|
@ -43,8 +43,8 @@ using namespace clang;
|
||||
/// namespace-alias-definition: [C++ 7.3.2: namespace.alias]
|
||||
/// 'namespace' identifier '=' qualified-namespace-specifier ';'
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||
SourceLocation &DeclEnd) {
|
||||
Decl *Parser::ParseNamespace(unsigned Context,
|
||||
SourceLocation &DeclEnd) {
|
||||
assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
|
||||
SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'.
|
||||
|
||||
@ -82,7 +82,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||
if (Tok.isNot(tok::l_brace)) {
|
||||
Diag(Tok, Ident ? diag::err_expected_lbrace :
|
||||
diag::err_expected_ident_lbrace);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
SourceLocation LBrace = ConsumeBrace();
|
||||
@ -92,13 +92,13 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||
getCurScope()->getFnParent()) {
|
||||
Diag(LBrace, diag::err_namespace_nonnamespace_scope);
|
||||
SkipUntil(tok::r_brace, false);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Enter a scope for the namespace.
|
||||
ParseScope NamespaceScope(this, Scope::DeclScope);
|
||||
|
||||
DeclPtrTy NamespcDecl =
|
||||
Decl *NamespcDecl =
|
||||
Actions.ActOnStartNamespaceDef(getCurScope(), IdentLoc, Ident, LBrace,
|
||||
AttrList.get());
|
||||
|
||||
@ -126,7 +126,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||
/// ParseNamespaceAlias - Parse the part after the '=' in a namespace
|
||||
/// alias definition.
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
Decl *Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
SourceLocation AliasLoc,
|
||||
IdentifierInfo *Alias,
|
||||
SourceLocation &DeclEnd) {
|
||||
@ -147,7 +147,7 @@ Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
Diag(Tok, diag::err_expected_namespace_name);
|
||||
// Skip to end of the definition and eat the ';'.
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse identifier.
|
||||
@ -170,7 +170,7 @@ Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||
/// 'extern' string-literal '{' declaration-seq[opt] '}'
|
||||
/// 'extern' string-literal declaration
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||
Decl *Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||
unsigned Context) {
|
||||
assert(Tok.is(tok::string_literal) && "Not a string literal!");
|
||||
llvm::SmallString<8> LangBuffer;
|
||||
@ -178,12 +178,12 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||
bool Invalid = false;
|
||||
llvm::StringRef Lang = PP.getSpelling(Tok, LangBuffer, &Invalid);
|
||||
if (Invalid)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
SourceLocation Loc = ConsumeStringToken();
|
||||
|
||||
ParseScope LinkageScope(this, Scope::DeclScope);
|
||||
DeclPtrTy LinkageSpec
|
||||
Decl *LinkageSpec
|
||||
= Actions.ActOnStartLinkageSpecification(getCurScope(),
|
||||
/*FIXME: */SourceLocation(),
|
||||
Loc, Lang,
|
||||
@ -222,7 +222,7 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||
|
||||
/// ParseUsingDirectiveOrDeclaration - Parse C++ using using-declaration or
|
||||
/// using-directive. Assumes that current token is 'using'.
|
||||
Parser::DeclPtrTy Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||
Decl *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
CXX0XAttributeList Attr) {
|
||||
assert(Tok.is(tok::kw_using) && "Not using token");
|
||||
@ -258,7 +258,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||
/// 'using' 'namespace' ::[opt] nested-name-specifier[opt]
|
||||
/// namespace-name attributes[opt] ;
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
|
||||
Decl *Parser::ParseUsingDirective(unsigned Context,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation &DeclEnd,
|
||||
AttributeList *Attr) {
|
||||
@ -285,7 +285,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
|
||||
// If there was invalid namespace name, skip to end of decl, and eat ';'.
|
||||
SkipUntil(tok::semi);
|
||||
// FIXME: Are there cases, when we would like to call ActOnUsingDirective?
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse identifier.
|
||||
@ -317,7 +317,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
|
||||
/// unqualified-id
|
||||
/// 'using' :: unqualified-id
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
|
||||
Decl *Parser::ParseUsingDeclaration(unsigned Context,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS) {
|
||||
@ -341,7 +341,7 @@ Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
|
||||
// Check nested-name specifier.
|
||||
if (SS.isInvalid()) {
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse the unqualified-id. We allow parsing of both constructor and
|
||||
@ -355,7 +355,7 @@ Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
|
||||
/*ObjectType=*/0,
|
||||
Name)) {
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse (optional) attributes (most likely GNU strong-using extension).
|
||||
@ -378,13 +378,13 @@ Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
|
||||
/// static_assert-declaration:
|
||||
/// static_assert ( constant-expression , string-literal ) ;
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
|
||||
Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
|
||||
assert(Tok.is(tok::kw_static_assert) && "Not a static_assert declaration");
|
||||
SourceLocation StaticAssertLoc = ConsumeToken();
|
||||
|
||||
if (Tok.isNot(tok::l_paren)) {
|
||||
Diag(Tok, diag::err_expected_lparen);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
SourceLocation LParenLoc = ConsumeParen();
|
||||
@ -392,21 +392,21 @@ Parser::DeclPtrTy Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
|
||||
OwningExprResult AssertExpr(ParseConstantExpression());
|
||||
if (AssertExpr.isInvalid()) {
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "", tok::semi))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (Tok.isNot(tok::string_literal)) {
|
||||
Diag(Tok, diag::err_expected_string_literal);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
OwningExprResult AssertMessage(ParseStringLiteralExpression());
|
||||
if (AssertMessage.isInvalid())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
MatchRHSPunctuation(tok::r_paren, LParenLoc);
|
||||
|
||||
@ -822,8 +822,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||
}
|
||||
|
||||
// Create the tag portion of the class or class template.
|
||||
Action::DeclResult TagOrTempResult = true; // invalid
|
||||
Action::TypeResult TypeResult = true; // invalid
|
||||
DeclResult TagOrTempResult = true; // invalid
|
||||
TypeResult TypeResult = true; // invalid
|
||||
|
||||
bool Owned = false;
|
||||
if (TemplateId) {
|
||||
@ -967,7 +967,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||
Result = TypeResult.get();
|
||||
Owned = false;
|
||||
} else if (!TagOrTempResult.isInvalid()) {
|
||||
Result = TagOrTempResult.get().getAs<void>();
|
||||
Result = TagOrTempResult.get();
|
||||
} else {
|
||||
DS.SetTypeSpecError();
|
||||
return;
|
||||
@ -1065,7 +1065,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||
/// base-specifier-list:
|
||||
/// base-specifier '...'[opt]
|
||||
/// base-specifier-list ',' base-specifier '...'[opt]
|
||||
void Parser::ParseBaseClause(DeclPtrTy ClassDecl) {
|
||||
void Parser::ParseBaseClause(Decl *ClassDecl) {
|
||||
assert(Tok.is(tok::colon) && "Not a base clause");
|
||||
ConsumeToken();
|
||||
|
||||
@ -1107,7 +1107,7 @@ void Parser::ParseBaseClause(DeclPtrTy ClassDecl) {
|
||||
/// class-name
|
||||
/// access-specifier 'virtual'[opt] ::[opt] nested-name-specifier[opt]
|
||||
/// class-name
|
||||
Parser::BaseResult Parser::ParseBaseSpecifier(DeclPtrTy ClassDecl) {
|
||||
Parser::BaseResult Parser::ParseBaseSpecifier(Decl *ClassDecl) {
|
||||
bool IsVirtual = false;
|
||||
SourceLocation StartLoc = Tok.getLocation();
|
||||
|
||||
@ -1175,7 +1175,7 @@ AccessSpecifier Parser::getAccessSpecifierIfPresent() const {
|
||||
}
|
||||
|
||||
void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
|
||||
DeclPtrTy ThisDecl) {
|
||||
Decl *ThisDecl) {
|
||||
// We just declared a member function. If this member function
|
||||
// has any default arguments, we'll need to parse them later.
|
||||
LateParsedMethodDeclaration *LateMethod = 0;
|
||||
@ -1345,7 +1345,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
|
||||
if (Tok.is(tok::semi)) {
|
||||
ConsumeToken();
|
||||
DeclPtrTy TheDecl =
|
||||
Decl *TheDecl =
|
||||
Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||
DS.complete(TheDecl);
|
||||
return;
|
||||
@ -1405,7 +1405,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
// member-declarator
|
||||
// member-declarator-list ',' member-declarator
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 8> DeclsInGroup;
|
||||
llvm::SmallVector<Decl *, 8> DeclsInGroup;
|
||||
OwningExprResult BitfieldSize(Actions);
|
||||
OwningExprResult Init(Actions);
|
||||
bool Deleted = false;
|
||||
@ -1465,7 +1465,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
// this call will *not* return the created decl; It will return null.
|
||||
// See Sema::ActOnCXXMemberDeclarator for details.
|
||||
|
||||
DeclPtrTy ThisDecl;
|
||||
Decl *ThisDecl = 0;
|
||||
if (DS.isFriendSpecified()) {
|
||||
// TODO: handle initializers, bitfields, 'delete'
|
||||
ThisDecl = Actions.ActOnFriendFunctionDecl(getCurScope(), DeclaratorInfo,
|
||||
@ -1535,7 +1535,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
/// access-specifier ':' member-specification[opt]
|
||||
///
|
||||
void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||
unsigned TagType, DeclPtrTy TagDecl) {
|
||||
unsigned TagType, Decl *TagDecl) {
|
||||
assert((TagType == DeclSpec::TST_struct ||
|
||||
TagType == DeclSpec::TST_union ||
|
||||
TagType == DeclSpec::TST_class) && "Invalid TagType!");
|
||||
@ -1701,7 +1701,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||
/// [C++] mem-initializer-list:
|
||||
/// mem-initializer
|
||||
/// mem-initializer , mem-initializer-list
|
||||
void Parser::ParseConstructorInitializer(DeclPtrTy ConstructorDecl) {
|
||||
void Parser::ParseConstructorInitializer(Decl *ConstructorDecl) {
|
||||
assert(Tok.is(tok::colon) && "Constructor initializer always starts with ':'");
|
||||
|
||||
SourceLocation ColonLoc = ConsumeToken();
|
||||
@ -1744,7 +1744,7 @@ void Parser::ParseConstructorInitializer(DeclPtrTy ConstructorDecl) {
|
||||
/// [C++] mem-initializer-id:
|
||||
/// '::'[opt] nested-name-specifier[opt] class-name
|
||||
/// identifier
|
||||
Parser::MemInitResult Parser::ParseMemInitializer(DeclPtrTy ConstructorDecl) {
|
||||
Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) {
|
||||
// parse '::'[opt] nested-name-specifier[opt]
|
||||
CXXScopeSpec SS;
|
||||
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false);
|
||||
@ -1851,7 +1851,7 @@ bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
|
||||
/// \brief We have just started parsing the definition of a new class,
|
||||
/// so push that class onto our stack of classes that is currently
|
||||
/// being parsed.
|
||||
void Parser::PushParsingClass(DeclPtrTy ClassDecl, bool NonNestedClass) {
|
||||
void Parser::PushParsingClass(Decl *ClassDecl, bool NonNestedClass) {
|
||||
assert((NonNestedClass || !ClassStack.empty()) &&
|
||||
"Nested class without outer class");
|
||||
ClassStack.push(new ParsingClass(ClassDecl, NonNestedClass));
|
||||
|
@ -730,7 +730,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
|
||||
///
|
||||
/// \returns true if there was a parsing, false otherwise.
|
||||
bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
|
||||
DeclPtrTy &DeclResult,
|
||||
Decl *&DeclResult,
|
||||
SourceLocation Loc,
|
||||
bool ConvertToBoolean) {
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
@ -741,7 +741,7 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
|
||||
if (!isCXXConditionDeclaration()) {
|
||||
// Parse the expression.
|
||||
ExprResult = ParseExpression(); // expression
|
||||
DeclResult = DeclPtrTy();
|
||||
DeclResult = 0;
|
||||
if (ExprResult.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -27,7 +27,7 @@ using namespace clang;
|
||||
/// [OBJC] objc-protocol-definition
|
||||
/// [OBJC] objc-method-definition
|
||||
/// [OBJC] '@' 'end'
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
|
||||
Decl *Parser::ParseObjCAtDirectives() {
|
||||
SourceLocation AtLoc = ConsumeToken(); // the "@"
|
||||
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
@ -55,7 +55,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
|
||||
default:
|
||||
Diag(AtLoc, diag::err_unexpected_at);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
|
||||
/// objc-class-declaration:
|
||||
/// '@' 'class' identifier-list ';'
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
|
||||
Decl *Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
|
||||
ConsumeToken(); // the identifier "class"
|
||||
llvm::SmallVector<IdentifierInfo *, 8> ClassNames;
|
||||
llvm::SmallVector<SourceLocation, 8> ClassLocs;
|
||||
@ -73,7 +73,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
ClassNames.push_back(Tok.getIdentifierInfo());
|
||||
ClassLocs.push_back(Tok.getLocation());
|
||||
@ -87,7 +87,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
|
||||
|
||||
// Consume the ';'.
|
||||
if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
return Actions.ActOnForwardClassDeclaration(atLoc, ClassNames.data(),
|
||||
ClassLocs.data(),
|
||||
@ -122,7 +122,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
|
||||
/// __attribute__((unavailable))
|
||||
/// __attribute__((objc_exception)) - used by NSException on 64-bit
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||
Decl *Parser::ParseObjCAtInterfaceDeclaration(
|
||||
SourceLocation atLoc, AttributeList *attrList) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_interface) &&
|
||||
"ParseObjCAtInterfaceDeclaration(): Expected @interface");
|
||||
@ -136,7 +136,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing class or category name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We have a class or category name - consume it.
|
||||
@ -159,27 +159,27 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||
}
|
||||
else if (!getLang().ObjC2) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing category name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
if (Tok.isNot(tok::r_paren)) {
|
||||
Diag(Tok, diag::err_expected_rparen);
|
||||
SkipUntil(tok::r_paren, false); // don't stop at ';'
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
rparenLoc = ConsumeParen();
|
||||
// Next, we need to check for any protocol references.
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolRefs;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
if (Tok.is(tok::less) &&
|
||||
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true,
|
||||
LAngleLoc, EndProtoLoc))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (attrList) // categories don't support attributes.
|
||||
Diag(Tok, diag::err_objc_no_attributes_on_category);
|
||||
|
||||
DeclPtrTy CategoryType =
|
||||
Decl *CategoryType =
|
||||
Actions.ActOnStartCategoryInterface(atLoc,
|
||||
nameId, nameLoc,
|
||||
categoryId, categoryLoc,
|
||||
@ -209,21 +209,21 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing super class name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
superClassId = Tok.getIdentifierInfo();
|
||||
superClassLoc = ConsumeToken();
|
||||
}
|
||||
// Next, we need to check for any protocol references.
|
||||
llvm::SmallVector<Action::DeclPtrTy, 8> ProtocolRefs;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolRefs;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
if (Tok.is(tok::less) &&
|
||||
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true,
|
||||
LAngleLoc, EndProtoLoc))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
DeclPtrTy ClsType =
|
||||
Decl *ClsType =
|
||||
Actions.ActOnStartClassInterface(atLoc, nameId, nameLoc,
|
||||
superClassId, superClassLoc,
|
||||
ProtocolRefs.data(), ProtocolRefs.size(),
|
||||
@ -241,30 +241,30 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||
/// it's used, but instead it's been lifted to here to support VS2005.
|
||||
struct Parser::ObjCPropertyCallback : FieldCallback {
|
||||
Parser &P;
|
||||
DeclPtrTy IDecl;
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Props;
|
||||
Decl *IDecl;
|
||||
llvm::SmallVectorImpl<Decl *> &Props;
|
||||
ObjCDeclSpec &OCDS;
|
||||
SourceLocation AtLoc;
|
||||
tok::ObjCKeywordKind MethodImplKind;
|
||||
|
||||
ObjCPropertyCallback(Parser &P, DeclPtrTy IDecl,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Props,
|
||||
ObjCPropertyCallback(Parser &P, Decl *IDecl,
|
||||
llvm::SmallVectorImpl<Decl *> &Props,
|
||||
ObjCDeclSpec &OCDS, SourceLocation AtLoc,
|
||||
tok::ObjCKeywordKind MethodImplKind) :
|
||||
P(P), IDecl(IDecl), Props(Props), OCDS(OCDS), AtLoc(AtLoc),
|
||||
MethodImplKind(MethodImplKind) {
|
||||
}
|
||||
|
||||
DeclPtrTy invoke(FieldDeclarator &FD) {
|
||||
Decl *invoke(FieldDeclarator &FD) {
|
||||
if (FD.D.getIdentifier() == 0) {
|
||||
P.Diag(AtLoc, diag::err_objc_property_requires_field_name)
|
||||
<< FD.D.getSourceRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
if (FD.BitfieldSize) {
|
||||
P.Diag(AtLoc, diag::err_objc_property_bitfield)
|
||||
<< FD.D.getSourceRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Install the property declarator into interfaceDecl.
|
||||
@ -282,7 +282,7 @@ struct Parser::ObjCPropertyCallback : FieldCallback {
|
||||
P.PP.getSelectorTable(),
|
||||
FD.D.getIdentifier());
|
||||
bool isOverridingProperty = false;
|
||||
DeclPtrTy Property =
|
||||
Decl *Property =
|
||||
P.Actions.ActOnProperty(P.getCurScope(), AtLoc, FD, OCDS,
|
||||
GetterSel, SetterSel, IDecl,
|
||||
&isOverridingProperty,
|
||||
@ -306,10 +306,10 @@ struct Parser::ObjCPropertyCallback : FieldCallback {
|
||||
/// @required
|
||||
/// @optional
|
||||
///
|
||||
void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||
void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl,
|
||||
tok::ObjCKeywordKind contextKey) {
|
||||
llvm::SmallVector<DeclPtrTy, 32> allMethods;
|
||||
llvm::SmallVector<DeclPtrTy, 16> allProperties;
|
||||
llvm::SmallVector<Decl *, 32> allMethods;
|
||||
llvm::SmallVector<Decl *, 16> allProperties;
|
||||
llvm::SmallVector<DeclGroupPtrTy, 8> allTUVariables;
|
||||
tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
|
||||
|
||||
@ -318,7 +318,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||
while (1) {
|
||||
// If this is a method prototype, parse it.
|
||||
if (Tok.is(tok::minus) || Tok.is(tok::plus)) {
|
||||
DeclPtrTy methodPrototype =
|
||||
Decl *methodPrototype =
|
||||
ParseObjCMethodPrototype(interfaceDecl, MethodImplKind);
|
||||
allMethods.push_back(methodPrototype);
|
||||
// Consume the ';' here, since ParseObjCMethodPrototype() is re-used for
|
||||
@ -329,10 +329,10 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||
}
|
||||
if (Tok.is(tok::l_paren)) {
|
||||
Diag(Tok, diag::err_expected_minus_or_plus);
|
||||
DeclPtrTy methodPrototype = ParseObjCMethodDecl(Tok.getLocation(),
|
||||
tok::minus,
|
||||
interfaceDecl,
|
||||
MethodImplKind);
|
||||
ParseObjCMethodDecl(Tok.getLocation(),
|
||||
tok::minus,
|
||||
interfaceDecl,
|
||||
MethodImplKind);
|
||||
continue;
|
||||
}
|
||||
// Ignore excess semicolons.
|
||||
@ -468,8 +468,8 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||
/// copy
|
||||
/// nonatomic
|
||||
///
|
||||
void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods) {
|
||||
assert(Tok.getKind() == tok::l_paren);
|
||||
SourceLocation LHSLoc = ConsumeParen(); // consume '('
|
||||
@ -562,14 +562,14 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
|
||||
/// objc-method-attributes: [OBJC2]
|
||||
/// __attribute__((deprecated))
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCMethodPrototype(DeclPtrTy IDecl,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
Decl *Parser::ParseObjCMethodPrototype(Decl *IDecl,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
assert((Tok.is(tok::minus) || Tok.is(tok::plus)) && "expected +/-");
|
||||
|
||||
tok::TokenKind methodType = Tok.getKind();
|
||||
SourceLocation mLoc = ConsumeToken();
|
||||
|
||||
DeclPtrTy MDecl = ParseObjCMethodDecl(mLoc, methodType, IDecl,MethodImplKind);
|
||||
Decl *MDecl = ParseObjCMethodDecl(mLoc, methodType, IDecl,MethodImplKind);
|
||||
// Since this rule is used for both method declarations and definitions,
|
||||
// the caller is (optionally) responsible for consuming the ';'.
|
||||
return MDecl;
|
||||
@ -773,10 +773,10 @@ Parser::TypeTy *Parser::ParseObjCTypeName(ObjCDeclSpec &DS) {
|
||||
/// objc-keyword-attributes: [OBJC2]
|
||||
/// __attribute__((unused))
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
tok::TokenKind mType,
|
||||
DeclPtrTy IDecl,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
tok::TokenKind mType,
|
||||
Decl *IDecl,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
ParsingDeclRAIIObject PD(*this);
|
||||
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
@ -812,7 +812,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
<< SourceRange(mLoc, Tok.getLocation());
|
||||
// Skip until we get a ; or {}.
|
||||
SkipUntil(tok::r_brace);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
llvm::SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo;
|
||||
@ -823,7 +823,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
ParseGNUAttributes()));
|
||||
|
||||
Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent);
|
||||
DeclPtrTy Result
|
||||
Decl *Result
|
||||
= Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
|
||||
mType, IDecl, DSRet, ReturnType, Sel,
|
||||
0,
|
||||
@ -918,7 +918,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
Declarator ParmDecl(DS, Declarator::PrototypeContext);
|
||||
ParseDeclarator(ParmDecl);
|
||||
IdentifierInfo *ParmII = ParmDecl.getIdentifier();
|
||||
DeclPtrTy Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||
Decl *Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||
CParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
|
||||
ParmDecl.getIdentifierLoc(),
|
||||
Param,
|
||||
@ -933,10 +933,10 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
ParseGNUAttributes()));
|
||||
|
||||
if (KeyIdents.size() == 0)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
|
||||
&KeyIdents[0]);
|
||||
DeclPtrTy Result
|
||||
Decl *Result
|
||||
= Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
|
||||
mType, IDecl, DSRet, ReturnType, Sel,
|
||||
&ArgInfos[0],
|
||||
@ -957,7 +957,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||
/// '<' identifier-list '>'
|
||||
///
|
||||
bool Parser::
|
||||
ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &Protocols,
|
||||
ParseObjCProtocolReferences(llvm::SmallVectorImpl<Decl *> &Protocols,
|
||||
llvm::SmallVectorImpl<SourceLocation> &ProtocolLocs,
|
||||
bool WarnOnDeclarations,
|
||||
SourceLocation &LAngleLoc, SourceLocation &EndLoc) {
|
||||
@ -1024,11 +1024,11 @@ ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &Protocols,
|
||||
/// objc-instance-variable-decl:
|
||||
/// struct-declaration
|
||||
///
|
||||
void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||
void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
|
||||
tok::ObjCKeywordKind visibility,
|
||||
SourceLocation atLoc) {
|
||||
assert(Tok.is(tok::l_brace) && "expected {");
|
||||
llvm::SmallVector<DeclPtrTy, 32> AllIvarDecls;
|
||||
llvm::SmallVector<Decl *, 32> AllIvarDecls;
|
||||
|
||||
ParseScope ClassScope(this, Scope::DeclScope|Scope::ClassScope);
|
||||
|
||||
@ -1077,18 +1077,18 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||
|
||||
struct ObjCIvarCallback : FieldCallback {
|
||||
Parser &P;
|
||||
DeclPtrTy IDecl;
|
||||
Decl *IDecl;
|
||||
tok::ObjCKeywordKind visibility;
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &AllIvarDecls;
|
||||
llvm::SmallVectorImpl<Decl *> &AllIvarDecls;
|
||||
|
||||
ObjCIvarCallback(Parser &P, DeclPtrTy IDecl, tok::ObjCKeywordKind V,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &AllIvarDecls) :
|
||||
ObjCIvarCallback(Parser &P, Decl *IDecl, tok::ObjCKeywordKind V,
|
||||
llvm::SmallVectorImpl<Decl *> &AllIvarDecls) :
|
||||
P(P), IDecl(IDecl), visibility(V), AllIvarDecls(AllIvarDecls) {
|
||||
}
|
||||
|
||||
DeclPtrTy invoke(FieldDeclarator &FD) {
|
||||
Decl *invoke(FieldDeclarator &FD) {
|
||||
// Install the declarator into the interface decl.
|
||||
DeclPtrTy Field
|
||||
Decl *Field
|
||||
= P.Actions.ActOnIvar(P.getCurScope(),
|
||||
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
||||
IDecl, FD.D, FD.BitfieldSize, visibility);
|
||||
@ -1135,7 +1135,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||
/// "@protocol identifier ;" should be resolved as "@protocol
|
||||
/// identifier-list ;": objc-interface-decl-list may not start with a
|
||||
/// semicolon in the first alternative if objc-protocol-refs are omitted.
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
AttributeList *attrList) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_protocol) &&
|
||||
"ParseObjCAtProtocolDeclaration(): Expected @protocol");
|
||||
@ -1148,7 +1148,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing protocol name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// Save the protocol name, then consume it.
|
||||
IdentifierInfo *protocolName = Tok.getIdentifierInfo();
|
||||
@ -1171,7 +1171,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
ProtocolRefs.push_back(IdentifierLocPair(Tok.getIdentifierInfo(),
|
||||
Tok.getLocation()));
|
||||
@ -1182,7 +1182,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
}
|
||||
// Consume the ';'.
|
||||
if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol"))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
return Actions.ActOnForwardProtocolDeclaration(AtLoc,
|
||||
&ProtocolRefs[0],
|
||||
@ -1193,14 +1193,14 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
// Last, and definitely not least, parse a protocol declaration.
|
||||
SourceLocation LAngleLoc, EndProtoLoc;
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs;
|
||||
llvm::SmallVector<Decl *, 8> ProtocolRefs;
|
||||
llvm::SmallVector<SourceLocation, 8> ProtocolLocs;
|
||||
if (Tok.is(tok::less) &&
|
||||
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false,
|
||||
LAngleLoc, EndProtoLoc))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
DeclPtrTy ProtoType =
|
||||
Decl *ProtoType =
|
||||
Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc,
|
||||
ProtocolRefs.data(),
|
||||
ProtocolRefs.size(),
|
||||
@ -1220,7 +1220,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||
///
|
||||
/// objc-category-implementation-prologue:
|
||||
/// @implementation identifier ( identifier )
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||
Decl *Parser::ParseObjCAtImplementationDeclaration(
|
||||
SourceLocation atLoc) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_implementation) &&
|
||||
"ParseObjCAtImplementationDeclaration(): Expected @implementation");
|
||||
@ -1234,7 +1234,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing class or category name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// We have a class or category name - consume it.
|
||||
IdentifierInfo *nameId = Tok.getIdentifierInfo();
|
||||
@ -1256,20 +1256,20 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||
categoryLoc = ConsumeToken();
|
||||
} else {
|
||||
Diag(Tok, diag::err_expected_ident); // missing category name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
if (Tok.isNot(tok::r_paren)) {
|
||||
Diag(Tok, diag::err_expected_rparen);
|
||||
SkipUntil(tok::r_paren, false); // don't stop at ';'
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
rparenLoc = ConsumeParen();
|
||||
DeclPtrTy ImplCatType = Actions.ActOnStartCategoryImplementation(
|
||||
Decl *ImplCatType = Actions.ActOnStartCategoryImplementation(
|
||||
atLoc, nameId, nameLoc, categoryId,
|
||||
categoryLoc);
|
||||
ObjCImpDecl = ImplCatType;
|
||||
PendingObjCImpDecl.push_back(ObjCImpDecl);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// We have a class implementation
|
||||
SourceLocation superClassLoc;
|
||||
@ -1279,12 +1279,12 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||
ConsumeToken();
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident); // missing super class name.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
superClassId = Tok.getIdentifierInfo();
|
||||
superClassLoc = ConsumeToken(); // Consume super class name
|
||||
}
|
||||
DeclPtrTy ImplClsType = Actions.ActOnStartClassImplementation(
|
||||
Decl *ImplClsType = Actions.ActOnStartClassImplementation(
|
||||
atLoc, nameId, nameLoc,
|
||||
superClassId, superClassLoc);
|
||||
|
||||
@ -1294,17 +1294,17 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||
ObjCImpDecl = ImplClsType;
|
||||
PendingObjCImpDecl.push_back(ObjCImpDecl);
|
||||
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
|
||||
Decl *Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_end) &&
|
||||
"ParseObjCAtEndDeclaration(): Expected @end");
|
||||
DeclPtrTy Result = ObjCImpDecl;
|
||||
Decl *Result = ObjCImpDecl;
|
||||
ConsumeToken(); // the "end" identifier
|
||||
if (ObjCImpDecl) {
|
||||
Actions.ActOnAtEnd(getCurScope(), atEnd, ObjCImpDecl);
|
||||
ObjCImpDecl = DeclPtrTy();
|
||||
ObjCImpDecl = 0;
|
||||
PendingObjCImpDecl.pop_back();
|
||||
}
|
||||
else {
|
||||
@ -1317,8 +1317,8 @@ Parser::DeclPtrTy Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
|
||||
Parser::DeclGroupPtrTy Parser::FinishPendingObjCActions() {
|
||||
Actions.DiagnoseUseOfUnimplementedSelectors();
|
||||
if (PendingObjCImpDecl.empty())
|
||||
return Actions.ConvertDeclToDeclGroup(DeclPtrTy());
|
||||
DeclPtrTy ImpDecl = PendingObjCImpDecl.pop_back_val();
|
||||
return Actions.ConvertDeclToDeclGroup(0);
|
||||
Decl *ImpDecl = PendingObjCImpDecl.pop_back_val();
|
||||
Actions.ActOnAtEnd(getCurScope(), SourceRange(), ImpDecl);
|
||||
return Actions.ConvertDeclToDeclGroup(ImpDecl);
|
||||
}
|
||||
@ -1326,25 +1326,25 @@ Parser::DeclGroupPtrTy Parser::FinishPendingObjCActions() {
|
||||
/// compatibility-alias-decl:
|
||||
/// @compatibility_alias alias-name class-name ';'
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) {
|
||||
Decl *Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_compatibility_alias) &&
|
||||
"ParseObjCAtAliasDeclaration(): Expected @compatibility_alias");
|
||||
ConsumeToken(); // consume compatibility_alias
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
IdentifierInfo *aliasId = Tok.getIdentifierInfo();
|
||||
SourceLocation aliasLoc = ConsumeToken(); // consume alias-name
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
IdentifierInfo *classId = Tok.getIdentifierInfo();
|
||||
SourceLocation classLoc = ConsumeToken(); // consume class-name;
|
||||
if (Tok.isNot(tok::semi)) {
|
||||
Diag(Tok, diag::err_expected_semi_after) << "@compatibility_alias";
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
return Actions.ActOnCompatiblityAlias(atLoc, aliasId, aliasLoc,
|
||||
classId, classLoc);
|
||||
@ -1361,7 +1361,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) {
|
||||
/// identifier
|
||||
/// identifier '=' identifier
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||
Decl *Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_synthesize) &&
|
||||
"ParseObjCPropertyDynamic(): Expected '@synthesize'");
|
||||
SourceLocation loc = ConsumeToken(); // consume synthesize
|
||||
@ -1375,7 +1375,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_synthesized_property_name);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IdentifierInfo *propertyIvar = 0;
|
||||
@ -1410,7 +1410,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||
}
|
||||
else
|
||||
ConsumeToken(); // consume ';'
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// property-dynamic:
|
||||
@ -1420,7 +1420,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||
/// identifier
|
||||
/// property-list ',' identifier
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||
Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||
assert(Tok.isObjCAtKeyword(tok::objc_dynamic) &&
|
||||
"ParseObjCPropertyDynamic(): Expected '@dynamic'");
|
||||
SourceLocation loc = ConsumeToken(); // consume dynamic
|
||||
@ -1433,7 +1433,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||
if (Tok.isNot(tok::identifier)) {
|
||||
Diag(Tok, diag::err_expected_ident);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
|
||||
@ -1451,7 +1451,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||
}
|
||||
else
|
||||
ConsumeToken(); // consume ';'
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// objc-throw-statement:
|
||||
@ -1547,7 +1547,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
|
||||
|
||||
SourceLocation AtCatchFinallyLoc = ConsumeToken();
|
||||
if (Tok.isObjCAtKeyword(tok::objc_catch)) {
|
||||
DeclPtrTy FirstPart;
|
||||
Decl *FirstPart = 0;
|
||||
ConsumeToken(); // consume catch
|
||||
if (Tok.is(tok::l_paren)) {
|
||||
ConsumeParen();
|
||||
@ -1625,8 +1625,8 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
|
||||
|
||||
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
|
||||
DeclPtrTy MDecl = ParseObjCMethodPrototype(ObjCImpDecl);
|
||||
Decl *Parser::ParseObjCMethodDefinition() {
|
||||
Decl *MDecl = ParseObjCMethodPrototype(ObjCImpDecl);
|
||||
|
||||
PrettyStackTraceActionsDecl CrashInfo(MDecl, Tok.getLocation(), Actions,
|
||||
PP.getSourceManager(),
|
||||
@ -1650,7 +1650,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
|
||||
|
||||
// If we didn't find the '{', bail out.
|
||||
if (Tok.isNot(tok::l_brace))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
SourceLocation BraceLoc = Tok.getLocation();
|
||||
|
||||
|
@ -538,7 +538,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
|
||||
/// successfully parsed. Note that a successful parse can still have semantic
|
||||
/// errors in the condition.
|
||||
bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
|
||||
DeclPtrTy &DeclResult,
|
||||
Decl *&DeclResult,
|
||||
SourceLocation Loc,
|
||||
bool ConvertToBoolean) {
|
||||
bool ParseError = false;
|
||||
@ -549,7 +549,7 @@ bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
|
||||
ConvertToBoolean);
|
||||
else {
|
||||
ExprResult = ParseExpression();
|
||||
DeclResult = DeclPtrTy();
|
||||
DeclResult = 0;
|
||||
|
||||
// If required, convert to a boolean value.
|
||||
if (!ExprResult.isInvalid() && ConvertToBoolean)
|
||||
@ -560,7 +560,7 @@ bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
|
||||
// If the parser was confused by the condition and we don't have a ')', try to
|
||||
// recover by skipping ahead to a semi and bailing out. If condexp is
|
||||
// semantically invalid but we have well formed code, keep going.
|
||||
if (ExprResult.isInvalid() && !DeclResult.get() && Tok.isNot(tok::r_paren)) {
|
||||
if (ExprResult.isInvalid() && !DeclResult && Tok.isNot(tok::r_paren)) {
|
||||
SkipUntil(tok::semi);
|
||||
// Skipping may have stopped if it found the containing ')'. If so, we can
|
||||
// continue parsing the if statement.
|
||||
@ -612,7 +612,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
|
||||
|
||||
// Parse the condition.
|
||||
OwningExprResult CondExp(Actions);
|
||||
DeclPtrTy CondVar;
|
||||
Decl *CondVar = 0;
|
||||
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
|
||||
return StmtError();
|
||||
|
||||
@ -677,7 +677,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
|
||||
|
||||
// If the condition was invalid, discard the if statement. We could recover
|
||||
// better by replacing it with a valid expr, but don't do that yet.
|
||||
if (CondExp.isInvalid() && !CondVar.get())
|
||||
if (CondExp.isInvalid() && !CondVar)
|
||||
return StmtError();
|
||||
|
||||
// If the then or else stmt is invalid and the other is valid (and present),
|
||||
@ -738,7 +738,7 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
|
||||
|
||||
// Parse the condition.
|
||||
OwningExprResult Cond(Actions);
|
||||
DeclPtrTy CondVar;
|
||||
Decl *CondVar = 0;
|
||||
if (ParseParenExprOrCondition(Cond, CondVar, SwitchLoc, false))
|
||||
return StmtError();
|
||||
|
||||
@ -828,7 +828,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
|
||||
|
||||
// Parse the condition.
|
||||
OwningExprResult Cond(Actions);
|
||||
DeclPtrTy CondVar;
|
||||
Decl *CondVar = 0;
|
||||
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
|
||||
return StmtError();
|
||||
|
||||
@ -855,7 +855,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
|
||||
InnerScope.Exit();
|
||||
WhileScope.Exit();
|
||||
|
||||
if ((Cond.isInvalid() && !CondVar.get()) || Body.isInvalid())
|
||||
if ((Cond.isInvalid() && !CondVar) || Body.isInvalid())
|
||||
return StmtError();
|
||||
|
||||
return Actions.ActOnWhileStmt(WhileLoc, FullCond, CondVar, move(Body));
|
||||
@ -990,7 +990,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
|
||||
FullExprArg SecondPart(Actions);
|
||||
OwningExprResult Collection(Actions);
|
||||
FullExprArg ThirdPart(Actions);
|
||||
DeclPtrTy SecondVar;
|
||||
Decl *SecondVar = 0;
|
||||
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
Actions.CodeCompleteOrdinaryName(getCurScope(),
|
||||
@ -1067,7 +1067,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
|
||||
if (Tok.is(tok::semi)) {
|
||||
ConsumeToken();
|
||||
} else {
|
||||
if (!SecondPartIsInvalid || SecondVar.get())
|
||||
if (!SecondPartIsInvalid || SecondVar)
|
||||
Diag(Tok, diag::err_expected_semi_for);
|
||||
SkipUntil(tok::semi);
|
||||
}
|
||||
@ -1454,7 +1454,7 @@ bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<IdentifierInfo *> &Names,
|
||||
return true;
|
||||
}
|
||||
|
||||
Parser::DeclPtrTy Parser::ParseFunctionStatementBody(DeclPtrTy Decl) {
|
||||
Decl *Parser::ParseFunctionStatementBody(Decl *Decl) {
|
||||
assert(Tok.is(tok::l_brace));
|
||||
SourceLocation LBraceLoc = Tok.getLocation();
|
||||
|
||||
@ -1480,7 +1480,7 @@ Parser::DeclPtrTy Parser::ParseFunctionStatementBody(DeclPtrTy Decl) {
|
||||
/// function-try-block:
|
||||
/// 'try' ctor-initializer[opt] compound-statement handler-seq
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseFunctionTryBlock(DeclPtrTy Decl) {
|
||||
Decl *Parser::ParseFunctionTryBlock(Decl *Decl) {
|
||||
assert(Tok.is(tok::kw_try) && "Expected 'try'");
|
||||
SourceLocation TryLoc = ConsumeToken();
|
||||
|
||||
@ -1586,7 +1586,7 @@ Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
|
||||
|
||||
// exception-declaration is equivalent to '...' or a parameter-declaration
|
||||
// without default arguments.
|
||||
DeclPtrTy ExceptionDecl;
|
||||
Decl *ExceptionDecl = 0;
|
||||
if (Tok.isNot(tok::ellipsis)) {
|
||||
DeclSpec DS;
|
||||
if (ParseCXXTypeSpecifierSeq(DS))
|
||||
|
@ -21,7 +21,7 @@ using namespace clang;
|
||||
|
||||
/// \brief Parse a template declaration, explicit instantiation, or
|
||||
/// explicit specialization.
|
||||
Parser::DeclPtrTy
|
||||
Decl *
|
||||
Parser::ParseDeclarationStartingWithTemplate(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS) {
|
||||
@ -70,7 +70,7 @@ namespace {
|
||||
///
|
||||
/// explicit-specialization: [ C++ temp.expl.spec]
|
||||
/// 'template' '<' '>' declaration
|
||||
Parser::DeclPtrTy
|
||||
Decl *
|
||||
Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
SourceLocation &DeclEnd,
|
||||
AccessSpecifier AS) {
|
||||
@ -122,7 +122,7 @@ Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
TemplateLoc = ConsumeToken();
|
||||
} else {
|
||||
Diag(Tok.getLocation(), diag::err_expected_template);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse the '<' template-parameter-list '>'
|
||||
@ -134,7 +134,7 @@ Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
SkipUntil(tok::r_brace, true, true);
|
||||
if (Tok.is(tok::semi))
|
||||
ConsumeToken();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ParamLists.push_back(
|
||||
@ -180,7 +180,7 @@ Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
|
||||
/// declaration. Will be AS_none for namespace-scope declarations.
|
||||
///
|
||||
/// \returns the new declaration.
|
||||
Parser::DeclPtrTy
|
||||
Decl *
|
||||
Parser::ParseSingleDeclarationAfterTemplate(
|
||||
unsigned Context,
|
||||
const ParsedTemplateInfo &TemplateInfo,
|
||||
@ -193,7 +193,7 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||
if (Context == Declarator::MemberContext) {
|
||||
// We are parsing a member template.
|
||||
ParseCXXClassMemberDeclaration(AS, TemplateInfo, &DiagsFromTParams);
|
||||
return DeclPtrTy::make((void*)0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Parse the declaration specifiers, stealing the accumulated
|
||||
@ -208,7 +208,7 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||
|
||||
if (Tok.is(tok::semi)) {
|
||||
DeclEnd = ConsumeToken();
|
||||
DeclPtrTy Decl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||
Decl *Decl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||
DS.complete(Decl);
|
||||
return Decl;
|
||||
}
|
||||
@ -222,14 +222,14 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||
SkipUntil(tok::r_brace, true, true);
|
||||
if (Tok.is(tok::semi))
|
||||
ConsumeToken();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If we have a declaration or declarator list, handle it.
|
||||
if (isDeclarationAfterDeclarator()) {
|
||||
// Parse this declaration.
|
||||
DeclPtrTy ThisDecl = ParseDeclarationAfterDeclarator(DeclaratorInfo,
|
||||
TemplateInfo);
|
||||
Decl *ThisDecl = ParseDeclarationAfterDeclarator(DeclaratorInfo,
|
||||
TemplateInfo);
|
||||
|
||||
if (Tok.is(tok::comma)) {
|
||||
Diag(Tok, diag::err_multiple_template_declarators)
|
||||
@ -258,7 +258,7 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||
} else {
|
||||
SkipUntil(tok::semi);
|
||||
}
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo);
|
||||
}
|
||||
@ -268,7 +268,7 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||
else
|
||||
Diag(Tok, diag::err_invalid_token_after_toplevel_declarator);
|
||||
SkipUntil(tok::semi);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// ParseTemplateParameters - Parses a template-parameter-list enclosed in
|
||||
@ -316,7 +316,7 @@ bool
|
||||
Parser::ParseTemplateParameterList(unsigned Depth,
|
||||
TemplateParameterList &TemplateParams) {
|
||||
while (1) {
|
||||
if (DeclPtrTy TmpParam
|
||||
if (Decl *TmpParam
|
||||
= ParseTemplateParameter(Depth, TemplateParams.size())) {
|
||||
TemplateParams.push_back(TmpParam);
|
||||
} else {
|
||||
@ -421,8 +421,7 @@ bool Parser::isStartOfTemplateTypeParameter() {
|
||||
/// 'typename' identifier[opt] '=' type-id
|
||||
/// 'template' ...[opt][C++0x] '<' template-parameter-list '>' 'class' identifier[opt]
|
||||
/// 'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
|
||||
Parser::DeclPtrTy
|
||||
Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
Decl *Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
if (isStartOfTemplateTypeParameter())
|
||||
return ParseTypeParameter(Depth, Position);
|
||||
|
||||
@ -444,7 +443,7 @@ Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
/// 'class' identifier[opt] '=' type-id
|
||||
/// 'typename' ...[opt][C++0x] identifier[opt]
|
||||
/// 'typename' identifier[opt] '=' type-id
|
||||
Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
|
||||
Decl *Parser::ParseTypeParameter(unsigned Depth, unsigned Position) {
|
||||
assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
|
||||
"A type-parameter starts with 'class' or 'typename'");
|
||||
|
||||
@ -475,7 +474,7 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
|
||||
// don't consume this token.
|
||||
} else {
|
||||
Diag(Tok.getLocation(), diag::err_expected_ident);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Grab a default argument (if available).
|
||||
@ -499,7 +498,7 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
|
||||
/// type-parameter: [C++ temp.param]
|
||||
/// 'template' '<' template-parameter-list '>' 'class' identifier[opt]
|
||||
/// 'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
|
||||
Parser::DeclPtrTy
|
||||
Decl *
|
||||
Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
|
||||
|
||||
@ -511,7 +510,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
|
||||
if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
|
||||
RAngleLoc)) {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,7 +519,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
if (!Tok.is(tok::kw_class)) {
|
||||
Diag(Tok.getLocation(), diag::err_expected_class_before)
|
||||
<< PP.getSpelling(Tok);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
SourceLocation ClassLoc = ConsumeToken();
|
||||
|
||||
@ -535,7 +534,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
// don't consume this token.
|
||||
} else {
|
||||
Diag(Tok.getLocation(), diag::err_expected_ident);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
TemplateParamsTy *ParamList =
|
||||
@ -575,7 +574,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
/// template-parameter:
|
||||
/// ...
|
||||
/// parameter-declaration
|
||||
Parser::DeclPtrTy
|
||||
Decl *
|
||||
Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
SourceLocation StartLoc = Tok.getLocation();
|
||||
|
||||
@ -595,7 +594,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
|
||||
// TODO: This is currently a placeholder for some kind of Sema Error.
|
||||
Diag(Tok.getLocation(), diag::err_parse_error);
|
||||
SkipUntil(tok::comma, tok::greater, true, true);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If there is a default value, parse it.
|
||||
@ -1062,10 +1061,9 @@ Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
|
||||
/// 'extern' [opt] 'template' declaration
|
||||
///
|
||||
/// Note that the 'extern' is a GNU extension and C++0x feature.
|
||||
Parser::DeclPtrTy
|
||||
Parser::ParseExplicitInstantiation(SourceLocation ExternLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation &DeclEnd) {
|
||||
Decl *Parser::ParseExplicitInstantiation(SourceLocation ExternLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation &DeclEnd) {
|
||||
// This isn't really required here.
|
||||
ParsingDeclRAIIObject ParsingTemplateParams(*this);
|
||||
|
||||
|
@ -29,7 +29,7 @@ Parser::Parser(Preprocessor &pp, Action &actions)
|
||||
Actions.CurScope = 0;
|
||||
NumCachedScopes = 0;
|
||||
ParenCount = BracketCount = BraceCount = 0;
|
||||
ObjCImpDecl = DeclPtrTy();
|
||||
ObjCImpDecl = 0;
|
||||
|
||||
// Add #pragma handlers. These are removed and destroyed in the
|
||||
// destructor.
|
||||
@ -408,7 +408,7 @@ void Parser::ParseTranslationUnit() {
|
||||
Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr) {
|
||||
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
||||
|
||||
DeclPtrTy SingleDecl;
|
||||
Decl *SingleDecl = 0;
|
||||
switch (Tok.getKind()) {
|
||||
case tok::semi:
|
||||
if (!getLang().CPlusPlus0x)
|
||||
@ -561,7 +561,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
|
||||
// declaration-specifiers init-declarator-list[opt] ';'
|
||||
if (Tok.is(tok::semi)) {
|
||||
ConsumeToken();
|
||||
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||
Decl *TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||
DS.complete(TheDecl);
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
@ -585,7 +585,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
|
||||
if (DS.SetTypeSpecType(DeclSpec::TST_unspecified, AtLoc, PrevSpec, DiagID))
|
||||
Diag(AtLoc, DiagID) << PrevSpec;
|
||||
|
||||
DeclPtrTy TheDecl;
|
||||
Decl *TheDecl = 0;
|
||||
if (Tok.isObjCAtKeyword(tok::objc_protocol))
|
||||
TheDecl = ParseObjCAtProtocolDeclaration(AtLoc, DS.getAttributes());
|
||||
else
|
||||
@ -599,7 +599,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
|
||||
if (Tok.is(tok::string_literal) && getLang().CPlusPlus &&
|
||||
DS.getStorageClassSpec() == DeclSpec::SCS_extern &&
|
||||
DS.getParsedSpecifiers() == DeclSpec::PQ_StorageClassSpecifier) {
|
||||
DeclPtrTy TheDecl = ParseLinkage(DS, Declarator::FileContext);
|
||||
Decl *TheDecl = ParseLinkage(DS, Declarator::FileContext);
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
|
||||
@ -627,7 +627,7 @@ Parser::ParseDeclarationOrFunctionDefinition(AttributeList *Attr,
|
||||
/// [C++] function-definition: [C++ 8.4]
|
||||
/// decl-specifier-seq[opt] declarator function-try-block
|
||||
///
|
||||
Parser::DeclPtrTy Parser::ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
const ParsedTemplateInfo &TemplateInfo) {
|
||||
const DeclaratorChunk &FnTypeInfo = D.getTypeObject(0);
|
||||
assert(FnTypeInfo.Kind == DeclaratorChunk::Function &&
|
||||
@ -663,7 +663,7 @@ Parser::DeclPtrTy Parser::ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
|
||||
// If we didn't find the '{', bail out.
|
||||
if (Tok.isNot(tok::l_brace))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Enter a scope for the function body.
|
||||
@ -671,7 +671,7 @@ Parser::DeclPtrTy Parser::ParseFunctionDefinition(ParsingDeclarator &D,
|
||||
|
||||
// Tell the actions module that we have entered a function definition with the
|
||||
// specified Declarator for the function.
|
||||
DeclPtrTy Res = TemplateInfo.TemplateParams?
|
||||
Decl *Res = TemplateInfo.TemplateParams?
|
||||
Actions.ActOnStartOfFunctionTemplateDef(getCurScope(),
|
||||
Action::MultiTemplateParamsArg(Actions,
|
||||
TemplateInfo.TemplateParams->data(),
|
||||
@ -762,7 +762,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
|
||||
}
|
||||
|
||||
// Ask the actions module to compute the type for this declarator.
|
||||
Action::DeclPtrTy Param =
|
||||
Decl *Param =
|
||||
Actions.ActOnParamDeclarator(getCurScope(), ParmDeclarator);
|
||||
|
||||
if (Param &&
|
||||
|
@ -11,6 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Sema/Action.h"
|
||||
#include "clang/Sema/DeclSpec.h"
|
||||
#include "clang/Sema/Scope.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
@ -69,35 +70,35 @@ Action::ObjCMessageKind Action::getObjCMessageKind(Scope *S,
|
||||
}
|
||||
|
||||
// Defined out-of-line here because of dependecy on AttributeList
|
||||
Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation NamespcLoc,
|
||||
CXXScopeSpec &SS,
|
||||
SourceLocation IdentLoc,
|
||||
IdentifierInfo *NamespcName,
|
||||
AttributeList *AttrList) {
|
||||
Decl *Action::ActOnUsingDirective(Scope *CurScope,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation NamespcLoc,
|
||||
CXXScopeSpec &SS,
|
||||
SourceLocation IdentLoc,
|
||||
IdentifierInfo *NamespcName,
|
||||
AttributeList *AttrList) {
|
||||
|
||||
// FIXME: Parser seems to assume that Action::ActOn* takes ownership over
|
||||
// passed AttributeList, however other actions don't free it, is it
|
||||
// temporary state or bug?
|
||||
delete AttrList;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Defined out-of-line here because of dependency on AttributeList
|
||||
Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope,
|
||||
AccessSpecifier AS,
|
||||
bool HasUsingKeyword,
|
||||
SourceLocation UsingLoc,
|
||||
CXXScopeSpec &SS,
|
||||
UnqualifiedId &Name,
|
||||
AttributeList *AttrList,
|
||||
bool IsTypeName,
|
||||
SourceLocation TypenameLoc) {
|
||||
Decl *Action::ActOnUsingDeclaration(Scope *CurScope,
|
||||
AccessSpecifier AS,
|
||||
bool HasUsingKeyword,
|
||||
SourceLocation UsingLoc,
|
||||
CXXScopeSpec &SS,
|
||||
UnqualifiedId &Name,
|
||||
AttributeList *AttrList,
|
||||
bool IsTypeName,
|
||||
SourceLocation TypenameLoc) {
|
||||
|
||||
// FIXME: Parser seems to assume that Action::ActOn* takes ownership over
|
||||
// passed AttributeList, however other actions don't free it, is it
|
||||
// temporary state or bug?
|
||||
delete AttrList;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
@ -407,14 +407,14 @@ bool DeclSpec::SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeclSpec::setProtocolQualifiers(const ActionBase::DeclPtrTy *Protos,
|
||||
void DeclSpec::setProtocolQualifiers(Decl * const *Protos,
|
||||
unsigned NP,
|
||||
SourceLocation *ProtoLocs,
|
||||
SourceLocation LAngleLoc) {
|
||||
if (NP == 0) return;
|
||||
ProtocolQualifiers = new ActionBase::DeclPtrTy[NP];
|
||||
ProtocolQualifiers = new Decl*[NP];
|
||||
ProtocolLocs = new SourceLocation[NP];
|
||||
memcpy((void*)ProtocolQualifiers, Protos, sizeof(ActionBase::DeclPtrTy)*NP);
|
||||
memcpy((void*)ProtocolQualifiers, Protos, sizeof(Decl*)*NP);
|
||||
memcpy(ProtocolLocs, ProtoLocs, sizeof(SourceLocation)*NP);
|
||||
NumProtocolQualifiers = NP;
|
||||
ProtocolLAngleLoc = LAngleLoc;
|
||||
|
@ -111,7 +111,7 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
|
||||
((DeclContext *)S->getEntity())->isTransparentContext())
|
||||
S = S->getParent();
|
||||
|
||||
if (S->isDeclScope(Action::DeclPtrTy::make(D)))
|
||||
if (S->isDeclScope(D))
|
||||
return true;
|
||||
if (LangOpt.CPlusPlus) {
|
||||
// C++ 3.3.2p3:
|
||||
@ -128,7 +128,7 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
|
||||
//
|
||||
assert(S->getParent() && "No TUScope?");
|
||||
if (S->getParent()->getFlags() & Scope::ControlScope)
|
||||
return S->getParent()->isDeclScope(Action::DeclPtrTy::make(D));
|
||||
return S->getParent()->isDeclScope(D);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2713,8 +2713,8 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn,
|
||||
Results.size());
|
||||
}
|
||||
|
||||
void Sema::CodeCompleteInitializer(Scope *S, DeclPtrTy D) {
|
||||
ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D.getAs<Decl>());
|
||||
void Sema::CodeCompleteInitializer(Scope *S, Decl *D) {
|
||||
ValueDecl *VD = dyn_cast_or_null<ValueDecl>(D);
|
||||
if (!VD) {
|
||||
CodeCompleteOrdinaryName(S, PCC_Expression);
|
||||
return;
|
||||
@ -2988,7 +2988,7 @@ static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) {
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
|
||||
void Sema::CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl,
|
||||
void Sema::CodeCompleteObjCAtDirective(Scope *S, Decl *ObjCImpDecl,
|
||||
bool InInterface) {
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
ResultBuilder Results(*this);
|
||||
@ -3310,17 +3310,16 @@ static void AddObjCMethods(ObjCContainerDecl *Container,
|
||||
}
|
||||
|
||||
|
||||
void Sema::CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
DeclPtrTy *Methods,
|
||||
void Sema::CodeCompleteObjCPropertyGetter(Scope *S, Decl *ClassDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods) {
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
|
||||
// Try to find the interface where getters might live.
|
||||
ObjCInterfaceDecl *Class
|
||||
= dyn_cast_or_null<ObjCInterfaceDecl>(ClassDecl.getAs<Decl>());
|
||||
ObjCInterfaceDecl *Class = dyn_cast_or_null<ObjCInterfaceDecl>(ClassDecl);
|
||||
if (!Class) {
|
||||
if (ObjCCategoryDecl *Category
|
||||
= dyn_cast_or_null<ObjCCategoryDecl>(ClassDecl.getAs<Decl>()))
|
||||
= dyn_cast_or_null<ObjCCategoryDecl>(ClassDecl))
|
||||
Class = Category->getClassInterface();
|
||||
|
||||
if (!Class)
|
||||
@ -3335,7 +3334,7 @@ void Sema::CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
// pushed into DeclContexts early enough. Argh!
|
||||
for (unsigned I = 0; I != NumMethods; ++I) {
|
||||
if (ObjCMethodDecl *Method
|
||||
= dyn_cast_or_null<ObjCMethodDecl>(Methods[I].getAs<Decl>()))
|
||||
= dyn_cast_or_null<ObjCMethodDecl>(Methods[I]))
|
||||
if (Method->isInstanceMethod() &&
|
||||
isAcceptableObjCMethod(Method, MK_ZeroArgSelector, 0, 0)) {
|
||||
Result R = Result(Method, 0);
|
||||
@ -3351,17 +3350,17 @@ void Sema::CodeCompleteObjCPropertyGetter(Scope *S, DeclPtrTy ClassDecl,
|
||||
Results.data(),Results.size());
|
||||
}
|
||||
|
||||
void Sema::CodeCompleteObjCPropertySetter(Scope *S, DeclPtrTy ObjCImplDecl,
|
||||
DeclPtrTy *Methods,
|
||||
void Sema::CodeCompleteObjCPropertySetter(Scope *S, Decl *ObjCImplDecl,
|
||||
Decl **Methods,
|
||||
unsigned NumMethods) {
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
|
||||
// Try to find the interface where setters might live.
|
||||
ObjCInterfaceDecl *Class
|
||||
= dyn_cast_or_null<ObjCInterfaceDecl>(ObjCImplDecl.getAs<Decl>());
|
||||
= dyn_cast_or_null<ObjCInterfaceDecl>(ObjCImplDecl);
|
||||
if (!Class) {
|
||||
if (ObjCCategoryDecl *Category
|
||||
= dyn_cast_or_null<ObjCCategoryDecl>(ObjCImplDecl.getAs<Decl>()))
|
||||
= dyn_cast_or_null<ObjCCategoryDecl>(ObjCImplDecl))
|
||||
Class = Category->getClassInterface();
|
||||
|
||||
if (!Class)
|
||||
@ -3376,7 +3375,7 @@ void Sema::CodeCompleteObjCPropertySetter(Scope *S, DeclPtrTy ObjCImplDecl,
|
||||
// pushed into DeclContexts early enough. Argh!
|
||||
for (unsigned I = 0; I != NumMethods; ++I) {
|
||||
if (ObjCMethodDecl *Method
|
||||
= dyn_cast_or_null<ObjCMethodDecl>(Methods[I].getAs<Decl>()))
|
||||
= dyn_cast_or_null<ObjCMethodDecl>(Methods[I]))
|
||||
if (Method->isInstanceMethod() &&
|
||||
isAcceptableObjCMethod(Method, MK_OneArgSelector, 0, 0)) {
|
||||
Result R = Result(Method, 0);
|
||||
@ -3932,13 +3931,13 @@ void Sema::CodeCompleteObjCImplementationCategory(Scope *S,
|
||||
Results.data(),Results.size());
|
||||
}
|
||||
|
||||
void Sema::CodeCompleteObjCPropertyDefinition(Scope *S, DeclPtrTy ObjCImpDecl) {
|
||||
void Sema::CodeCompleteObjCPropertyDefinition(Scope *S, Decl *ObjCImpDecl) {
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
ResultBuilder Results(*this);
|
||||
|
||||
// Figure out where this @synthesize lives.
|
||||
ObjCContainerDecl *Container
|
||||
= dyn_cast_or_null<ObjCContainerDecl>(ObjCImpDecl.getAs<Decl>());
|
||||
= dyn_cast_or_null<ObjCContainerDecl>(ObjCImpDecl);
|
||||
if (!Container ||
|
||||
(!isa<ObjCImplementationDecl>(Container) &&
|
||||
!isa<ObjCCategoryImplDecl>(Container)))
|
||||
@ -3969,13 +3968,13 @@ void Sema::CodeCompleteObjCPropertyDefinition(Scope *S, DeclPtrTy ObjCImpDecl) {
|
||||
|
||||
void Sema::CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
|
||||
IdentifierInfo *PropertyName,
|
||||
DeclPtrTy ObjCImpDecl) {
|
||||
Decl *ObjCImpDecl) {
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
ResultBuilder Results(*this);
|
||||
|
||||
// Figure out where this @synthesize lives.
|
||||
ObjCContainerDecl *Container
|
||||
= dyn_cast_or_null<ObjCContainerDecl>(ObjCImpDecl.getAs<Decl>());
|
||||
= dyn_cast_or_null<ObjCContainerDecl>(ObjCImpDecl);
|
||||
if (!Container ||
|
||||
(!isa<ObjCImplementationDecl>(Container) &&
|
||||
!isa<ObjCCategoryImplDecl>(Container)))
|
||||
@ -4086,7 +4085,7 @@ static void FindImplementableMethods(ASTContext &Context,
|
||||
void Sema::CodeCompleteObjCMethodDecl(Scope *S,
|
||||
bool IsInstanceMethod,
|
||||
TypeTy *ReturnTy,
|
||||
DeclPtrTy IDecl) {
|
||||
Decl *IDecl) {
|
||||
// Determine the return type of the method we're declaring, if
|
||||
// provided.
|
||||
QualType ReturnType = GetTypeFromParser(ReturnTy);
|
||||
@ -4094,7 +4093,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
|
||||
// Determine where we should start searching for methods, and where we
|
||||
ObjCContainerDecl *SearchDecl = 0, *CurrentDecl = 0;
|
||||
bool IsInImplementation = false;
|
||||
if (Decl *D = IDecl.getAs<Decl>()) {
|
||||
if (Decl *D = IDecl) {
|
||||
if (ObjCImplementationDecl *Impl = dyn_cast<ObjCImplementationDecl>(D)) {
|
||||
SearchDecl = Impl->getClassInterface();
|
||||
CurrentDecl = Impl;
|
||||
|
@ -38,15 +38,14 @@ using namespace clang;
|
||||
|
||||
/// getDeclName - Return a pretty name for the specified decl if possible, or
|
||||
/// an empty string if not. This is used for pretty crash reporting.
|
||||
std::string Sema::getDeclName(DeclPtrTy d) {
|
||||
Decl *D = d.getAs<Decl>();
|
||||
std::string Sema::getDeclName(Decl *D) {
|
||||
if (NamedDecl *DN = dyn_cast_or_null<NamedDecl>(D))
|
||||
return DN->getQualifiedNameAsString();
|
||||
return "";
|
||||
}
|
||||
|
||||
Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(DeclPtrTy Ptr) {
|
||||
return DeclGroupPtrTy::make(DeclGroupRef(Ptr.getAs<Decl>()));
|
||||
Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr) {
|
||||
return DeclGroupPtrTy::make(DeclGroupRef(Ptr));
|
||||
}
|
||||
|
||||
/// \brief If the identifier refers to a type name within this scope,
|
||||
@ -462,8 +461,8 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) {
|
||||
IdentifierResolver::iterator I = IdResolver.begin(D->getDeclName()),
|
||||
IEnd = IdResolver.end();
|
||||
for (; I != IEnd; ++I) {
|
||||
if (S->isDeclScope(DeclPtrTy::make(*I)) && D->declarationReplaces(*I)) {
|
||||
S->RemoveDecl(DeclPtrTy::make(*I));
|
||||
if (S->isDeclScope(*I) && D->declarationReplaces(*I)) {
|
||||
S->RemoveDecl(*I);
|
||||
IdResolver.RemoveDecl(*I);
|
||||
|
||||
// Should only need to replace one decl.
|
||||
@ -471,7 +470,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) {
|
||||
}
|
||||
}
|
||||
|
||||
S->AddDecl(DeclPtrTy::make(D));
|
||||
S->AddDecl(D);
|
||||
IdResolver.AddDecl(D);
|
||||
}
|
||||
|
||||
@ -673,7 +672,7 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
|
||||
|
||||
for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
|
||||
I != E; ++I) {
|
||||
Decl *TmpD = (*I).getAs<Decl>();
|
||||
Decl *TmpD = (*I);
|
||||
assert(TmpD && "This decl didn't get pushed??");
|
||||
|
||||
assert(isa<NamedDecl>(TmpD) && "Decl isn't NamedDecl?");
|
||||
@ -1581,8 +1580,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
|
||||
|
||||
/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
|
||||
/// no declarator (e.g. "struct foo;") is parsed.
|
||||
Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
DeclSpec &DS) {
|
||||
Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
DeclSpec &DS) {
|
||||
// FIXME: Error on auto/register at file scope
|
||||
// FIXME: Error on inline/virtual/explicit
|
||||
// FIXME: Warn on useless __thread
|
||||
@ -1598,7 +1597,7 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
TagD = static_cast<Decl *>(DS.getTypeRep());
|
||||
|
||||
if (!TagD) // We probably had an error
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
// Note that the above type specs guarantee that the
|
||||
// type rep is a Decl, whereas in many of the others
|
||||
@ -1619,7 +1618,7 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
// If we're dealing with a class template decl, assume that the
|
||||
// template routines are handling it.
|
||||
if (TagD && isa<ClassTemplateDecl>(TagD))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
return ActOnFriendTypeDecl(S, DS, MultiTemplateParamsArg(*this, 0, 0));
|
||||
}
|
||||
|
||||
@ -1640,7 +1639,7 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
// about them.
|
||||
// FIXME: Should we support Microsoft's extensions in this area?
|
||||
if (Record->getDeclName() && getLangOptions().Microsoft)
|
||||
return DeclPtrTy::make(Tag);
|
||||
return Tag;
|
||||
}
|
||||
|
||||
if (getLangOptions().CPlusPlus &&
|
||||
@ -1659,14 +1658,14 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
||||
Tag && isa<EnumDecl>(Tag)) {
|
||||
Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name)
|
||||
<< DS.getSourceRange();
|
||||
return DeclPtrTy::make(Tag);
|
||||
return Tag;
|
||||
}
|
||||
|
||||
Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators)
|
||||
<< DS.getSourceRange();
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(TagD);
|
||||
return TagD;
|
||||
}
|
||||
|
||||
/// We are trying to inject an anonymous member into the given scope;
|
||||
@ -1743,7 +1742,7 @@ static bool InjectAnonymousStructOrUnionMembers(Sema &SemaRef, Scope *S,
|
||||
// considered to have been defined in the scope in which the
|
||||
// anonymous union is declared.
|
||||
Owner->makeDeclVisibleInContext(*F);
|
||||
S->AddDecl(Sema::DeclPtrTy::make(*F));
|
||||
S->AddDecl(*F);
|
||||
SemaRef.IdResolver.AddDecl(*F);
|
||||
|
||||
// That includes picking up the appropriate access specifier.
|
||||
@ -1804,9 +1803,9 @@ StorageClassSpecToFunctionDeclStorageClass(DeclSpec::SCS StorageClassSpec) {
|
||||
/// anonymous structure or union. Anonymous unions are a C++ feature
|
||||
/// (C++ [class.union]) and a GNU C extension; anonymous structures
|
||||
/// are a GNU C and GNU C++ extension.
|
||||
Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
AccessSpecifier AS,
|
||||
RecordDecl *Record) {
|
||||
Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
AccessSpecifier AS,
|
||||
RecordDecl *Record) {
|
||||
DeclContext *Owner = Record->getDeclContext();
|
||||
|
||||
// Diagnose whether this anonymous struct/union is an extension.
|
||||
@ -1973,7 +1972,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
if (Invalid)
|
||||
Anon->setInvalidDecl();
|
||||
|
||||
return DeclPtrTy::make(Anon);
|
||||
return Anon;
|
||||
}
|
||||
|
||||
|
||||
@ -2172,10 +2171,9 @@ static bool RebuildDeclaratorInCurrentInstantiation(Sema &S, Declarator &D,
|
||||
return false;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParamLists,
|
||||
bool IsFunctionDefinition) {
|
||||
Decl *Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParamLists,
|
||||
bool IsFunctionDefinition) {
|
||||
// TODO: consider using NameInfo for diagnostic.
|
||||
DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
|
||||
DeclarationName Name = NameInfo.getName();
|
||||
@ -2187,7 +2185,7 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
Diag(D.getDeclSpec().getSourceRange().getBegin(),
|
||||
diag::err_declarator_need_ident)
|
||||
<< D.getDeclSpec().getSourceRange() << D.getSourceRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The scope passed in may not be a decl scope. Zip up the scope tree until
|
||||
@ -2211,14 +2209,14 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
diag::err_template_qualified_declarator_no_match)
|
||||
<< (NestedNameSpecifier*)D.getCXXScopeSpec().getScopeRep()
|
||||
<< D.getCXXScopeSpec().getRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool IsDependentContext = DC->isDependentContext();
|
||||
|
||||
if (!IsDependentContext &&
|
||||
RequireCompleteDeclContext(D.getCXXScopeSpec(), DC))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (isa<CXXRecordDecl>(DC) && !cast<CXXRecordDecl>(DC)->hasDefinition()) {
|
||||
Diag(D.getIdentifierLoc(),
|
||||
@ -2345,7 +2343,7 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef) {
|
||||
if (TemplateParamLists.size()) {
|
||||
Diag(D.getIdentifierLoc(), diag::err_template_typedef);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
New = ActOnTypedefDeclarator(S, D, DC, R, TInfo, Previous, Redeclaration);
|
||||
@ -2360,14 +2358,14 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
|
||||
}
|
||||
|
||||
if (New == 0)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
// If this has an identifier and is not an invalid redeclaration or
|
||||
// function template specialization, add it to the scope stack.
|
||||
if (New->getDeclName() && !(Redeclaration && New->isInvalidDecl()))
|
||||
PushOnScopeChains(New, S);
|
||||
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
/// TryToFixInvalidVariablyModifiedType - Helper method to turn variable array
|
||||
@ -2455,11 +2453,11 @@ Sema::RegisterLocallyScopedExternCDecl(NamedDecl *ND,
|
||||
if (S && IdResolver.ReplaceDecl(PrevDecl, ND)) {
|
||||
// The previous declaration was found on the identifer resolver
|
||||
// chain, so remove it from its scope.
|
||||
while (S && !S->isDeclScope(DeclPtrTy::make(PrevDecl)))
|
||||
while (S && !S->isDeclScope(PrevDecl))
|
||||
S = S->getParent();
|
||||
|
||||
if (S)
|
||||
S->RemoveDecl(DeclPtrTy::make(PrevDecl));
|
||||
S->RemoveDecl(PrevDecl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3478,9 +3476,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||
// already checks for that case.
|
||||
if (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 &&
|
||||
FTI.ArgInfo[0].Param &&
|
||||
FTI.ArgInfo[0].Param.getAs<ParmVarDecl>()->getType()->isVoidType()) {
|
||||
cast<ParmVarDecl>(FTI.ArgInfo[0].Param)->getType()->isVoidType()) {
|
||||
// Empty arg list, don't push any params.
|
||||
ParmVarDecl *Param = FTI.ArgInfo[0].Param.getAs<ParmVarDecl>();
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[0].Param);
|
||||
|
||||
// In C++, the empty parameter-type-list must be spelled "void"; a
|
||||
// typedef of void is not permitted.
|
||||
@ -3490,7 +3488,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||
// FIXME: Leaks decl?
|
||||
} else if (FTI.NumArgs > 0 && FTI.ArgInfo[0].Param != 0) {
|
||||
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
|
||||
ParmVarDecl *Param = FTI.ArgInfo[i].Param.getAs<ParmVarDecl>();
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[i].Param);
|
||||
assert(Param->getDeclContext() != NewFD && "Was set before ?");
|
||||
Param->setDeclContext(NewFD);
|
||||
Params.push_back(Param);
|
||||
@ -4038,15 +4036,14 @@ bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init) {
|
||||
void Sema::AddInitializerToDecl(Decl *dcl, ExprArg init) {
|
||||
AddInitializerToDecl(dcl, move(init), /*DirectInit=*/false);
|
||||
}
|
||||
|
||||
/// AddInitializerToDecl - Adds the initializer Init to the
|
||||
/// declaration dcl. If DirectInit is true, this is C++ direct
|
||||
/// initialization rather than copy initialization.
|
||||
void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
|
||||
Decl *RealDecl = dcl.getAs<Decl>();
|
||||
void Sema::AddInitializerToDecl(Decl *RealDecl, ExprArg init, bool DirectInit) {
|
||||
// If there is no declaration, there was an error parsing it. Just ignore
|
||||
// the initializer.
|
||||
if (RealDecl == 0)
|
||||
@ -4263,10 +4260,9 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
|
||||
/// ActOnInitializerError - Given that there was an error parsing an
|
||||
/// initializer for the given declaration, try to return to some form
|
||||
/// of sanity.
|
||||
void Sema::ActOnInitializerError(DeclPtrTy dcl) {
|
||||
void Sema::ActOnInitializerError(Decl *D) {
|
||||
// Our main concern here is re-establishing invariants like "a
|
||||
// variable's type is either dependent or complete".
|
||||
Decl *D = dcl.getAs<Decl>();
|
||||
if (!D || D->isInvalidDecl()) return;
|
||||
|
||||
VarDecl *VD = dyn_cast<VarDecl>(D);
|
||||
@ -4295,10 +4291,8 @@ void Sema::ActOnInitializerError(DeclPtrTy dcl) {
|
||||
// though.
|
||||
}
|
||||
|
||||
void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
|
||||
void Sema::ActOnUninitializedDecl(Decl *RealDecl,
|
||||
bool TypeContainsUndeducedAuto) {
|
||||
Decl *RealDecl = dcl.getAs<Decl>();
|
||||
|
||||
// If there is no declaration, there was an error parsing it. Just ignore it.
|
||||
if (RealDecl == 0)
|
||||
return;
|
||||
@ -4471,7 +4465,7 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
|
||||
}
|
||||
|
||||
Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
||||
DeclPtrTy *Group,
|
||||
Decl **Group,
|
||||
unsigned NumDecls) {
|
||||
llvm::SmallVector<Decl*, 8> Decls;
|
||||
|
||||
@ -4479,7 +4473,7 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
||||
Decls.push_back((Decl*)DS.getTypeRep());
|
||||
|
||||
for (unsigned i = 0; i != NumDecls; ++i)
|
||||
if (Decl *D = Group[i].getAs<Decl>())
|
||||
if (Decl *D = Group[i])
|
||||
Decls.push_back(D);
|
||||
|
||||
return DeclGroupPtrTy::make(DeclGroupRef::Create(Context,
|
||||
@ -4489,8 +4483,7 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
||||
|
||||
/// ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator()
|
||||
/// to introduce parameters into function prototype scope.
|
||||
Sema::DeclPtrTy
|
||||
Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
const DeclSpec &DS = D.getDeclSpec();
|
||||
|
||||
// Verify C99 6.7.5.3p2: The only SCS allowed is 'register'.
|
||||
@ -4539,7 +4532,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl);
|
||||
// Just pretend that we didn't see the previous declaration.
|
||||
PrevDecl = 0;
|
||||
} else if (S->isDeclScope(DeclPtrTy::make(PrevDecl))) {
|
||||
} else if (S->isDeclScope(PrevDecl)) {
|
||||
Diag(D.getIdentifierLoc(), diag::err_param_redefinition) << II;
|
||||
Diag(PrevDecl->getLocation(), diag::note_previous_declaration);
|
||||
|
||||
@ -4570,7 +4563,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
}
|
||||
|
||||
// Add the parameter declaration into this scope.
|
||||
S->AddDecl(DeclPtrTy::make(New));
|
||||
S->AddDecl(New);
|
||||
if (II)
|
||||
IdResolver.AddDecl(New);
|
||||
|
||||
@ -4579,7 +4572,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
|
||||
if (New->hasAttr<BlocksAttr>()) {
|
||||
Diag(New->getLocation(), diag::err_block_on_nonlocal);
|
||||
}
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
/// \brief Synthesizes a variable for a parameter arising from a
|
||||
@ -4668,8 +4661,8 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
|
||||
}
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope,
|
||||
Declarator &D) {
|
||||
Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope,
|
||||
Declarator &D) {
|
||||
assert(getCurFunctionDecl() == 0 && "Function parsing confused");
|
||||
assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
|
||||
"Not a function declarator!");
|
||||
@ -4681,9 +4674,9 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope,
|
||||
|
||||
Scope *ParentScope = FnBodyScope->getParent();
|
||||
|
||||
DeclPtrTy DP = HandleDeclarator(ParentScope, D,
|
||||
MultiTemplateParamsArg(*this),
|
||||
/*IsFunctionDefinition=*/true);
|
||||
Decl *DP = HandleDeclarator(ParentScope, D,
|
||||
MultiTemplateParamsArg(*this),
|
||||
/*IsFunctionDefinition=*/true);
|
||||
return ActOnStartOfFunctionDef(FnBodyScope, DP);
|
||||
}
|
||||
|
||||
@ -4731,7 +4724,7 @@ static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD) {
|
||||
return MissingPrototype;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
|
||||
// Clear the last template instantiation error context.
|
||||
LastTemplateInstantiationErrorContext = ActiveTemplateInstantiation();
|
||||
|
||||
@ -4739,11 +4732,10 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
return D;
|
||||
FunctionDecl *FD = 0;
|
||||
|
||||
if (FunctionTemplateDecl *FunTmpl
|
||||
= dyn_cast<FunctionTemplateDecl>(D.getAs<Decl>()))
|
||||
if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(D))
|
||||
FD = FunTmpl->getTemplatedDecl();
|
||||
else
|
||||
FD = cast<FunctionDecl>(D.getAs<Decl>());
|
||||
FD = cast<FunctionDecl>(D);
|
||||
|
||||
// Enter a new function scope
|
||||
PushFunctionScope();
|
||||
@ -4816,7 +4808,7 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
diag::err_attribute_can_be_applied_only_to_symbol_declaration)
|
||||
<< "dllimport";
|
||||
FD->setInvalidDecl();
|
||||
return DeclPtrTy::make(FD);
|
||||
return FD;
|
||||
}
|
||||
|
||||
// Visual C++ appears to not think this is an issue, so only issue
|
||||
@ -4830,7 +4822,7 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
<< FD->getName() << "dllimport";
|
||||
}
|
||||
}
|
||||
return DeclPtrTy::make(FD);
|
||||
return FD;
|
||||
}
|
||||
|
||||
/// \brief Given the set of return statements within a function body,
|
||||
@ -4865,13 +4857,12 @@ static void ComputeNRVO(Stmt *Body, ReturnStmt **Returns, unsigned NumReturns) {
|
||||
const_cast<VarDecl*>(NRVOCandidate)->setNRVOVariable(true);
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
|
||||
Decl *Sema::ActOnFinishFunctionBody(Decl *D, StmtArg BodyArg) {
|
||||
return ActOnFinishFunctionBody(D, move(BodyArg), false);
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
||||
bool IsInstantiation) {
|
||||
Decl *dcl = D.getAs<Decl>();
|
||||
Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, StmtArg BodyArg,
|
||||
bool IsInstantiation) {
|
||||
Stmt *Body = BodyArg.takeAs<Stmt>();
|
||||
|
||||
FunctionDecl *FD = 0;
|
||||
@ -4911,7 +4902,7 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
||||
if (!MD->isInvalidDecl())
|
||||
DiagnoseUnusedParameters(MD->param_begin(), MD->param_end());
|
||||
} else {
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Verify and clean out per-function state.
|
||||
@ -5010,7 +5001,7 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg,
|
||||
if (getDiagnostics().hasErrorOccurred())
|
||||
ExprTemporaries.clear();
|
||||
|
||||
return D;
|
||||
return dcl;
|
||||
}
|
||||
|
||||
/// ImplicitlyDefineFunction - An undeclared identifier was used in a function
|
||||
@ -5056,8 +5047,7 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
|
||||
DeclContext *PrevDC = CurContext;
|
||||
CurContext = Context.getTranslationUnitDecl();
|
||||
|
||||
FunctionDecl *FD =
|
||||
dyn_cast<FunctionDecl>(ActOnDeclarator(TUScope, D).getAs<Decl>());
|
||||
FunctionDecl *FD = dyn_cast<FunctionDecl>(ActOnDeclarator(TUScope, D));
|
||||
FD->setImplicit();
|
||||
|
||||
CurContext = PrevDC;
|
||||
@ -5224,7 +5214,7 @@ bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous,
|
||||
/// former case, Name will be non-null. In the later case, Name will be null.
|
||||
/// TagSpec indicates what kind of tag this is. TUK indicates whether this is a
|
||||
/// reference/declaration/definition of a tag.
|
||||
Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
SourceLocation KWLoc, CXXScopeSpec &SS,
|
||||
IdentifierInfo *Name, SourceLocation NameLoc,
|
||||
AttributeList *Attr, AccessSpecifier AS,
|
||||
@ -5256,7 +5246,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
// This is a declaration or definition of a class template (which may
|
||||
// be a member of another template).
|
||||
if (Invalid)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
OwnedDecl = false;
|
||||
DeclResult Result = CheckClassTemplate(S, TagSpec, TUK, KWLoc,
|
||||
@ -5299,26 +5289,26 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
DC = computeDeclContext(SS, false);
|
||||
if (!DC) {
|
||||
IsDependent = true;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
DC = computeDeclContext(SS, true);
|
||||
if (!DC) {
|
||||
Diag(SS.getRange().getBegin(), diag::err_dependent_nested_name_spec)
|
||||
<< SS.getRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (RequireCompleteDeclContext(SS, DC))
|
||||
return DeclPtrTy::make((Decl *)0);
|
||||
return 0;
|
||||
|
||||
SearchDC = DC;
|
||||
// Look-up name inside 'foo::'.
|
||||
LookupQualifiedName(Previous, DC);
|
||||
|
||||
if (Previous.isAmbiguous())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (Previous.empty()) {
|
||||
// Name lookup did not find anything. However, if the
|
||||
@ -5328,7 +5318,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
// this as a dependent elaborated-type-specifier.
|
||||
if (Previous.wasNotFoundInCurrentInstantiation()) {
|
||||
IsDependent = true;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// A tag 'foo::bar' must already exist.
|
||||
@ -5348,7 +5338,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
|
||||
// Note: there used to be some attempt at recovery here.
|
||||
if (Previous.isAmbiguous())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (!getLangOptions().CPlusPlus && TUK != TUK_Reference) {
|
||||
// FIXME: This makes sure that we ignore the contexts associated
|
||||
@ -5514,7 +5504,7 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
// need to be changed with DeclGroups.
|
||||
if ((TUK == TUK_Reference && !PrevTagDecl->getFriendObjectKind()) ||
|
||||
TUK == TUK_Friend)
|
||||
return DeclPtrTy::make(PrevTagDecl);
|
||||
return PrevTagDecl;
|
||||
|
||||
// Diagnose attempts to redefine a tag.
|
||||
if (TUK == TUK_Definition) {
|
||||
@ -5762,21 +5752,21 @@ CreateNewDecl:
|
||||
Context.setFILEDecl(New);
|
||||
|
||||
OwnedDecl = true;
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
void Sema::ActOnTagStartDefinition(Scope *S, DeclPtrTy TagD) {
|
||||
void Sema::ActOnTagStartDefinition(Scope *S, Decl *TagD) {
|
||||
AdjustDeclIfTemplate(TagD);
|
||||
TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>());
|
||||
TagDecl *Tag = cast<TagDecl>(TagD);
|
||||
|
||||
// Enter the tag context.
|
||||
PushDeclContext(S, Tag);
|
||||
}
|
||||
|
||||
void Sema::ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagD,
|
||||
void Sema::ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagD,
|
||||
SourceLocation LBraceLoc) {
|
||||
AdjustDeclIfTemplate(TagD);
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(TagD.getAs<Decl>());
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(TagD);
|
||||
|
||||
FieldCollector->StartClass();
|
||||
|
||||
@ -5803,10 +5793,10 @@ void Sema::ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagD,
|
||||
"Broken injected-class-name");
|
||||
}
|
||||
|
||||
void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD,
|
||||
void Sema::ActOnTagFinishDefinition(Scope *S, Decl *TagD,
|
||||
SourceLocation RBraceLoc) {
|
||||
AdjustDeclIfTemplate(TagD);
|
||||
TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>());
|
||||
TagDecl *Tag = cast<TagDecl>(TagD);
|
||||
Tag->setRBraceLoc(RBraceLoc);
|
||||
|
||||
if (isa<CXXRecordDecl>(Tag))
|
||||
@ -5819,9 +5809,9 @@ void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD,
|
||||
Consumer.HandleTagDeclDefinition(Tag);
|
||||
}
|
||||
|
||||
void Sema::ActOnTagDefinitionError(Scope *S, DeclPtrTy TagD) {
|
||||
void Sema::ActOnTagDefinitionError(Scope *S, Decl *TagD) {
|
||||
AdjustDeclIfTemplate(TagD);
|
||||
TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>());
|
||||
TagDecl *Tag = cast<TagDecl>(TagD);
|
||||
Tag->setInvalidDecl();
|
||||
|
||||
// We're undoing ActOnTagStartDefinition here, not
|
||||
@ -5904,13 +5894,13 @@ bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
|
||||
|
||||
/// ActOnField - Each field of a struct/union/class is passed into this in order
|
||||
/// to create a FieldDecl object for it.
|
||||
Sema::DeclPtrTy Sema::ActOnField(Scope *S, DeclPtrTy TagD,
|
||||
Decl *Sema::ActOnField(Scope *S, Decl *TagD,
|
||||
SourceLocation DeclStart,
|
||||
Declarator &D, ExprTy *BitfieldWidth) {
|
||||
FieldDecl *Res = HandleField(S, cast_or_null<RecordDecl>(TagD.getAs<Decl>()),
|
||||
FieldDecl *Res = HandleField(S, cast_or_null<RecordDecl>(TagD),
|
||||
DeclStart, D, static_cast<Expr*>(BitfieldWidth),
|
||||
AS_public);
|
||||
return DeclPtrTy::make(Res);
|
||||
return Res;
|
||||
}
|
||||
|
||||
/// HandleField - Analyze a field of a C struct or a C++ data member.
|
||||
@ -6310,9 +6300,9 @@ TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility) {
|
||||
|
||||
/// ActOnIvar - Each ivar field of an objective-c class is passed into this
|
||||
/// in order to create an IvarDecl object for it.
|
||||
Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
|
||||
Decl *Sema::ActOnIvar(Scope *S,
|
||||
SourceLocation DeclStart,
|
||||
DeclPtrTy IntfDecl,
|
||||
Decl *IntfDecl,
|
||||
Declarator &D, ExprTy *BitfieldWidth,
|
||||
tok::ObjCKeywordKind Visibility) {
|
||||
|
||||
@ -6356,7 +6346,7 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
|
||||
Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility)
|
||||
: ObjCIvarDecl::None;
|
||||
// Must set ivar's DeclContext to its enclosing interface.
|
||||
ObjCContainerDecl *EnclosingDecl = IntfDecl.getAs<ObjCContainerDecl>();
|
||||
ObjCContainerDecl *EnclosingDecl = cast<ObjCContainerDecl>(IntfDecl);
|
||||
ObjCContainerDecl *EnclosingContext;
|
||||
if (ObjCImplementationDecl *IMPDecl =
|
||||
dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
|
||||
@ -6368,7 +6358,7 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
|
||||
dyn_cast<ObjCCategoryDecl>(EnclosingDecl)) {
|
||||
if (!LangOpts.ObjCNonFragileABI2 || !CDecl->IsClassExtension()) {
|
||||
Diag(Loc, diag::err_misplaced_ivar) << CDecl->IsClassExtension();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
EnclosingContext = EnclosingDecl;
|
||||
@ -6399,19 +6389,18 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
|
||||
if (II) {
|
||||
// FIXME: When interfaces are DeclContexts, we'll need to add
|
||||
// these to the interface.
|
||||
S->AddDecl(DeclPtrTy::make(NewID));
|
||||
S->AddDecl(NewID);
|
||||
IdResolver.AddDecl(NewID);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(NewID);
|
||||
return NewID;
|
||||
}
|
||||
|
||||
void Sema::ActOnFields(Scope* S,
|
||||
SourceLocation RecLoc, DeclPtrTy RecDecl,
|
||||
DeclPtrTy *Fields, unsigned NumFields,
|
||||
SourceLocation RecLoc, Decl *EnclosingDecl,
|
||||
Decl **Fields, unsigned NumFields,
|
||||
SourceLocation LBrac, SourceLocation RBrac,
|
||||
AttributeList *Attr) {
|
||||
Decl *EnclosingDecl = RecDecl.getAs<Decl>();
|
||||
assert(EnclosingDecl && "missing record or interface decl");
|
||||
|
||||
// If the decl this is being inserted into is invalid, then it may be a
|
||||
@ -6428,7 +6417,7 @@ void Sema::ActOnFields(Scope* S,
|
||||
|
||||
RecordDecl *Record = dyn_cast<RecordDecl>(EnclosingDecl);
|
||||
for (unsigned i = 0; i != NumFields; ++i) {
|
||||
FieldDecl *FD = cast<FieldDecl>(Fields[i].getAs<Decl>());
|
||||
FieldDecl *FD = cast<FieldDecl>(Fields[i]);
|
||||
|
||||
// Get the type for the field.
|
||||
Type *FDTy = FD->getType().getTypePtr();
|
||||
@ -6757,14 +6746,14 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
|
||||
}
|
||||
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnEnumConstant(Scope *S, DeclPtrTy theEnumDecl,
|
||||
DeclPtrTy lastEnumConst,
|
||||
Decl *Sema::ActOnEnumConstant(Scope *S, Decl *theEnumDecl,
|
||||
Decl *lastEnumConst,
|
||||
SourceLocation IdLoc,
|
||||
IdentifierInfo *Id,
|
||||
SourceLocation EqualLoc, ExprTy *val) {
|
||||
EnumDecl *TheEnumDecl = cast<EnumDecl>(theEnumDecl.getAs<Decl>());
|
||||
EnumDecl *TheEnumDecl = cast<EnumDecl>(theEnumDecl);
|
||||
EnumConstantDecl *LastEnumConst =
|
||||
cast_or_null<EnumConstantDecl>(lastEnumConst.getAs<Decl>());
|
||||
cast_or_null<EnumConstantDecl>(lastEnumConst);
|
||||
Expr *Val = static_cast<Expr*>(val);
|
||||
|
||||
// The scope passed in may not be a decl scope. Zip up the scope tree until
|
||||
@ -6793,7 +6782,7 @@ Sema::DeclPtrTy Sema::ActOnEnumConstant(Scope *S, DeclPtrTy theEnumDecl,
|
||||
else
|
||||
Diag(IdLoc, diag::err_redefinition) << Id;
|
||||
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6806,14 +6795,14 @@ Sema::DeclPtrTy Sema::ActOnEnumConstant(Scope *S, DeclPtrTy theEnumDecl,
|
||||
PushOnScopeChains(New, S);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
SourceLocation RBraceLoc, DeclPtrTy EnumDeclX,
|
||||
DeclPtrTy *Elements, unsigned NumElements,
|
||||
SourceLocation RBraceLoc, Decl *EnumDeclX,
|
||||
Decl **Elements, unsigned NumElements,
|
||||
Scope *S, AttributeList *Attr) {
|
||||
EnumDecl *Enum = cast<EnumDecl>(EnumDeclX.getAs<Decl>());
|
||||
EnumDecl *Enum = cast<EnumDecl>(EnumDeclX);
|
||||
QualType EnumType = Context.getTypeDeclType(Enum);
|
||||
|
||||
if (Attr)
|
||||
@ -6822,7 +6811,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
if (Enum->isDependentType()) {
|
||||
for (unsigned i = 0; i != NumElements; ++i) {
|
||||
EnumConstantDecl *ECD =
|
||||
cast_or_null<EnumConstantDecl>(Elements[i].getAs<Decl>());
|
||||
cast_or_null<EnumConstantDecl>(Elements[i]);
|
||||
if (!ECD) continue;
|
||||
|
||||
ECD->setType(EnumType);
|
||||
@ -6849,7 +6838,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
|
||||
for (unsigned i = 0; i != NumElements; ++i) {
|
||||
EnumConstantDecl *ECD =
|
||||
cast_or_null<EnumConstantDecl>(Elements[i].getAs<Decl>());
|
||||
cast_or_null<EnumConstantDecl>(Elements[i]);
|
||||
if (!ECD) continue; // Already issued a diagnostic.
|
||||
|
||||
const llvm::APSInt &InitVal = ECD->getInitVal();
|
||||
@ -6951,8 +6940,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
// Loop over all of the enumerator constants, changing their types to match
|
||||
// the type of the enum if needed.
|
||||
for (unsigned i = 0; i != NumElements; ++i) {
|
||||
EnumConstantDecl *ECD =
|
||||
cast_or_null<EnumConstantDecl>(Elements[i].getAs<Decl>());
|
||||
EnumConstantDecl *ECD = cast_or_null<EnumConstantDecl>(Elements[i]);
|
||||
if (!ECD) continue; // Already issued a diagnostic.
|
||||
|
||||
// Standard C says the enumerators have int type, but we allow, as an
|
||||
@ -7013,14 +7001,13 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
|
||||
NumPositiveBits, NumNegativeBits);
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc,
|
||||
ExprArg expr) {
|
||||
Decl *Sema::ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr) {
|
||||
StringLiteral *AsmString = cast<StringLiteral>(expr.takeAs<Expr>());
|
||||
|
||||
FileScopeAsmDecl *New = FileScopeAsmDecl::Create(Context, CurContext,
|
||||
Loc, AsmString);
|
||||
CurContext->addDecl(New);
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
void Sema::ActOnPragmaWeakID(IdentifierInfo* Name,
|
||||
|
@ -2414,7 +2414,7 @@ Action::ParsingDeclStackState Sema::PushParsingDeclaration() {
|
||||
return (ParsingDeclStackState) DelayedDiagnostics.size();
|
||||
}
|
||||
|
||||
void Sema::PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy Ctx) {
|
||||
void Sema::PopParsingDeclaration(ParsingDeclStackState S, Decl *D) {
|
||||
assert(ParsingDeclDepth > 0 && "empty ParsingDeclaration stack");
|
||||
ParsingDeclDepth--;
|
||||
|
||||
@ -2429,7 +2429,6 @@ void Sema::PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy Ctx) {
|
||||
|
||||
// We only want to actually emit delayed diagnostics when we
|
||||
// successfully parsed a decl.
|
||||
Decl *D = Ctx ? Ctx.getAs<Decl>() : 0;
|
||||
if (D) {
|
||||
// We really do want to start with 0 here. We get one push for a
|
||||
// decl spec and another for each declarator; in a decl group like:
|
||||
|
@ -148,12 +148,12 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
|
||||
/// provided for a function parameter is well-formed. If so, attach it
|
||||
/// to the parameter declaration.
|
||||
void
|
||||
Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
|
||||
Sema::ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc,
|
||||
ExprArg defarg) {
|
||||
if (!param || !defarg.get())
|
||||
return;
|
||||
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
||||
UnparsedDefaultArgLocs.erase(Param);
|
||||
|
||||
ExprOwningPtr<Expr> DefaultArg(this, defarg.takeAs<Expr>());
|
||||
@ -180,13 +180,13 @@ Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
|
||||
/// argument for a function parameter, but we can't parse it yet
|
||||
/// because we're inside a class definition. Note that this default
|
||||
/// argument will be parsed later.
|
||||
void Sema::ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
|
||||
void Sema::ActOnParamUnparsedDefaultArgument(Decl *param,
|
||||
SourceLocation EqualLoc,
|
||||
SourceLocation ArgLoc) {
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
||||
if (Param)
|
||||
Param->setUnparsedDefaultArg();
|
||||
|
||||
@ -195,11 +195,11 @@ void Sema::ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
|
||||
|
||||
/// ActOnParamDefaultArgumentError - Parsing or semantic analysis of
|
||||
/// the default argument for the parameter param failed.
|
||||
void Sema::ActOnParamDefaultArgumentError(DeclPtrTy param) {
|
||||
void Sema::ActOnParamDefaultArgumentError(Decl *param) {
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
||||
|
||||
Param->setInvalidDecl();
|
||||
|
||||
@ -224,7 +224,7 @@ void Sema::CheckExtraCXXDefaultArguments(Declarator &D) {
|
||||
if (chunk.Kind == DeclaratorChunk::Function) {
|
||||
for (unsigned argIdx = 0, e = chunk.Fun.NumArgs; argIdx != e; ++argIdx) {
|
||||
ParmVarDecl *Param =
|
||||
cast<ParmVarDecl>(chunk.Fun.ArgInfo[argIdx].Param.getAs<Decl>());
|
||||
cast<ParmVarDecl>(chunk.Fun.ArgInfo[argIdx].Param);
|
||||
if (Param->hasUnparsedDefaultArg()) {
|
||||
CachedTokens *Toks = chunk.Fun.ArgInfo[argIdx].DefaultArgTokens;
|
||||
Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc)
|
||||
@ -588,14 +588,14 @@ void Sema::SetClassDeclAttributesFromBase(CXXRecordDecl *Class,
|
||||
/// class foo : public bar, virtual private baz {
|
||||
/// 'public bar' and 'virtual private baz' are each base-specifiers.
|
||||
Sema::BaseResult
|
||||
Sema::ActOnBaseSpecifier(DeclPtrTy classdecl, SourceRange SpecifierRange,
|
||||
Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
|
||||
bool Virtual, AccessSpecifier Access,
|
||||
TypeTy *basetype, SourceLocation BaseLoc) {
|
||||
if (!classdecl)
|
||||
return true;
|
||||
|
||||
AdjustDeclIfTemplate(classdecl);
|
||||
CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(classdecl.getAs<Decl>());
|
||||
CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(classdecl);
|
||||
if (!Class)
|
||||
return true;
|
||||
|
||||
@ -670,13 +670,13 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases,
|
||||
/// ActOnBaseSpecifiers - Attach the given base specifiers to the
|
||||
/// class, after checking whether there are any duplicate base
|
||||
/// classes.
|
||||
void Sema::ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
|
||||
void Sema::ActOnBaseSpecifiers(Decl *ClassDecl, BaseTy **Bases,
|
||||
unsigned NumBases) {
|
||||
if (!ClassDecl || !Bases || !NumBases)
|
||||
return;
|
||||
|
||||
AdjustDeclIfTemplate(ClassDecl);
|
||||
AttachBaseSpecifiers(cast<CXXRecordDecl>(ClassDecl.getAs<Decl>()),
|
||||
AttachBaseSpecifiers(cast<CXXRecordDecl>(ClassDecl),
|
||||
(CXXBaseSpecifier**)(Bases), NumBases);
|
||||
}
|
||||
|
||||
@ -878,21 +878,21 @@ std::string Sema::getAmbiguousPathsDisplayString(CXXBasePaths &Paths) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
|
||||
Sema::DeclPtrTy
|
||||
Sema::ActOnAccessSpecifier(AccessSpecifier Access,
|
||||
SourceLocation ASLoc, SourceLocation ColonLoc) {
|
||||
Decl *Sema::ActOnAccessSpecifier(AccessSpecifier Access,
|
||||
SourceLocation ASLoc,
|
||||
SourceLocation ColonLoc) {
|
||||
assert(Access != AS_none && "Invalid kind for syntactic access specifier!");
|
||||
AccessSpecDecl* ASDecl = AccessSpecDecl::Create(Context, Access, CurContext,
|
||||
AccessSpecDecl *ASDecl = AccessSpecDecl::Create(Context, Access, CurContext,
|
||||
ASLoc, ColonLoc);
|
||||
CurContext->addHiddenDecl(ASDecl);
|
||||
return DeclPtrTy::make(ASDecl);
|
||||
return ASDecl;
|
||||
}
|
||||
|
||||
/// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
|
||||
/// declarator is parsed. 'AS' is the access specifier, 'BW' specifies the
|
||||
/// bitfield width if there is one and 'InitExpr' specifies the initializer if
|
||||
/// any.
|
||||
Sema::DeclPtrTy
|
||||
Decl *
|
||||
Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
ExprTy *BW, ExprTy *InitExpr, bool IsDefinition,
|
||||
@ -959,11 +959,10 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
|
||||
AS);
|
||||
assert(Member && "HandleField never returns null");
|
||||
} else {
|
||||
Member = HandleDeclarator(S, D, move(TemplateParameterLists), IsDefinition)
|
||||
.getAs<Decl>();
|
||||
Member = HandleDeclarator(S, D, move(TemplateParameterLists), IsDefinition);
|
||||
if (!Member) {
|
||||
if (BitWidth) DeleteExpr(BitWidth);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Non-instance-fields can't have a bitfield.
|
||||
@ -1003,15 +1002,15 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
|
||||
assert((Name || isInstField) && "No identifier for non-field ?");
|
||||
|
||||
if (Init)
|
||||
AddInitializerToDecl(DeclPtrTy::make(Member), ExprArg(*this, Init), false);
|
||||
AddInitializerToDecl(Member, ExprArg(*this, Init), false);
|
||||
if (Deleted) // FIXME: Source location is not very good.
|
||||
SetDeclDeleted(DeclPtrTy::make(Member), D.getSourceRange().getBegin());
|
||||
SetDeclDeleted(Member, D.getSourceRange().getBegin());
|
||||
|
||||
if (isInstField) {
|
||||
FieldCollector->Add(cast<FieldDecl>(Member));
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
return DeclPtrTy::make(Member);
|
||||
return Member;
|
||||
}
|
||||
|
||||
/// \brief Find the direct and/or virtual base specifiers that
|
||||
@ -1061,7 +1060,7 @@ static bool FindBaseInitializer(Sema &SemaRef,
|
||||
|
||||
/// ActOnMemInitializer - Handle a C++ member initializer.
|
||||
Sema::MemInitResult
|
||||
Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
|
||||
Sema::ActOnMemInitializer(Decl *ConstructorD,
|
||||
Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
IdentifierInfo *MemberOrBase,
|
||||
@ -1077,7 +1076,7 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
|
||||
AdjustDeclIfTemplate(ConstructorD);
|
||||
|
||||
CXXConstructorDecl *Constructor
|
||||
= dyn_cast<CXXConstructorDecl>(ConstructorD.getAs<Decl>());
|
||||
= dyn_cast<CXXConstructorDecl>(ConstructorD);
|
||||
if (!Constructor) {
|
||||
// The user wrote a constructor initializer on a function that is
|
||||
// not a C++ constructor. Ignore the error for now, because we may
|
||||
@ -2156,7 +2155,7 @@ bool CheckRedundantUnionInit(Sema &S,
|
||||
}
|
||||
|
||||
/// ActOnMemInitializers - Handle the member initializers for a constructor.
|
||||
void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
||||
void Sema::ActOnMemInitializers(Decl *ConstructorDecl,
|
||||
SourceLocation ColonLoc,
|
||||
MemInitTy **meminits, unsigned NumMemInits,
|
||||
bool AnyErrors) {
|
||||
@ -2166,7 +2165,7 @@ void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
||||
AdjustDeclIfTemplate(ConstructorDecl);
|
||||
|
||||
CXXConstructorDecl *Constructor
|
||||
= dyn_cast<CXXConstructorDecl>(ConstructorDecl.getAs<Decl>());
|
||||
= dyn_cast<CXXConstructorDecl>(ConstructorDecl);
|
||||
|
||||
if (!Constructor) {
|
||||
Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
|
||||
@ -2301,12 +2300,12 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
|
||||
}
|
||||
}
|
||||
|
||||
void Sema::ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {
|
||||
void Sema::ActOnDefaultCtorInitializers(Decl *CDtorDecl) {
|
||||
if (!CDtorDecl)
|
||||
return;
|
||||
|
||||
if (CXXConstructorDecl *Constructor
|
||||
= dyn_cast<CXXConstructorDecl>(CDtorDecl.getAs<Decl>()))
|
||||
= dyn_cast<CXXConstructorDecl>(CDtorDecl))
|
||||
SetBaseOrMemberInitializers(Constructor, 0, 0, /*AnyErrors=*/false);
|
||||
}
|
||||
|
||||
@ -2681,7 +2680,7 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
|
||||
}
|
||||
|
||||
void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||
DeclPtrTy TagDecl,
|
||||
Decl *TagDecl,
|
||||
SourceLocation LBrac,
|
||||
SourceLocation RBrac,
|
||||
AttributeList *AttrList) {
|
||||
@ -2691,11 +2690,12 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||
AdjustDeclIfTemplate(TagDecl);
|
||||
|
||||
ActOnFields(S, RLoc, TagDecl,
|
||||
(DeclPtrTy*)FieldCollector->getCurFields(),
|
||||
// strict aliasing violation!
|
||||
reinterpret_cast<Decl**>(FieldCollector->getCurFields()),
|
||||
FieldCollector->getCurNumFields(), LBrac, RBrac, AttrList);
|
||||
|
||||
CheckCompletedCXXClass(
|
||||
dyn_cast_or_null<CXXRecordDecl>(TagDecl.getAs<Decl>()));
|
||||
dyn_cast_or_null<CXXRecordDecl>(TagDecl));
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -2792,8 +2792,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
|
||||
}
|
||||
}
|
||||
|
||||
void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
|
||||
Decl *D = TemplateD.getAs<Decl>();
|
||||
void Sema::ActOnReenterTemplateScope(Scope *S, Decl *D) {
|
||||
if (!D)
|
||||
return;
|
||||
|
||||
@ -2811,20 +2810,20 @@ void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
|
||||
Param != ParamEnd; ++Param) {
|
||||
NamedDecl *Named = cast<NamedDecl>(*Param);
|
||||
if (Named->getDeclName()) {
|
||||
S->AddDecl(DeclPtrTy::make(Named));
|
||||
S->AddDecl(Named);
|
||||
IdResolver.AddDecl(Named);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sema::ActOnStartDelayedMemberDeclarations(Scope *S, DeclPtrTy RecordD) {
|
||||
void Sema::ActOnStartDelayedMemberDeclarations(Scope *S, Decl *RecordD) {
|
||||
if (!RecordD) return;
|
||||
AdjustDeclIfTemplate(RecordD);
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordD.getAs<Decl>());
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordD);
|
||||
PushDeclContext(S, Record);
|
||||
}
|
||||
|
||||
void Sema::ActOnFinishDelayedMemberDeclarations(Scope *S, DeclPtrTy RecordD) {
|
||||
void Sema::ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *RecordD) {
|
||||
if (!RecordD) return;
|
||||
PopDeclContext();
|
||||
}
|
||||
@ -2837,7 +2836,7 @@ void Sema::ActOnFinishDelayedMemberDeclarations(Scope *S, DeclPtrTy RecordD) {
|
||||
/// Method declaration as if we had just parsed the qualified method
|
||||
/// name. However, it should not bring the parameters into scope;
|
||||
/// that will be performed by ActOnDelayedCXXMethodParameter.
|
||||
void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
|
||||
void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *MethodD) {
|
||||
}
|
||||
|
||||
/// ActOnDelayedCXXMethodParameter - We've already started a delayed
|
||||
@ -2845,18 +2844,18 @@ void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
|
||||
/// function parameter into scope for use in parsing later parts of
|
||||
/// the method declaration. For example, we could see an
|
||||
/// ActOnParamDefaultArgument event for this parameter.
|
||||
void Sema::ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy ParamD) {
|
||||
void Sema::ActOnDelayedCXXMethodParameter(Scope *S, Decl *ParamD) {
|
||||
if (!ParamD)
|
||||
return;
|
||||
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(ParamD.getAs<Decl>());
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(ParamD);
|
||||
|
||||
// If this parameter has an unparsed default argument, clear it out
|
||||
// to make way for the parsed default argument.
|
||||
if (Param->hasUnparsedDefaultArg())
|
||||
Param->setDefaultArg(0);
|
||||
|
||||
S->AddDecl(DeclPtrTy::make(Param));
|
||||
S->AddDecl(Param);
|
||||
if (Param->getDeclName())
|
||||
IdResolver.AddDecl(Param);
|
||||
}
|
||||
@ -2867,13 +2866,13 @@ void Sema::ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy ParamD) {
|
||||
/// ActOnStartOfFunctionDef action later (not necessarily
|
||||
/// immediately!) for this method, if it was also defined inside the
|
||||
/// class body.
|
||||
void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
|
||||
void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *MethodD) {
|
||||
if (!MethodD)
|
||||
return;
|
||||
|
||||
AdjustDeclIfTemplate(MethodD);
|
||||
|
||||
FunctionDecl *Method = cast<FunctionDecl>(MethodD.getAs<Decl>());
|
||||
FunctionDecl *Method = cast<FunctionDecl>(MethodD);
|
||||
|
||||
// Now that we have our default arguments, check the constructor
|
||||
// again. It could produce additional diagnostics or affect whether
|
||||
@ -3022,7 +3021,7 @@ static inline bool
|
||||
FTIHasSingleVoidArgument(DeclaratorChunk::FunctionTypeInfo &FTI) {
|
||||
return (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 &&
|
||||
FTI.ArgInfo[0].Param &&
|
||||
FTI.ArgInfo[0].Param.getAs<ParmVarDecl>()->getType()->isVoidType());
|
||||
cast<ParmVarDecl>(FTI.ArgInfo[0].Param)->getType()->isVoidType());
|
||||
}
|
||||
|
||||
/// CheckDestructorDeclarator - Called by ActOnDeclarator to check
|
||||
@ -3217,7 +3216,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R,
|
||||
/// the declaration of the given C++ conversion function. This routine
|
||||
/// is responsible for recording the conversion function in the C++
|
||||
/// class, if possible.
|
||||
Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
||||
Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
||||
assert(Conversion && "Expected to receive a conversion function declaration");
|
||||
|
||||
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Conversion->getDeclContext());
|
||||
@ -3258,10 +3257,10 @@ Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
||||
if (ClassDecl->replaceConversion(
|
||||
ConversionTemplate->getPreviousDeclaration(),
|
||||
ConversionTemplate))
|
||||
return DeclPtrTy::make(ConversionTemplate);
|
||||
return ConversionTemplate;
|
||||
} else if (ClassDecl->replaceConversion(Conversion->getPreviousDeclaration(),
|
||||
Conversion))
|
||||
return DeclPtrTy::make(Conversion);
|
||||
return Conversion;
|
||||
assert(Conversion->isInvalidDecl() && "Conversion should not get here.");
|
||||
} else if (FunctionTemplateDecl *ConversionTemplate
|
||||
= Conversion->getDescribedFunctionTemplate())
|
||||
@ -3269,7 +3268,7 @@ Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
||||
else
|
||||
ClassDecl->addConversionFunction(Conversion);
|
||||
|
||||
return DeclPtrTy::make(Conversion);
|
||||
return Conversion;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -3278,7 +3277,7 @@ Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
|
||||
|
||||
/// ActOnStartNamespaceDef - This is called at the start of a namespace
|
||||
/// definition.
|
||||
Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
|
||||
Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
|
||||
SourceLocation IdentLoc,
|
||||
IdentifierInfo *II,
|
||||
SourceLocation LBrace,
|
||||
@ -3315,9 +3314,9 @@ Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
|
||||
Namespc->setOriginalNamespace(OrigNS->getOriginalNamespace());
|
||||
|
||||
// Remove the previous declaration from the scope.
|
||||
if (DeclRegionScope->isDeclScope(DeclPtrTy::make(OrigNS))) {
|
||||
if (DeclRegionScope->isDeclScope(OrigNS)) {
|
||||
IdResolver.RemoveDecl(OrigNS);
|
||||
DeclRegionScope->RemoveDecl(DeclPtrTy::make(OrigNS));
|
||||
DeclRegionScope->RemoveDecl(OrigNS);
|
||||
}
|
||||
} else if (PrevDecl) {
|
||||
// This is an invalid name redefinition.
|
||||
@ -3407,7 +3406,7 @@ Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
|
||||
// for the namespace has the declarations that showed up in that particular
|
||||
// namespace definition.
|
||||
PushDeclContext(NamespcScope, Namespc);
|
||||
return DeclPtrTy::make(Namespc);
|
||||
return Namespc;
|
||||
}
|
||||
|
||||
/// getNamespaceDecl - Returns the namespace a decl represents. If the decl
|
||||
@ -3420,8 +3419,7 @@ static inline NamespaceDecl *getNamespaceDecl(NamedDecl *D) {
|
||||
|
||||
/// ActOnFinishNamespaceDef - This callback is called after a namespace is
|
||||
/// exited. Decl is the DeclTy returned by ActOnStartNamespaceDef.
|
||||
void Sema::ActOnFinishNamespaceDef(DeclPtrTy D, SourceLocation RBrace) {
|
||||
Decl *Dcl = D.getAs<Decl>();
|
||||
void Sema::ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace) {
|
||||
NamespaceDecl *Namespc = dyn_cast_or_null<NamespaceDecl>(Dcl);
|
||||
assert(Namespc && "Invalid parameter, expected NamespaceDecl");
|
||||
Namespc->setRBracLoc(RBrace);
|
||||
@ -3445,7 +3443,7 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() {
|
||||
return getStdNamespace();
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S,
|
||||
Decl *Sema::ActOnUsingDirective(Scope *S,
|
||||
SourceLocation UsingLoc,
|
||||
SourceLocation NamespcLoc,
|
||||
CXXScopeSpec &SS,
|
||||
@ -3466,7 +3464,7 @@ Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S,
|
||||
LookupResult R(*this, NamespcName, IdentLoc, LookupNamespaceName);
|
||||
LookupParsedName(R, S, &SS);
|
||||
if (R.isAmbiguous())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (R.empty()) {
|
||||
// Allow "using namespace std;" or "using namespace ::std;" even if
|
||||
@ -3533,7 +3531,7 @@ Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S,
|
||||
|
||||
// FIXME: We ignore attributes for now.
|
||||
delete AttrList;
|
||||
return DeclPtrTy::make(UDir);
|
||||
return UDir;
|
||||
}
|
||||
|
||||
void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) {
|
||||
@ -3545,11 +3543,11 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) {
|
||||
else
|
||||
// Otherwise it is block-sope. using-directives will affect lookup
|
||||
// only to the end of scope.
|
||||
S->PushUsingDirective(DeclPtrTy::make(UDir));
|
||||
S->PushUsingDirective(UDir);
|
||||
}
|
||||
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
|
||||
Decl *Sema::ActOnUsingDeclaration(Scope *S,
|
||||
AccessSpecifier AS,
|
||||
bool HasUsingKeyword,
|
||||
SourceLocation UsingLoc,
|
||||
@ -3574,23 +3572,23 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
|
||||
|
||||
Diag(Name.getSourceRange().getBegin(), diag::err_using_decl_constructor)
|
||||
<< SS.getRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
case UnqualifiedId::IK_DestructorName:
|
||||
Diag(Name.getSourceRange().getBegin(), diag::err_using_decl_destructor)
|
||||
<< SS.getRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
case UnqualifiedId::IK_TemplateId:
|
||||
Diag(Name.getSourceRange().getBegin(), diag::err_using_decl_template_id)
|
||||
<< SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DeclarationNameInfo TargetNameInfo = GetNameFromUnqualifiedId(Name);
|
||||
DeclarationName TargetName = TargetNameInfo.getName();
|
||||
if (!TargetName)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
// Warn about using declarations.
|
||||
// TODO: store that the declaration was written without 'using' and
|
||||
@ -3610,7 +3608,7 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
|
||||
if (UD)
|
||||
PushOnScopeChains(UD, S, /*AddToContext*/ false);
|
||||
|
||||
return DeclPtrTy::make(UD);
|
||||
return UD;
|
||||
}
|
||||
|
||||
/// \brief Determine whether a using declaration considers the given
|
||||
@ -3834,7 +3832,7 @@ void Sema::HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow) {
|
||||
|
||||
// ...and the scope, if applicable...
|
||||
if (S) {
|
||||
S->RemoveDecl(DeclPtrTy::make(static_cast<Decl*>(Shadow)));
|
||||
S->RemoveDecl(Shadow);
|
||||
IdResolver.RemoveDecl(Shadow);
|
||||
}
|
||||
|
||||
@ -4186,7 +4184,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc,
|
||||
return true;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||
Decl *Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||
SourceLocation NamespaceLoc,
|
||||
SourceLocation AliasLoc,
|
||||
IdentifierInfo *Alias,
|
||||
@ -4213,18 +4211,18 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||
// declaration to maintain better source information.
|
||||
if (!R.isAmbiguous() && !R.empty() &&
|
||||
AD->getNamespace()->Equals(getNamespaceDecl(R.getFoundDecl())))
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned DiagID = isa<NamespaceDecl>(PrevDecl) ? diag::err_redefinition :
|
||||
diag::err_redefinition_different_kind;
|
||||
Diag(AliasLoc, DiagID) << Alias;
|
||||
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (R.isAmbiguous())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
if (R.empty()) {
|
||||
if (DeclarationName Corrected = CorrectTypo(R, S, &SS, 0, false,
|
||||
@ -4252,7 +4250,7 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||
|
||||
if (R.empty()) {
|
||||
Diag(NamespaceLoc, diag::err_expected_namespace_name) << SS.getRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4263,7 +4261,7 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||
IdentLoc, R.getFoundDecl());
|
||||
|
||||
PushOnScopeChains(AliasDecl, S);
|
||||
return DeclPtrTy::make(AliasDecl);
|
||||
return AliasDecl;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -4710,8 +4708,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
|
||||
// Construct the loop that copies all elements of this array.
|
||||
return S.ActOnForStmt(Loc, Loc, S.Owned(InitStmt),
|
||||
S.MakeFullExpr(Comparison),
|
||||
Sema::DeclPtrTy(),
|
||||
S.MakeFullExpr(Increment),
|
||||
0, S.MakeFullExpr(Increment),
|
||||
Loc, move(Copy));
|
||||
}
|
||||
|
||||
@ -5490,13 +5487,12 @@ void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
|
||||
/// AddCXXDirectInitializerToDecl - This action is called immediately after
|
||||
/// ActOnDeclarator, when a C++ direct initializer is present.
|
||||
/// e.g: "int x(1);"
|
||||
void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
|
||||
void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl,
|
||||
SourceLocation LParenLoc,
|
||||
MultiExprArg Exprs,
|
||||
SourceLocation *CommaLocs,
|
||||
SourceLocation RParenLoc) {
|
||||
assert(Exprs.size() != 0 && Exprs.get() && "missing expressions");
|
||||
Decl *RealDecl = Dcl.getAs<Decl>();
|
||||
|
||||
// If there is no declaration, there was an error parsing it. Just ignore
|
||||
// the initializer.
|
||||
@ -6006,7 +6002,7 @@ FinishedParams:
|
||||
/// by Lang/StrSize. LBraceLoc, if valid, provides the location of
|
||||
/// the '{' brace. Otherwise, this linkage specification does not
|
||||
/// have any braces.
|
||||
Sema::DeclPtrTy Sema::ActOnStartLinkageSpecification(Scope *S,
|
||||
Decl *Sema::ActOnStartLinkageSpecification(Scope *S,
|
||||
SourceLocation ExternLoc,
|
||||
SourceLocation LangLoc,
|
||||
llvm::StringRef Lang,
|
||||
@ -6018,7 +6014,7 @@ Sema::DeclPtrTy Sema::ActOnStartLinkageSpecification(Scope *S,
|
||||
Language = LinkageSpecDecl::lang_cxx;
|
||||
else {
|
||||
Diag(LangLoc, diag::err_bad_language);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FIXME: Add all the various semantics of linkage specifications
|
||||
@ -6028,15 +6024,15 @@ Sema::DeclPtrTy Sema::ActOnStartLinkageSpecification(Scope *S,
|
||||
LBraceLoc.isValid());
|
||||
CurContext->addDecl(D);
|
||||
PushDeclContext(S, D);
|
||||
return DeclPtrTy::make(D);
|
||||
return D;
|
||||
}
|
||||
|
||||
/// ActOnFinishLinkageSpecification - Complete the definition of
|
||||
/// the C++ linkage specification LinkageSpec. If RBraceLoc is
|
||||
/// valid, it's the position of the closing '}' brace in a linkage
|
||||
/// specification that uses braces.
|
||||
Sema::DeclPtrTy Sema::ActOnFinishLinkageSpecification(Scope *S,
|
||||
DeclPtrTy LinkageSpec,
|
||||
Decl *Sema::ActOnFinishLinkageSpecification(Scope *S,
|
||||
Decl *LinkageSpec,
|
||||
SourceLocation RBraceLoc) {
|
||||
if (LinkageSpec)
|
||||
PopDeclContext();
|
||||
@ -6158,7 +6154,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
|
||||
|
||||
/// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch
|
||||
/// handler.
|
||||
Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
|
||||
QualType ExDeclType = TInfo->getType();
|
||||
|
||||
@ -6169,7 +6165,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
ForRedeclaration)) {
|
||||
// The scope should be freshly made just for us. There is just no way
|
||||
// it contains any previous declaration.
|
||||
assert(!S->isDeclScope(DeclPtrTy::make(PrevDecl)));
|
||||
assert(!S->isDeclScope(PrevDecl));
|
||||
if (PrevDecl->isTemplateParameter()) {
|
||||
// Maybe we will complain about the shadowed template parameter.
|
||||
DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl);
|
||||
@ -6197,10 +6193,10 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
||||
CurContext->addDecl(ExDecl);
|
||||
|
||||
ProcessDeclAttributes(S, ExDecl, D);
|
||||
return DeclPtrTy::make(ExDecl);
|
||||
return ExDecl;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
Decl *Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
ExprArg assertexpr,
|
||||
ExprArg assertmessageexpr) {
|
||||
Expr *AssertExpr = (Expr *)assertexpr.get();
|
||||
@ -6212,7 +6208,7 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
if (!AssertExpr->isIntegerConstantExpr(Value, Context)) {
|
||||
Diag(AssertLoc, diag::err_static_assert_expression_is_not_constant) <<
|
||||
AssertExpr->getSourceRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Value == 0) {
|
||||
@ -6227,7 +6223,7 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
|
||||
AssertExpr, AssertMessage);
|
||||
|
||||
CurContext->addDecl(Decl);
|
||||
return DeclPtrTy::make(Decl);
|
||||
return Decl;
|
||||
}
|
||||
|
||||
/// \brief Perform semantic analysis of the given friend type declaration.
|
||||
@ -6303,7 +6299,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation FriendLoc,
|
||||
/// We permit this as a special case; if there are any template
|
||||
/// parameters present at all, require proper matching, i.e.
|
||||
/// template <> template <class T> friend class A<int>::B;
|
||||
Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
MultiTemplateParamsArg TempParams) {
|
||||
SourceLocation Loc = DS.getSourceRange().getBegin();
|
||||
|
||||
@ -6317,7 +6313,7 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
TypeSourceInfo *TSI = GetTypeForDeclarator(TheDeclarator, S);
|
||||
QualType T = TSI->getType();
|
||||
if (TheDeclarator.isInvalidType())
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
// This is definitely an error in C++98. It's probably meant to
|
||||
// be forbidden in C++0x, too, but the specification is just
|
||||
@ -6336,7 +6332,7 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
if (TempParams.size() && !T->isElaboratedTypeSpecifier()) {
|
||||
Diag(Loc, diag::err_tagless_friend_type_template)
|
||||
<< DS.getSourceRange();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// C++98 [class.friend]p1: A friend of a class is a function
|
||||
@ -6361,18 +6357,17 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
|
||||
D = CheckFriendTypeDecl(DS.getFriendSpecLoc(), TSI);
|
||||
|
||||
if (!D)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
|
||||
D->setAccess(AS_public);
|
||||
CurContext->addDecl(D);
|
||||
|
||||
return DeclPtrTy::make(D);
|
||||
return D;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
Declarator &D,
|
||||
bool IsDefinition,
|
||||
Decl *Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
Declarator &D,
|
||||
bool IsDefinition,
|
||||
MultiTemplateParamsArg TemplateParams) {
|
||||
const DeclSpec &DS = D.getDeclSpec();
|
||||
|
||||
@ -6398,7 +6393,7 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
|
||||
// It might be worthwhile to try to recover by creating an
|
||||
// appropriate declaration.
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// C++ [namespace.memdef]p3
|
||||
@ -6434,8 +6429,8 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
DC = computeDeclContext(ScopeQual);
|
||||
|
||||
// FIXME: handle dependent contexts
|
||||
if (!DC) return DeclPtrTy();
|
||||
if (RequireCompleteDeclContext(ScopeQual, DC)) return DeclPtrTy();
|
||||
if (!DC) return 0;
|
||||
if (RequireCompleteDeclContext(ScopeQual, DC)) return 0;
|
||||
|
||||
LookupQualifiedName(Previous, DC);
|
||||
|
||||
@ -6453,7 +6448,7 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
if (Previous.empty()) {
|
||||
D.setInvalidType();
|
||||
Diag(Loc, diag::err_qualified_friend_not_found) << Name << T;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// C++ [class.friend]p1: A friend of a class is a function or
|
||||
@ -6505,7 +6500,7 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
Diag(Loc, diag::err_introducing_special_friend) <<
|
||||
(D.getName().getKind() == UnqualifiedId::IK_ConstructorName ? 0 :
|
||||
D.getName().getKind() == UnqualifiedId::IK_DestructorName ? 1 : 2);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6514,7 +6509,7 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
move(TemplateParams),
|
||||
IsDefinition,
|
||||
Redeclaration);
|
||||
if (!ND) return DeclPtrTy();
|
||||
if (!ND) return 0;
|
||||
|
||||
assert(ND->getDeclContext() == DC);
|
||||
assert(ND->getLexicalDeclContext() == CurContext);
|
||||
@ -6538,13 +6533,12 @@ Sema::ActOnFriendFunctionDecl(Scope *S,
|
||||
FrD->setAccess(AS_public);
|
||||
CurContext->addDecl(FrD);
|
||||
|
||||
return DeclPtrTy::make(ND);
|
||||
return ND;
|
||||
}
|
||||
|
||||
void Sema::SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc) {
|
||||
AdjustDeclIfTemplate(dcl);
|
||||
void Sema::SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) {
|
||||
AdjustDeclIfTemplate(Dcl);
|
||||
|
||||
Decl *Dcl = dcl.getAs<Decl>();
|
||||
FunctionDecl *Fn = dyn_cast<FunctionDecl>(Dcl);
|
||||
if (!Fn) {
|
||||
Diag(DelLoc, diag::err_deleted_non_function);
|
||||
@ -6712,9 +6706,8 @@ bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) {
|
||||
/// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
|
||||
/// static data member of class X, names should be looked up in the scope of
|
||||
/// class X.
|
||||
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) {
|
||||
// If there is no declaration, there was an error parsing it.
|
||||
Decl *D = Dcl.getAs<Decl>();
|
||||
if (D == 0) return;
|
||||
|
||||
// We should only get called for declarations with scope specifiers, like:
|
||||
@ -6724,10 +6717,9 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
}
|
||||
|
||||
/// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
|
||||
/// initializer for the out-of-line declaration 'Dcl'.
|
||||
void Sema::ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
/// initializer for the out-of-line declaration 'D'.
|
||||
void Sema::ActOnCXXExitDeclInitializer(Scope *S, Decl *D) {
|
||||
// If there is no declaration, there was an error parsing it.
|
||||
Decl *D = Dcl.getAs<Decl>();
|
||||
if (D == 0) return;
|
||||
|
||||
assert(D->isOutOfLine());
|
||||
@ -6737,8 +6729,7 @@ void Sema::ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
|
||||
/// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a
|
||||
/// C++ if/switch/while/for statement.
|
||||
/// e.g: "if (int x = f()) {...}"
|
||||
Action::DeclResult
|
||||
Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) {
|
||||
DeclResult Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) {
|
||||
// C++ 6.4p2:
|
||||
// The declarator shall not specify a function or an array.
|
||||
// The type-specifier-seq shall not contain typedef and shall not declare a
|
||||
@ -6761,7 +6752,7 @@ Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) {
|
||||
Diag(OwnedTag->getLocation(), diag::err_type_defined_in_condition);
|
||||
}
|
||||
|
||||
DeclPtrTy Dcl = ActOnDeclarator(S, D);
|
||||
Decl *Dcl = ActOnDeclarator(S, D);
|
||||
if (!Dcl)
|
||||
return DeclResult();
|
||||
|
||||
|
@ -22,9 +22,9 @@ using namespace clang;
|
||||
|
||||
/// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible
|
||||
/// and user declared, in the method definition's AST.
|
||||
void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
|
||||
assert(getCurMethodDecl() == 0 && "Method parsing confused");
|
||||
ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D.getAs<Decl>());
|
||||
ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D);
|
||||
|
||||
// If we don't have a valid method decl, simply return.
|
||||
if (!MDecl)
|
||||
@ -56,11 +56,11 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
|
||||
PushOnScopeChains(*PI, FnBodyScope);
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::
|
||||
Decl *Sema::
|
||||
ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperName, SourceLocation SuperLoc,
|
||||
const DeclPtrTy *ProtoRefs, unsigned NumProtoRefs,
|
||||
Decl * const *ProtoRefs, unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc, AttributeList *AttrList) {
|
||||
assert(ClassName && "Missing class identifier");
|
||||
@ -84,7 +84,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
|
||||
// Return the previous class interface.
|
||||
// FIXME: don't leak the objects passed in!
|
||||
return DeclPtrTy::make(IDecl);
|
||||
return IDecl;
|
||||
} else {
|
||||
IDecl->setLocation(AtInterfaceLoc);
|
||||
IDecl->setForwardDecl(false);
|
||||
@ -187,16 +187,16 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||
}
|
||||
|
||||
CheckObjCDeclScope(IDecl);
|
||||
return DeclPtrTy::make(IDecl);
|
||||
return IDecl;
|
||||
}
|
||||
|
||||
/// ActOnCompatiblityAlias - this action is called after complete parsing of
|
||||
/// @compatibility_alias declaration. It sets up the alias relationships.
|
||||
Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||
IdentifierInfo *AliasName,
|
||||
SourceLocation AliasLocation,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLocation) {
|
||||
Decl *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||
IdentifierInfo *AliasName,
|
||||
SourceLocation AliasLocation,
|
||||
IdentifierInfo *ClassName,
|
||||
SourceLocation ClassLocation) {
|
||||
// Look for previous declaration of alias name
|
||||
NamedDecl *ADecl = LookupSingleName(TUScope, AliasName, AliasLocation,
|
||||
LookupOrdinaryName, ForRedeclaration);
|
||||
@ -206,7 +206,7 @@ Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||
else
|
||||
Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
|
||||
Diag(ADecl->getLocation(), diag::note_previous_declaration);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// Check for class declaration
|
||||
NamedDecl *CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation,
|
||||
@ -226,7 +226,7 @@ Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||
Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
|
||||
if (CDeclU)
|
||||
Diag(CDeclU->getLocation(), diag::note_previous_declaration);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Everything checked out, instantiate a new alias declaration AST.
|
||||
@ -236,7 +236,7 @@ Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||
if (!CheckObjCDeclScope(AliasDecl))
|
||||
PushOnScopeChains(AliasDecl, TUScope);
|
||||
|
||||
return DeclPtrTy::make(AliasDecl);
|
||||
return AliasDecl;
|
||||
}
|
||||
|
||||
void Sema::CheckForwardProtocolDeclarationForCircularDependency(
|
||||
@ -258,11 +258,11 @@ void Sema::CheckForwardProtocolDeclarationForCircularDependency(
|
||||
}
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Decl *
|
||||
Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
|
||||
IdentifierInfo *ProtocolName,
|
||||
SourceLocation ProtocolLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc,
|
||||
@ -277,7 +277,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
|
||||
Diag(PDecl->getLocation(), diag::note_previous_definition);
|
||||
// Just return the protocol we already had.
|
||||
// FIXME: don't leak the objects passed in!
|
||||
return DeclPtrTy::make(PDecl);
|
||||
return PDecl;
|
||||
}
|
||||
ObjCList<ObjCProtocolDecl> PList;
|
||||
PList.set((ObjCProtocolDecl *const*)ProtoRefs, NumProtoRefs, Context);
|
||||
@ -306,7 +306,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
|
||||
}
|
||||
|
||||
CheckObjCDeclScope(PDecl);
|
||||
return DeclPtrTy::make(PDecl);
|
||||
return PDecl;
|
||||
}
|
||||
|
||||
/// FindProtocolDeclaration - This routine looks up protocols and
|
||||
@ -316,7 +316,7 @@ void
|
||||
Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
|
||||
const IdentifierLocPair *ProtocolId,
|
||||
unsigned NumProtocols,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Protocols) {
|
||||
llvm::SmallVectorImpl<Decl *> &Protocols) {
|
||||
for (unsigned i = 0; i != NumProtocols; ++i) {
|
||||
ObjCProtocolDecl *PDecl = LookupProtocol(ProtocolId[i].first,
|
||||
ProtocolId[i].second);
|
||||
@ -345,7 +345,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
|
||||
if (WarnOnDeclarations && PDecl->isForwardDecl())
|
||||
Diag(ProtocolId[i].second, diag::warn_undef_protocolref)
|
||||
<< ProtocolId[i].first;
|
||||
Protocols.push_back(DeclPtrTy::make(PDecl));
|
||||
Protocols.push_back(PDecl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
|
||||
}
|
||||
|
||||
/// ActOnForwardProtocolDeclaration - Handle @protocol foo;
|
||||
Action::DeclPtrTy
|
||||
Decl *
|
||||
Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
|
||||
const IdentifierLocPair *IdentList,
|
||||
unsigned NumElts,
|
||||
@ -412,15 +412,15 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
|
||||
ProtoLocs.data());
|
||||
CurContext->addDecl(PDecl);
|
||||
CheckObjCDeclScope(PDecl);
|
||||
return DeclPtrTy::make(PDecl);
|
||||
return PDecl;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::
|
||||
Decl *Sema::
|
||||
ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLoc,
|
||||
IdentifierInfo *CategoryName,
|
||||
SourceLocation CategoryLoc,
|
||||
const DeclPtrTy *ProtoRefs,
|
||||
Decl * const *ProtoRefs,
|
||||
unsigned NumProtoRefs,
|
||||
const SourceLocation *ProtoLocs,
|
||||
SourceLocation EndProtoLoc) {
|
||||
@ -436,7 +436,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
ClassLoc, CategoryLoc, CategoryName);
|
||||
CDecl->setInvalidDecl();
|
||||
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
|
||||
return DeclPtrTy::make(CDecl);
|
||||
return CDecl;
|
||||
}
|
||||
|
||||
if (!CategoryName && IDecl->getImplementation()) {
|
||||
@ -486,13 +486,13 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
||||
}
|
||||
|
||||
CheckObjCDeclScope(CDecl);
|
||||
return DeclPtrTy::make(CDecl);
|
||||
return CDecl;
|
||||
}
|
||||
|
||||
/// ActOnStartCategoryImplementation - Perform semantic checks on the
|
||||
/// category implementation declaration and build an ObjCCategoryImplDecl
|
||||
/// object.
|
||||
Sema::DeclPtrTy Sema::ActOnStartCategoryImplementation(
|
||||
Decl *Sema::ActOnStartCategoryImplementation(
|
||||
SourceLocation AtCatImplLoc,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLoc,
|
||||
IdentifierInfo *CatName, SourceLocation CatLoc) {
|
||||
@ -533,10 +533,10 @@ Sema::DeclPtrTy Sema::ActOnStartCategoryImplementation(
|
||||
}
|
||||
|
||||
CheckObjCDeclScope(CDecl);
|
||||
return DeclPtrTy::make(CDecl);
|
||||
return CDecl;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
|
||||
Decl *Sema::ActOnStartClassImplementation(
|
||||
SourceLocation AtClassImplLoc,
|
||||
IdentifierInfo *ClassName, SourceLocation ClassLoc,
|
||||
IdentifierInfo *SuperClassname,
|
||||
@ -627,7 +627,7 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
|
||||
IDecl, SDecl);
|
||||
|
||||
if (CheckObjCDeclScope(IMPDecl))
|
||||
return DeclPtrTy::make(IMPDecl);
|
||||
return IMPDecl;
|
||||
|
||||
// Check that there is no duplicate implementation of this class.
|
||||
if (IDecl->getImplementation()) {
|
||||
@ -639,7 +639,7 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
|
||||
IDecl->setImplementation(IMPDecl);
|
||||
PushOnScopeChains(IMPDecl, TUScope);
|
||||
}
|
||||
return DeclPtrTy::make(IMPDecl);
|
||||
return IMPDecl;
|
||||
}
|
||||
|
||||
void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
|
||||
@ -1002,7 +1002,7 @@ void Sema::ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl,
|
||||
}
|
||||
|
||||
/// ActOnForwardClassDeclaration -
|
||||
Action::DeclPtrTy
|
||||
Decl *
|
||||
Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
||||
IdentifierInfo **IdentList,
|
||||
SourceLocation *IdentLocs,
|
||||
@ -1063,7 +1063,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
||||
Interfaces.size());
|
||||
CurContext->addDecl(CDecl);
|
||||
CheckObjCDeclScope(CDecl);
|
||||
return DeclPtrTy::make(CDecl);
|
||||
return CDecl;
|
||||
}
|
||||
|
||||
|
||||
@ -1285,12 +1285,10 @@ void Sema::DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID,
|
||||
// Note: For class/category implemenations, allMethods/allProperties is
|
||||
// always null.
|
||||
void Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd,
|
||||
DeclPtrTy classDecl,
|
||||
DeclPtrTy *allMethods, unsigned allNum,
|
||||
DeclPtrTy *allProperties, unsigned pNum,
|
||||
Decl *ClassDecl,
|
||||
Decl **allMethods, unsigned allNum,
|
||||
Decl **allProperties, unsigned pNum,
|
||||
DeclGroupPtrTy *allTUVars, unsigned tuvNum) {
|
||||
Decl *ClassDecl = classDecl.getAs<Decl>();
|
||||
|
||||
// FIXME: If we don't have a ClassDecl, we have an error. We should consider
|
||||
// always passing in a decl. If the decl has an error, isInvalidDecl()
|
||||
// should be true.
|
||||
@ -1319,7 +1317,7 @@ void Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd,
|
||||
|
||||
for (unsigned i = 0; i < allNum; i++ ) {
|
||||
ObjCMethodDecl *Method =
|
||||
cast_or_null<ObjCMethodDecl>(allMethods[i].getAs<Decl>());
|
||||
cast_or_null<ObjCMethodDecl>(allMethods[i]);
|
||||
|
||||
if (!Method) continue; // Already issued a diagnostic.
|
||||
if (Method->isInstanceMethod()) {
|
||||
@ -1366,14 +1364,14 @@ void Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd,
|
||||
// Compares properties declared in this class to those of its
|
||||
// super class.
|
||||
ComparePropertiesInBaseAndSuper(I);
|
||||
CompareProperties(I, DeclPtrTy::make(I));
|
||||
CompareProperties(I, I);
|
||||
} else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
|
||||
// Categories are used to extend the class by declaring new methods.
|
||||
// By the same token, they are also used to add new properties. No
|
||||
// need to compare the added property to those in the class.
|
||||
|
||||
// Compare protocol properties with those in category
|
||||
CompareProperties(C, DeclPtrTy::make(C));
|
||||
CompareProperties(C, C);
|
||||
if (C->IsClassExtension())
|
||||
DiagnoseClassExtensionDupMethods(C, C->getClassInterface());
|
||||
}
|
||||
@ -1465,9 +1463,9 @@ bool containsInvalidMethodImplAttribute(const AttrVec &A) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
|
||||
Decl *Sema::ActOnMethodDeclaration(
|
||||
SourceLocation MethodLoc, SourceLocation EndLoc,
|
||||
tok::TokenKind MethodType, DeclPtrTy classDecl,
|
||||
tok::TokenKind MethodType, Decl *ClassDecl,
|
||||
ObjCDeclSpec &ReturnQT, TypeTy *ReturnType,
|
||||
Selector Sel,
|
||||
// optional arguments. The number of types/arguments is obtained
|
||||
@ -1476,13 +1474,11 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
|
||||
DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, // c-style args
|
||||
AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind,
|
||||
bool isVariadic) {
|
||||
Decl *ClassDecl = classDecl.getAs<Decl>();
|
||||
|
||||
// Make sure we can establish a context for the method.
|
||||
if (!ClassDecl) {
|
||||
Diag(MethodLoc, diag::error_missing_method_context);
|
||||
getLabelMap().clear();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
QualType resultDeclType;
|
||||
|
||||
@ -1495,7 +1491,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
|
||||
if (resultDeclType->isObjCObjectType()) {
|
||||
Diag(MethodLoc, diag::err_object_cannot_be_passed_returned_by_value)
|
||||
<< 0 << resultDeclType;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
} else // get the type for "id".
|
||||
resultDeclType = Context.getObjCIdType();
|
||||
@ -1547,7 +1543,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = CNumArgs; i != e; ++i) {
|
||||
ParmVarDecl *Param = CParamInfo[i].Param.getAs<ParmVarDecl>();
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(CParamInfo[i].Param);
|
||||
QualType ArgType = Param->getType();
|
||||
if (ArgType.isNull())
|
||||
ArgType = Context.getObjCIdType();
|
||||
@ -1622,7 +1618,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
|
||||
ObjCMethod->addAttr(::new (Context) DeprecatedAttr(DA->getLocation(),
|
||||
Context));
|
||||
|
||||
return DeclPtrTy::make(ObjCMethod);
|
||||
return ObjCMethod;
|
||||
}
|
||||
|
||||
bool Sema::CheckObjCDeclScope(Decl *D) {
|
||||
@ -1637,9 +1633,9 @@ bool Sema::CheckObjCDeclScope(Decl *D) {
|
||||
|
||||
/// Called whenever @defs(ClassName) is encountered in the source. Inserts the
|
||||
/// instance variables of ClassName into Decls.
|
||||
void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
|
||||
void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
|
||||
IdentifierInfo *ClassName,
|
||||
llvm::SmallVectorImpl<DeclPtrTy> &Decls) {
|
||||
llvm::SmallVectorImpl<Decl*> &Decls) {
|
||||
// Check that ClassName is a valid class
|
||||
ObjCInterfaceDecl *Class = getObjCInterfaceDecl(ClassName, DeclStart);
|
||||
if (!Class) {
|
||||
@ -1657,20 +1653,20 @@ void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
|
||||
// For each ivar, create a fresh ObjCAtDefsFieldDecl.
|
||||
for (unsigned i = 0; i < Ivars.size(); i++) {
|
||||
FieldDecl* ID = cast<FieldDecl>(Ivars[i]);
|
||||
RecordDecl *Record = dyn_cast<RecordDecl>(TagD.getAs<Decl>());
|
||||
RecordDecl *Record = dyn_cast<RecordDecl>(TagD);
|
||||
Decl *FD = ObjCAtDefsFieldDecl::Create(Context, Record, ID->getLocation(),
|
||||
ID->getIdentifier(), ID->getType(),
|
||||
ID->getBitWidth());
|
||||
Decls.push_back(Sema::DeclPtrTy::make(FD));
|
||||
Decls.push_back(FD);
|
||||
}
|
||||
|
||||
// Introduce all of these fields into the appropriate scope.
|
||||
for (llvm::SmallVectorImpl<DeclPtrTy>::iterator D = Decls.begin();
|
||||
for (llvm::SmallVectorImpl<Decl*>::iterator D = Decls.begin();
|
||||
D != Decls.end(); ++D) {
|
||||
FieldDecl *FD = cast<FieldDecl>(D->getAs<Decl>());
|
||||
FieldDecl *FD = cast<FieldDecl>(*D);
|
||||
if (getLangOptions().CPlusPlus)
|
||||
PushOnScopeChains(cast<FieldDecl>(FD), S);
|
||||
else if (RecordDecl *Record = dyn_cast<RecordDecl>(TagD.getAs<Decl>()))
|
||||
else if (RecordDecl *Record = dyn_cast<RecordDecl>(TagD))
|
||||
Record->addDecl(FD);
|
||||
}
|
||||
}
|
||||
@ -1713,7 +1709,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo,
|
||||
return New;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
const DeclSpec &DS = D.getDeclSpec();
|
||||
|
||||
// We allow the "register" storage class on exception variables because
|
||||
@ -1758,7 +1754,7 @@ Sema::DeclPtrTy Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
}
|
||||
|
||||
// Add the parameter declaration into this scope.
|
||||
S->AddDecl(DeclPtrTy::make(New));
|
||||
S->AddDecl(New);
|
||||
if (D.getIdentifier())
|
||||
IdResolver.AddDecl(New);
|
||||
|
||||
@ -1766,7 +1762,7 @@ Sema::DeclPtrTy Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
|
||||
|
||||
if (New->hasAttr<BlocksAttr>())
|
||||
Diag(New->getLocation(), diag::err_block_on_nonlocal);
|
||||
return DeclPtrTy::make(New);
|
||||
return New;
|
||||
}
|
||||
|
||||
/// CollectIvarsToConstructOrDestruct - Collect those ivars which require
|
||||
|
@ -2756,7 +2756,7 @@ Sema::BuildMemberReferenceExpr(ExprArg BaseArg, QualType BaseType,
|
||||
} else {
|
||||
OwningExprResult Result =
|
||||
LookupMemberExpr(R, Base, IsArrow, OpLoc,
|
||||
SS, /*ObjCImpDecl*/ DeclPtrTy(), TemplateArgs != 0);
|
||||
SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0);
|
||||
|
||||
if (Result.isInvalid()) {
|
||||
Owned(Base);
|
||||
@ -2972,7 +2972,7 @@ Sema::OwningExprResult
|
||||
Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
|
||||
bool &IsArrow, SourceLocation OpLoc,
|
||||
CXXScopeSpec &SS,
|
||||
DeclPtrTy ObjCImpDecl, bool HasTemplateArgs) {
|
||||
Decl *ObjCImpDecl, bool HasTemplateArgs) {
|
||||
assert(BaseExpr && "no base expression");
|
||||
|
||||
// Perform default conversions.
|
||||
@ -3210,12 +3210,11 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
|
||||
// down the context as argument to this routine. Ideally, this context
|
||||
// need be passed down in the AST node and somehow calculated from the
|
||||
// AST for a function decl.
|
||||
Decl *ImplDecl = ObjCImpDecl.getAs<Decl>();
|
||||
if (ObjCImplementationDecl *IMPD =
|
||||
dyn_cast<ObjCImplementationDecl>(ImplDecl))
|
||||
dyn_cast<ObjCImplementationDecl>(ObjCImpDecl))
|
||||
ClassOfMethodDecl = IMPD->getClassInterface();
|
||||
else if (ObjCCategoryImplDecl* CatImplClass =
|
||||
dyn_cast<ObjCCategoryImplDecl>(ImplDecl))
|
||||
dyn_cast<ObjCCategoryImplDecl>(ObjCImpDecl))
|
||||
ClassOfMethodDecl = CatImplClass->getClassInterface();
|
||||
}
|
||||
|
||||
@ -3321,7 +3320,7 @@ Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, ExprArg BaseArg,
|
||||
tok::TokenKind OpKind,
|
||||
CXXScopeSpec &SS,
|
||||
UnqualifiedId &Id,
|
||||
DeclPtrTy ObjCImpDecl,
|
||||
Decl *ObjCImpDecl,
|
||||
bool HasTrailingLParen) {
|
||||
if (SS.isSet() && SS.isInvalid())
|
||||
return ExprError();
|
||||
|
@ -100,7 +100,7 @@ namespace {
|
||||
End = S->using_directives_end();
|
||||
|
||||
for (; I != End; ++I)
|
||||
visit(I->getAs<UsingDirectiveDecl>(), InnermostFileDC);
|
||||
visit(*I, InnermostFileDC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -811,7 +811,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
|
||||
|
||||
// Check whether the IdResolver has anything in this scope.
|
||||
bool Found = false;
|
||||
for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) {
|
||||
for (; I != IEnd && S->isDeclScope(*I); ++I) {
|
||||
if (R.isAcceptableDecl(*I)) {
|
||||
Found = true;
|
||||
R.addDecl(*I);
|
||||
@ -909,7 +909,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
|
||||
for (; S; S = S->getParent()) {
|
||||
// Check whether the IdResolver has anything in this scope.
|
||||
bool Found = false;
|
||||
for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) {
|
||||
for (; I != IEnd && S->isDeclScope(*I); ++I) {
|
||||
if (R.isAcceptableDecl(*I)) {
|
||||
// We found something. Look for anything else in our scope
|
||||
// with this same name and in an acceptable identifier
|
||||
@ -1045,7 +1045,7 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
|
||||
if (NameKind == LookupRedeclarationWithLinkage) {
|
||||
// Determine whether this (or a previous) declaration is
|
||||
// out-of-scope.
|
||||
if (!LeftStartingScope && !S->isDeclScope(DeclPtrTy::make(*I)))
|
||||
if (!LeftStartingScope && !S->isDeclScope(*I))
|
||||
LeftStartingScope = true;
|
||||
|
||||
// If we found something outside of our starting scope that
|
||||
@ -1062,14 +1062,14 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
|
||||
|
||||
// Figure out what scope the identifier is in.
|
||||
while (!(S->getFlags() & Scope::DeclScope) ||
|
||||
!S->isDeclScope(DeclPtrTy::make(*I)))
|
||||
!S->isDeclScope(*I))
|
||||
S = S->getParent();
|
||||
|
||||
// Find the last declaration in this scope (with the same
|
||||
// name, naturally).
|
||||
IdentifierResolver::iterator LastI = I;
|
||||
for (++LastI; LastI != IEnd; ++LastI) {
|
||||
if (!S->isDeclScope(DeclPtrTy::make(*LastI)))
|
||||
if (!S->isDeclScope(*LastI))
|
||||
break;
|
||||
R.addDecl(*LastI);
|
||||
}
|
||||
@ -2535,7 +2535,7 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result,
|
||||
// Walk through the declarations in this Scope.
|
||||
for (Scope::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
|
||||
D != DEnd; ++D) {
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>((Decl *)((*D).get())))
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(*D))
|
||||
if (Result.isAcceptableDecl(ND)) {
|
||||
Consumer.FoundDecl(ND, Visited.checkHidden(ND), false);
|
||||
Visited.add(ND);
|
||||
|
@ -22,14 +22,14 @@ using namespace clang;
|
||||
// Grammar actions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
FieldDeclarator &FD,
|
||||
ObjCDeclSpec &ODS,
|
||||
Selector GetterSel,
|
||||
Selector SetterSel,
|
||||
DeclPtrTy ClassCategory,
|
||||
bool *isOverridingProperty,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
FieldDeclarator &FD,
|
||||
ObjCDeclSpec &ODS,
|
||||
Selector GetterSel,
|
||||
Selector SetterSel,
|
||||
Decl *ClassCategory,
|
||||
bool *isOverridingProperty,
|
||||
tok::ObjCKeywordKind MethodImplKind) {
|
||||
unsigned Attributes = ODS.getPropertyAttributes();
|
||||
bool isReadWrite = ((Attributes & ObjCDeclSpec::DQ_PR_readwrite) ||
|
||||
// default is readwrite!
|
||||
@ -45,15 +45,15 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
QualType T = TSI->getType();
|
||||
if (T->isReferenceType()) {
|
||||
Diag(AtLoc, diag::error_reference_property);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
// Proceed with constructing the ObjCPropertDecls.
|
||||
ObjCContainerDecl *ClassDecl =
|
||||
cast<ObjCContainerDecl>(ClassCategory.getAs<Decl>());
|
||||
cast<ObjCContainerDecl>(ClassCategory);
|
||||
|
||||
if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl))
|
||||
if (CDecl->IsClassExtension()) {
|
||||
DeclPtrTy Res = HandlePropertyInClassExtension(S, CDecl, AtLoc,
|
||||
Decl *Res = HandlePropertyInClassExtension(S, CDecl, AtLoc,
|
||||
FD, GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes,
|
||||
@ -64,16 +64,16 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
||||
return Res;
|
||||
}
|
||||
|
||||
DeclPtrTy Res = DeclPtrTy::make(CreatePropertyDecl(S, ClassDecl, AtLoc, FD,
|
||||
GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes, TSI, MethodImplKind));
|
||||
Decl *Res = CreatePropertyDecl(S, ClassDecl, AtLoc, FD,
|
||||
GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes, TSI, MethodImplKind);
|
||||
// Validate the attributes on the @property.
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attributes);
|
||||
return Res;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Decl *
|
||||
Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
SourceLocation AtLoc, FieldDeclarator &FD,
|
||||
Selector GetterSel, Selector SetterSel,
|
||||
@ -92,7 +92,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
ObjCPropertyDecl::findPropertyDecl(DC, PropertyId)) {
|
||||
Diag(AtLoc, diag::err_duplicate_property);
|
||||
Diag(prevDecl->getLocation(), diag::note_property_declare);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create a new ObjCPropertyDecl with the DeclContext being
|
||||
@ -113,7 +113,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
if (!CCPrimary) {
|
||||
Diag(CDecl->getLocation(), diag::err_continuation_class);
|
||||
*isOverridingProperty = true;
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Find the property in continuation class's primary class only.
|
||||
@ -136,7 +136,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
// is not what it was meant for. However, gcc supports it and so should we.
|
||||
// Make sure setter/getters are declared here.
|
||||
ProcessPropertyDecl(PDecl, CCPrimary);
|
||||
return DeclPtrTy::make(PDecl);
|
||||
return PDecl;
|
||||
|
||||
}
|
||||
|
||||
@ -165,13 +165,13 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
setPropertyAttributes((ObjCDeclSpec::ObjCPropertyAttributeKind)
|
||||
PIkind);
|
||||
|
||||
DeclPtrTy ProtocolPtrTy =
|
||||
Decl *ProtocolPtrTy =
|
||||
ActOnProperty(S, AtLoc, FD, ProtocolPropertyODS,
|
||||
PIDecl->getGetterName(),
|
||||
PIDecl->getSetterName(),
|
||||
DeclPtrTy::make(CCPrimary), isOverridingProperty,
|
||||
CCPrimary, isOverridingProperty,
|
||||
MethodImplKind);
|
||||
PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy.getAs<Decl>());
|
||||
PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy);
|
||||
}
|
||||
PIDecl->makeitReadWriteAttribute();
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain)
|
||||
@ -187,7 +187,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
|
||||
*isOverridingProperty = true;
|
||||
// Make sure setter decl is synthesized, and added to primary class's list.
|
||||
ProcessPropertyDecl(PIDecl, CCPrimary);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
||||
@ -289,19 +289,19 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
||||
/// builds the AST node for a property implementation declaration; declared
|
||||
/// as @synthesize or @dynamic.
|
||||
///
|
||||
Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
SourceLocation AtLoc,
|
||||
SourceLocation PropertyLoc,
|
||||
bool Synthesize,
|
||||
DeclPtrTy ClassCatImpDecl,
|
||||
IdentifierInfo *PropertyId,
|
||||
IdentifierInfo *PropertyIvar) {
|
||||
Decl *Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
SourceLocation AtLoc,
|
||||
SourceLocation PropertyLoc,
|
||||
bool Synthesize,
|
||||
Decl *ClassCatImpDecl,
|
||||
IdentifierInfo *PropertyId,
|
||||
IdentifierInfo *PropertyIvar) {
|
||||
ObjCContainerDecl *ClassImpDecl =
|
||||
cast_or_null<ObjCContainerDecl>(ClassCatImpDecl.getAs<Decl>());
|
||||
cast_or_null<ObjCContainerDecl>(ClassCatImpDecl);
|
||||
// Make sure we have a context for the property implementation declaration.
|
||||
if (!ClassImpDecl) {
|
||||
Diag(AtLoc, diag::error_missing_property_context);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
ObjCPropertyDecl *property = 0;
|
||||
ObjCInterfaceDecl* IDecl = 0;
|
||||
@ -320,25 +320,25 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
property = IDecl->FindPropertyDeclaration(PropertyId);
|
||||
if (!property) {
|
||||
Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
if (const ObjCCategoryDecl *CD =
|
||||
dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) {
|
||||
if (!CD->IsClassExtension()) {
|
||||
Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
|
||||
Diag(property->getLocation(), diag::note_property_declare);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
|
||||
if (Synthesize) {
|
||||
Diag(AtLoc, diag::error_synthesize_category_decl);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
IDecl = CatImplClass->getClassInterface();
|
||||
if (!IDecl) {
|
||||
Diag(AtLoc, diag::error_missing_property_interface);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
ObjCCategoryDecl *Category =
|
||||
IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier());
|
||||
@ -346,17 +346,17 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
// If category for this implementation not found, it is an error which
|
||||
// has already been reported eralier.
|
||||
if (!Category)
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
// Look for this property declaration in @implementation's category
|
||||
property = Category->FindPropertyDeclaration(PropertyId);
|
||||
if (!property) {
|
||||
Diag(PropertyLoc, diag::error_bad_category_property_decl)
|
||||
<< Category->getDeclName();
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
Diag(AtLoc, diag::error_bad_property_context);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
ObjCIvarDecl *Ivar = 0;
|
||||
// Check that we have a valid, previously declared ivar for @synthesize
|
||||
@ -514,7 +514,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
= IC->FindPropertyImplDecl(PropertyId)) {
|
||||
Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
|
||||
Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
IC->addPropertyImplementation(PIDecl);
|
||||
if (getLangOptions().ObjCNonFragileABI2) {
|
||||
@ -549,12 +549,12 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
|
||||
CatImplClass->FindPropertyImplDecl(PropertyId)) {
|
||||
Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
|
||||
Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
|
||||
return DeclPtrTy();
|
||||
return 0;
|
||||
}
|
||||
CatImplClass->addPropertyImplementation(PIDecl);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(PIDecl);
|
||||
return PIDecl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -698,9 +698,8 @@ Sema::MatchOneProtocolPropertiesInClass(Decl *CDecl,
|
||||
/// declared in 'ClassOrProtocol' objects (which can be a class or an
|
||||
/// inherited protocol with the list of properties for class/category 'CDecl'
|
||||
///
|
||||
void Sema::CompareProperties(Decl *CDecl,
|
||||
DeclPtrTy ClassOrProtocol) {
|
||||
Decl *ClassDecl = ClassOrProtocol.getAs<Decl>();
|
||||
void Sema::CompareProperties(Decl *CDecl, Decl *ClassOrProtocol) {
|
||||
Decl *ClassDecl = ClassOrProtocol;
|
||||
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDecl);
|
||||
|
||||
if (!IDecl) {
|
||||
@ -717,7 +716,7 @@ void Sema::CompareProperties(Decl *CDecl,
|
||||
// their properties with those in the category.
|
||||
for (ObjCCategoryDecl::protocol_iterator P = CatDecl->protocol_begin(),
|
||||
E = CatDecl->protocol_end(); P != E; ++P)
|
||||
CompareProperties(CatDecl, DeclPtrTy::make(*P));
|
||||
CompareProperties(CatDecl, *P);
|
||||
} else {
|
||||
ObjCProtocolDecl *MD = cast<ObjCProtocolDecl>(ClassDecl);
|
||||
for (ObjCProtocolDecl::protocol_iterator P = MD->protocol_begin(),
|
||||
@ -737,7 +736,7 @@ void Sema::CompareProperties(Decl *CDecl,
|
||||
// their properties with those declared in the class.
|
||||
for (ObjCInterfaceDecl::protocol_iterator P = IDecl->protocol_begin(),
|
||||
E = IDecl->protocol_end(); P != E; ++P)
|
||||
CompareProperties(IDecl, DeclPtrTy::make(*P));
|
||||
CompareProperties(IDecl, *P);
|
||||
} else {
|
||||
ObjCProtocolDecl *MD = cast<ObjCProtocolDecl>(ClassDecl);
|
||||
for (ObjCProtocolDecl::protocol_iterator P = MD->protocol_begin(),
|
||||
@ -953,7 +952,7 @@ void Sema::DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl,
|
||||
continue;
|
||||
|
||||
ActOnPropertyImplDecl(S, IMPDecl->getLocation(), IMPDecl->getLocation(),
|
||||
true, DeclPtrTy::make(IMPDecl),
|
||||
true, IMPDecl,
|
||||
Prop->getIdentifier(), Prop->getIdentifier());
|
||||
}
|
||||
}
|
||||
@ -1158,11 +1157,10 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
|
||||
AddInstanceMethodToGlobalPool(SetterMethod);
|
||||
}
|
||||
|
||||
void Sema::CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy,
|
||||
void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
||||
SourceLocation Loc,
|
||||
unsigned &Attributes) {
|
||||
// FIXME: Improve the reported location.
|
||||
Decl *PDecl = PropertyPtrTy.getAs<Decl>();
|
||||
if (!PDecl)
|
||||
return;
|
||||
|
||||
|
@ -257,14 +257,14 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
|
||||
}
|
||||
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, DeclPtrTy CondVar,
|
||||
Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,
|
||||
StmtArg ThenVal, SourceLocation ElseLoc,
|
||||
StmtArg ElseVal) {
|
||||
OwningExprResult CondResult(CondVal.release());
|
||||
|
||||
VarDecl *ConditionVar = 0;
|
||||
if (CondVar.get()) {
|
||||
ConditionVar = CondVar.getAs<VarDecl>();
|
||||
if (CondVar) {
|
||||
ConditionVar = cast<VarDecl>(CondVar);
|
||||
CondResult = CheckConditionVariable(ConditionVar, IfLoc, true);
|
||||
if (CondResult.isInvalid())
|
||||
return StmtError();
|
||||
@ -397,10 +397,10 @@ static QualType GetTypeBeforeIntegralPromotion(const Expr* expr) {
|
||||
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, ExprArg Cond,
|
||||
DeclPtrTy CondVar) {
|
||||
Decl *CondVar) {
|
||||
VarDecl *ConditionVar = 0;
|
||||
if (CondVar.get()) {
|
||||
ConditionVar = CondVar.getAs<VarDecl>();
|
||||
if (CondVar) {
|
||||
ConditionVar = cast<VarDecl>(CondVar);
|
||||
OwningExprResult CondE = CheckConditionVariable(ConditionVar, SourceLocation(), false);
|
||||
if (CondE.isInvalid())
|
||||
return StmtError();
|
||||
@ -427,7 +427,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, ExprArg Cond,
|
||||
|
||||
CondExpr = ConvertedCond.takeAs<Expr>();
|
||||
|
||||
if (!CondVar.get()) {
|
||||
if (!CondVar) {
|
||||
CondExpr = MaybeCreateCXXExprWithTemporaries(CondExpr);
|
||||
if (!CondExpr)
|
||||
return StmtError();
|
||||
@ -801,12 +801,12 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtArg Switch,
|
||||
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond,
|
||||
DeclPtrTy CondVar, StmtArg Body) {
|
||||
Decl *CondVar, StmtArg Body) {
|
||||
OwningExprResult CondResult(Cond.release());
|
||||
|
||||
VarDecl *ConditionVar = 0;
|
||||
if (CondVar.get()) {
|
||||
ConditionVar = CondVar.getAs<VarDecl>();
|
||||
if (CondVar) {
|
||||
ConditionVar = cast<VarDecl>(CondVar);
|
||||
CondResult = CheckConditionVariable(ConditionVar, WhileLoc, true);
|
||||
if (CondResult.isInvalid())
|
||||
return StmtError();
|
||||
@ -849,7 +849,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
|
||||
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
|
||||
StmtArg first, FullExprArg second, DeclPtrTy secondVar,
|
||||
StmtArg first, FullExprArg second, Decl *secondVar,
|
||||
FullExprArg third,
|
||||
SourceLocation RParenLoc, StmtArg body) {
|
||||
Stmt *First = static_cast<Stmt*>(first.get());
|
||||
@ -873,8 +873,8 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
|
||||
|
||||
OwningExprResult SecondResult(second.release());
|
||||
VarDecl *ConditionVar = 0;
|
||||
if (secondVar.get()) {
|
||||
ConditionVar = secondVar.getAs<VarDecl>();
|
||||
if (secondVar) {
|
||||
ConditionVar = cast<VarDecl>(secondVar);
|
||||
SecondResult = CheckConditionVariable(ConditionVar, ForLoc, true);
|
||||
if (SecondResult.isInvalid())
|
||||
return StmtError();
|
||||
@ -1504,9 +1504,9 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
|
||||
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
|
||||
SourceLocation RParen, DeclPtrTy Parm,
|
||||
SourceLocation RParen, Decl *Parm,
|
||||
StmtArg Body) {
|
||||
VarDecl *Var = cast_or_null<VarDecl>(Parm.getAs<Decl>());
|
||||
VarDecl *Var = cast_or_null<VarDecl>(Parm);
|
||||
if (Var && Var->isInvalidDecl())
|
||||
return StmtError();
|
||||
|
||||
@ -1588,11 +1588,11 @@ Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, ExprArg SynchExpr,
|
||||
/// ActOnCXXCatchBlock - Takes an exception declaration and a handler block
|
||||
/// and creates a proper catch handler from them.
|
||||
Action::OwningStmtResult
|
||||
Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, DeclPtrTy ExDecl,
|
||||
Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl,
|
||||
StmtArg HandlerBlock) {
|
||||
// There's nothing to test that ActOnExceptionDecl didn't already test.
|
||||
return Owned(new (Context) CXXCatchStmt(CatchLoc,
|
||||
cast_or_null<VarDecl>(ExDecl.getAs<Decl>()),
|
||||
cast_or_null<VarDecl>(ExDecl),
|
||||
HandlerBlock.takeAs<Stmt>()));
|
||||
}
|
||||
|
||||
|
@ -410,9 +410,9 @@ bool Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) {
|
||||
/// AdjustDeclIfTemplate - If the given decl happens to be a template, reset
|
||||
/// the parameter D to reference the templated declaration and return a pointer
|
||||
/// to the template declaration. Otherwise, do nothing to D and return null.
|
||||
TemplateDecl *Sema::AdjustDeclIfTemplate(DeclPtrTy &D) {
|
||||
if (TemplateDecl *Temp = dyn_cast_or_null<TemplateDecl>(D.getAs<Decl>())) {
|
||||
D = DeclPtrTy::make(Temp->getTemplatedDecl());
|
||||
TemplateDecl *Sema::AdjustDeclIfTemplate(Decl *&D) {
|
||||
if (TemplateDecl *Temp = dyn_cast_or_null<TemplateDecl>(D)) {
|
||||
D = Temp->getTemplatedDecl();
|
||||
return Temp;
|
||||
}
|
||||
return 0;
|
||||
@ -466,14 +466,14 @@ void Sema::translateTemplateArguments(const ASTTemplateArgsPtr &TemplateArgsIn,
|
||||
/// ParamName is the location of the parameter name (if any).
|
||||
/// If the type parameter has a default argument, it will be added
|
||||
/// later via ActOnTypeParameterDefault.
|
||||
Sema::DeclPtrTy Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
SourceLocation EllipsisLoc,
|
||||
SourceLocation KeyLoc,
|
||||
IdentifierInfo *ParamName,
|
||||
SourceLocation ParamNameLoc,
|
||||
unsigned Depth, unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
TypeTy *DefaultArg) {
|
||||
Decl *Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
SourceLocation EllipsisLoc,
|
||||
SourceLocation KeyLoc,
|
||||
IdentifierInfo *ParamName,
|
||||
SourceLocation ParamNameLoc,
|
||||
unsigned Depth, unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
TypeTy *DefaultArg) {
|
||||
assert(S->isTemplateParamScope() &&
|
||||
"Template type parameter not in template parameter scope!");
|
||||
bool Invalid = false;
|
||||
@ -500,7 +500,7 @@ Sema::DeclPtrTy Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
|
||||
if (ParamName) {
|
||||
// Add the template parameter into the current scope.
|
||||
S->AddDecl(DeclPtrTy::make(Param));
|
||||
S->AddDecl(Param);
|
||||
IdResolver.AddDecl(Param);
|
||||
}
|
||||
|
||||
@ -516,19 +516,19 @@ Sema::DeclPtrTy Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
|
||||
// template-parameter that is not a template parameter pack.
|
||||
if (Ellipsis) {
|
||||
Diag(EqualLoc, diag::err_template_param_pack_default_arg);
|
||||
return DeclPtrTy::make(Param);
|
||||
return Param;
|
||||
}
|
||||
|
||||
// Check the template argument itself.
|
||||
if (CheckTemplateArgument(Param, DefaultTInfo)) {
|
||||
Param->setInvalidDecl();
|
||||
return DeclPtrTy::make(Param);;
|
||||
return Param;
|
||||
}
|
||||
|
||||
Param->setDefaultArgument(DefaultTInfo, false);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(Param);
|
||||
return Param;
|
||||
}
|
||||
|
||||
/// \brief Check that the type of a non-type template parameter is
|
||||
@ -581,11 +581,11 @@ Sema::CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc) {
|
||||
return QualType();
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg DefaultArg) {
|
||||
Decl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
ExprArg DefaultArg) {
|
||||
TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
|
||||
QualType T = TInfo->getType();
|
||||
|
||||
@ -618,7 +618,7 @@ Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
|
||||
if (D.getIdentifier()) {
|
||||
// Add the template parameter into the current scope.
|
||||
S->AddDecl(DeclPtrTy::make(Param));
|
||||
S->AddDecl(Param);
|
||||
IdResolver.AddDecl(Param);
|
||||
}
|
||||
|
||||
@ -627,26 +627,26 @@ Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
|
||||
TemplateArgument Converted;
|
||||
if (CheckTemplateArgument(Param, Param->getType(), Default, Converted)) {
|
||||
Param->setInvalidDecl();
|
||||
return DeclPtrTy::make(Param);;
|
||||
return Param;
|
||||
}
|
||||
|
||||
Param->setDefaultArgument(DefaultArg.takeAs<Expr>(), false);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(Param);
|
||||
return Param;
|
||||
}
|
||||
|
||||
/// ActOnTemplateTemplateParameter - Called when a C++ template template
|
||||
/// parameter (e.g. T in template <template <typename> class T> class array)
|
||||
/// has been parsed. S is the current scope.
|
||||
Sema::DeclPtrTy Sema::ActOnTemplateTemplateParameter(Scope* S,
|
||||
SourceLocation TmpLoc,
|
||||
TemplateParamsTy *Params,
|
||||
IdentifierInfo *Name,
|
||||
SourceLocation NameLoc,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
Decl *Sema::ActOnTemplateTemplateParameter(Scope* S,
|
||||
SourceLocation TmpLoc,
|
||||
TemplateParamsTy *Params,
|
||||
IdentifierInfo *Name,
|
||||
SourceLocation NameLoc,
|
||||
unsigned Depth,
|
||||
unsigned Position,
|
||||
SourceLocation EqualLoc,
|
||||
const ParsedTemplateArgument &Default) {
|
||||
assert(S->isTemplateParamScope() &&
|
||||
"Template template parameter not in template parameter scope!");
|
||||
@ -660,7 +660,7 @@ Sema::DeclPtrTy Sema::ActOnTemplateTemplateParameter(Scope* S,
|
||||
// If the template template parameter has a name, then link the identifier
|
||||
// into the scope and lookup mechanisms.
|
||||
if (Name) {
|
||||
S->AddDecl(DeclPtrTy::make(Param));
|
||||
S->AddDecl(Param);
|
||||
IdResolver.AddDecl(Param);
|
||||
}
|
||||
|
||||
@ -677,13 +677,13 @@ Sema::DeclPtrTy Sema::ActOnTemplateTemplateParameter(Scope* S,
|
||||
if (DefaultArg.getArgument().getAsTemplate().isNull()) {
|
||||
Diag(DefaultArg.getLocation(), diag::err_template_arg_not_class_template)
|
||||
<< DefaultArg.getSourceRange();
|
||||
return DeclPtrTy::make(Param);
|
||||
return Param;
|
||||
}
|
||||
|
||||
Param->setDefaultArgument(DefaultArg, false);
|
||||
}
|
||||
|
||||
return DeclPtrTy::make(Param);
|
||||
return Param;
|
||||
}
|
||||
|
||||
/// ActOnTemplateParameterList - Builds a TemplateParameterList that
|
||||
@ -693,7 +693,7 @@ Sema::ActOnTemplateParameterList(unsigned Depth,
|
||||
SourceLocation ExportLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
DeclPtrTy *Params, unsigned NumParams,
|
||||
Decl **Params, unsigned NumParams,
|
||||
SourceLocation RAngleLoc) {
|
||||
if (ExportLoc.isValid())
|
||||
Diag(ExportLoc, diag::warn_template_export_unsupported);
|
||||
@ -951,7 +951,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
NewTemplate->setInvalidDecl();
|
||||
NewClass->setInvalidDecl();
|
||||
}
|
||||
return DeclPtrTy::make(NewTemplate);
|
||||
return NewTemplate;
|
||||
}
|
||||
|
||||
/// \brief Diagnose the presence of a default template argument on a
|
||||
@ -3603,7 +3603,7 @@ static NamedDecl *getPreviousDecl(NamedDecl *ND) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Sema::DeclResult
|
||||
DeclResult
|
||||
Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
|
||||
TagUseKind TUK,
|
||||
SourceLocation KWLoc,
|
||||
@ -3991,20 +3991,18 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
|
||||
// context. However, specializations are not found by name lookup.
|
||||
CurContext->addDecl(Specialization);
|
||||
}
|
||||
return DeclPtrTy::make(Specialization);
|
||||
return Specialization;
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Sema::ActOnTemplateDeclarator(Scope *S,
|
||||
Decl *Sema::ActOnTemplateDeclarator(Scope *S,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D) {
|
||||
Declarator &D) {
|
||||
return HandleDeclarator(S, D, move(TemplateParameterLists), false);
|
||||
}
|
||||
|
||||
Sema::DeclPtrTy
|
||||
Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
MultiTemplateParamsArg TemplateParameterLists,
|
||||
Declarator &D) {
|
||||
Declarator &D) {
|
||||
assert(getCurFunctionDecl() == 0 && "Function parsing confused");
|
||||
assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
|
||||
"Not a function declarator!");
|
||||
@ -4016,16 +4014,16 @@ Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
|
||||
|
||||
Scope *ParentScope = FnBodyScope->getParent();
|
||||
|
||||
DeclPtrTy DP = HandleDeclarator(ParentScope, D,
|
||||
move(TemplateParameterLists),
|
||||
/*IsFunctionDefinition=*/true);
|
||||
Decl *DP = HandleDeclarator(ParentScope, D,
|
||||
move(TemplateParameterLists),
|
||||
/*IsFunctionDefinition=*/true);
|
||||
if (FunctionTemplateDecl *FunctionTemplate
|
||||
= dyn_cast_or_null<FunctionTemplateDecl>(DP.getAs<Decl>()))
|
||||
= dyn_cast_or_null<FunctionTemplateDecl>(DP))
|
||||
return ActOnStartOfFunctionDef(FnBodyScope,
|
||||
DeclPtrTy::make(FunctionTemplate->getTemplatedDecl()));
|
||||
if (FunctionDecl *Function = dyn_cast_or_null<FunctionDecl>(DP.getAs<Decl>()))
|
||||
return ActOnStartOfFunctionDef(FnBodyScope, DeclPtrTy::make(Function));
|
||||
return DeclPtrTy();
|
||||
FunctionTemplate->getTemplatedDecl());
|
||||
if (FunctionDecl *Function = dyn_cast_or_null<FunctionDecl>(DP))
|
||||
return ActOnStartOfFunctionDef(FnBodyScope, Function);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// \brief Strips various properties off an implicit instantiation
|
||||
@ -4720,7 +4718,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
PrevDecl, PrevDecl_TSK,
|
||||
PrevDecl->getPointOfInstantiation(),
|
||||
HasNoEffect))
|
||||
return DeclPtrTy::make(PrevDecl);
|
||||
return PrevDecl;
|
||||
|
||||
// Even though HasNoEffect == true means that this explicit instantiation
|
||||
// has no effect on semantics, we go on to put its syntax in the AST.
|
||||
@ -4784,7 +4782,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
if (HasNoEffect) {
|
||||
// Set the template specialization kind.
|
||||
Specialization->setTemplateSpecializationKind(TSK);
|
||||
return DeclPtrTy::make(Specialization);
|
||||
return Specialization;
|
||||
}
|
||||
|
||||
// C++ [temp.explicit]p3:
|
||||
@ -4821,11 +4819,11 @@ Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
|
||||
// Set the template specialization kind.
|
||||
Specialization->setTemplateSpecializationKind(TSK);
|
||||
return DeclPtrTy::make(Specialization);
|
||||
return Specialization;
|
||||
}
|
||||
|
||||
// Explicit instantiation of a member class of a class template.
|
||||
Sema::DeclResult
|
||||
DeclResult
|
||||
Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
SourceLocation ExternLoc,
|
||||
SourceLocation TemplateLoc,
|
||||
@ -4838,16 +4836,16 @@ Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
|
||||
bool Owned = false;
|
||||
bool IsDependent = false;
|
||||
DeclPtrTy TagD = ActOnTag(S, TagSpec, Action::TUK_Reference,
|
||||
KWLoc, SS, Name, NameLoc, Attr, AS_none,
|
||||
MultiTemplateParamsArg(*this, 0, 0),
|
||||
Owned, IsDependent);
|
||||
Decl *TagD = ActOnTag(S, TagSpec, Action::TUK_Reference,
|
||||
KWLoc, SS, Name, NameLoc, Attr, AS_none,
|
||||
MultiTemplateParamsArg(*this, 0, 0),
|
||||
Owned, IsDependent);
|
||||
assert(!IsDependent && "explicit instantiation of dependent name not yet handled");
|
||||
|
||||
if (!TagD)
|
||||
return true;
|
||||
|
||||
TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>());
|
||||
TagDecl *Tag = cast<TagDecl>(TagD);
|
||||
if (Tag->isEnum()) {
|
||||
Diag(TemplateLoc, diag::err_explicit_instantiation_enum)
|
||||
<< Context.getTypeDeclType(Tag);
|
||||
@ -5064,7 +5062,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
HasNoEffect))
|
||||
return true;
|
||||
if (HasNoEffect)
|
||||
return DeclPtrTy();
|
||||
return (Decl*) 0;
|
||||
|
||||
// Instantiate static data member.
|
||||
Prev->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
|
||||
@ -5073,7 +5071,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
/*DefinitionRequired=*/true);
|
||||
|
||||
// FIXME: Create an ExplicitInstantiation node?
|
||||
return DeclPtrTy();
|
||||
return (Decl*) 0;
|
||||
}
|
||||
|
||||
// If the declarator is a template-id, translate the parser's template
|
||||
@ -5171,7 +5169,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
// FIXME: We may still want to build some representation of this
|
||||
// explicit specialization.
|
||||
if (HasNoEffect)
|
||||
return DeclPtrTy();
|
||||
return (Decl*) 0;
|
||||
}
|
||||
|
||||
Specialization->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
|
||||
@ -5202,7 +5200,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
|
||||
D.getCXXScopeSpec().isSet());
|
||||
|
||||
// FIXME: Create some kind of ExplicitInstantiationDecl here.
|
||||
return DeclPtrTy();
|
||||
return (Decl*) 0;
|
||||
}
|
||||
|
||||
Sema::TypeResult
|
||||
|
@ -1218,14 +1218,14 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
|
||||
if (SubstBaseSpecifiers(Instantiation, Pattern, TemplateArgs))
|
||||
Invalid = true;
|
||||
|
||||
llvm::SmallVector<DeclPtrTy, 4> Fields;
|
||||
llvm::SmallVector<Decl*, 4> Fields;
|
||||
for (RecordDecl::decl_iterator Member = Pattern->decls_begin(),
|
||||
MemberEnd = Pattern->decls_end();
|
||||
Member != MemberEnd; ++Member) {
|
||||
Decl *NewMember = SubstDecl(*Member, Instantiation, TemplateArgs);
|
||||
if (NewMember) {
|
||||
if (FieldDecl *Field = dyn_cast<FieldDecl>(NewMember))
|
||||
Fields.push_back(DeclPtrTy::make(Field));
|
||||
Fields.push_back(Field);
|
||||
else if (NewMember->isInvalidDecl())
|
||||
Invalid = true;
|
||||
} else {
|
||||
@ -1236,7 +1236,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
|
||||
}
|
||||
|
||||
// Finish checking fields.
|
||||
ActOnFields(0, Instantiation->getLocation(), DeclPtrTy::make(Instantiation),
|
||||
ActOnFields(0, Instantiation->getLocation(), Instantiation,
|
||||
Fields.data(), Fields.size(), SourceLocation(), SourceLocation(),
|
||||
0);
|
||||
CheckCompletedCXXClass(Instantiation);
|
||||
|
@ -427,19 +427,19 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
|
||||
// Attach the initializer to the declaration.
|
||||
if (D->hasCXXDirectInitializer()) {
|
||||
// Add the direct initializer to the declaration.
|
||||
SemaRef.AddCXXDirectInitializerToDecl(Sema::DeclPtrTy::make(Var),
|
||||
SemaRef.AddCXXDirectInitializerToDecl(Var,
|
||||
LParenLoc,
|
||||
move_arg(InitArgs),
|
||||
CommaLocs.data(),
|
||||
RParenLoc);
|
||||
} else if (InitArgs.size() == 1) {
|
||||
Expr *Init = (Expr*)(InitArgs.take()[0]);
|
||||
SemaRef.AddInitializerToDecl(Sema::DeclPtrTy::make(Var),
|
||||
SemaRef.AddInitializerToDecl(Var,
|
||||
SemaRef.Owned(Init),
|
||||
false);
|
||||
} else {
|
||||
assert(InitArgs.size() == 0);
|
||||
SemaRef.ActOnUninitializedDecl(Sema::DeclPtrTy::make(Var), false);
|
||||
SemaRef.ActOnUninitializedDecl(Var, false);
|
||||
}
|
||||
} else {
|
||||
// FIXME: Not too happy about invalidating the declaration
|
||||
@ -449,7 +449,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
|
||||
|
||||
SemaRef.PopExpressionEvaluationContext();
|
||||
} else if (!Var->isStaticDataMember() || Var->isOutOfLine())
|
||||
SemaRef.ActOnUninitializedDecl(Sema::DeclPtrTy::make(Var), false);
|
||||
SemaRef.ActOnUninitializedDecl(Var, false);
|
||||
|
||||
// Diagnose unused local variables.
|
||||
if (!Var->isInvalidDecl() && Owner->isFunctionOrMethod() && !Var->isUsed())
|
||||
@ -593,11 +593,9 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
|
||||
|
||||
OwningExprResult Message(SemaRef, D->getMessage());
|
||||
D->getMessage()->Retain();
|
||||
Decl *StaticAssert
|
||||
= SemaRef.ActOnStaticAssertDeclaration(D->getLocation(),
|
||||
move(InstantiatedAssertExpr),
|
||||
move(Message)).getAs<Decl>();
|
||||
return StaticAssert;
|
||||
return SemaRef.ActOnStaticAssertDeclaration(D->getLocation(),
|
||||
move(InstantiatedAssertExpr),
|
||||
move(Message));
|
||||
}
|
||||
|
||||
Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
|
||||
@ -614,7 +612,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
|
||||
if (D->getDeclContext()->isFunctionOrMethod())
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Enum);
|
||||
|
||||
llvm::SmallVector<Sema::DeclPtrTy, 4> Enumerators;
|
||||
llvm::SmallVector<Decl*, 4> Enumerators;
|
||||
|
||||
EnumConstantDecl *LastEnumConst = 0;
|
||||
for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(),
|
||||
@ -651,7 +649,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
|
||||
if (EnumConst) {
|
||||
EnumConst->setAccess(Enum->getAccess());
|
||||
Enum->addDecl(EnumConst);
|
||||
Enumerators.push_back(Sema::DeclPtrTy::make(EnumConst));
|
||||
Enumerators.push_back(EnumConst);
|
||||
LastEnumConst = EnumConst;
|
||||
|
||||
if (D->getDeclContext()->isFunctionOrMethod()) {
|
||||
@ -665,7 +663,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
|
||||
// FIXME: Fixup LBraceLoc and RBraceLoc
|
||||
// FIXME: Empty Scope and AttributeList (required to handle attribute packed).
|
||||
SemaRef.ActOnEnumBody(Enum->getLocation(), SourceLocation(), SourceLocation(),
|
||||
Sema::DeclPtrTy::make(Enum),
|
||||
Enum,
|
||||
Enumerators.data(), Enumerators.size(),
|
||||
0, 0);
|
||||
|
||||
@ -2072,7 +2070,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
|
||||
|
||||
EnterExpressionEvaluationContext EvalContext(*this,
|
||||
Action::PotentiallyEvaluated);
|
||||
ActOnStartOfFunctionDef(0, DeclPtrTy::make(Function));
|
||||
ActOnStartOfFunctionDef(0, Function);
|
||||
|
||||
// Introduce a new scope where local variable instantiations will be
|
||||
// recorded, unless we're actually a member function within a local
|
||||
@ -2115,7 +2113,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
|
||||
if (Body.isInvalid())
|
||||
Function->setInvalidDecl();
|
||||
|
||||
ActOnFinishFunctionBody(DeclPtrTy::make(Function), move(Body),
|
||||
ActOnFinishFunctionBody(Function, move(Body),
|
||||
/*IsInstantiation=*/true);
|
||||
|
||||
PerformDependentDiagnostics(PatternDecl, TemplateArgs);
|
||||
@ -2312,7 +2310,7 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New,
|
||||
}
|
||||
|
||||
// Assign all the initializers to the new constructor.
|
||||
ActOnMemInitializers(DeclPtrTy::make(New),
|
||||
ActOnMemInitializers(New,
|
||||
/*FIXME: ColonLoc */
|
||||
SourceLocation(),
|
||||
NewInits.data(), NewInits.size(),
|
||||
@ -2715,7 +2713,7 @@ void Sema::PerformPendingImplicitInstantiations(bool LocalOnly) {
|
||||
|
||||
// Instantiate function definitions
|
||||
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
|
||||
PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Function),
|
||||
PrettyStackTraceActionsDecl CrashInfo(Function,
|
||||
Function->getLocation(), *this,
|
||||
Context.getSourceManager(),
|
||||
"instantiating function definition");
|
||||
@ -2746,8 +2744,7 @@ void Sema::PerformPendingImplicitInstantiations(bool LocalOnly) {
|
||||
break;
|
||||
}
|
||||
|
||||
PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Var),
|
||||
Var->getLocation(), *this,
|
||||
PrettyStackTraceActionsDecl CrashInfo(Var, Var->getLocation(), *this,
|
||||
Context.getSourceManager(),
|
||||
"instantiating static data member "
|
||||
"definition");
|
||||
|
@ -1239,8 +1239,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
|
||||
ArgTys.reserve(FTI.NumArgs);
|
||||
|
||||
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
|
||||
ParmVarDecl *Param =
|
||||
cast<ParmVarDecl>(FTI.ArgInfo[i].Param.getAs<Decl>());
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[i].Param);
|
||||
QualType ArgTy = Param->getType();
|
||||
assert(!ArgTy.isNull() && "Couldn't parse type?");
|
||||
|
||||
@ -1642,7 +1641,7 @@ namespace {
|
||||
|
||||
const DeclaratorChunk::FunctionTypeInfo &FTI = Chunk.Fun;
|
||||
for (unsigned i = 0, e = TL.getNumArgs(), tpi = 0; i != e; ++i) {
|
||||
ParmVarDecl *Param = FTI.ArgInfo[i].Param.getAs<ParmVarDecl>();
|
||||
ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[i].Param);
|
||||
TL.setArg(tpi++, Param);
|
||||
}
|
||||
// FIXME: exception specs
|
||||
|
@ -95,7 +95,6 @@ public:
|
||||
typedef Sema::ExprArg ExprArg;
|
||||
typedef Sema::MultiExprArg MultiExprArg;
|
||||
typedef Sema::MultiStmtArg MultiStmtArg;
|
||||
typedef Sema::DeclPtrTy DeclPtrTy;
|
||||
|
||||
/// \brief Initializes a new tree transformer.
|
||||
TreeTransform(Sema &SemaRef) : SemaRef(SemaRef) { }
|
||||
@ -768,7 +767,7 @@ public:
|
||||
OwningStmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond,
|
||||
VarDecl *CondVar, StmtArg Then,
|
||||
SourceLocation ElseLoc, StmtArg Else) {
|
||||
return getSema().ActOnIfStmt(IfLoc, Cond, DeclPtrTy::make(CondVar),
|
||||
return getSema().ActOnIfStmt(IfLoc, Cond, CondVar,
|
||||
move(Then), ElseLoc, move(Else));
|
||||
}
|
||||
|
||||
@ -780,7 +779,7 @@ public:
|
||||
Sema::ExprArg Cond,
|
||||
VarDecl *CondVar) {
|
||||
return getSema().ActOnStartOfSwitchStmt(SwitchLoc, move(Cond),
|
||||
DeclPtrTy::make(CondVar));
|
||||
CondVar);
|
||||
}
|
||||
|
||||
/// \brief Attach the body to the switch statement.
|
||||
@ -802,7 +801,7 @@ public:
|
||||
VarDecl *CondVar,
|
||||
StmtArg Body) {
|
||||
return getSema().ActOnWhileStmt(WhileLoc, Cond,
|
||||
DeclPtrTy::make(CondVar), move(Body));
|
||||
CondVar, move(Body));
|
||||
}
|
||||
|
||||
/// \brief Build a new do-while statement.
|
||||
@ -828,7 +827,7 @@ public:
|
||||
VarDecl *CondVar, Sema::FullExprArg Inc,
|
||||
SourceLocation RParenLoc, StmtArg Body) {
|
||||
return getSema().ActOnForStmt(ForLoc, LParenLoc, move(Init), Cond,
|
||||
DeclPtrTy::make(CondVar),
|
||||
CondVar,
|
||||
Inc, RParenLoc, move(Body));
|
||||
}
|
||||
|
||||
@ -930,8 +929,7 @@ public:
|
||||
VarDecl *Var,
|
||||
StmtArg Body) {
|
||||
return getSema().ActOnObjCAtCatchStmt(AtLoc, RParenLoc,
|
||||
Sema::DeclPtrTy::make(Var),
|
||||
move(Body));
|
||||
Var, move(Body));
|
||||
}
|
||||
|
||||
/// \brief Build a new Objective-C @finally statement.
|
||||
@ -1834,7 +1832,7 @@ public:
|
||||
Sema::LookupMemberName);
|
||||
OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
|
||||
/*FIME:*/IvarLoc,
|
||||
SS, DeclPtrTy(),
|
||||
SS, 0,
|
||||
false);
|
||||
if (Result.isInvalid())
|
||||
return getSema().ExprError();
|
||||
@ -1864,8 +1862,7 @@ public:
|
||||
bool IsArrow = false;
|
||||
OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
|
||||
/*FIME:*/PropertyLoc,
|
||||
SS, DeclPtrTy(),
|
||||
false);
|
||||
SS, 0, false);
|
||||
if (Result.isInvalid())
|
||||
return getSema().ExprError();
|
||||
|
||||
@ -1913,8 +1910,7 @@ public:
|
||||
Sema::LookupMemberName);
|
||||
OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
|
||||
/*FIME:*/IsaLoc,
|
||||
SS, DeclPtrTy(),
|
||||
false);
|
||||
SS, 0, false);
|
||||
if (Result.isInvalid())
|
||||
return getSema().ExprError();
|
||||
|
||||
|
@ -3364,7 +3364,7 @@ void ASTReader::InitializeSema(Sema &S) {
|
||||
// still get added to the identifier's declaration chains.
|
||||
if (SemaObj->TUScope) {
|
||||
for (unsigned I = 0, N = PreloadedDecls.size(); I != N; ++I) {
|
||||
SemaObj->TUScope->AddDecl(Action::DeclPtrTy::make(PreloadedDecls[I]));
|
||||
SemaObj->TUScope->AddDecl(PreloadedDecls[I]);
|
||||
SemaObj->IdResolver.AddDecl(PreloadedDecls[I]);
|
||||
}
|
||||
}
|
||||
@ -3565,7 +3565,7 @@ ASTReader::SetGloballyVisibleDecls(IdentifierInfo *II,
|
||||
// Introduce this declaration into the translation-unit scope
|
||||
// and add it to the declaration chain for this identifier, so
|
||||
// that (unqualified) name lookup will find it.
|
||||
SemaObj->TUScope->AddDecl(Action::DeclPtrTy::make(D));
|
||||
SemaObj->TUScope->AddDecl(D);
|
||||
SemaObj->IdResolver.AddDeclToIdentifierChain(II, D);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user