forked from OSchip/llvm-project
Fixes/tweaks that prevent "defaults-i.m" from compiling.
- Allow classnames as the receiver (removing a FIXME from ParseObjCMessageExpression). - Added a FIXME to ParseObjCMessageExpression()...we need to return a message expr AST node! llvm-svn: 42001
This commit is contained in:
parent
66356bda5d
commit
2f742085f5
|
@ -28,6 +28,42 @@ static unsigned nFieldDecls = 0;
|
|||
static unsigned nInterfaceDecls = 0;
|
||||
static bool StatSwitch = false;
|
||||
|
||||
const char *Decl::getDeclKindName() {
|
||||
switch (DeclKind) {
|
||||
default: assert(0 && "Unknown decl kind!");
|
||||
case Typedef:
|
||||
return "Typedef";
|
||||
case Function:
|
||||
return "Function";
|
||||
case BlockVariable:
|
||||
return "BlockVariable";
|
||||
case FileVariable:
|
||||
return "FileVariable";
|
||||
case ParmVariable:
|
||||
return "ParmVariable";
|
||||
case EnumConstant:
|
||||
return "EnumConstant";
|
||||
case ObjcInterface:
|
||||
return "ObjcInterface";
|
||||
case ObjcClass:
|
||||
return "ObjcClass";
|
||||
case ObjcMethod:
|
||||
return "ObjcMethod";
|
||||
case ObjcProtoMethod:
|
||||
return "ObjcProtoMethod";
|
||||
case ObjcProtocol:
|
||||
return "ObjcProtocol";
|
||||
case Struct:
|
||||
return "Struct";
|
||||
case Union:
|
||||
return "Union";
|
||||
case Class:
|
||||
return "Class";
|
||||
case Enum:
|
||||
return "Enum";
|
||||
}
|
||||
}
|
||||
|
||||
bool Decl::CollectingStats(bool enable) {
|
||||
if (enable) StatSwitch = true;
|
||||
return StatSwitch;
|
||||
|
|
|
@ -986,8 +986,11 @@ Parser::ExprResult Parser::ParseObjCMessageExpression() {
|
|||
assert(Tok.getKind() == tok::l_square && "'[' expected");
|
||||
SourceLocation Loc = ConsumeBracket(); // consume '['
|
||||
// Parse receiver
|
||||
// FIXME: receiver as type-name/class-name
|
||||
ParseAssignmentExpression();
|
||||
if (Tok.getKind() == tok::identifier &&
|
||||
Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope))
|
||||
ConsumeToken();
|
||||
else
|
||||
ParseAssignmentExpression();
|
||||
// Parse objc-selector
|
||||
IdentifierInfo *selIdent = ParseObjCSelector();
|
||||
if (Tok.getKind() == tok::colon) {
|
||||
|
@ -1024,7 +1027,7 @@ Parser::ExprResult Parser::ParseObjCMessageExpression() {
|
|||
return 0;
|
||||
}
|
||||
ConsumeBracket(); // consume ']'
|
||||
return 0;
|
||||
return 0; // FIXME: return a message expr AST!
|
||||
}
|
||||
|
||||
Parser::ExprResult Parser::ParseObjCStringLiteral() {
|
||||
|
|
|
@ -182,7 +182,7 @@ private:
|
|||
ScopedDecl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI,
|
||||
SourceLocation IdLoc, Scope *S);
|
||||
ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S);
|
||||
Decl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
||||
ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
||||
Scope *S);
|
||||
// Decl attributes - this routine is the top level dispatcher.
|
||||
void HandleDeclAttributes(Decl *New, AttributeList *declspec_prefix,
|
||||
|
|
|
@ -815,8 +815,8 @@ Sema::DeclTy *Sema::ParseFunctionDefBody(DeclTy *D, StmtTy *Body) {
|
|||
|
||||
/// ImplicitlyDefineFunction - An undeclared identifier was used in a function
|
||||
/// call, forming a call to an implicitly defined function (per C99 6.5.1p2).
|
||||
Decl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
||||
Scope *S) {
|
||||
ScopedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
|
||||
IdentifierInfo &II, Scope *S) {
|
||||
if (getLangOptions().C99) // Extension in C99.
|
||||
Diag(Loc, diag::ext_implicit_function_decl, II.getName());
|
||||
else // Legal in C90, but warn about it.
|
||||
|
@ -842,7 +842,7 @@ Decl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
|||
while (S->getParent())
|
||||
S = S->getParent();
|
||||
|
||||
return static_cast<Decl*>(ActOnDeclarator(S, D, 0));
|
||||
return dyn_cast<ScopedDecl>(static_cast<Decl*>(ActOnDeclarator(S, D, 0)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
|
|||
IdentifierInfo &II,
|
||||
bool HasTrailingLParen) {
|
||||
// Could be enum-constant or decl.
|
||||
Decl *D = LookupScopedDecl(&II, Decl::IDNS_Ordinary, Loc, S);
|
||||
ScopedDecl *D = LookupScopedDecl(&II, Decl::IDNS_Ordinary, Loc, S);
|
||||
if (D == 0) {
|
||||
// Otherwise, this could be an implicitly declared function reference (legal
|
||||
// in C90, extension in C99).
|
||||
|
|
|
@ -68,7 +68,8 @@ protected:
|
|||
public:
|
||||
|
||||
Kind getKind() const { return DeclKind; }
|
||||
|
||||
const char *getDeclKindName();
|
||||
|
||||
/// setInvalidDecl - Indicates the Decl had a semantic error. This
|
||||
/// allows for graceful error recovery.
|
||||
void setInvalidDecl() { InvalidDecl = 1; }
|
||||
|
@ -83,6 +84,7 @@ public:
|
|||
case FileVariable:
|
||||
case ParmVariable:
|
||||
case EnumConstant:
|
||||
case ObjcInterface:
|
||||
return IDNS_Ordinary;
|
||||
case Struct:
|
||||
case Union:
|
||||
|
|
Loading…
Reference in New Issue