summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-031-0/+1
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-1/+1
| | | | | | | | | new gcc warning that complains on self-assignments and self-initializations. Fix one bug found by the warning, in which one clang::OverloadCandidate constructor failed to initialize its FunctionTemplate member. llvm-svn: 122459
* Rewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fixJohn McCall2010-12-141-78/+109
| | | | | | | the basic casting logic to insert intermediate casts and preserve the exact complex-cast design. Fixes a crash in the test suite. llvm-svn: 121776
* Improved complex constants evaluation.Abramo Bagnara2010-12-111-2/+100
| | | | llvm-svn: 121616
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-11/+0
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-4/+3
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121121
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-071-0/+5
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-1/+0
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Kill CK_Unknown and flesh out the documentation for the existing CastKinds.John McCall2010-11-161-29/+0
| | | | llvm-svn: 119331
* Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall2010-11-151-0/+1
| | | | | | | certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. llvm-svn: 119289
* Add a few more complex-related cast kinds that arise due to arbitraryJohn McCall2010-11-141-1/+8
| | | | | | | | | | implicit conversions; the last batch was specific to promotions. I think this is the full set we need. I do think dividing the cast kinds into floating and integral is probably a good idea. Annotate a *lot* more C casts with useful cast kinds. llvm-svn: 119036
* Introduce five new cast kinds for various conversions into andJohn McCall2010-11-131-0/+2
| | | | | | between complex types. llvm-svn: 118994
* Introduce a null-to-pointer implicit cast kind.John McCall2010-11-131-0/+6
| | | | llvm-svn: 118966
* Split out -Wconversion warnings about constant precision into theirJohn McCall2010-11-091-3/+16
| | | | | | | | | | | own subcategory, -Wconstant-conversion, which is on by default. Tweak the constant folder to give better results in the invalid case of a negative shift amount. Implements rdar://problem/6792488 llvm-svn: 118636
* Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a ↵Anders Carlsson2010-10-311-2/+2
| | | | | | getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset. llvm-svn: 117881
* Teach the constant expr evaluator about derived-to-base casts when no ↵Anders Carlsson2010-10-311-0/+36
| | | | | | virtual bases are involved. Fixes PR5974. llvm-svn: 117868
* Don't try to evaluate the LHS or RHS of a member pointer binary operation. ↵Anders Carlsson2010-10-311-0/+4
| | | | | | Fixes PR8507. llvm-svn: 117850
* Eliminate usage of ObjCSuperExpr used forFariborz Jahanian2010-10-141-1/+0
| | | | | | | 'super' as receiver of property or a setter/getter methods. //rdar: //8525788 llvm-svn: 116483
* Permit constant evaluation of const floating-point variables withJohn McCall2010-10-091-0/+41
| | | | | | constant initializers. llvm-svn: 116138
* Eagerly evaluate type traits in Sema instead of lazily in AST. They actually ↵Sebastian Redl2010-09-131-1/+1
| | | | | | need Sema access to be correct, fixes coming up. llvm-svn: 113782
* First version of a testcase, plus fixes.Sebastian Redl2010-09-101-0/+6
| | | | llvm-svn: 113624
* Define and implement CXXNoexceptExpr. Create it in Sema.Sebastian Redl2010-09-101-0/+1
| | | | llvm-svn: 113623
* Support strlen() and __builtin_strlen() as constant expressions withDouglas Gregor2010-09-101-0/+18
| | | | | | | the call argument is a string literal. Fixes <rdar://problem/8413477>. llvm-svn: 113580
* Fix warnings caused by new CXXUuidofExprClass enumerator.Francois Pichet2010-09-081-0/+1
| | | | llvm-svn: 113444
* Get rid of unnecessary return.Eli Friedman2010-09-061-1/+0
| | | | llvm-svn: 113132
* PR7242: Make sure to use a different context for evaluating constantEli Friedman2010-09-061-1/+4
| | | | | | | | initializers, so the result of the evaluation doesn't leak through inconsistently. Also, don't evaluate references to variables with initializers with side-effects. llvm-svn: 113128
* Eliminate CXXBindReferenceExpr, which was used in a ton ofDouglas Gregor2010-09-021-1/+0
| | | | | | well-intentioned but completely unused code. llvm-svn: 112868
* Revert my user-defined literal commits - r1124{58,60,67} pendingAlexis Hunt2010-08-301-2/+1
| | | | | | some issues being sorted out. llvm-svn: 112493
* Implement C++0x user-defined string literals.Alexis Hunt2010-08-291-1/+2
| | | | | | | | | | The extra data stored on user-defined literal Tokens is stored in extra allocated memory, which is managed by the PreprocessorLexer because there isn't a better place to put it that makes sure it gets deallocated, but only after it's used up. My testing has shown no significant slowdown as a result, but independent testing would be appreciated. llvm-svn: 112458
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-116/+116
| | | | | | to the new constants. llvm-svn: 112047
* Move a bunch of code out of the ComplexExprEvaluator class definition;Eli Friedman2010-08-161-105/+109
| | | | | | no functionality change. llvm-svn: 111207
* PR7884: Fix the implementations of __real__ and __imag__ on real floats.Eli Friedman2010-08-141-9/+21
| | | | llvm-svn: 111080
* Zap unused UnaryOperator::OffsetOf.Eli Friedman2010-08-131-15/+0
| | | | llvm-svn: 110996
* Get rid of isObjectType; when C++ says "object type", it generallyEli Friedman2010-08-051-1/+1
| | | | | | | just means "not a function type", not "not a function type or void". This changes behavior slightly, but generally in a way which accepts more code. llvm-svn: 110303
* Fix namespace polution.Dan Gohman2010-07-261-1/+5
| | | | llvm-svn: 109440
* Introduce a new cast kind for an "lvalue bitcast", which handlesDouglas Gregor2010-07-131-0/+1
| | | | | | | | | | | | | | | | reinterpret_casts (possibly indirectly via C-style/functional casts) on values, e.g., int i; reinterpret_cast<short&>(i); The IR generated for this is essentially the same as for *reinterpret_cast<short*>(&i). Fixes PR6437, PR7593, and PR7344. llvm-svn: 108294
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-4/+4
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-4/+4
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect itsDouglas Gregor2010-07-071-4/+4
| | | | | | newly-narrowed scope. No functionality change. llvm-svn: 107828
* Don't consider casted non-global pointers to be evaluatable.John McCall2010-07-071-0/+2
| | | | | | Fixes rdar://problem/8154689 llvm-svn: 107755
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-14/+17
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* Fix the constant evaluator for AltiVec-style vector literals so that theJohn McCall2010-06-111-13/+34
| | | | | | | vector is filled with the given constant; we were just initializing the first element. llvm-svn: 105824
* When constant folding reference variables with an initializer to theChandler Carruth2010-05-161-0/+4
| | | | | | | | initializer, don't fold paramters. Their initializers are just default arguments which can be overridden. This fixes some spectacular regressions due to more things making it into the constant folding. llvm-svn: 103904
* Added Expr::EvaluateAsAnyLValue.Abramo Bagnara2010-05-141-5/+21
| | | | llvm-svn: 103780
* Refactor the constant-evaluator so that it only supports a single formJohn McCall2010-05-101-62/+80
| | | | | | | | | of constant-evaluation. Formerly you could control whether it accepted local l-values or not; now it always evaluates local l-values in the core routines, but filters them out where consumed by the top-level routines. This will make it much easier to cache evaluability. llvm-svn: 103444
* The FP constant evaluator was missing a few cases of unary operators that ↵John McCall2010-05-071-2/+20
| | | | | | | | | | | return floats but whose operand isn't a float: specifically, __real__ and __imag__. Instead of filtering these out, just implement them. Fixes <rdar://problem/7958272>. llvm-svn: 103307
* Make that null-dereference fix a little clearer by rearranging some code.John McCall2010-05-071-2/+14
| | | | llvm-svn: 103298
* Fix a potential null dereference in the pointer-to-bool evaluator; caught byJohn McCall2010-05-071-1/+1
| | | | | | Eli Friedman. llvm-svn: 103297
* Change the pointer / lvalue constant evaluators to build into a target referenceJohn McCall2010-05-071-205/+199
| | | | | | and return a bool. llvm-svn: 103296
OpenPOWER on IntegriCloud