- Jun 16, 2007
-
-
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
-
- Jun 13, 2007
-
-
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
-
- Jun 12, 2007
-
-
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
-
- Jun 11, 2007
-
-
Chris Lattner authored
llvm-svn: 39645
-
Chris Lattner authored
llvm-svn: 39644
-
- Jun 09, 2007
-
-
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
-
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
-
- Jun 08, 2007
-
-
Chris Lattner authored
llvm-svn: 39618
-
Chris Lattner authored
llvm-svn: 39617
-
Chris Lattner authored
llvm-svn: 39610
-
- Jun 05, 2007
-
-
Chris Lattner authored
llvm-svn: 39592
-
Chris Lattner authored
llvm-svn: 39588
-
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
-
Chris Lattner authored
on complete types. llvm-svn: 39586
-
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
-
Chris Lattner authored
isConstantExpr into just isIntegerConstantExpr in preparation for other changes. llvm-svn: 39584
-
Chris Lattner authored
llvm-svn: 39583
-
- Jun 03, 2007
-
-
Chris Lattner authored
llvm-svn: 39578
-
Chris Lattner authored
'char', which varies based on the target. Instead of spreading target knowledge throughout the compiler, bifurcate char into Char_S and Char_U, and have ASTContext create the right one based on the target, when it starts up. llvm-svn: 39577
-
Bill Wendling authored
Reviewed by: Chris Lattner - Added a method to determine if two types, where at least one is a reference, are compatible. That is you can assign the RHS to the LHS. llvm-svn: 39566
-
Chris Lattner authored
llvm-svn: 39563
-
- Jun 02, 2007
-
-
Chris Lattner authored
llvm-svn: 39556
-
Chris Lattner authored
of one by reference, making it optional. llvm-svn: 39552
-
Chris Lattner authored
We now print: extern void blah(); as: void (blah)(); Strange, but ok :) llvm-svn: 39549
-
- Jun 01, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: Add implemention file for GCC attributes llvm-svn: 39542
-
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
-
- May 31, 2007
-
-
Chris Lattner authored
llvm-svn: 39538
-
Chris Lattner authored
llvm-svn: 39537
-
Chris Lattner authored
a = b; { int c; c = a + b; int d; d++; } int e; instead of: a = b; { int c; c = a + b; int d; d++; } int e; llvm-svn: 39535
-
- May 30, 2007
-
-
Chris Lattner authored
llvm-svn: 39531
-
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
-
Chris Lattner authored
llvm-svn: 39521
-
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
-
- May 28, 2007
-
-
Chris Lattner authored
llvm-svn: 39510
-
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
-
Chris Lattner authored
llvm-svn: 39507
-
Chris Lattner authored
llvm-svn: 39505
-
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
-
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
-
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
-