Skip to content
  1. Feb 15, 2009
  2. Feb 14, 2009
    • Douglas Gregor's avatar
      Add -ffreestanding to suppress the implicit declaration of library builtins... · 69c7951c
      Douglas Gregor authored
      Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
      
      llvm-svn: 64566
      69c7951c
    • Fariborz Jahanian's avatar
      Fixed a problem caused by foreward @class use · 99bed6fd
      Fariborz Jahanian authored
      which consequently caused a Seg fault. during meta-data
      generation. It also addresses an issue related to
      late binding of newly synthesize ivars (when we support it).
      
      llvm-svn: 64563
      99bed6fd
    • 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
    • Cedric Venet's avatar
      Fix the build on win32. · d3c80de9
      Cedric Venet authored
      llvm-svn: 64556
      d3c80de9
    • Chris Lattner's avatar
      Several related changes: · 237f2757
      Chris Lattner authored
      1) implement parser and sema support for reading and verifying attribute(warnunusedresult).
      2) rename hasLocalSideEffect to isUnusedResultAWarning, inverting the sense
         of its result.
      3) extend isUnusedResultAWarning to directly return the loc and range 
         info that should be reported to the user.  Make it substantially more
         precise in some cases than what was previously reported.
      4) teach isUnusedResultAWarning about CallExpr to decls that are 
         pure/const/warnunusedresult, fixing a fixme.
      5) change warn_attribute_wrong_decl_type to not pass in english strings, instead,
         pass in integers and use %select.
      
      llvm-svn: 64543
      237f2757
    • Douglas Gregor's avatar
      Make it possible for builtins to expression FILE* arguments, so that · 538c3d84
      Douglas Gregor authored
      we can define builtins such as fprintf, vfprintf, and
      __builtin___fprintf_chk. Give a nice error message when we need to
      implicitly declare a function like fprintf.
      
      llvm-svn: 64526
      538c3d84
    • Douglas Gregor's avatar
      Extend builtin "attribute" syntax to include a notation for · ac5d4c5f
      Douglas Gregor authored
      printf-like functions, both builtin functions and those in the
      C library. The function-call checker now queries this attribute do
      determine if we have a printf-like function, rather than scanning
      through the list of "known functions IDs". However, there are 5
      functions they are not yet "builtins", so the function-call checker
      handles them specifically still:
      
        - fprintf and vfprintf: the builtins mechanism cannot (yet)
          express FILE* arguments, so these can't be encoded.
        - NSLog: the builtins mechanism cannot (yet) express NSString*
          arguments, so this (and NSLogv) can't be encoded.
        - asprintf and vasprintf: these aren't part of the C99 standard
          library, so we really shouldn't be defining them as builtins in
          the general case (and we don't seem to have the machinery to make
          them builtins only on certain targets and depending on whether
          extensions are enabled).
      
      llvm-svn: 64512
      ac5d4c5f
    • 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
  3. Feb 13, 2009
    • Douglas Gregor's avatar
      Remove DeclGroupOwningRef, since we intend for declarations to be owned · 4feb36de
      Douglas Gregor authored
      by DeclContexts (always) rather than by statements. 
      
      DeclContext currently goes out of its way to avoid destroying any
      Decls that might be owned by a DeclGroupOwningRef. However, in an
      error-recovery situation, a failure in a declaration statement can
      cause all of the decls in a DeclGroupOwningRef to be destroyed after
      they've already be added into the DeclContext. Hence, DeclContext is
      left with already-destroyed declarations, and bad things happen. This
      problem was causing failures that showed up as assertions on x86 Linux
      in test/Parser/objc-forcollection-neg-2.m.
      
      llvm-svn: 64474
      4feb36de
    • Eli Friedman's avatar
      Initial implementation of arbitrary fixed-width integer types. · 1efaaeaa
      Eli Friedman authored
      Currently only used for 128-bit integers.
      
      Note that we can't use the fixed-width integer types for other integer 
      modes without other changes because glibc headers redefines (u)int*_t 
      and friends using the mode attribute.  For example, this means that uint64_t
      has to be compatible with unsigned __attribute((mode(DI))), and 
      uint64_t is currently defined to long long.  And I have a feeling we'll 
      run into issues if we try to define uint64_t as something which isn't 
      either long or long long.
      
      This doesn't get the alignment right in most cases, including 
      the 128-bit integer case; I'll file a PR shortly.  The gist of the issue 
      is that the targets don't really expose the information necessary to 
      figure out the alignment outside of the target description, so there's a 
      non-trivial amount of work involved in getting it working right.  That 
      said, the alignment used is conservative, so the only issue with the 
      current implementation is ABI compatibility.
      
      This makes it trivial to add some sort of "bitwidth" attribute to make 
      arbitrary-width integers; I'll do that in a followup.
      
      We could also use this for stuff like the following for compatibility 
      with gcc, but I have a feeling it would be a better idea for clang to be 
      consistent between C and C++ modes rather than follow gcc's example for 
      C mode.
      struct {unsigned long long x : 33;} x;
      unsigned long long a(void) {return x.x+1;}
      
      llvm-svn: 64434
      1efaaeaa
  4. Feb 12, 2009
    • 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
    • Daniel Dunbar's avatar
      Fix va_arg bug noticed by Eli, __builtin_va_arg is not an l-value · 6d0402d4
      Daniel Dunbar authored
      designating an object.
      
      llvm-svn: 64371
      6d0402d4
    • Douglas Gregor's avatar
      Introduce _Complex conversions into the function overloading · 78ca74d8
      Douglas Gregor authored
      system. Since C99 doesn't have overloading and C++ doesn't have
      _Complex, there is no specification for    this. Here's what I think
      makes sense.
      
      Complex conversions come in several flavors:
      
        - Complex promotions:  a complex -> complex   conversion where the
          underlying real-type conversion is a floating-point promotion. GCC
          seems to call this a promotion, EDG does something else. This is
          given "promotion" rank for determining the best viable function.
        - Complex conversions: a complex -> complex conversion that is
          not a complex promotion. This is given "conversion" rank for
          determining the best viable   function.
        - Complex-real conversions: a real -> complex or complex -> real
          conversion. This is given "conversion" rank for determining the
          best viable function.
      
      These rules are the same for C99 (when using the "overloadable"
      attribute) and C++. However, there is one difference in the handling
      of floating-point promotions: in C99, float -> long double and double
      -> long double are considered promotions (so we give them "promotion" 
      rank), while C++ considers these conversions ("conversion" rank).
      
      llvm-svn: 64343
      78ca74d8
    • Fariborz Jahanian's avatar
      Last @encode'ing fix for objc2's nonfragile abi. · 77b6b5d6
      Fariborz Jahanian authored
      All relevant dejagnu enocding tests pass in this mode.
      
      llvm-svn: 64341
      77b6b5d6
  5. Feb 11, 2009
  6. Feb 10, 2009
  7. Feb 09, 2009
  8. Feb 08, 2009
  9. Feb 07, 2009
    • Sebastian Redl's avatar
      Fix pretty-printing of if conditions. Patch by Ben Lickly. · 7b7cec68
      Sebastian Redl authored
      llvm-svn: 64027
      7b7cec68
    • Sebastian Redl's avatar
      Make const-initialized const integral variables I-C-Es in C++. · f3b5e27f
      Sebastian Redl authored
      llvm-svn: 64015
      f3b5e27f
    • 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
      Implement dereferencing of pointers-to-member. · 112a9766
      Sebastian Redl authored
      llvm-svn: 63983
      112a9766
  10. Feb 06, 2009
  11. Feb 05, 2009
Loading