Граф коммитов

26 Коммитов

Автор SHA1 Сообщение Дата
Eli Friedman c4a2638b5e Fix for PR6274: teach constant folding to evaluate __builtin_expect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96054 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 00:10:10 +00:00
Daniel Dunbar a5728872c7 Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Eli Friedman 7f92f0362e Add constant evaluation for comma operator with floating-point operand. Fixes
PR5449.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 04:25:37 +00:00
Sebastian Redl 632d772a78 Make ASTContext::getIntWidth return 1 for all boolean type variations, not just for the unqualified, unaliased bool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 21:10:57 +00:00
Eli Friedman 5bc8610376 PR4351: Add constant evaluation for constructs like "foo == NULL", where
foo has a constant address.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 02:17:33 +00:00
Eli Friedman 147bd641dd PR4326: Handle constant evaluation for void* pointer subtraction
correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 20:04:03 +00:00
Eli Friedman ad02d7debd PR4097: add logic to Evaluate to handle pointer equality comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 19:17:36 +00:00
Eli Friedman 1725f68343 Add handling for complex->int, int->complex float, and float->complex
int.  Note that constant int->complex float and float->complex int casts
were being miscompiled.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 19:23:09 +00:00
Chris Lattner 81045d8dcd Fix PR4027 + rdar://6808859, we were rejecting implicit casts of
aggregates even though we already accept explicit ones.  Easy fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 05:19:11 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Eli Friedman a1f47c447a Minor enhancements to Evaluate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 04:38:34 +00:00
Anders Carlsson 1a7acfa0de Fix invalid VLAs/VMs in Sema::ActOnVariableDeclarator, so that the variable will have the right type by the time the initializer is checked. This ensures that code like
int a[(int)(1.0 / 1.0) = { 1 } will work.

Eli, please review.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 21:56:50 +00:00
Eli Friedman 722c717cd8 Fix obvious shortcoming in the implementations of Evaluate for
integer __real__ and __imag__.  Not sure how I missed this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 03:59:05 +00:00
Daniel Dunbar 4fff4819a9 Evaluation of unary deref could call integer evaluator on non-integral
expr; hilarity ensued.
 - PR3640.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-21 18:14:20 +00:00
Eli Friedman e8761c8fe2 Add support for * (unary dereference) operator to ExprConstant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 01:57:15 +00:00
Anders Carlsson 1c17689a67 Emit the correct diagnostics when we constant fold an array size to a negative value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65023 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 06:30:50 +00:00
Anders Carlsson e2f0e96e9b Make sure to check the value of the constant expression, as suggested by Daniel.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 06:19:15 +00:00
Anders Carlsson 4d4c50dd8b Handle the GNU void* and function pointer arithmetic extensions for constant expressions as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 04:55:58 +00:00
Daniel Dunbar 2d6744ff04 isICE was evaluating ?: incorrectly with missing-gcc-LHS extension.
Add assert to isICE that, on success, result must be the same as
EvaluateAsInt()... this enforces a minimum level of sanity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 00:47:45 +00:00
Daniel Dunbar 8f826f0e0c Fix invalid evaluation of _Complex float (real & imaginary parts had
mismatched semantics).
 - Enforce this in APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 19:08:01 +00:00
Anders Carlsson 35873c49ad The address of a variable is only constant if the variable has global storage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:41:22 +00:00
Anders Carlsson 4bbc0e05a7 Fix bug in the constant evaluator. Fixes PR3115.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:21:33 +00:00
Eli Friedman a6afa768aa 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
2008-11-13 06:09:17 +00:00
Eli Friedman b11e77836d 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
2008-11-13 02:13:11 +00:00
Daniel Dunbar dd2b12a032 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
2008-11-13 00:03:19 +00:00
Eli Friedman 4efaa276bc 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
2008-11-12 09:44:48 +00:00