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
    • 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
  3. Jun 12, 2007
    • Chris Lattner's avatar
      Pretty print if/else/elseif chains nicer, like this: · c0a38dd3
      Chris Lattner authored
      void printutf8(unsigned int X) {
        if (X <= 127)
          printf("%c", (char)X);
        else if (X <= 2047)
          printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
        else if (X <= 65535)
          printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
        else
          printf("UNKNOWN %d\n", X);
      
      instead of:
      
        if (X <= 127)
          printf("%c", (char)X);
        else
          if (X <= 2047)
            printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
          else
            if (X <= 65535)
              printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
            else
              printf("UNKNOWN %d\n", X);
      
      llvm-svn: 39648
      c0a38dd3
  4. Jun 11, 2007
  5. Jun 09, 2007
    • Steve Naroff's avatar
      Bug #: · b309644a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Lot's of attribute scaffolding.
      Modernized ParseArraySubscriptExpr...call DefaultFunctionArrayConversion (which
      simplified the logic considerably) and upgrade Diags to use the range support.
      
      llvm-svn: 39628
      b309644a
    • Chris Lattner's avatar
      Finally break down and chain together decls that are defined with common declspecs, · 776fac87
      Chris Lattner authored
      like: int X, Y, Z;
      
      This is required for the code gen to get to all of the declarations in a
      DeclStmt, and should simplify some other code.
      
      llvm-svn: 39623
      776fac87
  6. Jun 08, 2007
  7. Jun 05, 2007
    • Chris Lattner's avatar
    • Chris Lattner's avatar
      add another fixme · 66cfa8ad
      Chris Lattner authored
      llvm-svn: 39588
      66cfa8ad
    • 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
      simplify Type::isConstantSizeType based on knowledge that it is only called · 3e4dabe4
      Chris Lattner authored
      on complete types.
      
      llvm-svn: 39586
      3e4dabe4
    • Chris Lattner's avatar
      Change Expr::isIntegerConstantExpr in two ways: · e0da5dc8
      Chris Lattner authored
        1. Compute and return the value of the i-c-e if the expression is one.
        2. Use this computation to correctly track whether subexprs are being
           evaluated, and use this to guide diagnostics appropriately.
      
      This allows us to correctly handle all the cases in:
      
      void bar() {
        int foo();
        switch (1) {
        case 1 ? 0 : foo():    // bad
        case 0 ? 0 : foo():    // bad
      
        case 0 ? 1/0 : 14 :  // ok
        case 1 ? 1/0 : 14 :  // bad
          ;
        }
      
        switch (1) {
        case 1 ? 2: (2, 3): // ok
        case 0 ? 2: (2, 3): // invalid comma.
          ;
        }
      }
      
      This code has numerous todo items.  Specifically, we need to:
        1. Pass in target info, so we know the size of the integers we are producing.
        2. Model type sizes and alignments correctly, so we can eval sizeof/alignof
        3. Handle promotions (need to talk to steve about this).
        4. Return an enum that can be used to better diagnose problems with i-c-e's.
           instead of just saying "this isn't valid" we should be able to say why.
        5. Various other miscellanea, like handling enums and character literals
           properly.
      
      llvm-svn: 39585
      e0da5dc8
    • Chris Lattner's avatar
      Nothing currently wants to know if something is a constantexpr. Simplify · 1f4479e7
      Chris Lattner authored
      isConstantExpr into just isIntegerConstantExpr in preparation for other
      changes.
      
      llvm-svn: 39584
      1f4479e7
    • Chris Lattner's avatar
      ab0b2df4
  8. Jun 03, 2007
  9. Jun 02, 2007
  10. Jun 01, 2007
    • Steve Naroff's avatar
      Bug #: · 6a0675f8
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Add implemention file for GCC attributes
      
      llvm-svn: 39542
      6a0675f8
    • 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
  11. May 31, 2007
  12. May 30, 2007
    • Chris Lattner's avatar
      pretty print exprs in stmt contexts with a trailing semicolon. · fc068c15
      Chris Lattner authored
      llvm-svn: 39531
      fc068c15
    • 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
    • Chris Lattner's avatar
      Don't print billions of spaces for a label with no indent. · d5322cd2
      Chris Lattner authored
      llvm-svn: 39521
      d5322cd2
    • 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
  13. May 28, 2007
    • Chris Lattner's avatar
      eefa10e7
    • Chris Lattner's avatar
      Change GotoStmt's to have a pointer to the LabelStmt instead of a pointer to · e2473068
      Chris Lattner authored
      the label identifier.  Handle fwd references etc.  This allows us to detect
      uses of undefined labels and label redefinitions, such as:
      
      t.c:2:12: error: redefinition of label 'abc'
        abc: ;   abc:
                 ^
      t.c:2:3: error: previous definition is here
        abc: ;   abc:
        ^
      t.c:12:12: error: use of undeclared label 'hijl'
            goto hijl;
                 ^
      
      llvm-svn: 39509
      e2473068
    • Chris Lattner's avatar
      2f6ac263
    • Chris Lattner's avatar
      add a NullStmt ast node. · 012a6cf1
      Chris Lattner authored
      llvm-svn: 39505
      012a6cf1
    • Steve Naroff's avatar
      Bug #: · 9358c715
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      - Added type checking to Sema::ParseReturnStmt (still under construction).
      - Improved Expr::isLvalue() and Expr::isModifiableLvalue() to return more
      info. Used the info in Sema::CheckAssignmentOperands() to produce more
      descriptive diagnostics. Added FIXME to other clients of isLvalue()/etc.
      - Added a SourceLocation slot to MemberExpr...changed the implementation
      of getSourceRange().
      - Added getResultType() helper to FunctionDecl.
      - Changed many Diag calls to use the SourceRange support (now that it's
      a big hit...we better milk it:-).
      
      llvm-svn: 39501
      9358c715
    • Bill Wendling's avatar
      Bug #: · c5fc5f19
      Bill Wendling authored
      Submitted by: Bill Wendling
      Reviewed by:
      
      - Can do just a 'cast<>()' because we're checking that it's Tagged.
      
      llvm-svn: 39500
      c5fc5f19
    • Bill Wendling's avatar
      Bug #: · 229f243f
      Bill Wendling authored
      Submitted by: Bill Wendling
      Reviewed by: Steve Naroff
      
      - Steve suggested avoiding the dyn_cast by using the "Tagged" type class
        and having the "default" just return false.
      
      llvm-svn: 39499
      229f243f
Loading