aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Parse/Action.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-14 02:22:16 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-14 02:22:16 +0000
commit1dbca6ea983231b4cab1a8f1edda8f6e13c21f12 (patch)
treec5435bd2736db69b010bf3b073e36f94466a6f60 /include/clang/Parse/Action.h
parentf19de1ce44b9c7ffdeb388d6fe2fa8a1d0288f64 (diff)
Introduce a parsing action to distinguish between class, instance, and
super message sends in Objective-C. No actual functionality change here, but it provides a hook so that Sema can typo-correct the receiver in some cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Parse/Action.h')
-rw-r--r--include/clang/Parse/Action.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index e030e31d11..d784f42567 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -2344,6 +2344,52 @@ public:
return ExprEmpty();
}
+ /// \brief Describes the kind of message expression indicated by a message
+ /// send that starts with an identifier.
+ enum ObjCMessageKind {
+ /// \brief The message is sent to 'super'.
+ ObjCSuperMessage,
+ /// \brief The message is an instance message.
+ ObjCInstanceMessage,
+ /// \brief The message is a class message, and the identifier is a type
+ /// name.
+ ObjCClassMessage
+ };
+
+ /// \brief Determine the kind of Objective-C message send that we will be
+ /// performing based on the identifier given.
+ ///
+ /// This action determines how a message send that starts with [
+ /// identifier (followed by another identifier) will be parsed,
+ /// e.g., as a class message, instance message, super message. The
+ /// result depends on the meaning of the given identifier. If the
+ /// identifier is unknown, the action should indicate that the
+ /// message is an instance message.
+ ///
+ /// By default, this routine applies syntactic disambiguation and uses
+ /// \c getTypeName() to determine whether the identifier refers to a type.
+ /// However, \c Action subclasses may override this routine to improve
+ /// error recovery.
+ ///
+ /// \param S The scope in which the message send occurs.
+ ///
+ /// \param Name The identifier following the '['. This identifier
+ /// may be modified by the action, if, for example, typo-correction
+ /// finds a different class name.
+ ///
+ /// \param NameLoc The location of the identifier.
+ ///
+ /// \param IsSuper Whether the name is the pseudo-keyword "super".
+ ///
+ /// \param HasTrailingDot Whether the name is followed by a period.
+ ///
+ /// \returns The kind of message send.
+ virtual ObjCMessageKind getObjCMessageKind(Scope *S,
+ IdentifierInfo *&Name,
+ SourceLocation NameLoc,
+ bool IsSuper,
+ bool HasTrailingDot);
+
// ActOnClassMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from NumArgs.