| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
- Add comment and minor cleanup to yesterday's fix to ParseCallExpr().
llvm-svn: 40492
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Fix a todo in Parser::ParseTag, to recover better. On code like
that in test/Sema/decl-invalid.c it causes us to return a single
error instead of multiple.
2. Fix an error in Sema::ParseDeclarator, where it would crash if the
declarator didn't have an identifier. Instead, diagnose the problem.
3. Start adding infrastructure to track the range of locations covered
by a declspec or declarator. This is mostly implemented for declspec,
but could be improved, it is missing for declarator.
Thanks to Neil for pointing out this crash.
llvm-svn: 40482
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
This implements test/Sema/stmt_exprs.c
llvm-svn: 40465
|
|
|
|
|
|
| |
this fixes test/Sema/switch.c.
llvm-svn: 40438
|
|
|
|
| |
llvm-svn: 40388
|
|
|
|
| |
llvm-svn: 40169
|
|
|
|
| |
llvm-svn: 40163
|
|
|
|
| |
llvm-svn: 40162
|
|
|
|
|
|
| |
invalid arguments.
llvm-svn: 40161
|
|
|
|
| |
llvm-svn: 40139
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a bit nicer for people who pass lots of extra arguments to calls by
selecting them all instead of just the first one:
arg-duplicate.c:13:13: error: too many arguments to function
f3 (1, 1, 2, 3, 4); // expected-error {{too many arguments to function}}
^~~~~~~
This implements test/Sema/arg-duplicate.c, thanks to Neil for pointing
out this crash.
llvm-svn: 40136
|
|
|
|
| |
llvm-svn: 40135
|
|
|
|
|
|
|
|
|
|
| |
1) fix a crash on test/Sema/default.c by making
sure that the switch scope is non-null.
2) if there is an error sema'ing a default or case stmt,
make sure to return the substmt up, so that the error
recovery code has more acurate info to continue with.
llvm-svn: 40134
|
|
|
|
|
|
|
| |
Since that point is now long gone, we should rename LexerToken to
Token, as it is the only kind of token we have.
llvm-svn: 40105
|
|
|
|
|
|
|
| |
We still need to do sematic analysis (and implement initializers), however this
should complete the parsing & ast building for compound literals.
llvm-svn: 40067
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit, we crashed in ParseBinOp...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:1298: failed assertion `(rhs != 0) && "ParseBinOp(): missing right expression"'
With this commit, we still crash in the newly added action ParseCompoundLiteral (which is progress:-)
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:478: failed assertion `(Op != 0) && "ParseCompoundLiteral(): missing expression"'
The crash go away once the actions return AST nodes. I will do this in a separate commit.
llvm-svn: 40032
|
|
|
|
|
|
|
| |
return a null type. If there is an error parsing the type, pick a new type
for error recovery purposes.
llvm-svn: 40029
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
| |
llvm-svn: 40003
|
|
|
|
| |
llvm-svn: 39989
|
|
|
|
| |
llvm-svn: 39960
|
|
|
|
|
|
| |
the canonical type. Also fix so that we're not expecting a return value from a void function
llvm-svn: 39954
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
ImplicitCastExpr's,
there is no compelling need to return the converted type. If both expression type's are arithmetic, then
both types will always be the same. If they aren't (for pointer/int types, say), then the
types will be different. The client is responsible for distinguishing...
llvm-svn: 39947
|
|
|
|
| |
llvm-svn: 39943
|
|
|
|
|
|
|
|
|
|
| |
week, I added these
to quickly fix a regression. Avoiding them entirely is a much cleaner solution. Clients of
UsualArithmeticConversions should simply call getType() on the expression to get the
converted type. In practice, only a small number of routines care about this.
llvm-svn: 39934
|
|
|
|
|
|
|
|
|
| |
void. The caller
needs to query the expression for the type. Since both these functions guarantee the expression
contains a valid type, removed old/vacuous asserts (from code calling both of these routines).
llvm-svn: 39930
|
|
|
|
|
|
|
|
| |
SemaExpr.cpp:561: warning: dereferencing type-punned pointer will break strict-aliasing rules
Patch by Benoit Boissinot!
llvm-svn: 39928
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
ParseArraySubscriptExpr. Notably, the new code doesn't have to think about
canonical types at all.
llvm-svn: 39891
|
|
|
|
|
|
| |
sometimes.
llvm-svn: 39889
|
|
|
|
| |
llvm-svn: 39884
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
compute type alignment. This info is needed for struct layout.
llvm-svn: 39850
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
where ASTContext can manage caches for struct layout, etc.
llvm-svn: 39835
|
|
|
|
|
|
| |
on test/Sema/implicit-int.c
llvm-svn: 39833
|
|
|
|
|
|
| |
assert is now done in UsualUnaryConversions().
llvm-svn: 39818
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Keith Bauer.
llvm-svn: 39793
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
pretty printer to print it.
llvm-svn: 39770
|
|
|
|
| |
llvm-svn: 39756
|
|
|
|
|
|
|
|
| |
Submitted by:
Reviewed by:
Remove reference to Attr.h...
llvm-svn: 39730
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Submitted by:
Reviewed by:
Support the following...
1. Type checking and codegen support for V[i] on vectors. Hacked
Sema::ParseArraySubscriptExpr().
2. Unary bitwise complement ("~") on vectors. Hacked Sema::ParseUnaryOp().
llvm-svn: 39723
|
|
|
|
|
|
|
|
| |
Submitted by:
Reviewed by:
Added primitive support for 32-bit floating point literals.
llvm-svn: 39719
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|