Devang Patel
ab379c905b
Remove unncessary isDeclaration() checks.
...
llvm-svn: 57179
2008-10-06 17:30:07 +00:00
Argyrios Kyrtzidis
9a1191c047
Implement support for C++ direct initializers in declarations, e.g. "int x(1);".
...
This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.
e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.
A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.
llvm-svn: 57178
2008-10-06 17:10:33 +00:00
Matthijs Kooijman
cbe5e16eb5
Allow scalarrepl to treat an all-zero GEP just as bitcast.
...
This includes not marking a GEP involving a vector as unsafe, but only when it
has all zero indices. This allows scalarrepl to work in a few more cases.
llvm-svn: 57177
2008-10-06 16:23:31 +00:00
Ted Kremenek
3b670d1a0c
Updated checker build.
...
llvm-svn: 57176
2008-10-06 15:46:11 +00:00
Duncan Sands
bae7a517cc
Actually run Obj-C++ tests if llvm-gcc supports.
...
Before there were two problems: (1) configure
turned "obj-c++" into "obj" in the langs line;
(2) the dejagnu library called it objc++ not
obj-c++.
Now the problem is that some of these tests don't
pass!
llvm-svn: 57167
2008-10-06 10:31:21 +00:00
Duncan Sands
2a1d8bace1
Clarify the relationship between byval and readonly/
...
readnone. Make clearer that readnone functions do not
dereference pointer arguments. Do not use the highly
ambiguous "side-effects" in the readonly description
(since such functions can have control flow side-effects,
such as throwing an exception, or looping for ever).
llvm-svn: 57166
2008-10-06 08:14:18 +00:00
Chris Lattner
25728d931a
fix incorrect rdar number.
...
llvm-svn: 57165
2008-10-06 07:43:28 +00:00
Chris Lattner
1b0a00a4c9
__CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR
...
won't expand to the builtin. This fixes rdar://6248329
llvm-svn: 57164
2008-10-06 07:43:09 +00:00
Chris Lattner
a97132a9c4
Make sema and codegen allow __builtin___CFStringMakeConstantString as a valid
...
constant lvalue. Implement this in codegen by moving the code out of CGBuiltin
into EmitConstantExpr.
llvm-svn: 57163
2008-10-06 07:26:43 +00:00
Chris Lattner
2c091b1ead
ExprConstant should not abort when it sees a pointer constant that isn't.
...
llvm-svn: 57162
2008-10-06 07:20:11 +00:00
Chris Lattner
24355b5240
always try to fold a builtin before emitting it. In the future
...
it is possible that a builtin could sometimes be folded (e.g. __builtin_clz)
if it's operand is a constant.
llvm-svn: 57161
2008-10-06 06:56:41 +00:00
Chris Lattner
b7c86a211c
Remove the 'C' / isConstantExpr flag on builtins. Code should never
...
depend on the value of this flag, it should depend on whether
tryEvaluate is able to *actually* fold a builtin.
llvm-svn: 57160
2008-10-06 06:51:12 +00:00
Chris Lattner
cb13691a62
Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr
...
which is checking for something that can be inconsistent with
what we can constant fold.
llvm-svn: 57159
2008-10-06 06:49:02 +00:00
Chris Lattner
86ee286b09
Move folding of __builtin_classify_type out of the CallExpr
...
interface into the constant folding interface.
llvm-svn: 57158
2008-10-06 06:40:35 +00:00
Chris Lattner
0b7282eafc
Move handling of __builtin_nan("") out of CGBuiltin.cpp into ExprConstant.cpp
...
llvm-svn: 57157
2008-10-06 06:31:58 +00:00
Chris Lattner
a1518b1dfe
remove some code where CGBuiltin folds constants, and use tryEvaluate to
...
do it instead. We should still handle __builtin_nan etc, but don't yet.
This fixes incorrect evaluation of __builtin_constant_p, a FIXME.
llvm-svn: 57156
2008-10-06 06:09:18 +00:00
Chris Lattner
e50e90142e
instead of making codegen try to know about all of the builtins to generate
...
constants for them, just use the constant evaluator to do the job. This
also fixes crashes on 'unknown constant builtins'.
llvm-svn: 57155
2008-10-06 05:59:01 +00:00
Chris Lattner
37346e081c
Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.
...
llvm-svn: 57154
2008-10-06 05:53:16 +00:00
Chris Lattner
c43467526d
"Enhance" CheckArithmeticConstantExpression to accept ?: with a constant
...
condition as a constant even if the unevaluated side is a not a constant.
We don't do this when extensions are off, and we emit a warning when this
happens:
t.c:22:11: warning: expression is not a constant, but is accepted as one by GNU extensions
short t = __builtin_constant_p(5353) ? 42 : somefunc();
^ ~~~~~~~~~~
suggestions for improvement are welcome. This is obviously horrible, but
is required for real-world code.
llvm-svn: 57153
2008-10-06 05:42:39 +00:00
Chris Lattner
4deaa4ea24
Add a comment that describes tryEvaluate. Make tryEvaluate fold
...
__builtin_constant_p properly, and add some scaffolding for
FloatExprEvaluator to eventually handle huge_val and inf.
llvm-svn: 57152
2008-10-06 05:28:25 +00:00
Chris Lattner
01ff98a48a
add a new CallExpr::isBuiltinCall() method, and use it to simplify some existing
...
code.
llvm-svn: 57151
2008-10-06 05:00:53 +00:00
Anders Carlsson
1e18220dc4
Actually use the mmintrin.h header, it's good enough now.
...
llvm-svn: 57150
2008-10-06 04:49:00 +00:00
Chris Lattner
d1d152a613
a more efficient test for __builtin_classify_type
...
llvm-svn: 57149
2008-10-06 04:48:17 +00:00
Chris Lattner
7875876e46
reorder #include order, patch by Kenneth Boyd!
...
llvm-svn: 57148
2008-10-06 03:54:25 +00:00
Chris Lattner
0c41861f39
Add #include to get alloca, patch by Kenneth Boyd!
...
llvm-svn: 57147
2008-10-06 03:53:16 +00:00
Zhongxing Xu
a4bbcd302e
Fix typos.
...
llvm-svn: 57146
2008-10-06 03:03:33 +00:00
Anders Carlsson
f407150c06
Apparently gcc uses pi64 for the shift intrinsics.
...
llvm-svn: 57145
2008-10-06 02:07:50 +00:00
Anders Carlsson
83661acf30
Add the 'y' assembler constraint.
...
llvm-svn: 57144
2008-10-06 00:41:45 +00:00
Argyrios Kyrtzidis
e8addf5e04
Allow variadic arguments without named ones for C++, e.g. "void(...);"
...
llvm-svn: 57143
2008-10-06 00:07:55 +00:00
Anders Carlsson
b83162840f
Implement support for the const and pure attributes.
...
llvm-svn: 57142
2008-10-05 23:32:53 +00:00
Argyrios Kyrtzidis
4217c7ec81
A tiny optimization; use isCXXFunctionDeclarator only when it's appropriate.
...
llvm-svn: 57141
2008-10-05 23:15:41 +00:00
Chris Lattner
09d98f5d8a
miscellaneous cleanups
...
llvm-svn: 57140
2008-10-05 21:50:58 +00:00
Chris Lattner
ac7ed9a71a
move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
...
target indep code.
llvm-svn: 57139
2008-10-05 21:49:27 +00:00
Chris Lattner
c34a35d56f
it helps when I save the file before testing and committing.
...
llvm-svn: 57138
2008-10-05 21:42:17 +00:00
Chris Lattner
6da2f0dd2e
suck the rest of the FP macros out of the targets into the PP
...
llvm-svn: 57137
2008-10-05 21:40:58 +00:00
Argyrios Kyrtzidis
279d9814e5
Add some text from the C++ standard and additional ambiguity resolution tests.
...
No funcitonality change.
llvm-svn: 57136
2008-10-05 21:10:08 +00:00
Daniel Dunbar
33ec2898d9
Set svn:ignore on test/Parser/Output
...
llvm-svn: 57135
2008-10-05 20:41:42 +00:00
Chris Lattner
5cd8351808
start moving fp macros over
...
llvm-svn: 57134
2008-10-05 20:40:30 +00:00
Daniel Dunbar
6ba6cc42d4
Add script for checking builtin macros verse another compiler ($CC or
...
gcc).
llvm-svn: 57133
2008-10-05 20:39:30 +00:00
Chris Lattner
6512a88984
move a bunch more integer sizing out of target-specific code into
...
target indep code.
Note that this changes functionality on PIC16: it defines __INT_MAX__
correctly for it, and it changes sizeof(long) to 16-bits (to match
the size of pointer).
llvm-svn: 57132
2008-10-05 20:06:37 +00:00
Argyrios Kyrtzidis
2b1ef227f5
Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:
...
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.
llvm-svn: 57131
2008-10-05 19:56:22 +00:00
Chris Lattner
4ecd753486
eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
...
integer size #defines over to the Preprocessor.
llvm-svn: 57130
2008-10-05 19:44:25 +00:00
Chris Lattner
248d3c4192
gcc no longer defines __block to nothing when blocks aren't enabled.
...
llvm-svn: 57129
2008-10-05 19:32:52 +00:00
Chris Lattner
1f7e2d5430
rearrange preprocessor macro definitions into language-specific
...
then target specific.
llvm-svn: 57128
2008-10-05 19:32:22 +00:00
Chris Lattner
f37bafc5ca
Implement PR2773, support for __USER_LABEL_PREFIX__
...
llvm-svn: 57127
2008-10-05 19:22:37 +00:00
Chris Lattner
9daca0e561
Fix a problem reported in PR2766 that makes clang reject old versions
...
of GCC's headers. This impacts people that run clang in Tiger systems.
llvm-svn: 57126
2008-10-05 19:05:44 +00:00
Argyrios Kyrtzidis
df788f4eea
Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
...
This was the motivation of the following changes:
-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).
llvm-svn: 57125
2008-10-05 18:52:21 +00:00
Chris Lattner
758ce7260d
Fix shift overflow bug that would occur when a field was a full 32-bits
...
in tblgen. This is PR2827, thanks to Waldemar Knorr for tracking this
down.
llvm-svn: 57124
2008-10-05 18:31:58 +00:00
Chris Lattner
851e72cd22
fix an incorrect and extremely confusing error message
...
llvm-svn: 57123
2008-10-05 18:24:03 +00:00
Chris Lattner
4744ed5f94
make the autoupgrade code for ret attributes dramatically simpler
...
and actually work. We can now read the llvm 2.3 bc file from PR2849
llvm-svn: 57122
2008-10-05 18:22:09 +00:00