- Jul 14, 2007
-
-
Chris Lattner authored
where ASTContext can manage caches for struct layout, etc. llvm-svn: 39835
-
- Jul 13, 2007
-
-
Chris Lattner authored
llvm-svn: 39832
-
Steve Naroff authored
Add (explicit) AST support for implicit casts. This should simplify the code generator. Source translation tools can simply ignore this node. - Added a new Expr node, ImplicitCastExpr. - Changed UsualUnaryConversions/UsualArithmeticConversions to take references to Expr *'s. This will allow these routines to instantiate the new AST node and pass it back. - Changed all clients of UsualUnary/UsualArithmetic (lot's of diff's). - Changed some names in CheckConditionalOperands. Several variables where only distinguished by their case (e.g. Cond, cond). Yuck (what was I thinking). - Removed an old/crufty constructor in CastExpr (cleanup). This check-in does not actually create the new AST node. I wanted to separate the mechanical changes from the semantic changes. In addition, I need to coordinate with Chris, since the semantic change will break the code generator. llvm-svn: 39814
-
Chris Lattner authored
Both in one patch, and the test case that Chris didn't commit last time is in there too... I'll split the patch up if somebody wants it split." Patch by Keith Bauer. llvm-svn: 39796
-
Chris Lattner authored
Keith Bauer. llvm-svn: 39793
-
Anton Korobeynikov authored
llvm-svn: 39792
-
- Jul 12, 2007
-
-
Steve Naroff authored
Two changes... - Teach all the integer/float predicates on Type about Vectors. - Disallow bitwise compliment on float vectors. For example... typedef float __attribute__(( vector_size(16) )) float4; float4 float4_return() { float4 xx; return ~xx; } ...now emits the following diagnostic... [administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang bug.c bug.c:8:12: error: invalid argument type to unary expression 'float4' return ~xx; ^ 1 diagnostic generated. llvm-svn: 39791
-
Chris Lattner authored
Benoit Boissinot! llvm-svn: 39780
-
Anton Korobeynikov authored
llvm-svn: 39777
-
Chris Lattner authored
pretty printer to print it. llvm-svn: 39770
-
- Jul 11, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: Removed Attr.[h,cpp]...they didn't have any useful content. When more (GCC) attributes are added, we might want to create a file of this ilk. For now, it's better to remove them (to eliminate any confusion). I also update the Xcode project file... llvm-svn: 39729
-
Steve Naroff authored
Submitted by: Reviewed by: Two vector fixes: - Sema::CheckAssignmentConstraints() needs to compare the canonical type. - Expr::isLvalue() needs to disallow subscripting into a vector returned by a function. This follows the rules for struct returns (in C, at least...C++ is another story:-) Here is an example... float4 float4_return() { float4 xx; return xx; } void add_float4_void_return(float4 *a, float4 *b, float4 *result) { float f; float4_return()[1] = f; // now illegal } llvm-svn: 39728
-
- Jul 09, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: Typechecking support for vectors... - Added CheckVectorOperands(). Called from CheckAdditionOperands, CheckMultiplyDivideOperands, CheckSubstractionOperands, and CheckBitwiseOperands. - Added diagnostic for converting vector values of different size. - Modified Type::isArithmeticType to include vectors. Sould be ready for Chris to add code generation. I will continue testing/refining. llvm-svn: 39717
-
- Jul 07, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: - Finished semantic analysis for vectors, added some diagnostics. - Added AST for vectors (instantiation, installation into the decl). - Fixed bug in ParseArraySubscriptExpr()...this crasher was introduced by me when we added the range support. - Turned pedantic off by default. Since vectors are gcc extensions, having pedantic on by default was annoying. Turning it off by default is also consistent with gcc (but this wasn't my primary motivation). - Tweaked some comments and diagnostics. Note: The type checking code is still under construction (for vectors). This will be my next check-in. llvm-svn: 39715
-
- Jun 27, 2007
-
-
Chris Lattner authored
some ivars to more obvious names, eliminating some comments. llvm-svn: 39685
-
Chris Lattner authored
llvm-svn: 39684
-
Chris Lattner authored
this produces: warn.c:4:3: warning: expression result unused X == Y; ^~~~~~ warn.c:5:3: warning: expression result unused (void)X; ^~~~~~~ warn.c:11:3: warning: expression result unused A == foo(1, 2); ^~~~~~~~~~~~~~ warn.c:13:3: warning: expression result unused foo(1,2)+foo(4,3); ^~~~~~~~~~~~~~~~~ llvm-svn: 39682
-
- Jun 22, 2007
-
-
Chris Lattner authored
types. llvm-svn: 39672
-
- 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
-