| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 41611
|
|
|
|
|
|
| |
to test for the right type class.
llvm-svn: 41601
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c
// incorrectly generates redefinition error
extern int array[3];
int array[3];
// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}
It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.
To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.
This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!
llvm-svn: 41592
|
|
|
|
| |
llvm-svn: 41582
|
|
|
|
| |
llvm-svn: 41581
|
|
|
|
|
|
|
|
| |
== or !=.
This is the same functionality gcc provides via --Wfloat-equal.
llvm-svn: 41574
|
|
|
|
|
|
| |
A small bit of codegen work is still pending.
llvm-svn: 41571
|
|
|
|
| |
llvm-svn: 41564
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
variable argument lists).
[dylan:~/llvm/tools/clang] admin% cat x.c
int printf(const char *, ...);
int oldschool();
void foo() {
float f;
short i;
printf("foo %f", 1.0f);
oldschool(f,i);
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -parse-ast-dump
int printf(char const *, ...);
int oldschool();
void foo()
(CompoundStmt 0x3105f00
(DeclStmt 0x3105ba0
0x3105ce0 "float f")
(DeclStmt 0x3105c90
0x3105d10 "short i")
(CallExpr 0x3105df0 'int'
(ImplicitCastExpr 0x3105dc0 'int (*)(char const *, ...)'
(DeclRefExpr 0x3105c20 'int (char const *, ...)' Decl='printf' 0x3105bd0))
(ImplicitCastExpr 0x3105dd0 'char const *'
(StringLiteral 0x3105d60 'char *' "foo %f"))
(ImplicitCastExpr 0x3105de0 'double'
(FloatingLiteral 0x3105d80 'float' 1.000000)))
(CallExpr 0x3105ed0 'int'
(ImplicitCastExpr 0x3105ea0 'int (*)()'
(DeclRefExpr 0x3105e20 'int ()' Decl='oldschool' 0x3105c40))
(ImplicitCastExpr 0x3105eb0 'double'
(DeclRefExpr 0x3105e40 'float' Decl='f' 0x3105ce0))
(ImplicitCastExpr 0x3105ec0 'int'
(DeclRefExpr 0x3105e60 'short' Decl='i' 0x3105d10))))
llvm-svn: 41558
|
|
|
|
|
|
| |
Also removed an old FIXME (FIXME: "auto func();" passes through...).
llvm-svn: 41555
|
|
|
|
|
|
|
|
| |
Converted ParmVarDecl, FileVarDecl, BlockVarDecl, and Sema::ParseIdentifierExpr() to use the idiom.
Updated array-constraint.c to make sure we no longer get "undeclared identifier" errors:-)
llvm-svn: 41552
|
|
|
|
|
|
|
|
| |
t2.c:3:18: warning: expression result unused
x = ++x, ++y, y+2;
~~~~~~~~~~~~^ ~~~
llvm-svn: 41551
|
|
|
|
|
|
| |
operator.
llvm-svn: 41550
|
|
|
|
|
|
|
| |
directly in it. Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.
llvm-svn: 41548
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
variables that have a pointer type, or arrays that contain pointers.
This fixes a crash on the following code:
int *h[3];
int **foo(int i)
{
return &(h[i]);
}
This bug was reported by Keith Bauer (thanks!).
llvm-svn: 41546
|
|
|
|
| |
llvm-svn: 41545
|
|
|
|
| |
llvm-svn: 41544
|
|
|
|
| |
llvm-svn: 41543
|
|
|
|
| |
llvm-svn: 41533
|
|
|
|
|
| |
TODO: update the types of the constants and the enum.
llvm-svn: 41532
|
|
|
|
|
|
|
|
| |
t.c:1:12: warning: ISO C restricts enumerator values to range of 'int' (180388626432 is too large)
enum e {A, B = 42LL << 32, C = -4, D = 12456 };
^
llvm-svn: 41530
|
|
|
|
| |
llvm-svn: 41528
|
|
|
|
|
|
| |
Note the FIXME: we need some way to mark a decl erroneous :)
llvm-svn: 41524
|
|
|
|
|
|
| |
implicit cast gets linked back into the AST.
llvm-svn: 41523
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
types.
For example, the following code was resulting in spurious warnings. This was the result of
Sema::GetTypeForDeclarator() synthesizing a type to hand back to the caller (in this case,
"int []", instead of "struct s[]", which is invalid).
struct s;
struct s* t (struct s z[]) { // expected-error {{array has incomplete element type}}
return z;
}
Strategy: Flag the error in Declarator/DeclaratorChunk. This info is later stored in
the ParmVarDecl. If the decl is referenced, Sema::ParseIdentifierExpr() will check if
the type is invalid. If so, it quietly returns "true", without instantiating a DeclRefExpr.
This seems to work nicely. If Chris is happy with the approach, I will generalize this to
all VarDecls.
llvm-svn: 41521
|
|
|
|
| |
llvm-svn: 41517
|
|
|
|
| |
llvm-svn: 41515
|
|
|
|
| |
llvm-svn: 41513
|
|
|
|
| |
llvm-svn: 41499
|
|
|
|
|
|
|
|
|
|
| |
implicit casts from T to T& at the topmost part of the return-value expression.
This checking may be needed within EvalAddr later on. We'll wait until
test cases show this kind of logic is necessary (as more C++ features are
implemented in clang).
llvm-svn: 41493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changed Sema::UsualArithmeticConversions to use the new API.
This fixes the following case...
_Complex double X;
double y;
void foo() {
X = X + y;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -parse-ast-dump
Read top-level variable decl: 'X'
Read top-level variable decl: 'y'
void foo()
(CompoundStmt 0x2605cc0
(BinaryOperator 0x2605ca0 '_Complex double' '='
(DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
(BinaryOperator 0x2605c80 '_Complex double' '+'
(DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
(ImplicitCastExpr 0x2605c70 '_Complex double'
(DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))
llvm-svn: 41483
|
|
|
|
| |
llvm-svn: 41477
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modified Type::typesAreCompatible() to use the above.
This fixes the following bug submitted by Keith Bauer (thanks!).
int equal(char *a, const char *b)
{
return a == b;
}
Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when
comparing two pointer types (though it doesn't relate directly to this bug).
llvm-svn: 41476
|
|
|
|
|
|
|
|
|
| |
ASTContext::getFloatingTypeOfSizeWithinDomain().
Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions,
using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().
llvm-svn: 41474
|
|
|
|
| |
llvm-svn: 41473
|
|
|
|
| |
llvm-svn: 41454
|
|
|
|
|
|
|
|
|
|
| |
t.c:3:9: warning: invalid conversion '%B'
printf("%B\a\n", p);
~~~~~~ ^
Don't beep the console or print the newline.
llvm-svn: 41453
|
|
|
|
| |
llvm-svn: 41452
|
|
|
|
|
|
|
|
|
| |
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit
only deals with the array types (DeclaratorCheck::Array), though the
rest of this routine should be reviewed. Given the complexity of C declarators,
I don't want to change the entire routine now (will discuss with Chris tomorrow).
llvm-svn: 41443
|
|
|
|
|
|
|
|
| |
hold declarations. Instead, introduce a new "DeclScope" scope type that
holds them explicitly. For now, all scopes have this bit, but in the
future we can use them to fix some issues Neil noticed.
llvm-svn: 41431
|
|
|
|
|
|
| |
fixes GCC PR33193
llvm-svn: 41428
|
|
|
|
|
|
| |
specifier of functions.
llvm-svn: 41416
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
represent imaginary literals:
float _Complex A;
void foo() {
A = 1.0iF;
}
generates:
(BinaryOperator 0x2305ec0 '_Complex float' '='
(DeclRefExpr 0x2305e60 '_Complex float' Decl='A' 0x2305cf0)
(ImaginaryLiteral 0x2305f40 '_Complex float'
(FloatingLiteral 0x2305ea0 'float' 1.000000))))
llvm-svn: 41413
|
|
|
|
| |
llvm-svn: 41412
|
|
|
|
|
|
| |
to merge duplicate code.
llvm-svn: 41410
|
|
|
|
|
|
|
|
|
|
| |
char *C;
C != ((void*)0);
Should not warn about incompatible pointer types. Also, make sure to
insert an implicit conversion even if the operand is null.
llvm-svn: 41408
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
change
eliminates the possibility that the left hand expression is an ImplicitCastExpr.
As a result, I removed the check for ImplicitCastExpr in Expr::isLvalue().
This results in the following AST's...
[dylan:~/llvm/tools/clang] admin% cat fix.c
short x; void test4(char c) {
x += c;
x = x + c;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang fix.c -parse-ast-dump
Read top-level variable decl: 'x'
void test4(char c)
(CompoundStmt 0x2605d30
(CompoundAssignOperator 0x2605c40 'short' '+='
(DeclRefExpr 0x2605c00 'short' Decl='x' 0x2605a80)
(DeclRefExpr 0x2605c20 'char' Decl='c' 0x2605bc0))
(BinaryOperator 0x2605d10 'short' '='
(DeclRefExpr 0x2605c60 'short' Decl='x' 0x2605a80)
(ImplicitCastExpr 0x2605d00 'short'
(BinaryOperator 0x2605ce0 'int' '+'
(ImplicitCastExpr 0x2605cc0 'int'
(DeclRefExpr 0x2605c80 'short' Decl='x' 0x2605a80))
(ImplicitCastExpr 0x2605cd0 'int'
(DeclRefExpr 0x2605ca0 'char' Decl='c' 0x2605bc0))))))
llvm-svn: 41404
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following:
******************** TEST 'Parser/cxx-bool.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-bool.cpp
Output:
SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"'
Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap clang -fsyntax-only Parser/cxx-bool.cpp
llvm-svn: 41401
|
|
|
|
| |
llvm-svn: 41398
|
|
|
|
| |
llvm-svn: 41396
|