- 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
-
-
Steve Naroff authored
Submitted by: Reviewed by: Fix CheckRelationalOperands/CheckEqualityOperands to deal with null pointer constants. The new logic also deals (more) correctly for non-pointer/integer operands. llvm-svn: 39654
-
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
-
Steve Naroff authored
Submitted by: Reviewed by: Fixed typechecking bugs wrt UsualUnaryConversions. Includes two distinct fixes: #1: Call UsualUnaryConversions in CheckRelationalOperands/CheckEqualityOperands. #2: UsualArithmeticConversions arguments are now output parameters. This insures the implicit conversion is seen by clients (and fixes bugs in CheckAdditionOperands and CheckSubtractionOperands when doing pointer arithmetic). ~ llvm-svn: 39649
-
- Jun 11, 2007
-
-
Chris Lattner authored
llvm-svn: 39644
-
Steve Naroff authored
Submitted by: Reviewed by: Implement semantic analysis for vector_size attribute! We now produce the following diagnostics... [administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang vector.c vector.c:2:29: error: attribute requires precisely 1 argument typedef int __attribute__(( vector_size )) tVecp; ^ vector.c:7:32: error: attribute requires precisely 1 argument extern int foo __attribute__(( vector_size )); ^ vector.c:8:34: error: attribute requires precisely 1 argument extern float bar __attribute__(( vector_size(16,18) )); ^ vector.c:11:34: error: vector_size requires integer constant (attribute ignored) extern char foo2 __attribute__(( vector_size(16.2) )); ^ ~~~~ vector.c:21:47: error: invalid vector type 'struct s' struct s { int a; } structVar __attribute__(( vector_size(16) )); llvm-svn: 39643
-
Chris Lattner authored
static int seminal(from, to) { } llvm-svn: 39642
-
- Jun 09, 2007
-
-
Chris Lattner authored
llvm-svn: 39637
-
Chris Lattner authored
llvm-svn: 39634
-
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
-
Chris Lattner authored
llvm-svn: 39620
-
Chris Lattner authored
llvm-svn: 39619
-
- Jun 06, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: The following code illustrates a bug in the semantic analysis for assignments: int func() { int *P; char *x; P = x; // type of this assignment expression should be "int *", NOT "char *". } While the type checking/diagnostics are correct, the type of the assignment expression is incorrect (which shows up during code gen). With the fix, the llvm code looks correct... [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang cast.c -emit-llvm cast.c:4:5: warning: incompatible pointer types assigning 'char *' to 'int *' P = x; // type of assignment expression is "int *", NOT "char *". ~ ^ ~ ; ModuleID = 'foo' define i32 @func() { entry: %P = alloca i32* ; <i32**> [#uses=1] %x = alloca i8* ; <i8**> [#uses=1] %allocapt = bitcast i32 undef to i32 ; <i32> [#uses=0] %tmp = load i8** %x ; <i8*> [#uses=1] %conv = bitcast i8* %tmp to i32* ; <i32*> [#uses=1] store i32* %conv, i32** %P ret i32 undef } Even though the fix was simple, I decided to rename/refactor the surrounding code to make a clearer distinction between constraint checking and conversion. - Renamed AssignmentConversionResult -> AssignmentCheckResult. - Renamed UsualAssignmentConversions -> CheckAssignmentConstraints. - Changed the return type of CheckAssignmentConstraints and CheckPointerTypesForAssignment from QualType -> AssignmentCheckResult. These routines no longer take a reference to the result (obviously). - Changed CheckAssignmentOperands to return the correct type (with spec annotations). llvm-svn: 39601
-
Chris Lattner authored
int *P2; P2(1, 2, 3); register short X; X(); emit: ds.c:10:3: error: called object is not a function or function pointer P2(1, 2, 3); ^~~~~~~~~~~ ds.c:13:3: error: called object is not a function or function pointer X(); ^~~ instead of aborting. llvm-svn: 39599
-
Chris Lattner authored
int func() { int (*FP)(); FP(); (*****FP)(); } llvm-svn: 39598
-
Chris Lattner authored
llvm-svn: 39597
-
- Jun 05, 2007
-
-
Chris Lattner authored
llvm-svn: 39591
-
Steve Naroff authored
Submitted by: Reviewed by: Touch up a couple comments (one was incorrect/out-of-date). llvm-svn: 39589
-
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
llvm-svn: 39583
-
Steve Naroff authored
Submitted by: Reviewed by: Fixed an "impurity" in the typechecking code (to more closely model the C99 spec)... - Added function Sema::DefaultFunctionArrayConversion(). This is called by UsualUnaryConversions(). It is also called from several contexts that don't call for integer promotions (logical negation for expressions, and while/if/do/for conditions in statements). It is also used in UsualAssignmentConversions (which is cleaner than the check I was using before). - Changed the name from UsualUnaryConversion->UsualUnaryConversions. - Added comments to the header. Since several contexts don't call for integer promotions, llvm-svn: 39581
-
- Jun 03, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: Apply UsualUnaryConversion() to statement conditions that expect scalars. UsualUnaryConversion() converts function/arrays to pointers. This fixes the following... int func() { int A[10]; while (A) { } if (A) ; for (; A; ) ; } llvm-svn: 39580
-
Chris Lattner authored
llvm-svn: 39575
-
Chris Lattner authored
ds.c:11:16: error: case label does not reduce to an integer constant case 0 ? 0 : foo(): ~~~~~~~~^~~~~ llvm-svn: 39574
-
Bill Wendling authored
Reviewed by: Chris Lattner - Disallow references to references, pointers to references, or arrays of references. llvm-svn: 39569
-
Bill Wendling authored
Reviewed by: Chris Lattner - If the LHS and/or RHS is a reference, then see if they're compatible. If so, the type is that of the LHS. llvm-svn: 39568
-
Chris Lattner authored
typedef information associated with the input. llvm-svn: 39562
-
- Jun 02, 2007
-
-
Chris Lattner authored
llvm-svn: 39558
-
Bill Wendling authored
- Added C99 reference to why "auto" and "register" cannot be used as a storage class specifier for file scoped variable declarations. llvm-svn: 39557
-
Chris Lattner authored
of one by reference, making it optional. llvm-svn: 39552
-
- Jun 01, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: After speaking with Chris, decided not to have GCC "attributes" inherit from Decl. This will enable us to grow the attribute hierarchy over time without effecting Decls. llvm-svn: 39543
-
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: 39536
-
- May 30, 2007
-
-
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
-
Bill Wendling authored
Comment format changes. llvm-svn: 39527
-
Steve Naroff authored
Submitted by: Reviewed by: - Many tweaks to various diagnostics. - Fixed some location/range issues. - Bug fix to Sema::ParseDeclStmt() - error return code is "true", not 0. llvm-svn: 39526
-
Steve Naroff authored
Submitted by: Reviewed by: Unified the diagnostics for function calls. Since we have range support, there is no need for including the argument number. Instead, I've made the diags more expressive by including more type info. Also improved the indentation of many calls to Diag (which can be 2-3 lines now). llvm-svn: 39523
-
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 29, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: - Finished Sema::ParseReturnStmt(). Still need to tweak ranges. - Tweaked location for function arguments (they now point at the expression directly, no parens or commas). - Added InvalidOperands helper...was sick of looking at the same 3 lines in ~9 Check functions. - Added a few diags and moved a group of statement diags to the proper comment/category. llvm-svn: 39517
-