- Jul 19, 2007
-
-
Steve Naroff authored
We still need to do sematic analysis (and implement initializers), however this should complete the parsing & ast building for compound literals. llvm-svn: 40067
-
- Jul 18, 2007
-
-
Chris Lattner authored
llvm-svn: 40012
-
Chris Lattner authored
This allows us to compile this: struct abc { char A; double D; }; int foo() { return sizeof(struct abc); return __alignof__(struct abc); } Into: ret i32 16 ret i32 8 llvm-svn: 40010
-
Steve Naroff authored
First round of extended vector support. Here is an overview... - added ocu_vector_type attribute, Sema::HandleOCUVectorTypeAttribute(). - added new AST node, OCUVectorType, a subclass of VectorType. - added ASTContext::getOCUVectorType. - changed ASTContext::convertToVectorType() to ASTContext::getVectorType(). This is unrelated to extended vectors, however I was in the vicinity and it was on my todo list. Added a FIXME to Sema::HandleVectorTypeAttribute to deal with converting complex types. llvm-svn: 40007
-
Chris Lattner authored
hooked up to anything, so it's not very useful yet. llvm-svn: 40006
-
Chris Lattner authored
llvm-svn: 39996
-
Chris Lattner authored
llvm-svn: 39994
-
- Jul 17, 2007
-
-
Bill Wendling authored
llvm-svn: 39956
-
Bill Wendling authored
Change dyn_cast for reference types to be more like pointers and not need the canonical type. Also fix so that we're not expecting a return value from a void function llvm-svn: 39954
-
Bill Wendling authored
According to the spec (C++ 5p6[expr]), we need to adjust "T&" to "T" before further analysis. We do this via the "implicit cast" thingy. llvm-svn: 39953
-
Chris Lattner authored
isPointerType and isVectorType to only look through a single level of typedef when one is present. For this invalid code: typedef float float4 __attribute__((vector_size(16))); typedef int int4 __attribute__((vector_size(16))); typedef int4* int4p; void test(float4 a, int4p result, int i) { result[i] = a; } we now get: t.c:5:15: error: incompatible types assigning 'float4' to 'int4' result[i] = a; ~~~~~~~~~ ^ ~ instead of: t.c:5:15: error: incompatible types assigning 'float4' to 'int __attribute__((vector_size(16)))' result[i] = a; ~~~~~~~~~ ^ ~ The rest of the type predicates should be upgraded to do the same thing. llvm-svn: 39932
-
- Jul 16, 2007
-
-
Chris Lattner authored
llvm-svn: 39925
-
Bill Wendling authored
llvm-svn: 39907
-
Chris Lattner authored
information in the common case. On this invalid code: typedef float float4 __attribute__((vector_size(16))); typedef int int4 __attribute__((vector_size(16))); void test(float4 a, int4 *result, int i) { result[i] = a; } we now generate: t.c:5:15: error: incompatible types assigning 'float4' to 'int4' instead of: t.c:5:15: error: incompatible types assigning 'float4' to 'int __attribute__((vector_size(16)))' This implements test/Sema/typedef-retain.c llvm-svn: 39892
-
Chris Lattner authored
the actual vectortype or pointertype when they return success. llvm-svn: 39890
-
Chris Lattner authored
the result type of the expr node. Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same was as for CastExpr nodes. Implement proper sign/zero extension as well as truncation and noop conversion in the i-c-e evaluator. This allows us to correctly handle i-c-e's like these: char array[1024/(sizeof (long))]; int x['\xBb' == (char) 187 ? 1: -1]; this implements test/Sema/i-c-e2.c llvm-svn: 39888
-
Chris Lattner authored
not all builtin types have size and alignment equal to pointers :) llvm-svn: 39887
-
Chris Lattner authored
llvm-svn: 39886
-
Chris Lattner authored
llvm-svn: 39884
-
- Jul 15, 2007
-
-
Steve Naroff authored
This is the final step/commit for implementing exlicit implicit casts. Unlike the previous two checkins, which involved lot's of tedious refactoring, this checkin is nice and clean:-) - Hacked UsualUnaryConversions, UsualArithmeticConversions, and DefaultFunctionArrayConversion to create the AST node (using a helper function promoteExprToType). - Added a setType method to Expr. - Changed Expr::isIntegerConstantExpr to allow for the new node. llvm-svn: 39866
-
- Jul 14, 2007
-
-
Chris Lattner authored
compute type alignment. This info is needed for struct layout. llvm-svn: 39850
-
Chris Lattner authored
llvm-svn: 39846
-
Steve Naroff authored
More changes related to implementing ImplicitCastExpr. - Fixed a recent regression discovered by Keith Bauer (thanks!). The fix involved adding (back) two arguments to UsualArithmeticConversions. Without the reference arguments, no unary conversions were being passed back to the caller. This had the effect of turning off the UsualUnaryConversions. - Refactored CheckAssignmentConstraints into 3 functions. CheckAssignmentConstraints, CheckSingleAssignmentConstraints, and CheckCompoundAssignmentConstraints. - Changed the argument type of DefaultFunctionArrayConversion from QualType->Expr*&. - Removed a bunch of casts in routines I was working on (cleanup). - Fixed the visitor for ImplicitCastExpr (oops). llvm-svn: 39840
-
Chris Lattner authored
llvm-svn: 39838
-
Chris Lattner authored
llvm-svn: 39837
-
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
-