summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-10/+161
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-091-0/+1
| | | | llvm-svn: 125217
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | there were only three virtual methods of any significance. The primary way to grab child iterators now is with Stmt::child_range children(); Stmt::const_child_range children() const; where a child_range is just a std::pair of iterators suitable for being llvm::tie'd to some locals. I've left the old child_begin() and child_end() accessors in place, but it's probably a substantial penalty to grab the iterators individually now, since the switch-based dispatch is kindof inherently slower than vtable dispatch. Grabbing them together is probably a slight win over the status quo, although of course we could've achieved that with vtables, too. I also reclassified SwitchCase (correctly) as an abstract Stmt class, which (as the first such class that wasn't an Expr subclass) required some fiddling in a few places. There are somewhat gross metaprogramming hooks in place to ensure that new statements/expressions continue to implement getSourceRange() and children(). I had to work around a recent clang bug; dgregor actually fixed it already, but I didn't want to introduce a selfhosting dependency on ToT. llvm-svn: 125183
* An insomniac stab at making block declarations list the variables they closeJohn McCall2011-02-021-1/+1
| | | | | | | on, as well as more reliably limiting invalid references to locals from nested scopes. llvm-svn: 124721
* Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead ofKen Dyck2011-01-261-7/+4
| | | | | | converting getBaseClassOffsetInBits() to CharUnits. llvm-svn: 124274
* Fix the computation of alignment for fields of packed+aligned structs.John McCall2011-01-201-8/+1
| | | | | | Part of the fix for PR8413. llvm-svn: 123904
* Replace calls to CharUnits::fromQuantity() with onesKen Dyck2011-01-181-13/+8
| | | | | | ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units. llvm-svn: 123715
* Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,Douglas Gregor2011-01-151-0/+1
| | | | | | | | | that captures the substitution of a non-type template argument pack for a non-type template parameter pack within a pack expansion that cannot be fully expanded. This follows the approach taken by SubstTemplateTypeParmPackType. llvm-svn: 123506
* Replace a literal '8' with getCharWidth().Ken Dyck2011-01-141-1/+2
| | | | llvm-svn: 123421
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-14/+16
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Implement the sizeof...(pack) expression to compute the length of aDouglas Gregor2011-01-041-1/+9
| | | | | | | | | parameter pack. Note that we're missing proper libclang support for the new SizeOfPackExpr expression node. llvm-svn: 122813
* 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
OpenPOWER on IntegriCloud