Skip to content
  1. Sep 24, 2010
  2. Sep 16, 2010
    • Douglas Gregor's avatar
      Implement automatic bracket insertion for Objective-C class message · abf4a3e4
      Douglas Gregor authored
      sends. These are far trickier than instance messages, because we
      typically have something like
      
        NSArray alloc]
      
      where it appears to be a declaration of a variable named "alloc" up
      until we see the ']' (or a ':'), and at that point we can't backtrace.
      So, we use a combination of syntactic and semantic disambiguation to
      treat this as a message send only when the type is an Objective-C type
      and it has the syntax of a class message send (which would otherwise
      be ill-formed).
      
      llvm-svn: 114057
      abf4a3e4
    • Douglas Gregor's avatar
      Handle bracket insertion for Objective-C class messages in a very · 3e972009
      Douglas Gregor authored
      narrow, almost useless case where we're inside a parenthesized
      expression, e.g.,
      
        (NSArray alloc])
      
      The solution to the general case still eludes me.
      
      llvm-svn: 114039
      3e972009
  3. Sep 15, 2010
    • Douglas Gregor's avatar
      Implement bracket insertion for Objective-C instance message sends as · e9bba4f1
      Douglas Gregor authored
      part of parser recovery. For example, given:
      
        a method1:arg];
      
      we detect after parsing the expression "a" that we have the start of a
      message send expression. We pretend we've seen a '[' prior to the a,
      then parse the remainder as a message send. We'll then give a
      diagnostic+fix-it such as:
      
      fixit-objc-message.m:17:3: error: missing '[' at start of message
            send expression
        a method1:arg];
        ^
        [
      
      The algorithm here is very simple, and always assumes that the open
      bracket goes at the beginning of the message send. It also only works
      for non-super instance message sends at this time.
      
      llvm-svn: 113968
      e9bba4f1
  4. Aug 27, 2010
  5. Aug 26, 2010
  6. Aug 25, 2010
  7. Aug 24, 2010
  8. Aug 17, 2010
  9. Aug 12, 2010
  10. Aug 10, 2010
  11. Aug 03, 2010
  12. Jul 25, 2010
  13. Jul 23, 2010
  14. Jul 22, 2010
  15. Jul 13, 2010
    • Douglas Gregor's avatar
      When forming a function call or message send expression, be sure to · 603d81bf
      Douglas Gregor authored
      strip cv-qualifiers from the expression's type when the language calls
      for it: in C, that's all the time, while C++ only does it for
      non-class types. 
      
      Centralized the computation of the call expression type in
      QualType::getCallResultType() and some helper functions in other nodes
      (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
      callers of getResultType() to getCallResultType().
      
      Fixes PR7598 and PR7463, along with a bunch of getResultType() call
      sites that weren't stripping references off the result type (nothing
      stripped cv-qualifiers properly before this change).
      
      llvm-svn: 108234
      603d81bf
  16. Jun 16, 2010
  17. May 22, 2010
    • Douglas Gregor's avatar
      Improve our handling of reference binding for subobjects of · aae38d66
      Douglas Gregor authored
      temporaries. There are actually several interrelated fixes here:
      
        - When converting an object to a base class, it's only an lvalue
        cast when the original object was an lvalue and we aren't casting
        pointer-to-derived to pointer-to-base. Previously, we were
        misclassifying derived-to-base casts of class rvalues as lvalues,
        causing various oddities (including problems with reference binding
        not extending the lifetimes of some temporaries).
      
        - Teach the code for emitting a reference binding how to look
        through no-op casts and parentheses directly, since
        Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make
        sure that we properly look through multiple levels of indirection
        from the temporary object, but destroy the actual temporary object;
        this fixes the reference-binding issue mentioned above.
      
        - Teach Objective-C message sends to bind the result as a temporary
          when needed. This is actually John's change, but it triggered the
          reference-binding problem above, so it's included here. Now John
          can actually test his return-slot improvements.
      
      llvm-svn: 104434
      aae38d66
  18. May 20, 2010
  19. May 16, 2010
  20. May 15, 2010
    • John McCall's avatar
      Substantially alter the design of the Objective C type AST by introducing · 8b07ec25
      John McCall authored
      ObjCObjectType, which is basically just a pair of
        one of {primitive-id, primitive-Class, user-defined @class}
      with
        a list of protocols.
      An ObjCObjectPointerType is therefore just a pointer which always points to
      one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
      of ObjCObjectType which happens to not carry any protocols.
      
      Alter a rather large number of use sites to use ObjCObjectType instead of
      ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
      than hashing them in a FoldingSet.  Remove some number of methods that are no
      longer used, at least after this patch.
      
      By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
      pointers to Objective-C types, which is crucial for a certain kind of ObjC++
      metaprogramming common in WebKit.
      
      llvm-svn: 103870
      8b07ec25
  21. May 13, 2010
  22. Apr 24, 2010
  23. Apr 22, 2010
  24. Apr 21, 2010
    • Douglas Gregor's avatar
      Migrate the responsibility for turning the receiver name in an · e5798dcb
      Douglas Gregor authored
      Objective-C class message expression into a type from the parser
      (which was doing so in two places) to Action::getObjCMessageKind()
      which, in the case of Sema, reduces the number of name lookups we need
      to perform.
      
      llvm-svn: 102026
      e5798dcb
    • Douglas Gregor's avatar
      Eliminate unused code in Sema::ActOnSuperMessage and use early exits · 4fdba130
      Douglas Gregor authored
      to reduce nesting. No functionality change. 
      
      llvm-svn: 102022
      4fdba130
    • Douglas Gregor's avatar
      Rework the Parser-Sema interaction for Objective-C message · 0c78ad96
      Douglas Gregor authored
      sends. Major changes include:
      
        - Expanded the interface from two actions (ActOnInstanceMessage,
          ActOnClassMessage), where ActOnClassMessage also handled sends to
          "super" by checking whether the identifier was "super", to three
          actions (ActOnInstanceMessage, ActOnClassMessage,
          ActOnSuperMessage). Code completion has the same changes.
        - The parser now resolves the type to which we are sending a class
          message, so ActOnClassMessage now accepts a TypeTy* (rather than
          an IdentifierInfo *). This opens the door to more interesting
          types (for Objective-C++ support).
        - Split ActOnInstanceMessage and ActOnClassMessage into parser
          action functions (with their original names) and semantic
          functions (BuildInstanceMessage and BuildClassMessage,
          respectively). At present, this split is onyl used by
          ActOnSuperMessage, which decides which kind of super message it
          has and forwards to the appropriate Build*Message. In the future,
          Build*Message will be used by template instantiation.
        - Use getObjCMessageKind() within the disambiguation of Objective-C
          message sends vs. array designators.
      
      Two notes about substandard bits in this patch:
        - There is some redundancy in the code in ParseObjCMessageExpr and
        ParseInitializerWithPotentialDesignator; this will be addressed
        shortly by centralizing the mapping from identifiers to type names
        for the message receiver.
        - There is some #if 0'd code that won't likely ever be used---it
        handles the use of 'super' in methods whose class does not have a
        superclass---but could be used to model GCC's behavior more
        closely. This code will die in my next check-in, but I want it in
        Subversion.
      
      llvm-svn: 102021
      0c78ad96
    • Douglas Gregor's avatar
      Overhaul the AST representation of Objective-C message send · 9a129194
      Douglas Gregor authored
      expressions, to improve source-location information, clarify the
      actual receiver of the message, and pave the way for proper C++
      support. The ObjCMessageExpr node represents four different kinds of
      message sends in a single AST node:
      
        1) Send to a object instance described by an expression (e.g., [x method:5])
        2) Send to a class described by the class name (e.g., [NSString method:5])
        3) Send to a superclass class (e.g, [super method:5] in class method)
        4) Send to a superclass instance (e.g., [super method:5] in instance method)
      
      Previously these four cases where tangled together. Now, they have
      more distinct representations. Specific changes:
      
        1) Unchanged; the object instance is represented by an Expr*.
      
        2) Previously stored the ObjCInterfaceDecl* referring to the class
        receiving the message. Now stores a TypeSourceInfo* so that we know
        how the class was spelled. This both maintains typedef information
        and opens the door for more complicated C++ types (e.g., dependent
        types). There was an alternative, unused representation of these
        sends by naming the class via an IdentifierInfo *. In practice, we
        either had an ObjCInterfaceDecl *, from which we would get the
        IdentifierInfo *, or we fell into the case below...
      
        3) Previously represented by a class message whose IdentifierInfo *
        referred to "super". Sema and CodeGen would use isStr("super") to
        determine if they had a send to super. Now represented as a
        "class super" send, where we have both the location of the "super"
        keyword and the ObjCInterfaceDecl* of the superclass we're
        targetting (statically).
      
        4) Previously represented by an instance message whose receiver is a
        an ObjCSuperExpr, which Sema and CodeGen would check for via
        isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
        where we have both the location of the "super" keyword and the
        ObjCInterfaceDecl* of the superclass we're targetting
        (statically). Note that ObjCSuperExpr only has one remaining use in
        the AST, which is for "super.prop" references.
      
      The new representation of ObjCMessageExpr is 2 pointers smaller than
      the old one, since it combines more storage. It also eliminates a leak
      when we loaded message-send expressions from a precompiled header. The
      representation also feels much cleaner to me; comments welcome!
      
      This patch attempts to maintain the same semantics we previously had
      with Objective-C message sends. In several places, there are massive
      changes that boil down to simply replacing a nested-if structure such
      as:
      
        if (message has a receiver expression) {
          // instance message
          if (isa<ObjCSuperExpr>(...)) {
           // send to super
          } else {
           // send to an object
         }
        } else {
          // class message
          if (name->isStr("super")) {
            // class send to super
          } else {
            // send to class
          }
        }
      
      with a switch
      
        switch (E->getReceiverKind()) {
        case ObjCMessageExpr::SuperInstance: ...
        case ObjCMessageExpr::Instance: ...
        case ObjCMessageExpr::SuperClass: ...
        case ObjCMessageExpr::Class:...
        }
      
      There are quite a few places (particularly in the checkers) where
      send-to-super is effectively ignored. I've placed FIXMEs in most of
      them, and attempted to address send-to-super in a reasonable way. This
      could use some review.
      
      llvm-svn: 101972
      9a129194
  25. Apr 20, 2010
  26. Apr 19, 2010
Loading