summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Support evaluation of vector constant expressions, and codegen of same.Nate Begeman2009-01-181-1/+77
| | | | llvm-svn: 62455
* postpone sizeof objc-class computatin to the clients.Fariborz Jahanian2009-01-161-0/+4
| | | | llvm-svn: 62292
* Fix some unused variable, control reaches end of non-void function,Daniel Dunbar2009-01-151-0/+1
| | | | | | and uninitialized use options. llvm-svn: 62270
* PODness and Type TraitsSebastian Redl2009-01-051-0/+6
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* Add codegen support for __nullAnders Carlsson2008-12-211-0/+6
| | | | llvm-svn: 61314
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-1/+4
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* Get rid of the old Expr::Evaluate variant.Anders Carlsson2008-12-191-17/+4
| | | | llvm-svn: 61260
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Workaround for PR3173. The fix is correct in the sense that if the enum Eli Friedman2008-12-081-0/+3
| | | | | | | | | code were working correctly, it would be a no-op, but it's not really a proper fix. That said, I don't really want to touch the enum code at the moment because I don't understand it very well, and this seems to be a relatively visible regression. llvm-svn: 60680
* This wasn't such a good idea after all as it broke some tests.Anders Carlsson2008-12-051-10/+1
| | | | llvm-svn: 60582
* Handle __builtin___CFStringMakeConstantString in Expr::Evaluate.Anders Carlsson2008-12-051-1/+10
| | | | llvm-svn: 60581
* Generate the correct results for the comma expression. Fixes PR3123.Anders Carlsson2008-12-011-7/+10
| | | | llvm-svn: 60334
* Emit the correct diagnostic when a comma is in an ICE.Anders Carlsson2008-12-011-4/+4
| | | | llvm-svn: 60316
* Change the diagnostics that the evaluator reports to be of type NOTE.Anders Carlsson2008-11-301-11/+10
| | | | llvm-svn: 60301
* Replace the isEvaluated bool with a ShortCircuit int, making it easier to ↵Anders Carlsson2008-11-301-12/+10
| | | | | | handle recursion llvm-svn: 60300
* Pass the expression to the Error and Extension methods.Anders Carlsson2008-11-301-20/+22
| | | | llvm-svn: 60299
* Add a new variant of Evaluate and reimplement the old Evaluate in terms of ↵Anders Carlsson2008-11-301-7/+17
| | | | | | the new. llvm-svn: 60298
* General cleanup, evaluate the RHS of a logical op even if the LHS will give ↵Anders Carlsson2008-11-301-16/+25
| | | | | | us the result. llvm-svn: 60297
* EvalInfo now holds a reference to an EvalResult struct.Anders Carlsson2008-11-301-24/+14
| | | | llvm-svn: 60296
* remove debug-only assertion in the complex float evaluator as it makes some ↵Nuno Lopes2008-11-261-1/+0
| | | | | | real apps crash llvm-svn: 60069
* The address of a variable is only constant if the variable has global storage.Anders Carlsson2008-11-241-1/+9
| | | | llvm-svn: 59939
* Fix bug in the constant evaluator. Fixes PR3115.Anders Carlsson2008-11-241-33/+33
| | | | llvm-svn: 59938
* Return false if we encounter a type we can't handle.Anders Carlsson2008-11-221-1/+2
| | | | llvm-svn: 59889
* Case values must be evaluatedAnders Carlsson2008-11-221-19/+23
| | | | llvm-svn: 59884
* Use Expr::Evaluate for case statements. Fixes PR2525Anders Carlsson2008-11-221-9/+27
| | | | llvm-svn: 59881
* fix folding of '*doubleArray'Nuno Lopes2008-11-191-0/+3
| | | | llvm-svn: 59647
* Address some comments Eli had.Anders Carlsson2008-11-161-11/+6
| | | | llvm-svn: 59430
* use HandleConversionToBool() to check if a given cond is foldable (per Eli's ↵Nuno Lopes2008-11-161-3/+3
| | | | | | comment) llvm-svn: 59429
* More complex float evaluator support.Anders Carlsson2008-11-161-0/+45
| | | | llvm-svn: 59428
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-161-6/+6
| | | | llvm-svn: 59426
* Add very limited support for evaluating complex floats.Anders Carlsson2008-11-161-1/+46
| | | | llvm-svn: 59425
* fix folding of comma if given a non-constant operand.Nuno Lopes2008-11-161-3/+4
| | | | | | Eli please take a look, as I'm not sure if this gets the extension warning in the right place llvm-svn: 59422
* make IntExprEvaluator fold the ?: operatorNuno Lopes2008-11-161-0/+9
| | | | llvm-svn: 59421
* More work on the constant evaluator. Eli, it would be great if you could ↵Anders Carlsson2008-11-161-1/+65
| | | | | | have a look at this. llvm-svn: 59420
* Add the ability to evaluate comparison operators with floating point numbers ↵Anders Carlsson2008-11-161-2/+45
| | | | | | as operands. llvm-svn: 59408
* Fix for crash issues with comma operators with a void first operand, and Eli Friedman2008-11-131-50/+67
| | | | | | | | | | 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
* Backout of r59196, plus a new ICE test. Sorry if this is a Eli Friedman2008-11-131-32/+16
| | | | | | | | | | | | | | | | | | 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
* Fix bug in constant evaluation exposed by 176.gcc.Daniel Dunbar2008-11-131-16/+32
| | | | | | | | | | | | - 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
* Disable some debug prints.Daniel Dunbar2008-11-121-0/+2
| | | | llvm-svn: 59174
* Some additions to tryEvaluate I've had sitting around for a while.Eli Friedman2008-11-121-25/+202
| | | | | | | | | | | | | | 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
* fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It wasChris Lattner2008-11-121-16/+34
| | | | | | | | 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
* Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1Chris Lattner2008-11-121-1/+21
| | | | llvm-svn: 59105
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-111-14/+10
| | | | | | expressions, both of values and types. llvm-svn: 59057
* PR2919: __builtin_types_compatible_p strips CRV qualifiers.Daniel Dunbar2008-10-241-1/+7
| | | | llvm-svn: 58079
* Teach tryEvaluate that fabs, copysign, and unary +/- are constants forDaniel Dunbar2008-10-161-1/+36
| | | | | | | | floats. - With testcase, which also has some other things GCC folds but we don't commented out in it. llvm-svn: 57624
* Fix test suite regression, getFloatTypeSemantics shouldn't be calledDaniel Dunbar2008-10-141-4/+6
| | | | | | on non-float types. llvm-svn: 57477
* Adjust calls to APFloat conversion for new interface.Dale Johannesen2008-10-091-2/+3
| | | | llvm-svn: 57332
* ExprConstant should not abort when it sees a pointer constant that isn't.Chris Lattner2008-10-061-3/+0
| | | | llvm-svn: 57162
* Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExprChris Lattner2008-10-061-0/+7
| | | | | | | which is checking for something that can be inconsistent with what we can constant fold. llvm-svn: 57159
* Move folding of __builtin_classify_type out of the CallExprChris Lattner2008-10-061-2/+57
| | | | | | interface into the constant folding interface. llvm-svn: 57158
OpenPOWER on IntegriCloud