Skip to content
  1. Jun 16, 2007
    • Chris Lattner's avatar
      Finally bite the bullet and make the major change: split the clang namespace · 23b7eb67
      Chris Lattner authored
      out of the llvm namespace.  This makes the clang namespace be a sibling of
      llvm instead of being a child.
      
      The good thing about this is that it makes many things unambiguous.  The
      bad things is that many things in the llvm namespace (notably data structures
      like smallvector) now require an llvm:: qualifier.  IMO, libsystem and libsupport
      should be split out of llvm into their own namespace in the future, which will fix
      this issue.
      
      llvm-svn: 39659
      23b7eb67
  2. Jun 13, 2007
    • Steve Naroff's avatar
      Bug #: · 75c1723b
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Fix CheckRelationalOperands/CheckEqualityOperands to deal with null pointer
      constants. The new logic also deals (more) correctly for non-pointer/integer
      operands.
      
      llvm-svn: 39654
      75c1723b
    • Chris Lattner's avatar
      Implement support for formal arguments. We can now compile this: · 53621a53
      Chris Lattner authored
      int test(int X, short Y, float Z) {
        return (int)(X*Y+Z);
      }
      
      to:
      
      define i32 @test(i32 %X, i16 %Y, float %Z) {
      entry:
              %promote = sext i16 %Y to i32           ; <i32> [#uses=1]
              %mul = mul i32 %promote, %X             ; <i32> [#uses=1]
              %promote3 = sitofp i32 %mul to float            ; <float> [#uses=1]
              %add = add float %promote3, %Z          ; <float> [#uses=1]
              %conv = fptosi float %add to i32                ; <i32> [#uses=1]
              ret i32 %conv
      }
      
      with:
      
      $ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis
      
      llvm-svn: 39652
      53621a53
    • Steve Naroff's avatar
      Bug #: · d6fbee81
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Fixed typechecking bugs wrt UsualUnaryConversions. Includes two distinct fixes:
      
      #1: Call UsualUnaryConversions in CheckRelationalOperands/CheckEqualityOperands.
      #2: UsualArithmeticConversions arguments are now output parameters. This insures
      the implicit conversion is seen by clients (and fixes bugs in CheckAdditionOperands
      and CheckSubtractionOperands when doing pointer arithmetic).
      ~
      
      llvm-svn: 39649
      d6fbee81
  3. Jun 11, 2007
    • Chris Lattner's avatar
      Implement capturing of enum values and chaining of enums together. · 4ef40013
      Chris Lattner authored
      llvm-svn: 39644
      4ef40013
    • Steve Naroff's avatar
      Bug #: · a8fd973a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Implement semantic analysis for vector_size attribute!
      We now produce the following diagnostics...
      
      [administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang vector.c
      vector.c:2:29: error: attribute requires precisely 1 argument
      typedef int __attribute__(( vector_size )) tVecp;
                                  ^
      vector.c:7:32: error: attribute requires precisely 1 argument
      extern int foo __attribute__(( vector_size ));
                                     ^
      vector.c:8:34: error: attribute requires precisely 1 argument
      extern float bar __attribute__(( vector_size(16,18) ));
                                       ^
      vector.c:11:34: error: vector_size requires integer constant (attribute ignored)
      extern char foo2 __attribute__(( vector_size(16.2) ));
                                       ^           ~~~~
      vector.c:21:47: error: invalid vector type 'struct s'
      struct s { int a; } structVar __attribute__(( vector_size(16) ));
      
      llvm-svn: 39643
      a8fd973a
    • Chris Lattner's avatar
      GCC accepts code like this as an extension: · 843c592e
      Chris Lattner authored
      static int seminal(from, to)
      {
      }
      
      llvm-svn: 39642
      843c592e
  4. Jun 09, 2007
  5. Jun 06, 2007
    • Steve Naroff's avatar
      Bug #: · 98cf3e95
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      
      The following code illustrates a bug in the semantic analysis for assignments:
      
      int func() {
        int *P;
        char *x;
        P = x; // type of this assignment expression should be "int *", NOT "char *".
      }
      
      While the type checking/diagnostics are correct, the type of the assignment
      expression is incorrect (which shows up during code gen).  With the fix,
      the llvm code looks correct...
      
      [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang cast.c -emit-llvm
      cast.c:4:5: warning: incompatible pointer types assigning 'char *' to 'int *'
        P = x; // type of assignment expression is "int *", NOT "char *".
        ~ ^ ~
      ; ModuleID = 'foo'
      
      define i32 @func() {
      entry:
              %P = alloca i32*                ; <i32**> [#uses=1]
              %x = alloca i8*         ; <i8**> [#uses=1]
              %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
              %tmp = load i8** %x             ; <i8*> [#uses=1]
              %conv = bitcast i8* %tmp to i32*                ; <i32*> [#uses=1]
              store i32* %conv, i32** %P
              ret i32 undef
      }
      
      Even though the fix was simple, I decided to rename/refactor the surrounding code
      to make a clearer distinction between constraint checking and conversion.
      
      - Renamed AssignmentConversionResult -> AssignmentCheckResult.
      - Renamed UsualAssignmentConversions -> CheckAssignmentConstraints.
      - Changed the return type of CheckAssignmentConstraints and CheckPointerTypesForAssignment
      from QualType -> AssignmentCheckResult. These routines no longer take a reference to the result (obviously).
      - Changed CheckAssignmentOperands to return the correct type (with spec annotations).
      
      llvm-svn: 39601
      98cf3e95
    • Chris Lattner's avatar
      On bogus code like this: · 3d01e4ea
      Chris Lattner authored
        int *P2;
        P2(1, 2, 3);
      
        register short X;
        X();
      
      emit:
      
      ds.c:10:3: error: called object is not a function or function pointer
        P2(1, 2, 3);
        ^~~~~~~~~~~
      ds.c:13:3: error: called object is not a function or function pointer
        X();
        ^~~
      
      instead of aborting.
      
      llvm-svn: 39599
      3d01e4ea
    • Chris Lattner's avatar
      Fix semantic analysis of calls on stuff like: · 3343f81a
      Chris Lattner authored
      int func() {
       int (*FP)();
       FP();
       (*****FP)();
      }
      
      llvm-svn: 39598
      3343f81a
    • Chris Lattner's avatar
      implement codegen of string literals. · 4347e369
      Chris Lattner authored
      llvm-svn: 39597
      4347e369
  6. Jun 05, 2007
    • Chris Lattner's avatar
      add some fixme's for incorrect sema · 1d411a82
      Chris Lattner authored
      llvm-svn: 39591
      1d411a82
    • Steve Naroff's avatar
      Bug #: · 6d9de3dd
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Touch up a couple comments (one was incorrect/out-of-date).
      
      llvm-svn: 39589
      6d9de3dd
    • Chris Lattner's avatar
      Rename Sema::isConstantArrayType -> VerifyConstantArrayType. Make sure to · 6046e008
      Chris Lattner authored
      check canonical types in a few places.  Tighten up VerifyConstantArrayType
      to diagnose more errors, now that we can evaluate i-c-e's.  Add some fixmes
      about poor diagnostics.
      
      We now correctly typecheck this example:
      
      void s(void) {
        typedef int a[(int) +1.0];
        static a b;    // invalid, static VLA
      
        static int c[(int) +1.0];  // invalid, static VLA
      }
      
      void t(void) {
        typedef int a[(int)1.0];
        static a b;    // valid, constant size
      }
      
      void u() {
        static int X[-1];
        static int Y[0];
      }
      
      producing:
      
      static-vla.c:3:12: error: variable length array declared outside of any function
        static a b;    // invalid, static VLA
                 ^
      static-vla.c:5:14: error: variable length array declared outside of any function
        static int c[(int) +1.0];  // invalid, static VLA
                   ^ ~~~~~~~~~~
      static-vla.c:15:14: error: array size is negative
        static int X[-1];
                   ^ ~~
      static-vla.c:16:14: warning: zero size arrays are an extension
        static int Y[0];
                   ^ ~
      
      llvm-svn: 39587
      6046e008
    • Chris Lattner's avatar
      ab0b2df4
    • Steve Naroff's avatar
      Bug #: · 71b59a9a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Fixed an "impurity" in the typechecking code (to more closely model the
      C99 spec)...
      
      - Added function Sema::DefaultFunctionArrayConversion(). This is called
      by UsualUnaryConversions(). It is also called from several contexts that
      don't call for integer promotions (logical negation for expressions, and
      while/if/do/for conditions in statements). It is also used in
      UsualAssignmentConversions (which is cleaner than the check I was using
      before).
      
      - Changed the name from UsualUnaryConversion->UsualUnaryConversions.
      
      - Added comments to the header.
      
      Since several contexts don't call for integer
      promotions,
      
      llvm-svn: 39581
      71b59a9a
  7. Jun 03, 2007
  8. Jun 02, 2007
  9. Jun 01, 2007
    • Steve Naroff's avatar
      Bug #: · 4555292b
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      After speaking with Chris, decided not to have GCC "attributes" inherit
      from Decl. This will enable us to grow the attribute hierarchy over time
      without effecting Decls.
      
      llvm-svn: 39543
      4555292b
    • Steve Naroff's avatar
      Bug #: · 0f2fe17f
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Implement support for GCC __attribute__.
      
      - Implement "TODO" in Parser::ParseAttributes. Changed the return type from
      void to Parser::DeclTy. Changed all call sites to accept the return value.
      - Added Action::ParseAttribute and Sema::ParseAttribute to return an
      appropriate AST node. Added new node AttributeDecl to Decl.h.
      
      Still to do...hook up to the Decl...
      
      llvm-svn: 39539
      0f2fe17f
  10. May 31, 2007
  11. May 30, 2007
    • Steve Naroff's avatar
      Bug #: · 9992bbab
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      - ParseForStatement(): Put back a test/assignment. My removal of
      ParseExprStmt() was a bit over zealous:-(thanks to Chris for pointing it out)
      - Add assert to VisitDeclStmt().
      - Removed an out-of-date FIXME
      - Added some curlies for a couple multi-line calls to Diag().
      
      llvm-svn: 39528
      9992bbab
    • Bill Wendling's avatar
      Submitted by: Bill Wendling · 216423bb
      Bill Wendling authored
      Comment format changes.
      
      llvm-svn: 39527
      216423bb
    • Steve Naroff's avatar
      Bug #: · 56faab2d
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      - Many tweaks to various diagnostics.
      - Fixed some location/range issues.
      - Bug fix to Sema::ParseDeclStmt() - error return code is "true", not 0.
      
      llvm-svn: 39526
      56faab2d
    • Steve Naroff's avatar
      Bug #: · eb9da94d
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Unified the diagnostics for function calls. Since we have range support,
      there is no need for including the argument number. Instead, I've made
      the diags more expressive by including more type info.
      
      Also improved the indentation of many calls to Diag (which can be 2-3
      lines now).
      
      llvm-svn: 39523
      eb9da94d
    • Steve Naroff's avatar
      Bug #: · 2a8ad18e
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Implement some FIXME's that stand in the way of fully typechecking "for"
      statements. This involved:
      
      - Adding a DeclStmt AST node (with statement visitor). The DeclStmt
      printer is preliminary.
      - Added a ParseDeclStmt action, called from Parser::ParseForStatement()
      and Parser::ParseStatementOrDeclaration(). DID NOT add to
      Parser::ParseIdentifierStatement()...probably could have, however didn't
      really understand the context of this rule (will speak with Chris).
      - Removed ParseExprStmt (and it's clients)...it was vestigial.
      
      llvm-svn: 39518
      2a8ad18e
  12. May 29, 2007
    • Steve Naroff's avatar
      Bug #: · 6f49f5df
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      - Finished Sema::ParseReturnStmt(). Still need to tweak ranges.
      - Tweaked location for function arguments (they now point at the expression directly, no parens or commas).
      - Added InvalidOperands helper...was sick of looking at the same 3 lines in ~9 Check functions.
      - Added a few diags and moved a group of statement diags to the proper comment/category.
      
      llvm-svn: 39517
      6f49f5df
Loading