Anders Carlsson
c9dacf4fdd
Use IgnoreParenCasts. No functionality change.
...
llvm-svn: 59371
2008-11-15 18:52:06 +00:00
Zhongxing Xu
461b4f4276
Use the allocator of ExplodedGraph. The whole static analysis module uses it.
...
llvm-svn: 59359
2008-11-15 08:19:58 +00:00
Anders Carlsson
312045115e
Fix silly bug spotted by Daniel Dunbar
...
llvm-svn: 59358
2008-11-15 06:35:36 +00:00
Zhongxing Xu
6a276cf5b7
Improve zero value generation.
...
llvm-svn: 59356
2008-11-15 05:18:50 +00:00
Zhongxing Xu
fe354a200a
Add isUnsigned option.
...
llvm-svn: 59355
2008-11-15 05:17:04 +00:00
Ted Kremenek
1b2dace792
Reduce permissiveness of assertion.
...
llvm-svn: 59354
2008-11-15 05:00:27 +00:00
Ted Kremenek
9f748e23e3
Updated checker build.
...
llvm-svn: 59353
2008-11-15 04:57:19 +00:00
Ted Kremenek
3ebd7dea7e
Add a test case for compound assignments that lazily symbolicate the value of the LHS when the computation type is an integer of more bits.
...
llvm-svn: 59352
2008-11-15 04:44:13 +00:00
Ted Kremenek
4413714946
Reverted part of r59335: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081110/009243.html
...
In that patch I added a bogus type promotion for unary '!'.
The real bug was more fallout from edges cases with compound assignments and conjured symbolic values. Now the conjured value has the type of the LHS expression, and we do a promotion to the computation type. We also now correctly do a conversion from the computation type back to the LHS type.
llvm-svn: 59349
2008-11-15 04:01:56 +00:00
Ted Kremenek
ac172fc574
Re-enable an assertion that I mistakenly removed.
...
llvm-svn: 59348
2008-11-15 02:35:08 +00:00
Anders Carlsson
d0e4f2b106
Handle complex return values.
...
llvm-svn: 59345
2008-11-15 01:29:05 +00:00
Ted Kremenek
519a223056
Use the correct QualType when creating the '0' constant.
...
llvm-svn: 59343
2008-11-15 00:40:08 +00:00
Ted Kremenek
1ca3346b19
Implement FIXME in GRExprEngine::VisitUnaryOperator() to handle implicit conversions caused by the '!' operator. This required adding some logic to GRSimpleVals to reason about nonloc::LocAsInteger SVals. This code appears to work fine, but it should eventually be cleaned up.
...
llvm-svn: 59335
2008-11-15 00:20:05 +00:00
Ted Kremenek
7eee049eea
Flush llvm::errs() when printing out SVals.
...
llvm-svn: 59334
2008-11-15 00:16:53 +00:00
Zhongxing Xu
c381841e99
Add handy method.
...
llvm-svn: 59332
2008-11-14 23:49:15 +00:00
Sebastian Redl
ccdfabab35
Implement parsing and semantic checking of the 'mutable' keyword.
...
Thanks to Doug for the review. Actual effects of mutable to follow.
llvm-svn: 59331
2008-11-14 23:42:31 +00:00
Argyrios Kyrtzidis
494d410b32
Use ReadPtr, not ReadUIntPtr through a reinterpret_cast.
...
Thanks to Sebastian for the suggestion.
llvm-svn: 59330
2008-11-14 23:32:45 +00:00
Argyrios Kyrtzidis
d800fd96af
Remove Parser::isTokenUnqualifiedId, it's not getting used anywhere.
...
llvm-svn: 59323
2008-11-14 21:41:24 +00:00
Steve Naroff
a610ab3283
Fix <rdar://problem/6372970> clang ObjC rewriter: incorrect cast when passing block argument
...
SynthBlockInitExpr() was not adding by-ref arguments to the init expr.
llvm-svn: 59322
2008-11-14 21:36:12 +00:00
Ted Kremenek
fc419a035f
Minor tweaks to liveness analysis:
...
- Block-expression for 'ObjCForCollectionStmt' is not alive before it occurs
- Recursively visit 'element' expression for ObjCForCollectionStmt to get liveness for referenced block-level expressions and variables.
llvm-svn: 59316
2008-11-14 21:07:14 +00:00
Ted Kremenek
537f6387a2
Second attempt at implementation transfer function support for ObjCForCollectionStmt. We now assume that the 'element' expression can be any lvalue.
...
llvm-svn: 59313
2008-11-14 19:47:18 +00:00
Ted Kremenek
8959a1a69a
Flow-sensitive uninitialized values analysis: properly handle the 'element' expression of ObjCForCollectionStmt (can be anything).
...
llvm-svn: 59312
2008-11-14 18:21:25 +00:00
Douglas Gregor
993603d80d
Add a new expression node, CXXOperatorCallExpr, which expresses a
...
function call created in response to the use of operator syntax that
resolves to an overloaded operator in C++, e.g., "str1 +
str2" that resolves to std::operator+(str1, str2)". We now build a
CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But
only for binary operators, where we actually implement overloading)
I decided *not* to refactor the current CallExpr to make it abstract
(with FunctionCallExpr and CXXOperatorCallExpr as derived
classes). Doing so would allow us to make CXXOperatorCallExpr a little
bit smaller, at the cost of making the argument and callee accessors
virtual. We won't know if this is going to be a win until we can parse
lots of C++ code to determine how much memory we'll save by making
this change vs. the performance penalty due to the extra virtual
calls.
llvm-svn: 59306
2008-11-14 16:09:21 +00:00
Steve Naroff
2a2a41fa11
Fix <rdar://problem/6370288> clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS
...
llvm-svn: 59301
2008-11-14 14:10:01 +00:00
Douglas Gregor
be35ce953e
Don't require us to manually number the statements and expressions in StmtNodes.def. We don't need stable numbers yet, renumbering is a pain, and LAST_STMT had the wrong value anyway.
...
llvm-svn: 59300
2008-11-14 12:46:07 +00:00
Zhongxing Xu
c967d03528
Improve comments.
...
llvm-svn: 59294
2008-11-14 09:23:38 +00:00
Ted Kremenek
99d4ff3c7a
Handle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt or DeclRefExpr.
...
llvm-svn: 59290
2008-11-14 01:58:12 +00:00
Ted Kremenek
5cf87ff564
Fix CFG construction for ObjCForCollectionStmt: 'element' expression can be anything that evaluates to an lvalue
...
llvm-svn: 59289
2008-11-14 01:57:41 +00:00
Ted Kremenek
33d2dae0d4
Update Xcode project.
...
llvm-svn: 59285
2008-11-14 01:16:15 +00:00
Ted Kremenek
a9d3e6c087
Rename header file.
...
Update include files.
llvm-svn: 59284
2008-11-14 01:14:18 +00:00
Ted Kremenek
63f4398e0b
Rename ExprDeclBitVector to BlkExprDeclBitVector, and store mappings from Stmt* to bit indices instead using Expr*.
...
llvm-svn: 59283
2008-11-14 01:13:07 +00:00
Daniel Dunbar
62efa23518
Fix some validation errors.
...
llvm-svn: 59272
2008-11-13 23:01:34 +00:00
Daniel Dunbar
ed40bc19c9
Start a "hacking" page with some simple notes on getting started
...
developing clang.
llvm-svn: 59270
2008-11-13 22:49:41 +00:00
Steve Naroff
c9337928c1
Add file to VC++ project.
...
llvm-svn: 59261
2008-11-13 21:16:53 +00:00
Douglas Gregor
58e008d2a6
Some cleanup for the implementation of built-in operator
...
candidates. Thanks to Chris for the review!
llvm-svn: 59260
2008-11-13 20:12:29 +00:00
Steve Naroff
f8cfd1647e
Fix an obscure rewriter bug when rewriting implementations that don't have a corresponding interface (found while doing random testing on another bug).
...
llvm-svn: 59259
2008-11-13 20:07:04 +00:00
Chris Lattner
0046de17e5
Fix a couple of suboptimalities in error recovery.
...
1. In the top level of ParseStatementOrDeclaration, don't eat a } if we
just parsed a statement if it list there. Also, don't even bother
emitting an error about a missing semicolon if the statement had a
bug (an rbrace is fine).
2. In do/while parsing, don't require a 'while' to be present if the do
body didn't parse.
This allows us to generate a clean diagnostic for this code:
t.c:1:22: error: expected expression
void foo (void) { do . while (0); }
^
Thanks to Neil for pointing this out.
llvm-svn: 59256
2008-11-13 18:52:53 +00:00
Chris Lattner
f3e388d1bf
don't highlight field name, just put a caret on it.
...
llvm-svn: 59255
2008-11-13 18:49:38 +00:00
Chris Lattner
7464fc784e
disable these two tests, they crash and take a long time to run crashreporter etc.
...
llvm-svn: 59254
2008-11-13 18:45:47 +00:00
Chris Lattner
9226b92563
implement a fixme :), switch to -verify mode.
...
llvm-svn: 59253
2008-11-13 18:42:17 +00:00
Steve Naroff
832d89012f
Fix <rdar://problem/6343942> clang ObjC rewriter: crash rewriting blocks
...
and <rdar://problem/6344601> clang ObjC rewriter: crash passing Block parameter?
llvm-svn: 59251
2008-11-13 17:40:07 +00:00
Ted Kremenek
a0d2a1661a
Using llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ownership semantics of these objects explicit within the Preprocessor and also tightens up the code (explicit deletes not needed).
...
llvm-svn: 59249
2008-11-13 17:11:24 +00:00
Ted Kremenek
7c1e61d78b
Use PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping from IncludeMacroStack. This is both cleaner and makes the include stack transparently extensible.
...
llvm-svn: 59248
2008-11-13 16:51:03 +00:00
Ted Kremenek
9df654fa95
Update Xcode project.
...
llvm-svn: 59247
2008-11-13 16:36:43 +00:00
Ted Kremenek
7d5389e4b3
- Revert r59229 and r59232: AllocRegion should be immutable.
...
- Temporarily disabled test Analysis/array-struct.c for region store.
llvm-svn: 59245
2008-11-13 15:42:31 +00:00
Zhongxing Xu
d4e72fca45
Process array base expression of any type.
...
llvm-svn: 59240
2008-11-13 09:48:44 +00:00
Zhongxing Xu
e9857ddcc0
Add test for unsigned array index.
...
llvm-svn: 59239
2008-11-13 09:20:05 +00:00
Zhongxing Xu
189a30796a
Array index might be unsigned. We have to generate a temporary signed value for
...
it to be evaluated by APSInt::operators.
llvm-svn: 59238
2008-11-13 09:15:14 +00:00
Zhongxing Xu
b9ec8f555f
Add test for incomplete struct pointer.
...
llvm-svn: 59236
2008-11-13 08:44:52 +00:00
Zhongxing Xu
29188c2948
Incomplete struct pointer can be used as a function argument.
...
llvm-svn: 59235
2008-11-13 08:41:36 +00:00
Zhongxing Xu
06a04bd1ae
Add a test case for alloca().
...
llvm-svn: 59233
2008-11-13 07:59:15 +00:00
Zhongxing Xu
0dbeeaa886
Lift the pointer to alloca'ed region to the pointer to its first element.
...
This is required by some operations, e.g., *p = 1; p[0] = 1;.
Also set the AllocaRegion's type during the cast.
llvm-svn: 59232
2008-11-13 07:58:20 +00:00
Zhongxing Xu
a70987eb82
Change AllocaRegion to subclass TypedRegion. We need to know ElementRegion's
...
type when assigning to it.
llvm-svn: 59229
2008-11-13 07:30:58 +00:00
Ted Kremenek
9f164c96bf
Hook up "BodyBlock", not "Block".
...
llvm-svn: 59227
2008-11-13 07:01:10 +00:00
Ted Kremenek
1516dc075a
Correctly connect 'continue' and 'break' statements in Objective-C fast enumeration for blocks to the appropriate basic blocks.
...
llvm-svn: 59226
2008-11-13 06:36:45 +00:00
Ted Kremenek
16866d6fd8
GRExprEngine/CFRefCount/GRSimpleVals: We don't do any special handling (yet) of vector types. Add explicit checks that when we process integers that they really are scalars.
...
llvm-svn: 59225
2008-11-13 06:10:40 +00:00
Eli Friedman
5a332ea01f
Fix for crash issues with comma operators with a void first operand, and
...
some more bullet-proofing/enhancements for tryEvaluate. This shouldn't
cause any behavior changes except for handling cases where we were
crashing before and being able to evaluate a few more cases in tryEvaluate.
This should settle the minor mess surrounding r59196.
llvm-svn: 59224
2008-11-13 06:09:17 +00:00
Daniel Dunbar
4b27eb4d26
Obey the FIXMES!
...
- Resume running the always inliner pass always now that LLVM has
been improved and functions with debug info can be inlined.
- Remove unused header.
llvm-svn: 59223
2008-11-13 05:29:02 +00:00
Ted Kremenek
75db6d7529
Fix uninitialized variable.
...
llvm-svn: 59222
2008-11-13 05:26:15 +00:00
Daniel Dunbar
f3502dbc14
[LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that
...
the Backend output should be done in binary mode.
- I'd appreciate it if someone who has a Windows build could verify
this.
llvm-svn: 59221
2008-11-13 05:09:21 +00:00
Ted Kremenek
45698bf05f
GRExprEngine::VisitInitListExpr:
...
- Don't crash on vector types.
- Handle typedefs.
llvm-svn: 59220
2008-11-13 05:05:34 +00:00
Daniel Dunbar
f7fb75044f
Easy IRgen improvement for bitfields, don't emit x >> 0.
...
- Logic such as this quite possibly should be optional builder
behavior.
llvm-svn: 59213
2008-11-13 02:20:34 +00:00
Eli Friedman
8553a98b8e
Backout of r59196, plus a new ICE test. Sorry if this is a
...
little rude; I figure it's cleaner to just back this out now so
it doesn't get forgotten or mixed up with other checkins.
The modification to isICE is simply wrong; I've added a test that the
change to isICE breaks.
I'm pretty sure the modification to tryEvaluate is also wrong.
At the very least, there's some serious miscommunication going on here,
as this is going in exactly the opposite direction of r59105. My
understanding is that tryEvaluate is not supposed to care about side
effects. That said, a lot of the clients to tryEvaluate are
expecting it to enforce a no-side-effects policy, so we probably need
another method that provides that guarantee.
llvm-svn: 59212
2008-11-13 02:13:11 +00:00
Daniel Dunbar
df21c6e203
Supply finished flag to EmitBlock for common statements which use
...
landing pads.
- Primarily a cleanliness issue instead of a performance issue (this
eliminates all blocks w/o predecessors on 176.gcc/expr.c), but this
also allows subsequent code to recognize it is unreachable and
potentially avoid IRgen.
llvm-svn: 59211
2008-11-13 01:54:24 +00:00
Daniel Dunbar
a612e79be4
Normalize many BasicBlock names.
...
- Use dotted notation for blocks related to a particular statement
type.
- Use .end for landing pads.
No functionality change in NDEBUG mode. :)
llvm-svn: 59210
2008-11-13 01:38:36 +00:00
Ted Kremenek
83844100fb
Revert to older checker build.
...
llvm-svn: 59209
2008-11-13 01:30:19 +00:00
Daniel Dunbar
fcac22eac1
Add IsFinished arg to EmitBlock.
...
- Indicates that caller is done with the block and it can be dropped
if it has no predecessors. Useful for callers who need to make
landing pads but which may not be reached.
No functionality change.
llvm-svn: 59207
2008-11-13 01:24:05 +00:00
Ted Kremenek
d0e32791d5
Update checker build.
...
llvm-svn: 59206
2008-11-13 01:23:50 +00:00
Daniel Dunbar
f75c823e5c
For if blocks with no else, name the join block ifend instead of the
...
more confusing ifelse.
Use dotted names for if blocks (if.then vs ifthen).
llvm-svn: 59201
2008-11-13 00:47:57 +00:00
Ted Kremenek
ce9082ad5c
Fix bug where the body block of an ObjCForCollectionStmt would not properly get expanded as a series of basic blocks.
...
llvm-svn: 59197
2008-11-13 00:06:59 +00:00
Daniel Dunbar
c7ec5fcf24
Fix bug in constant evaluation exposed by 176.gcc.
...
- Evaluation of , operator used bogus assumption that LHS could be
evaluated as an integral expression even though its type is
unspecified.
This change is making isICE very permissive of the LHS in non-evaluated
contexts because it is not clear what predicate we would use to reject
code here. The standard didn't offer me any guidance; opinions?
llvm-svn: 59196
2008-11-13 00:03:19 +00:00
Ted Kremenek
e9c16a6a79
Updated checker build.
...
llvm-svn: 59195
2008-11-12 23:26:57 +00:00
Douglas Gregor
b6acda0f36
Don't build identifiers for C++ constructors, destructors, or
...
conversion functions. Instead, we just use a placeholder identifier
for these (e.g., "<constructor>") and override NamedDecl::getName() to
provide a human-readable name.
This is one potential solution to the problem; another solution would
be to replace the use of IdentifierInfo* in NamedDecl with a different
class that deals with identifiers better. I'm also prototyping that to
see how it compares, but this commit is better than what we had
previously.
llvm-svn: 59193
2008-11-12 23:21:09 +00:00
Douglas Gregor
c208f4617c
Fix compilation on 64-bit targets
...
llvm-svn: 59192
2008-11-12 23:17:06 +00:00
Ted Kremenek
66312a3ff4
Move some diagnostic handling to PreprocessorLexer.
...
llvm-svn: 59191
2008-11-12 23:13:54 +00:00
Ted Kremenek
3060634fba
Add virtual dtor to PreprocessorLexer.
...
llvm-svn: 59188
2008-11-12 22:48:57 +00:00
Ted Kremenek
9d39e377df
Add LexIncludeFilename.
...
llvm-svn: 59187
2008-11-12 22:46:33 +00:00
Ted Kremenek
2f4f2dea82
Remove Lexer::LexIncludeFilename.
...
llvm-svn: 59186
2008-11-12 22:44:15 +00:00
Ted Kremenek
6c90efb923
Move LexIncludeFilename from Lexer to PreprocessorLexer.
...
PreprocessorLexer now has a virtual method "IndirectLex" which allows it to call the lex method of its subclasses. This is not for performance intensive operations.
llvm-svn: 59185
2008-11-12 22:43:05 +00:00
Daniel Dunbar
f32443cdcd
Quick fix for crash in IRgen when we can tryEvaluate a condition to
...
something that is not an int.
- Ignore these cases for now, added FIXME that we should also boolize
them.
llvm-svn: 59184
2008-11-12 22:37:10 +00:00
Ted Kremenek
50b4f48225
Use PushIncludeMacroStack() instead of manually manipulating the include stack.
...
llvm-svn: 59181
2008-11-12 22:21:57 +00:00
Ted Kremenek
50b84bb5f6
Unbreak last commit.
...
llvm-svn: 59180
2008-11-12 22:19:18 +00:00
Ted Kremenek
f5518cc95b
Add Preprocessor::PushIncludeMacroStack() and Preprocessor::PopIncludeMacroStack(), two utility methods for manipulating the Preprocessor stack. These will be used to remove manually manipulation of IncludeMacroStack from the rest of the Preprocessor implementation.
...
llvm-svn: 59179
2008-11-12 22:10:22 +00:00
Ted Kremenek
65dd30fdea
Update CFGStmtVisitor to recognize that ObjCForCollectionStmts are special block-level "expressions".
...
llvm-svn: 59176
2008-11-12 21:58:46 +00:00
Daniel Dunbar
a461e6d124
Disable some debug prints.
...
llvm-svn: 59174
2008-11-12 21:52:46 +00:00
Douglas Gregor
63eb9386b7
Slightly improve type hash
...
llvm-svn: 59173
2008-11-12 21:52:20 +00:00
Ted Kremenek
7cd62457c4
Add skeleton for PTH lexer.
...
llvm-svn: 59169
2008-11-12 21:37:15 +00:00
Ted Kremenek
3a460b1106
Move pieces of Lexer that the Preprocessor mutates to a new base class 'PreprocessorLexer'. This will also be the base class of the new Preprocessed-Token-Header (PTH) lexer. No functionality change.
...
llvm-svn: 59168
2008-11-12 21:33:59 +00:00
Chris Lattner
6515bcc3c6
Fix a FIXME by improving a diagnostic, add a testcase for PR3048
...
llvm-svn: 59167
2008-11-12 21:25:45 +00:00
Sebastian Redl
15b7160a17
64-bit test fixes.
...
llvm-svn: 59165
2008-11-12 21:19:11 +00:00
Chris Lattner
ffb31a23a5
make TryFixInvalidVariablyModifiedType a static function.
...
llvm-svn: 59163
2008-11-12 21:17:48 +00:00
Ted Kremenek
df31792a66
Shore up transfer function for ObjCForCollectionStmt.
...
llvm-svn: 59162
2008-11-12 21:12:46 +00:00
Ted Kremenek
97450fe0a1
Use Stmt* instead of Expr* for block-level expression.
...
llvm-svn: 59161
2008-11-12 21:12:18 +00:00
Ted Kremenek
6d8b46e71d
ObjCForCollectionStmts are block-level expressions.
...
llvm-svn: 59160
2008-11-12 21:11:49 +00:00
Chris Lattner
b5da7a342c
Restructure code to encourage fallthrough, no functionality change.
...
llvm-svn: 59157
2008-11-12 19:48:13 +00:00
Chris Lattner
e7d1cdb6fd
fix PR3048. I'm going to do some more work before closing it off and
...
adding a testcase.
llvm-svn: 59156
2008-11-12 19:45:49 +00:00
Ted Kremenek
1781080c34
Add (preliminary) transfer function support for ObjCForCollectionStmt. Still need to flesh out some logic.
...
When processing DeclStmt, use the new interface to StateManager::BindDecl. Conjuring of symbols is now done in VisitDeclStmt.
llvm-svn: 59155
2008-11-12 19:24:17 +00:00
Ted Kremenek
9999d72fe2
Conjured symbols now bind to Stmt* instead of Expr*.
...
llvm-svn: 59154
2008-11-12 19:22:47 +00:00
Ted Kremenek
60d46414f4
Update method names involving GRStateRef. No functionality change.
...
llvm-svn: 59153
2008-11-12 19:22:09 +00:00
Ted Kremenek
b94d72a0e3
GRStateRef:
...
- Rename SetSVal to BindLoc
- Add BindDecl
- Add BindExpr
GRState:
- Environment now binds to Stmt* instead of Expr*. This is needed for processing ObjCForCollectionStmt (essentially the declaration of the the 'element' variable can have an SVal attached to it).
- BindDecl no longer accepts Expr* for the initialization value; use SVal* instead.
llvm-svn: 59152
2008-11-12 19:21:30 +00:00
Ted Kremenek
cd639218e4
StoreManager::BindDecl now takes an SVal* for the initialization value instead of an Expr* (which can be null). Lazy symbolication of conjured symbols is now the sole responsibility of GRExprEngine.
...
llvm-svn: 59151
2008-11-12 19:18:35 +00:00
Douglas Gregor
a11693bc37
Implement support for operator overloading using candidate operator
...
functions for built-in operators, e.g., the builtin
bool operator==(int const*, int const*)
can be used for the expression "x1 == x2" given:
struct X {
operator int const*();
} x1, x2;
The scheme for handling these built-in operators is relatively simple:
for each candidate required by the standard, create a special kind of
candidate function for the built-in. If overload resolution picks the
built-in operator, we perform the appropriate conversions on the
arguments and then let the normal built-in operator take care of it.
There may be some optimization opportunity left: if we can reduce the
number of built-in operator overloads we generate, overload resolution
for these cases will go faster. However, one must be careful when
doing this: GCC generates too few operator overloads in our little
test program, and fails to compile it because none of the overloads it
generates match.
Note that we only support operator overload for non-member binary
operators at the moment. The other operators will follow.
As part of this change, ImplicitCastExpr can now be an lvalue.
llvm-svn: 59148
2008-11-12 17:17:38 +00:00
Daniel Dunbar
2889780436
Start a README.txt of possible optimizations to do in IRgen.
...
llvm-svn: 59130
2008-11-12 12:31:28 +00:00
Daniel Dunbar
bf3c22e51d
Handle ?: in EmitBranchOnBoolExpr.
...
llvm-svn: 59129
2008-11-12 10:30:32 +00:00
Daniel Dunbar
d2a53a7b77
Rename ?: operator blocks to cond.true and cond.false (I don't know
...
what "cond.?" means, and this avoids quoting).
llvm-svn: 59128
2008-11-12 10:13:37 +00:00
Daniel Dunbar
682712cda0
Comment/indentation fix.
...
llvm-svn: 59127
2008-11-12 10:12:14 +00:00
Eli Friedman
9a156e5c1e
Some additions to tryEvaluate I've had sitting around for a while.
...
This pushes it a lot closer to being able to deal with most of the stuff
CodeGen's constant expression evaluator knows how to deal with. This
also fixes PR3003.
The test could possibly use some improvement, but this'll work for now.
Test 6 is inspired by PR3003; the other tests are mostly just designed
to exercise the new code. The reason for the funny structure of the
tests is that type fixing for arrays inside of structs is the only place
in Sema that calls tryEvaluate, at least for the moment.
llvm-svn: 59125
2008-11-12 09:44:48 +00:00
Chris Lattner
3fd91f83fd
Lower ?: into select when the selected values are cheap and side-effect-free.
...
This cuts another 200 lines off expr.ll, forming 23 selects.
llvm-svn: 59124
2008-11-12 08:55:54 +00:00
Chris Lattner
35710d18fe
emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.
...
This happens for stuff like this:
x = cond1 || cond2 || cond3 || cond4;
llvm-svn: 59123
2008-11-12 08:38:24 +00:00
Chris Lattner
8b0845822d
use ConstantFoldsToSimpleInteger instead of code emission to do
...
constant folding.
llvm-svn: 59121
2008-11-12 08:26:50 +00:00
Daniel Dunbar
5fc2871820
IRgen improvements on unreachable code:
...
- Split out "simple" statements which can easily handle IR generation
when there is no insert point. These are generally statements which
start by emitting a new block or are only containers for other
statements.
- This fixes a regression in emitting dummy blocks, notably for case
statements.
- This also fixes spurious emission of a number of debug stoppoint
intrinsic instructions.
Remove unneeded sw.body block, just clear the insertion point.
Lift out CodeGenFunction::EmitStopPoint which calls into the
CGDebugInfo class when generating debug info.
Normalize definitions of Emit{Break,Continue}Stmt and usage of
ErrorUnsupported.
llvm-svn: 59118
2008-11-12 08:21:33 +00:00
Chris Lattner
d95377341b
Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
...
codegen stuff like "if (!(X && Y))"
llvm-svn: 59115
2008-11-12 08:13:36 +00:00
Chris Lattner
51e7118c30
Use EmitBranchOnBoolExpr in VisitConditionalOperator. This
...
shrinks code yet again by a bit.
llvm-svn: 59114
2008-11-12 08:08:13 +00:00
Chris Lattner
cd439299b0
Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to
...
CodeGenFunction.cpp. Change VisitConditionalOperator to use
constant fold instead of codegen'ing a constant conditional.
Change ForStmt to use EmitBranchOnBoolExpr, this shrinks
expr.c very slightly to 40239 lines.
llvm-svn: 59113
2008-11-12 08:04:58 +00:00
Chris Lattner
c51ded9e4a
sort files by name.
...
llvm-svn: 59112
2008-11-12 07:46:52 +00:00
Chris Lattner
b7a9e16486
Make emission of 'if' conditions much more sophisticated when we
...
have a condition that is an &&/||. Before we used to compile things like this:
int test() {
if (x && y) foo(); else bar();
}
into:
%0 = load i32* @x ; <i32> [#uses=1]
%1 = icmp ne i32 %0, 0 ; <i1> [#uses=1]
br i1 %1, label %land_rhs, label %land_cont
land_rhs: ; preds = %entry
%2 = load i32* @y ; <i32> [#uses=1]
%3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
br label %land_cont
land_cont: ; preds = %land_rhs, %entry
%4 = phi i1 [ false, %entry ], [ %3, %land_rhs ] ; <i1> [#uses=1]
br i1 %4, label %ifthen, label %ifelse
ifthen: ; preds = %land_cont
%call = call i32 (...)* @foo() ; <i32> [#uses=0]
br label %ifend
ifelse: ; preds = %land_cont
%call1 = call i32 (...)* @bar() ; <i32> [#uses=0]
br label %ifend
ifend: ; preds = %ifelse, %ifthen
Now we turn it into the much more svelte code:
%0 = load i32* @x ; <i32> [#uses=1]
%1 = icmp ne i32 %0, 0 ; <i1> [#uses=1]
br i1 %1, label %land_lhs_true, label %ifelse
land_lhs_true: ; preds = %entry
%2 = load i32* @y ; <i32> [#uses=1]
%3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
br i1 %3, label %ifthen, label %ifelse
ifthen: ; preds = %land_lhs_true
%call = call i32 (...)* @foo() ; <i32> [#uses=0]
br label %ifend
ifelse: ; preds = %land_lhs_true, %entry
%call1 = call i32 (...)* @bar() ; <i32> [#uses=0]
br label %ifend
ifend: ; preds = %ifelse, %ifthen
Note the lack of a phi node.
This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines.
llvm-svn: 59111
2008-11-12 07:46:33 +00:00
Chris Lattner
fac05aeae5
fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was
...
crashing because we errors are ignored in subexpressions that are not evaluated,
but we still evaluate the result of parents. This would cause an assertion
because the erroneous subexpr didn't have its result value set to the right type.
llvm-svn: 59110
2008-11-12 07:43:42 +00:00
Chris Lattner
aa3f951efc
Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1
...
llvm-svn: 59105
2008-11-12 07:04:29 +00:00
Chris Lattner
4ad31fcc43
Clean up some code to use isZero instead of calling getZExtValue.
...
llvm-svn: 59103
2008-11-12 04:54:14 +00:00
Sebastian Redl
85a4019167
Fix testcase for 64-bit systems.
...
llvm-svn: 59099
2008-11-12 00:18:32 +00:00
Daniel Dunbar
8307290f35
Use createBasicBlock here too.
...
llvm-svn: 59095
2008-11-12 00:02:07 +00:00
Daniel Dunbar
851eec11a7
Disable generation of basic block names in NDEBUG mode.
...
Revert to enabling generation of instruction names when not in NDEBUG
mode.
llvm-svn: 59094
2008-11-12 00:01:12 +00:00
Daniel Dunbar
5c7e3935f1
Rework IRgen invariant w.r.t. current insert point.
...
- EmitStmt is no longer required to finish with a current insertion
point defined (i.e. it does not need to make dummy
blocks). Instead, it can clear the insertion point in the builder
which indicates that the current insertion point is unreachable.
- CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
which respectively test if there is an insert point and ensure an
insertion point exists (by making a dummy block).
- Clearly mark functions in CodeGenFunction which can be called with
no insertion point defined. Currently this is a limited set, and
EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.
Remove EmitDummyBlock, which is no longer needed. Clients who haven't
already cleared the insertion point (typically via EmitBranch) can do
so by hand.
Remove isDummyBlock, which has effectively been renamed to
HaveInsertPoint.
The main thrust of this change is that we no longer have create dummy
blocks just to destroy them a short time later in EmitBlock in the
common case that there is no unreachable code following something like
a goto.
Additionally, this means that we are not using the hokey condition in
isDummyBlock that a block without a name is a dummy block. Guess how
well that works when we never emit block names!
llvm-svn: 59089
2008-11-11 23:11:34 +00:00
Daniel Dunbar
ab197ebb1a
Change EmitBranch to always clear the insert point to clarify irgen
...
invariants.
llvm-svn: 59085
2008-11-11 22:06:59 +00:00
Daniel Dunbar
fab3f936dd
Emit debug region end in unified return block.
...
llvm-svn: 59081
2008-11-11 20:59:54 +00:00
Anton Korobeynikov
fdf389b9e4
Codegen support for fastcall & stdcall CC.
...
Patch by Ilya Okonsky!
llvm-svn: 59080
2008-11-11 20:21:14 +00:00
Ted Kremenek
7a18858bcf
Flow-sensitive uninitialized values analysis:
...
- Added support for ObjCForCollectionStmt
- Fixed bug where expression values would be always set to uninitialized when loops were involved
llvm-svn: 59076
2008-11-11 19:41:42 +00:00
Ted Kremenek
3b4e1d5cc6
Accesses to a collection within a fast enumeration 'for' statement constitute a 'use'.
...
llvm-svn: 59075
2008-11-11 19:40:47 +00:00
Ted Kremenek
1d7f2fcda8
Add fine-grain methods for control which bits are set/reset in ExprDeclBitVector.
...
llvm-svn: 59073
2008-11-11 19:39:47 +00:00
Chris Lattner
d53e23328e
Try to not emit the dead side of ?: if the condition is a constant.
...
llvm-svn: 59061
2008-11-11 18:56:45 +00:00
Chris Lattner
c3b41e31fb
"a patch telling cmake to install clang headers in the target
...
install directory"
Patch by Lukasz Janyst!
llvm-svn: 59059
2008-11-11 18:39:10 +00:00
Sebastian Redl
6f28289aca
Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
...
llvm-svn: 59057
2008-11-11 17:56:53 +00:00
Ted Kremenek
fbd2f4006b
Add transfer function support for ObjCForCollectionStmt to LiveVariables.
...
llvm-svn: 59053
2008-11-11 17:42:10 +00:00
Ted Kremenek
9d56e64543
Add CFG support for Objective-C 2.0 fast enumeration 'for' statement:
...
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_2.html#//apple_ref/doc/uid/TP30001163-CH18-SW3
Need to modify GRExprEngine, LiveVariables, and UninitializedValues to understand this construct.
llvm-svn: 59049
2008-11-11 17:10:00 +00:00
Sebastian Redl
c470476420
Implement C++ 'typeid' parsing and sema.
...
llvm-svn: 59042
2008-11-11 11:37:55 +00:00
Daniel Dunbar
c56e67644f
Add CodeGenFunction::EmitBranch.
...
- Emits an unconditional branch, with extra logic to avoid generating
spurious branches out of dummy blocks.
llvm-svn: 59037
2008-11-11 09:41:28 +00:00
Daniel Dunbar
a0821bf8a2
Fix cmake build, patch from Jjgod Jiang.
...
llvm-svn: 59036
2008-11-11 08:29:24 +00:00
Chris Lattner
5b1964b5f9
short circuit && and || when possible. This substantially reduces
...
the size of the -O0 output on some cases. For example, on expr.c from
176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed
references to two external symbols.
llvm-svn: 59034
2008-11-11 07:41:27 +00:00
Chris Lattner
aaaa199ad1
Make codegen smart enough to not emit the dead side of an if whose
...
condition is a constant. This shrinks -O0 codegen by quite a bit
on some cases.
llvm-svn: 59033
2008-11-11 07:24:28 +00:00
Chris Lattner
cd2523b41c
implement debug info for typeof()
...
llvm-svn: 59032
2008-11-11 07:01:36 +00:00
Chris Lattner
bd178d51ff
merge some testcases together.
...
llvm-svn: 59031
2008-11-11 06:42:53 +00:00
Daniel Dunbar
a94d873b4b
Move backend output out of destructor.
...
Don't free AST consumer when --disable-free is set.
llvm-svn: 59030
2008-11-11 06:35:39 +00:00
Chris Lattner
4497fbf6e0
remove the wrong PR # from the file name.
...
llvm-svn: 59029
2008-11-11 06:28:10 +00:00
Chris Lattner
d75e4e59b9
add PR#
...
llvm-svn: 59028
2008-11-11 06:27:34 +00:00
Chris Lattner
8c5dd730ce
Fix PR3031 by silencing follow-on errors in invalid declarations.
...
llvm-svn: 59027
2008-11-11 06:13:16 +00:00
Daniel Dunbar
c92892d9cc
Remove unused function declaration.
...
llvm-svn: 59024
2008-11-11 04:48:20 +00:00
Daniel Dunbar
29ac59f25c
Add CodeGenFunction::EmitDummyBlock for marking places where we make
...
"dummy" blocks (blocks just used to make sure we have a place to dump
code to).
llvm-svn: 59022
2008-11-11 04:34:23 +00:00
Daniel Dunbar
05e629aec6
Remove CodeGenFunction::StartBlock.
...
- Was confusing and only used in one small part of the code.
llvm-svn: 59020
2008-11-11 04:12:31 +00:00
Daniel Dunbar
471d9ddeab
These tests have no needed to redirect stderr to stdout.
...
llvm-svn: 59019
2008-11-11 04:09:47 +00:00
Daniel Dunbar
75283ff38a
Centralize basic block creation in CodeGenFunction::createBasicBlock.
...
- No functionality change.
llvm-svn: 59017
2008-11-11 02:29:29 +00:00
Zhongxing Xu
deb7cac332
Fix StringLiteral print bug.
...
llvm-svn: 59015
2008-11-11 01:36:32 +00:00
Zhongxing Xu
f8b84b0def
Add && to test command.
...
llvm-svn: 59014
2008-11-11 01:25:18 +00:00
Daniel Dunbar
e27d7b5530
Fix Release-Asserts warning.
...
llvm-svn: 59013
2008-11-11 01:16:00 +00:00
Douglas Gregor
cd695e500d
Basic support for taking the address of an overloaded function
...
llvm-svn: 59000
2008-11-10 20:40:00 +00:00
Steve Naroff
23394ab63f
Update VC++ project file.
...
llvm-svn: 58996
2008-11-10 20:02:45 +00:00
Douglas Gregor
d36ed56c52
Remove an out-of-date FIXME
...
llvm-svn: 58990
2008-11-10 17:01:38 +00:00
Douglas Gregor
49de5340c0
Improve parser error recovery after a constructor initializer
...
llvm-svn: 58989
2008-11-10 16:59:40 +00:00
Douglas Gregor
f52cdd0124
Allow user-defined conversions during reference binding
...
llvm-svn: 58988
2008-11-10 16:14:15 +00:00
Douglas Gregor
1cd48f1645
Don't create a typedef for the injected-class-name
...
llvm-svn: 58987
2008-11-10 14:41:22 +00:00
Douglas Gregor
6cf0806e75
Some cleanups to the declaration/checking of overloaded operators in C++. Thanks to Sebastian for the review
...
llvm-svn: 58986
2008-11-10 13:38:07 +00:00
Zhongxing Xu
bba5c7c629
Add pretty printing to StringRegion.
...
llvm-svn: 58985
2008-11-10 13:05:26 +00:00
Zhongxing Xu
7be05ed6b8
Add region store model to path-sensitive testing.
...
llvm-svn: 58983
2008-11-10 09:43:12 +00:00
Zhongxing Xu
18d6fd45de
Implement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning caused by removal of symbolic constraints. Currently we just mark all symbols live. Further optimization for dead binding removal needed.
...
llvm-svn: 58982
2008-11-10 09:39:04 +00:00
Chris Lattner
b5d21a4d03
don't preserve names on IR instructions. This matches llvm-gcc's behavior and
...
speeds up the compiler by ~8% at -emit-llvm -O0.
llvm-svn: 58977
2008-11-10 06:31:46 +00:00
Chris Lattner
494e4a6e3e
sort files add a missed header to the project.
...
llvm-svn: 58976
2008-11-10 06:31:19 +00:00
Chris Lattner
f61801403d
Fix even more bugs in debug info support:
...
1. emit proper debug info for forward decls of structs.
2. emit DW_TAG_member nodes around members of a field like llvm-gcc does.
This slows down debug info generation, but is required for correctness.
llvm-svn: 58973
2008-11-10 06:10:01 +00:00
Chris Lattner
affb37337f
reimplement debug info generation in terms of DebugInfo.h instead of
...
using MachineModuleInfo. This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.
llvm-svn: 58971
2008-11-10 06:08:34 +00:00
Zhongxing Xu
1c31dbe417
Print integer value instead of raw pointer. This is a hack to be fixed by migrating the output in analyzer to llvm::raw_ostream.
...
llvm-svn: 58965
2008-11-10 05:00:06 +00:00
Chris Lattner
231f7bbdbe
silence a warning from gcc.
...
llvm-svn: 58956
2008-11-10 03:00:37 +00:00
Argyrios Kyrtzidis
9e59b577d8
Introduce ScopedDecl::getLexicalDeclContext() which is different from ScopedDecl::getDeclContext() when there are nested-names.
...
e.g.:
namespace A {
void f(); // SemanticDC (getDeclContext) == LexicalDC (getLexicalDeclContext) == 'namespace A'
}
void A::f(); // SemanticDC == namespace 'A'
// LexicalDC == global namespace
llvm-svn: 58948
2008-11-09 23:41:00 +00:00
Argyrios Kyrtzidis
8ad00b26ee
When a tag has nested-name ('struct foo::bar'), use not 'CurContext' but the context of the nested-name ('foo::').
...
llvm-svn: 58945
2008-11-09 22:53:32 +00:00
Argyrios Kyrtzidis
e02eb2bac2
Simplify handling of nested-names in tags ('struct foo::bar').
...
-Use more of the non nested-name code path.
-Also use the ActOnTagStruct code path.
llvm-svn: 58944
2008-11-09 22:09:58 +00:00
Anders Carlsson
3442f82c2f
Support named operands in inline asm statements.
...
llvm-svn: 58940
2008-11-09 18:54:14 +00:00
Sebastian Redl
e0b2b1bf8c
Update C++ status: class support improved due to nested name parsing.
...
llvm-svn: 58932
2008-11-09 11:32:32 +00:00
Argyrios Kyrtzidis
16ac9be7f0
Implement Sema support for C++ nested-name-specifiers.
...
llvm-svn: 58916
2008-11-08 17:17:31 +00:00
Argyrios Kyrtzidis
430a58edd8
Silence a GCC member initialization order warning.
...
llvm-svn: 58914
2008-11-08 16:47:38 +00:00
Argyrios Kyrtzidis
32a0379575
Implement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
...
No Sema functionality change, just the signatures of the Action/Sema methods.
llvm-svn: 58913
2008-11-08 16:45:02 +00:00
Argyrios Kyrtzidis
c7e67a04c3
Introduce annotation tokens, a special kind of token, created and used only by the parser to replace a group of tokens with a single token encoding semantic information.
...
Will be fully utilized later for C++ nested-name-specifiers.
llvm-svn: 58911
2008-11-08 16:17:04 +00:00
Sebastian Redl
f4485de48a
Update C++ status to reflect parser capabilities for chapter 9 (classes). Slightly extend the class parser test.
...
llvm-svn: 58909
2008-11-08 15:40:37 +00:00
Sebastian Redl
2e133e47aa
Update C++ status: dynamic_cast is sema-complete.
...
llvm-svn: 58907
2008-11-08 14:43:13 +00:00
Sebastian Redl
842ef52ff3
Move named cast helpers out of Sema, as Chris requested. This requirse making a few functions public that weren't before.
...
llvm-svn: 58906
2008-11-08 13:00:26 +00:00
Argyrios Kyrtzidis
0d9ee2eb2e
Revert r58880, it breaks test/SemaCXX/constructor.cpp
...
llvm-svn: 58904
2008-11-08 12:02:25 +00:00
Argyrios Kyrtzidis
13042a4a4a
Use only one constructor for CXXMethodDecl. Keep initialization stuff into one place.
...
llvm-svn: 58902
2008-11-08 11:24:06 +00:00
Daniel Dunbar
238475c8ca
Avoid redundant cast<>s / simplify type dispatch.
...
llvm-svn: 58892
2008-11-08 06:12:46 +00:00
Daniel Dunbar
bbc0af7e37
Support getTypeInfo, getTypeAlign, getTypeSize on const Type*s.
...
- Size/align are not effected by CVR qualifiers.
Support getCanonicalType: const Type* -> const Type*.
llvm-svn: 58891
2008-11-08 05:48:37 +00:00
Daniel Dunbar
8ec8048f93
"Fix" PR3021, don't crash on generating record types when we can't
...
generate the type of a member.
llvm-svn: 58889
2008-11-08 04:42:29 +00:00
Daniel Dunbar
ad0a0f9cd2
Silence a gcc warning.
...
llvm-svn: 58888
2008-11-08 04:28:37 +00:00
Zhongxing Xu
3d43015bc7
Add a boilerplate for out-of-bound array checking. This has no real function currently.
...
llvm-svn: 58886
2008-11-08 03:45:42 +00:00
Argyrios Kyrtzidis
19b66a5e32
In a declarator, consider an identifier a constructor only if it is followed by '('.
...
Previously:
class C {
int C; // Declarator::SetConstructor was called here.
};
llvm-svn: 58880
2008-11-08 01:09:16 +00:00
Ted Kremenek
58b1c2d54a
update post-build step
...
llvm-svn: 58878
2008-11-08 01:02:26 +00:00
Sebastian Redl
015085fafa
Greatly improve static_cast diagnostics
...
llvm-svn: 58873
2008-11-07 23:29:29 +00:00
Douglas Gregor
a1f013e8ed
Initial, partially-baked support for implicit user-defined conversions by conversion functions
...
llvm-svn: 58870
2008-11-07 22:36:19 +00:00
Cedric Venet
571c662350
Use css style instead of hard coded color in cxx_status. No visible change.
...
llvm-svn: 58867
2008-11-07 22:24:44 +00:00
Argyrios Kyrtzidis
e442635c37
Changes in preparation for nested-name-specifiers.
...
-When parsing declarators, don't depend on "CurScope->isCXXClassScope() == true" for constructors/destructors
-For C++ member declarations, don't depend on "Declarator.getContext() == Declarator::MemberContext"
llvm-svn: 58866
2008-11-07 22:02:30 +00:00
Ted Kremenek
47a6235491
Updated checker build.
...
llvm-svn: 58864
2008-11-07 20:55:59 +00:00
Douglas Gregor
60e64cfc43
Update C++ status
...
llvm-svn: 58862
2008-11-07 20:16:04 +00:00
Douglas Gregor
dbc5daf058
Parsing, ASTs, and semantic analysis for the declaration of conversion
...
functions in C++, e.g.,
struct X {
operator bool() const;
};
Note that these conversions don't actually do anything, since we don't
yet have the ability to use them for implicit or explicit conversions.
llvm-svn: 58860
2008-11-07 20:08:42 +00:00
Argyrios Kyrtzidis
56fa31bc87
Assert that Parser::MaybeParseOperatorFunctionId is called when token is kw_operator, and replace ExpectAndConsume for the 'operator' token with a ConsumeToken.
...
llvm-svn: 58855
2008-11-07 15:54:02 +00:00
Douglas Gregor
450c75a15f
Separate the parsing of type-specifiers from other declaration specifiers, so that we can parse a C++ type-specifier-seq
...
llvm-svn: 58854
2008-11-07 15:42:26 +00:00
Anders Carlsson
aaa183e944
include alloca.h instead of malloc.h. If this doesn't work for everyone we can just declare alloca directly in the file.
...
llvm-svn: 58853
2008-11-07 15:41:33 +00:00