Skip to content
  1. Feb 25, 2009
  2. Feb 24, 2009
  3. Feb 23, 2009
  4. Feb 21, 2009
    • Steve Naroff's avatar
      More work to integrate newly added ObjCQualifiedClassType into the type system. · 8487e3e5
      Steve Naroff authored
      This is necessary 'plumbing' to fix <rdar://problem/6497631> Message lookup is sometimes different than gcc's.
      
      llvm-svn: 65248
      8487e3e5
    • Steve Naroff's avatar
      · 7a7814c3
      Steve Naroff authored
      This fixes <rdar://problem/6497650> More type mismatches issues with clang.
      
      Move two key ObjC typechecks from Sema::CheckPointerTypesForAssignment() to ASTContext::mergeTypes().
      
      This allows us to take advantage of the recursion in ASTContext::mergeTypes(), removing some bogus warnings.
      
      This test case I've added includes an example where we still warn (and GCC doesn't). Need to talk with folks and decide what to do. At this point, the major bogosities should be fixed.
      
      llvm-svn: 65231
      7a7814c3
  5. Feb 19, 2009
  6. Feb 18, 2009
  7. Feb 17, 2009
    • Fariborz Jahanian's avatar
      Renamed ASQualType to ExtQualType to reflect its more · ece8582c
      Fariborz Jahanian authored
      general use; as for, objc2's gc type attributes. No
      change in functionality.
      
      llvm-svn: 64778
      ece8582c
    • Chris Lattner's avatar
      emit: · 709322b8
      Chris Lattner authored
      t.c:4:9: error: invalid type 'short *' to __real operator
                               __tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)), 
                                            ^
      instead of:
      t.c:4:9: error: invalid type 'short *' to __real or __imag operator
                               __tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)),
                                            ^
      
      fixing a fixme.  It would be even fancier to get the spelling of the token, but I
      don't care *that* much :)
      
      llvm-svn: 64759
      709322b8
  8. Feb 16, 2009
  9. Feb 15, 2009
  10. Feb 14, 2009
    • Douglas Gregor's avatar
      Add hook to add attributes to function declarations that we know · e711f705
      Douglas Gregor authored
      about, whether they are builtins or not. Use this to add the
      appropriate "format" attribute to NSLog, NSLogv, asprintf, and
      vasprintf, and to translate builtin attributes (from Builtins.def)
      into actual attributes on the function declaration.
      
      Use the "printf" format attribute on function declarations to
      determine whether we should do format string checking, rather than
      looking at an ad hoc list of builtins and "known" function names.
      
      Be a bit more careful about when we consider a function a "builtin" in
      C++.
      
      llvm-svn: 64561
      e711f705
    • Chris Lattner's avatar
      reduce nesting. · 3a230739
      Chris Lattner authored
      llvm-svn: 64542
      3a230739
    • Douglas Gregor's avatar
      Implicitly declare certain C library functions (malloc, strcpy, memmove, · b9063fc1
      Douglas Gregor authored
      etc.) when we perform name lookup on them. This ensures that we
      produce the correct signature for these functions, which has two
      practical impacts:
      
        1) When we're supporting the "implicit function declaration" feature
        of C99, these functions will be implicitly declared with the right
        signature rather than as a function returning "int" with no
        prototype. See PR3541 for the reason why this is important (hint:
        GCC always predeclares these functions).
       
        2) If users attempt to redeclare one of these library functions with
        an incompatible signature, we produce a hard error.
      
      This patch does a little bit of work to give reasonable error
      messages. For example, when we hit case #1 we complain that we're
      implicitly declaring this function with a specific signature, and then
      we give a note that asks the user to include the appropriate header
      (e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
      case #2, we show the type of the implicit builtin that was incorrectly
      declared, so the user can see the problem. We could do better here:
      for example, when displaying this latter error message we say
      something like:
      
        'strcpy' was implicitly declared here with type 'char *(char *, char
        const *)'
      
      but we should really print out a fake code line showing the
      declaration, like this:
      
        'strcpy' was implicitly declared here as:
      
          char *strcpy(char *, char const *)
      
      This would also be good for printing built-in candidates with C++
      operator overloading.
      
      The set of C library functions supported by this patch includes all
      functions from the C99 specification's <stdlib.h> and <string.h> that
      (a) are predefined by GCC and (b) have signatures that could cause
      codegen issues if they are treated as functions with no prototype
      returning and int. Future work could extend this set of functions to
      other C library functions that we know about.
      
      llvm-svn: 64504
      b9063fc1
  11. Feb 13, 2009
  12. Feb 12, 2009
    • Steve Naroff's avatar
    • Steve Naroff's avatar
      Several cleanups: · b7605153
      Steve Naroff authored
      - rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect.
      - add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time.
      - move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types).
      
      llvm-svn: 64385
      b7605153
    • Douglas Gregor's avatar
      Initial implementation of function overloading in C. · 4e5cbdcb
      Douglas Gregor authored
      This commit adds a new attribute, "overloadable", that enables C++
      function overloading in C. The attribute can only be added to function
      declarations, e.g.,
      
        int *f(int) __attribute__((overloadable));
      
      If the "overloadable" attribute exists on a function with a given
      name, *all* functions with that name (and in that scope) must have the
      "overloadable" attribute. Sets of overloaded functions with the
      "overloadable" attribute then follow the normal C++ rules for
      overloaded functions, e.g., overloads must have different
      parameter-type-lists from each other.
      
      When calling an overloaded function in C, we follow the same
      overloading rules as C++, with three extensions to the set of standard
      conversions:
      
        - A value of a given struct or union type T can be converted to the
          type T. This is just the identity conversion. (In C++, this would
          go through a copy constructor).
        - A value of pointer type T* can be converted to a value of type U*
          if T and U are compatible types. This conversion has Conversion
          rank (it's considered a pointer conversion in C).
        - A value of type T can be converted to a value of type U if T and U
          are compatible (and are not both pointer types). This conversion
          has Conversion rank (it's considered to be a new kind of
          conversion unique to C, a "compatible" conversion).
      
      Known defects (and, therefore, next steps):
        1) The standard-conversion handling does not understand conversions
        involving _Complex or vector extensions, so it is likely to get
        these wrong. We need to add these conversions.
        2) All overloadable functions with the same name will have the same
        linkage name, which means we'll get a collision in the linker (if
        not sooner). We'll need to mangle the names of these functions.
      
      llvm-svn: 64336
      4e5cbdcb
  13. Feb 10, 2009
  14. Feb 09, 2009
  15. Feb 07, 2009
    • Sebastian Redl's avatar
      Move CheckPointerToMemberOperands to SemaExprCXX.cpp · 5822f08c
      Sebastian Redl authored
      llvm-svn: 64029
      5822f08c
    • Ted Kremenek's avatar
      Overhaul of Stmt allocation: · 5a201951
      Ted Kremenek authored
      - Made allocation of Stmt objects using vanilla new/delete a *compiler
        error* by making this new/delete "protected" within class Stmt.
      - Now the only way to allocate Stmt objects is by using the new
        operator that takes ASTContext& as an argument.  This ensures that
        all Stmt nodes are allocated from the same (pool) allocator.
      - Naturally, these two changes required that *all* creation sites for
        AST nodes use new (ASTContext&).  This is a large patch, but the
        majority of the changes are just this mechanical adjustment.
      - The above changes also mean that AST nodes can no longer be
        deallocated using 'delete'.  Instead, one most do
        StmtObject->Destroy(ASTContext&) or do
        ASTContextObject.Deallocate(StmtObject) (the latter not running the
        'Destroy' method).
      
      Along the way I also...
      - Made CompoundStmt allocate its array of Stmt* using the allocator in
        ASTContext (previously it used std::vector).  There are a whole
        bunch of other Stmt classes that need to be similarly changed to
        ensure that all memory allocated for ASTs comes from the allocator
        in ASTContext.
      - Added a new smart pointer ExprOwningPtr to Sema.h.  This replaces
        the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used
        'delete' to free memory instead of a Stmt's 'Destroy' method.
      
      Big thanks to Doug Gregor for helping with the acrobatics of making
      'new/delete' private and the new smart pointer ExprOwningPtr!
      
      llvm-svn: 63997
      5a201951
    • Sebastian Redl's avatar
Loading