summaryrefslogtreecommitdiffstats
path: root/clang/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Added a new expression, OCUVectorComponent.Steve Naroff2007-07-283-0/+22
| | | | llvm-svn: 40577
* Add Type::isOCUVectorType().Steve Naroff2007-07-261-8/+43
| | | | | | Convert isFunctionType(), isStructureType(), and isUnionType() to the new API. llvm-svn: 40541
* Forgot a return stmt (oops).Steve Naroff2007-07-261-0/+1
| | | | llvm-svn: 40509
* Various improvements to Sema::ParseMemberReferenceExpr().Steve Naroff2007-07-261-0/+11
| | | | | | | | | | | - Added source range support to Diag's. - Used the new type predicate API to remove dealing with the canonical type explicitly. - Added Type::isRecordType(). - Removed some casts. - Removed a const qualifier from RecordType::getDecl(). llvm-svn: 40508
* Fix Sema::ParseCallExpr()...it wasn't doing the default array/function ↵Steve Naroff2007-07-241-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | promotions on it's argument types. This resulted in the following errors when compiling promote_types_in_proto.c test... [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang test/Parser/promote_types_in_proto.c test/Parser/promote_types_in_proto.c:7:24: error: incompatible types passing 'char *[]' to function expecting 'char *const []' arrayPromotion(argv); ~~~~~~~~~~~~~~ ^~~~ test/Parser/promote_types_in_proto.c:8:27: error: incompatible types passing 'void (char *const [])' to function expecting 'void (char *const [])' functionPromotion(arrayPromotion); ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~ 2 diagnostics generated. When fixing this, noticed that both ParseCallExpr() and ParseReturnStmt() were prematurely comparing types for equivalence. This is incorrect (since the expr. promotions haven't been done yet). To fix this, I moved the check "down" to Sema::CheckAssignmentConstraints(). I also converted Type::isArrayType() to the modern API (since I needed it). Still more Type predicates to convert. llvm-svn: 40475
* implement ast building and trivial semantic analysis of stmt exprs.Chris Lattner2007-07-241-1/+7
| | | | | | This implements test/Sema/stmt_exprs.c llvm-svn: 40465
* fix bogus warnings about potentially uninit vars Size and Align.Chris Lattner2007-07-231-8/+8
| | | | | | Patch by Neil Booth! llvm-svn: 40452
* Refactor switch analysis to make it possible to detect duplicate case valuesAnders Carlsson2007-07-221-0/+4
| | | | llvm-svn: 40388
* Minor simplification to Expr::isLvalue().Steve Naroff2007-07-211-1/+1
| | | | llvm-svn: 40375
* minor simplificationsChris Lattner2007-07-211-2/+2
| | | | llvm-svn: 40176
* Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__Anders Carlsson2007-07-211-0/+16
| | | | llvm-svn: 40162
* Fix a valgrind error noticed by Benoit BoissinotChris Lattner2007-07-202-3/+3
| | | | llvm-svn: 40113
* fix a nasty bug Owen noticed in a gcc warning.Chris Lattner2007-07-201-4/+4
| | | | llvm-svn: 40110
* implement size/alignment analysis for arrays and vectors. This gets ↵Chris Lattner2007-07-191-4/+22
| | | | | | carbon.h working again. llvm-svn: 40068
* Finish fixing crasher with compound literals.Steve Naroff2007-07-191-0/+4
| | | | | | | We still need to do sematic analysis (and implement initializers), however this should complete the parsing & ast building for compound literals. llvm-svn: 40067
* implement i-c-e correct evaluation for sizeof/alignof, remove some obsolete ↵Chris Lattner2007-07-181-13/+20
| | | | | | fixme's. llvm-svn: 40012
* implement sizeof/alignof support for structs, unions and complex.Chris Lattner2007-07-181-6/+28
| | | | | | | | | | | | | | | | | | 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
* First round of extended vector support. Here is an overview...Steve Naroff2007-07-181-8/+37
| | | | | | | | | | | - 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
* initial layout support for structures and unions. This isn't actuallyChris Lattner2007-07-181-0/+70
| | | | | | hooked up to anything, so it's not very useful yet. llvm-svn: 40006
* teach -stats about new typesChris Lattner2007-07-181-0/+8
| | | | llvm-svn: 39996
* add a note Neil pointed outChris Lattner2007-07-181-0/+4
| | | | llvm-svn: 39994
* Return the correct type from isReferenceType().Bill Wendling2007-07-171-1/+1
| | | | llvm-svn: 39956
* Change dyn_cast for reference types to be more like pointers and not need ↵Bill Wendling2007-07-171-1/+9
| | | | | | the canonical type. Also fix so that we're not expecting a return value from a void function llvm-svn: 39954
* Fix references:Bill Wendling2007-07-171-1/+5
| | | | | | | | 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
* In the final step for preserving typedef info better in the AST, upgrade Chris Lattner2007-07-161-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* avoid requiring people to update from llvm svn.Chris Lattner2007-07-161-1/+1
| | | | llvm-svn: 39925
* Constify the is*Lvalue() methods.Bill Wendling2007-07-161-2/+2
| | | | llvm-svn: 39907
* Now that isPointerType can return a pointer type, avoid stripping off typedefChris Lattner2007-07-161-12/+21
| | | | | | | | | | | | | | | | | | | 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
* as a very useful feature, make isVectorType and isPointerType returnChris Lattner2007-07-161-4/+8
| | | | | | the actual vectortype or pointertype when they return success. llvm-svn: 39890
* Remove an extraneous QualType from CastExpr, it's type is alwaysChris Lattner2007-07-152-13/+27
| | | | | | | | | | | | | | | | | | 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
* don't let builtin-type handling code fall into pointer handling codeChris Lattner2007-07-151-0/+1
| | | | | | not all builtin types have size and alignment equal to pointers :) llvm-svn: 39887
* set the correct width for a character literal when evaluating it as an i-c-e.Chris Lattner2007-07-151-4/+7
| | | | llvm-svn: 39886
* Refactor code so that isIntegerConstantExpr has an ASTContext available.Chris Lattner2007-07-152-20/+21
| | | | llvm-svn: 39884
* This is the final step/commit for implementing exlicit implicit casts. ↵Steve Naroff2007-07-151-0/+3
| | | | | | | | | | | | | 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
* A significant refactoring of the type size stuff to also Chris Lattner2007-07-141-43/+19
| | | | | | compute type alignment. This info is needed for struct layout. llvm-svn: 39850
* Improve char literal pretty printing, patch by Keith Bauer!Chris Lattner2007-07-131-6/+43
| | | | llvm-svn: 39846
* More changes related to implementing ImplicitCastExpr.Steve Naroff2007-07-131-1/+2
| | | | | | | | | | | | | | - 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
* Use target info to decide the sizes of basic types.Chris Lattner2007-07-131-29/+30
| | | | llvm-svn: 39838
* Add missing citation.Chris Lattner2007-07-131-1/+2
| | | | llvm-svn: 39837
* Move getSize() out of type, into ASTContext, where it has target info, andChris Lattner2007-07-132-46/+53
| | | | | | where ASTContext can manage caches for struct layout, etc. llvm-svn: 39835
* remove some extraneous spaces, no functionality change.Chris Lattner2007-07-131-3/+3
| | | | llvm-svn: 39832
* Add (explicit) AST support for implicit casts. This should simplify the Steve Naroff2007-07-131-0/+3
| | | | | | | | | | | | | | | | | | | 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
* "Codegen for Character Literals and Conditional OperatorChris Lattner2007-07-131-2/+9
| | | | | | | | | | | 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
* Implement codegen for + and - with pointers. Patch contributed by Chris Lattner2007-07-132-28/+58
| | | | | | Keith Bauer. llvm-svn: 39793
* Workaround gcc 3.4.x bugAnton Korobeynikov2007-07-131-1/+2
| | | | llvm-svn: 39792
* Two changes...Steve Naroff2007-07-121-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* Fix "no newline at end of file" warnings. Patch contributed byChris Lattner2007-07-121-1/+1
| | | | | | Benoit Boissinot! llvm-svn: 39780
* Properly use local variable declaration inside a switch caseAnton Korobeynikov2007-07-121-1/+2
| | | | llvm-svn: 39777
* remember the initializer for a variable in the AST and teach theChris Lattner2007-07-121-1/+7
| | | | | | pretty printer to print it. llvm-svn: 39770
* Bug #:Steve Naroff2007-07-111-18/+0
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud