Chris Lattner
9594acf32d
Cache macro expander objects to avoid thrashing malloc in heavy expansion situations.
...
This doesn't significantly improve carbon.h, but it does speed up
INPUTS/macro_pounder_obj.c by 48%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 00:25:26 +00:00
Chris Lattner
9e344c65b1
Make parser scope cache be a member of the parser instead of a global,
...
which makes it multithread clean.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39863 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 00:04:39 +00:00
Chris Lattner
25c9648909
switch function-like macros from using a vector for their arguments to an
...
explicitly new'd array. The array never mutates once created, so a vector
is overkill.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39862 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 22:46:43 +00:00
Chris Lattner
f46f68b558
switch from using a vector to a smallvector for macro replacement tokens
...
This speeds up parsing carbon.h by 3.3% by avoiding some malloc traffic for
small macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39861 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 22:15:50 +00:00
Chris Lattner
c215bd659d
expose an iterator interface to getReplacementTokens instead of the datastructure itself.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 22:11:41 +00:00
Chris Lattner
b5e240fa9e
split function-like and object-like macro body parsing to make the
...
code more obvious.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39859 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 21:54:03 +00:00
Gabor Greif
d5e0d9854c
add FIXME and un-XFAIL test
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 20:05:18 +00:00
Bill Wendling
11f2dfefc9
Add missing directory
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39853 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 09:37:10 +00:00
Chris Lattner
d2d2a11a91
A significant refactoring of the type size stuff to also
...
compute type alignment. This info is needed for struct layout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39850 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 01:29:45 +00:00
Chris Lattner
8f32f7189b
Implement trivial integer initializers, like 'int X = 4;' for global
...
vars. Approach suggested by Keith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39849 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:23:28 +00:00
Chris Lattner
32b266cff6
In "int X,Y;", compile both X and Y.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39848 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:16:50 +00:00
Chris Lattner
06c8d963bc
add a fixme
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39847 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:01:01 +00:00
Chris Lattner
8bf9f079f1
Improve char literal pretty printing, patch by Keith Bauer!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39846 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:58:20 +00:00
Gabor Greif
b02d4b4bdf
fix type of main, use !=
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39842 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:40:27 +00:00
Gabor Greif
4db18f279b
implement _Complex * == and !=
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39841 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:33:18 +00:00
Steve Naroff
90045e8eba
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:32:42 +00:00
Chris Lattner
692233e90a
Use target info to decide the sizes of basic types.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39838 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:27:08 +00:00
Chris Lattner
7ab2ed8e88
Add missing citation.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39837 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:16:13 +00:00
Gabor Greif
bacfa02138
a simple _Complex testcase
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39836 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:15:44 +00:00
Chris Lattner
a7674d8a9a
Move getSize() out of type, into ASTContext, where it has target info, and
...
where ASTContext can manage caches for struct layout, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39835 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:13:22 +00:00
Chris Lattner
7a543ad55a
Unspecified type specs default to int. This fixes a crash
...
on test/Sema/implicit-int.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39833 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 21:02:29 +00:00
Chris Lattner
e107b5d1b3
remove some extraneous spaces, no functionality change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39832 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 21:01:17 +00:00
Chris Lattner
d07eb3b5b4
implement codegen support for implicit casts.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:25:53 +00:00
Chris Lattner
d0d560a097
eliminate extraneous type, add accessors.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39830 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:25:36 +00:00
Chris Lattner
8da1cb6339
Check in these testcases.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:18:44 +00:00
Chris Lattner
a63ff1486d
new testcase that crashes the cfe due to implicit conversion fun
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39826 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:11:01 +00:00
Chris Lattner
a80b0bafd4
silence a bogus gcc warning.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:07:11 +00:00
Steve Naroff
ba61c14bc9
Removed some superfluous code. The getType() method and associated
...
assert is now done in UsualUnaryConversions().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39818 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 17:39:21 +00:00
Chris Lattner
c35717a1b3
remove use of alloca.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39815 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 17:10:38 +00:00
Steve Naroff
49b4526992
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39814 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 16:58:59 +00:00
Chris Lattner
8a6a237817
check in the basic llvm license
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39812 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 15:47:47 +00:00
Gabor Greif
7ae5326415
Solaris needs an included header for alloca
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 08:21:39 +00:00
Chris Lattner
b0a721a51a
"Codegen for Character Literals and Conditional Operator
...
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 05:18:11 +00:00
Chris Lattner
88a69ad80e
implement support for basic codegen of global variables with no initializers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 05:13:43 +00:00
Chris Lattner
fa7c64562d
"Someone typed "PtrToInt" where they meant "IntToPtr".
...
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."
Patch by Keith Bauer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 03:25:53 +00:00
Chris Lattner
8b9023ba35
Implement codegen for + and - with pointers. Patch contributed by
...
Keith Bauer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 03:05:23 +00:00
Anton Korobeynikov
b7b50bc29b
Workaround gcc 3.4.x bug
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 00:48:55 +00:00
Steve Naroff
c63b96ad70
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39791 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 21:46:55 +00:00
Chris Lattner
a7fa381a50
update tests
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39786 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 16:52:08 +00:00
Chris Lattner
e8fdbba7d7
-pedantic no longer defaults to on.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 16:49:27 +00:00
Chris Lattner
2b80ec2192
update test
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39784 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 16:48:52 +00:00
Chris Lattner
9623feb09f
don't pick up random stuff in .svn directories.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39783 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 16:46:07 +00:00
Gabor Greif
1501218865
add missing header
...
(needed on Solaris)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39781 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 16:00:00 +00:00
Chris Lattner
6fa5f0943a
Fix "no newline at end of file" warnings. Patch contributed by
...
Benoit Boissinot!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39780 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:43:07 +00:00
Chris Lattner
9dc62f044a
Improve portability to compilers where <cassert> is not implicitly
...
included. Patch contributed by Benoit Boissinot!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39779 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:32:57 +00:00
Chris Lattner
f86638365f
Allow this to compile on compilers where <string>
...
doesn't imply <cassert>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39778 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:30:49 +00:00
Anton Korobeynikov
fdd75663ff
Properly use local variable declaration inside a switch case
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:26:50 +00:00
Chris Lattner
3724c00ab7
add missing specification for a default argument. I guess g++ 4.0 doesn't
...
notice this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:26:16 +00:00
Chris Lattner
1978596a6f
Evaluate the initializer for automatic variables.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 00:39:48 +00:00
Chris Lattner
24c3990cd2
remember the initializer for a variable in the AST and teach the
...
pretty printer to print it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39770 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 00:36:32 +00:00