]> granicus.if.org Git - clang/log
clang
16 years agoReverted part of r59335: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon...
Ted Kremenek [Sat, 15 Nov 2008 04:01:56 +0000 (04:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59349 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRe-enable an assertion that I mistakenly removed.
Ted Kremenek [Sat, 15 Nov 2008 02:35:08 +0000 (02:35 +0000)]
Re-enable an assertion that I mistakenly removed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59348 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle complex return values.
Anders Carlsson [Sat, 15 Nov 2008 01:29:05 +0000 (01:29 +0000)]
Handle complex return values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59345 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse the correct QualType when creating the '0' constant.
Ted Kremenek [Sat, 15 Nov 2008 00:40:08 +0000 (00:40 +0000)]
Use the correct QualType when creating the '0' constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59343 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement FIXME in GRExprEngine::VisitUnaryOperator() to handle implicit conversions...
Ted Kremenek [Sat, 15 Nov 2008 00:20:05 +0000 (00:20 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59335 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFlush llvm::errs() when printing out SVals.
Ted Kremenek [Sat, 15 Nov 2008 00:16:53 +0000 (00:16 +0000)]
Flush llvm::errs() when printing out SVals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59334 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd handy method.
Zhongxing Xu [Fri, 14 Nov 2008 23:49:15 +0000 (23:49 +0000)]
Add handy method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59332 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement parsing and semantic checking of the 'mutable' keyword.
Sebastian Redl [Fri, 14 Nov 2008 23:42:31 +0000 (23:42 +0000)]
Implement parsing and semantic checking of the 'mutable' keyword.
Thanks to Doug for the review. Actual effects of mutable to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59331 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse ReadPtr, not ReadUIntPtr through a reinterpret_cast.
Argyrios Kyrtzidis [Fri, 14 Nov 2008 23:32:45 +0000 (23:32 +0000)]
Use ReadPtr, not ReadUIntPtr through a reinterpret_cast.
Thanks to Sebastian for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59330 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove Parser::isTokenUnqualifiedId, it's not getting used anywhere.
Argyrios Kyrtzidis [Fri, 14 Nov 2008 21:41:24 +0000 (21:41 +0000)]
Remove Parser::isTokenUnqualifiedId, it's not getting used anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59323 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/6372970> clang ObjC rewriter: incorrect cast when passing block...
Steve Naroff [Fri, 14 Nov 2008 21:36:12 +0000 (21:36 +0000)]
Fix <rdar://problem/6372970> clang ObjC rewriter: incorrect cast when passing block argument

SynthBlockInitExpr() was not adding by-ref arguments to the init expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59322 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor tweaks to liveness analysis:
Ted Kremenek [Fri, 14 Nov 2008 21:07:14 +0000 (21:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59316 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSecond attempt at implementation transfer function support for ObjCForCollectionStmt...
Ted Kremenek [Fri, 14 Nov 2008 19:47:18 +0000 (19:47 +0000)]
Second attempt at implementation transfer function support for ObjCForCollectionStmt.  We now assume that the 'element' expression can be any lvalue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59313 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFlow-sensitive uninitialized values analysis: properly handle the 'element' expressio...
Ted Kremenek [Fri, 14 Nov 2008 18:21:25 +0000 (18:21 +0000)]
Flow-sensitive uninitialized values analysis: properly handle the 'element' expression of ObjCForCollectionStmt (can be anything).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59312 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a new expression node, CXXOperatorCallExpr, which expresses a
Douglas Gregor [Fri, 14 Nov 2008 16:09:21 +0000 (16:09 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59306 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/6370288> clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS
Steve Naroff [Fri, 14 Nov 2008 14:10:01 +0000 (14:10 +0000)]
Fix <rdar://problem/6370288> clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59301 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't require us to manually number the statements and expressions in StmtNodes.def...
Douglas Gregor [Fri, 14 Nov 2008 12:46:07 +0000 (12:46 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59300 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImprove comments.
Zhongxing Xu [Fri, 14 Nov 2008 09:23:38 +0000 (09:23 +0000)]
Improve comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59294 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt or DeclRef...
Ted Kremenek [Fri, 14 Nov 2008 01:58:12 +0000 (01:58 +0000)]
Handle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt or DeclRefExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59290 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix CFG construction for ObjCForCollectionStmt: 'element' expression can be anything...
Ted Kremenek [Fri, 14 Nov 2008 01:57:41 +0000 (01:57 +0000)]
Fix CFG construction for ObjCForCollectionStmt: 'element' expression can be anything that evaluates to an lvalue

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59289 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate Xcode project.
Ted Kremenek [Fri, 14 Nov 2008 01:16:15 +0000 (01:16 +0000)]
Update Xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59285 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRename header file.
Ted Kremenek [Fri, 14 Nov 2008 01:14:18 +0000 (01:14 +0000)]
Rename header file.
Update include files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59284 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRename ExprDeclBitVector to BlkExprDeclBitVector, and store mappings from Stmt* to...
Ted Kremenek [Fri, 14 Nov 2008 01:13:07 +0000 (01:13 +0000)]
Rename ExprDeclBitVector to BlkExprDeclBitVector, and store mappings from Stmt* to bit indices instead using Expr*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59283 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix some validation errors.
Daniel Dunbar [Thu, 13 Nov 2008 23:01:34 +0000 (23:01 +0000)]
Fix some validation errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59272 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoStart a "hacking" page with some simple notes on getting started
Daniel Dunbar [Thu, 13 Nov 2008 22:49:41 +0000 (22:49 +0000)]
Start a "hacking" page with some simple notes on getting started
developing clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59270 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd file to VC++ project.
Steve Naroff [Thu, 13 Nov 2008 21:16:53 +0000 (21:16 +0000)]
Add file to VC++ project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59261 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome cleanup for the implementation of built-in operator
Douglas Gregor [Thu, 13 Nov 2008 20:12:29 +0000 (20:12 +0000)]
Some cleanup for the implementation of built-in operator
candidates. Thanks to Chris for the review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59260 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix an obscure rewriter bug when rewriting implementations that don't have a correspo...
Steve Naroff [Thu, 13 Nov 2008 20:07:04 +0000 (20:07 +0000)]
Fix an obscure rewriter bug when rewriting implementations that don't have a corresponding interface (found while doing random testing on another bug).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59259 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a couple of suboptimalities in error recovery.
Chris Lattner [Thu, 13 Nov 2008 18:52:53 +0000 (18:52 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59256 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodon't highlight field name, just put a caret on it.
Chris Lattner [Thu, 13 Nov 2008 18:49:38 +0000 (18:49 +0000)]
don't highlight field name, just put a caret on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59255 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodisable these two tests, they crash and take a long time to run crashreporter etc.
Chris Lattner [Thu, 13 Nov 2008 18:45:47 +0000 (18:45 +0000)]
disable these two tests, they crash and take a long time to run crashreporter etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59254 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimplement a fixme :), switch to -verify mode.
Chris Lattner [Thu, 13 Nov 2008 18:42:17 +0000 (18:42 +0000)]
implement a fixme :), switch to -verify mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59253 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/6343942> clang ObjC rewriter: crash rewriting blocks
Steve Naroff [Thu, 13 Nov 2008 17:40:07 +0000 (17:40 +0000)]
Fix <rdar://problem/6343942> clang ObjC rewriter: crash rewriting blocks
and <rdar://problem/6344601> clang ObjC rewriter: crash passing Block parameter?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59251 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUsing llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ownershi...
Ted Kremenek [Thu, 13 Nov 2008 17:11:24 +0000 (17:11 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59249 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping from...
Ted Kremenek [Thu, 13 Nov 2008 16:51:03 +0000 (16:51 +0000)]
Use PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping from IncludeMacroStack.  This is both cleaner and makes the include stack transparently extensible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59248 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate Xcode project.
Ted Kremenek [Thu, 13 Nov 2008 16:36:43 +0000 (16:36 +0000)]
Update Xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59247 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago- Revert r59229 and r59232: AllocRegion should be immutable.
Ted Kremenek [Thu, 13 Nov 2008 15:42:31 +0000 (15:42 +0000)]
- Revert r59229 and r59232: AllocRegion should be immutable.
- Temporarily disabled test Analysis/array-struct.c for region store.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59245 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoProcess array base expression of any type.
Zhongxing Xu [Thu, 13 Nov 2008 09:48:44 +0000 (09:48 +0000)]
Process array base expression of any type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59240 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd test for unsigned array index.
Zhongxing Xu [Thu, 13 Nov 2008 09:20:05 +0000 (09:20 +0000)]
Add test for unsigned array index.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59239 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoArray index might be unsigned. We have to generate a temporary signed value for
Zhongxing Xu [Thu, 13 Nov 2008 09:15:14 +0000 (09:15 +0000)]
Array index might be unsigned. We have to generate a temporary signed value for
it to be evaluated by APSInt::operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59238 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd test for incomplete struct pointer.
Zhongxing Xu [Thu, 13 Nov 2008 08:44:52 +0000 (08:44 +0000)]
Add test for incomplete struct pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59236 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIncomplete struct pointer can be used as a function argument.
Zhongxing Xu [Thu, 13 Nov 2008 08:41:36 +0000 (08:41 +0000)]
Incomplete struct pointer can be used as a function argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59235 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a test case for alloca().
Zhongxing Xu [Thu, 13 Nov 2008 07:59:15 +0000 (07:59 +0000)]
Add a test case for alloca().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59233 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLift the pointer to alloca'ed region to the pointer to its first element.
Zhongxing Xu [Thu, 13 Nov 2008 07:58:20 +0000 (07:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59232 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange AllocaRegion to subclass TypedRegion. We need to know ElementRegion's
Zhongxing Xu [Thu, 13 Nov 2008 07:30:58 +0000 (07:30 +0000)]
Change AllocaRegion to subclass TypedRegion. We need to know ElementRegion's
type when assigning to it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59229 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHook up "BodyBlock", not "Block".
Ted Kremenek [Thu, 13 Nov 2008 07:01:10 +0000 (07:01 +0000)]
Hook up "BodyBlock", not "Block".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59227 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCorrectly connect 'continue' and 'break' statements in Objective-C fast enumeration...
Ted Kremenek [Thu, 13 Nov 2008 06:36:45 +0000 (06:36 +0000)]
Correctly connect 'continue' and 'break' statements in Objective-C fast enumeration for blocks to the appropriate basic blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59226 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGRExprEngine/CFRefCount/GRSimpleVals: We don't do any special handling (yet) of vecto...
Ted Kremenek [Thu, 13 Nov 2008 06:10:40 +0000 (06:10 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59225 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix for crash issues with comma operators with a void first operand, and
Eli Friedman [Thu, 13 Nov 2008 06:09:17 +0000 (06:09 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59224 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoObey the FIXMES!
Daniel Dunbar [Thu, 13 Nov 2008 05:29:02 +0000 (05:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59223 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix uninitialized variable.
Ted Kremenek [Thu, 13 Nov 2008 05:26:15 +0000 (05:26 +0000)]
Fix uninitialized variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59222 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago[LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that
Daniel Dunbar [Thu, 13 Nov 2008 05:09:21 +0000 (05:09 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59221 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGRExprEngine::VisitInitListExpr:
Ted Kremenek [Thu, 13 Nov 2008 05:05:34 +0000 (05:05 +0000)]
GRExprEngine::VisitInitListExpr:
- Don't crash on vector types.
- Handle typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59220 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEasy IRgen improvement for bitfields, don't emit x >> 0.
Daniel Dunbar [Thu, 13 Nov 2008 02:20:34 +0000 (02:20 +0000)]
Easy IRgen improvement for bitfields, don't emit x >> 0.
 - Logic such as this quite possibly should be optional builder
   behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59213 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBackout of r59196, plus a new ICE test. Sorry if this is a
Eli Friedman [Thu, 13 Nov 2008 02:13:11 +0000 (02:13 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59212 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSupply finished flag to EmitBlock for common statements which use
Daniel Dunbar [Thu, 13 Nov 2008 01:54:24 +0000 (01:54 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59211 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoNormalize many BasicBlock names.
Daniel Dunbar [Thu, 13 Nov 2008 01:38:36 +0000 (01:38 +0000)]
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. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59210 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRevert to older checker build.
Ted Kremenek [Thu, 13 Nov 2008 01:30:19 +0000 (01:30 +0000)]
Revert to older checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59209 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd IsFinished arg to EmitBlock.
Daniel Dunbar [Thu, 13 Nov 2008 01:24:05 +0000 (01:24 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59207 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate checker build.
Ted Kremenek [Thu, 13 Nov 2008 01:23:50 +0000 (01:23 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59206 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFor if blocks with no else, name the join block ifend instead of the
Daniel Dunbar [Thu, 13 Nov 2008 00:47:57 +0000 (00:47 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59201 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix bug where the body block of an ObjCForCollectionStmt would not properly get expan...
Ted Kremenek [Thu, 13 Nov 2008 00:06:59 +0000 (00:06 +0000)]
Fix bug where the body block of an ObjCForCollectionStmt would not properly get expanded as a series of basic blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59197 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix bug in constant evaluation exposed by 176.gcc.
Daniel Dunbar [Thu, 13 Nov 2008 00:03:19 +0000 (00:03 +0000)]
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?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59196 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated checker build.
Ted Kremenek [Wed, 12 Nov 2008 23:26:57 +0000 (23:26 +0000)]
Updated checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59195 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't build identifiers for C++ constructors, destructors, or
Douglas Gregor [Wed, 12 Nov 2008 23:21:09 +0000 (23:21 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59193 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix compilation on 64-bit targets
Douglas Gregor [Wed, 12 Nov 2008 23:17:06 +0000 (23:17 +0000)]
Fix compilation on 64-bit targets

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59192 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove some diagnostic handling to PreprocessorLexer.
Ted Kremenek [Wed, 12 Nov 2008 23:13:54 +0000 (23:13 +0000)]
Move some diagnostic handling to PreprocessorLexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59191 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd virtual dtor to PreprocessorLexer.
Ted Kremenek [Wed, 12 Nov 2008 22:48:57 +0000 (22:48 +0000)]
Add virtual dtor to PreprocessorLexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59188 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd LexIncludeFilename.
Ted Kremenek [Wed, 12 Nov 2008 22:46:33 +0000 (22:46 +0000)]
Add LexIncludeFilename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59187 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove Lexer::LexIncludeFilename.
Ted Kremenek [Wed, 12 Nov 2008 22:44:15 +0000 (22:44 +0000)]
Remove Lexer::LexIncludeFilename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59186 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove LexIncludeFilename from Lexer to PreprocessorLexer.
Ted Kremenek [Wed, 12 Nov 2008 22:43:05 +0000 (22:43 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59185 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoQuick fix for crash in IRgen when we can tryEvaluate a condition to
Daniel Dunbar [Wed, 12 Nov 2008 22:37:10 +0000 (22:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59184 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse PushIncludeMacroStack() instead of manually manipulating the include stack.
Ted Kremenek [Wed, 12 Nov 2008 22:21:57 +0000 (22:21 +0000)]
Use PushIncludeMacroStack() instead of manually manipulating the include stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59181 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUnbreak last commit.
Ted Kremenek [Wed, 12 Nov 2008 22:19:18 +0000 (22:19 +0000)]
Unbreak last commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59180 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd Preprocessor::PushIncludeMacroStack() and Preprocessor::PopIncludeMacroStack...
Ted Kremenek [Wed, 12 Nov 2008 22:10:22 +0000 (22:10 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59179 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate CFGStmtVisitor to recognize that ObjCForCollectionStmts are special block...
Ted Kremenek [Wed, 12 Nov 2008 21:58:46 +0000 (21:58 +0000)]
Update CFGStmtVisitor to recognize that ObjCForCollectionStmts are special block-level "expressions".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59176 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable some debug prints.
Daniel Dunbar [Wed, 12 Nov 2008 21:52:46 +0000 (21:52 +0000)]
Disable some debug prints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59174 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSlightly improve type hash
Douglas Gregor [Wed, 12 Nov 2008 21:52:20 +0000 (21:52 +0000)]
Slightly improve type hash

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59173 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd skeleton for PTH lexer.
Ted Kremenek [Wed, 12 Nov 2008 21:37:15 +0000 (21:37 +0000)]
Add skeleton for PTH lexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59169 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove pieces of Lexer that the Preprocessor mutates to a new base class 'PreprocessorL...
Ted Kremenek [Wed, 12 Nov 2008 21:33:59 +0000 (21:33 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59168 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a FIXME by improving a diagnostic, add a testcase for PR3048
Chris Lattner [Wed, 12 Nov 2008 21:25:45 +0000 (21:25 +0000)]
Fix a FIXME by improving a diagnostic, add a testcase for PR3048

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59167 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago64-bit test fixes.
Sebastian Redl [Wed, 12 Nov 2008 21:19:11 +0000 (21:19 +0000)]
64-bit test fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59165 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agomake TryFixInvalidVariablyModifiedType a static function.
Chris Lattner [Wed, 12 Nov 2008 21:17:48 +0000 (21:17 +0000)]
make TryFixInvalidVariablyModifiedType a static function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59163 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoShore up transfer function for ObjCForCollectionStmt.
Ted Kremenek [Wed, 12 Nov 2008 21:12:46 +0000 (21:12 +0000)]
Shore up transfer function for ObjCForCollectionStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59162 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse Stmt* instead of Expr* for block-level expression.
Ted Kremenek [Wed, 12 Nov 2008 21:12:18 +0000 (21:12 +0000)]
Use Stmt* instead of Expr* for block-level expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59161 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoObjCForCollectionStmts are block-level expressions.
Ted Kremenek [Wed, 12 Nov 2008 21:11:49 +0000 (21:11 +0000)]
ObjCForCollectionStmts are block-level expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59160 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRestructure code to encourage fallthrough, no functionality change.
Chris Lattner [Wed, 12 Nov 2008 19:48:13 +0000 (19:48 +0000)]
Restructure code to encourage fallthrough, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59157 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix PR3048. I'm going to do some more work before closing it off and
Chris Lattner [Wed, 12 Nov 2008 19:45:49 +0000 (19:45 +0000)]
fix PR3048.  I'm going to do some more work before closing it off and
adding a testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59156 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd (preliminary) transfer function support for ObjCForCollectionStmt. Still need...
Ted Kremenek [Wed, 12 Nov 2008 19:24:17 +0000 (19:24 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59155 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoConjured symbols now bind to Stmt* instead of Expr*.
Ted Kremenek [Wed, 12 Nov 2008 19:22:47 +0000 (19:22 +0000)]
Conjured symbols now bind to Stmt* instead of Expr*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59154 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate method names involving GRStateRef. No functionality change.
Ted Kremenek [Wed, 12 Nov 2008 19:22:09 +0000 (19:22 +0000)]
Update method names involving GRStateRef.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59153 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGRStateRef:
Ted Kremenek [Wed, 12 Nov 2008 19:21:30 +0000 (19:21 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59152 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoStoreManager::BindDecl now takes an SVal* for the initialization value instead of...
Ted Kremenek [Wed, 12 Nov 2008 19:18:35 +0000 (19:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59151 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement support for operator overloading using candidate operator
Douglas Gregor [Wed, 12 Nov 2008 17:17:38 +0000 (17:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59148 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoStart a README.txt of possible optimizations to do in IRgen.
Daniel Dunbar [Wed, 12 Nov 2008 12:31:28 +0000 (12:31 +0000)]
Start a README.txt of possible optimizations to do in IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59130 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle ?: in EmitBranchOnBoolExpr.
Daniel Dunbar [Wed, 12 Nov 2008 10:30:32 +0000 (10:30 +0000)]
Handle ?: in EmitBranchOnBoolExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59129 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRename ?: operator blocks to cond.true and cond.false (I don't know
Daniel Dunbar [Wed, 12 Nov 2008 10:13:37 +0000 (10:13 +0000)]
Rename ?: operator blocks to cond.true and cond.false (I don't know
what "cond.?" means, and this avoids quoting).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59128 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoComment/indentation fix.
Daniel Dunbar [Wed, 12 Nov 2008 10:12:14 +0000 (10:12 +0000)]
Comment/indentation fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59127 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome additions to tryEvaluate I've had sitting around for a while.
Eli Friedman [Wed, 12 Nov 2008 09:44:48 +0000 (09:44 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59125 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLower ?: into select when the selected values are cheap and side-effect-free.
Chris Lattner [Wed, 12 Nov 2008 08:55:54 +0000 (08:55 +0000)]
Lower ?: into select when the selected values are cheap and side-effect-free.
This cuts another 200 lines off expr.ll, forming 23 selects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59124 91177308-0d34-0410-b5e6-96231b3b80d8