summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-5/+5
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Codegen support for nullptr from C++0x.Anders Carlsson2009-09-151-1/+2
| | | | llvm-svn: 81835
* Add utility to evaluate lvalues which are an offset relative to a stack Eli Friedman2009-09-131-6/+16
| | | | | | location. Patch by Enea Zaffanella. llvm-svn: 81672
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-112/+106
| | | | llvm-svn: 81346
* Get rid of mostly-unused, buggy method.Eli Friedman2009-08-291-3/+3
| | | | llvm-svn: 80432
* Change uses of:Ted Kremenek2009-07-291-4/+4
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* This patch fixes the implementations of the __has_trivial_destructorDouglas Gregor2009-07-231-1/+1
| | | | | | | | and __has_trivial_constructor builtin pseudo-functions and additionally implements __has_trivial_copy and __has_trivial_assign, from John McCall! llvm-svn: 76916
* Revert r75641.Anders Carlsson2009-07-181-1/+1
| | | | llvm-svn: 76327
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-4/+4
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-1/+1
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-3/+3
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Rename RecordLayout.h to ASTRecordLayout.hAnders Carlsson2009-07-141-1/+1
| | | | llvm-svn: 75641
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-1/+2
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Fix thinko in r74506, test condition for floats was inverted.Daniel Dunbar2009-07-011-7/+7
| | | | | | - Refactored slightly to make control flow more obvious. llvm-svn: 74637
* Implement Eli's feedback for vecto constant expressions;Nate Begeman2009-07-011-5/+52
| | | | | | | | | For ExtVectorType, initializer is splatted to all elements. For VectorType, initializer is bitcast to vector type. Verified that for VectorType, output is identical to gcc. llvm-svn: 74600
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-2/+2
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* OpenCL 1.0 Support:Nate Begeman2009-06-261-3/+19
| | | | | | Add support for scalar to vector and partially initialized vector constant initializers. llvm-svn: 74299
* PR4351: Add constant evaluation for constructs like "foo == NULL", where Eli Friedman2009-06-141-8/+29
| | | | | | foo has a constant address. llvm-svn: 73321
* Sink the BuiltinInfo object from ASTContext into theChris Lattner2009-06-141-0/+1
| | | | | | | | preprocessor and initialize it early in clang-cc. This ensures that __has_builtin works in all modes, not just when ASTContext is around. llvm-svn: 73319
* Minor simplification.Eli Friedman2009-06-041-6/+2
| | | | llvm-svn: 72887
* PR4326: Handle constant evaluation for void* pointer subtraction Eli Friedman2009-06-041-1/+6
| | | | | | correctly. llvm-svn: 72886
* Some small fixes for fields of reference type.Eli Friedman2009-05-301-2/+5
| | | | llvm-svn: 72636
* Cleqnup ideas from Chris, thanks.Mike Stump2009-05-301-5/+6
| | | | llvm-svn: 72621
* Improve __builtin_nanf support; we now can deal with them as constants.Mike Stump2009-05-301-3/+14
| | | | llvm-svn: 72607
* Fix up constant expression handling to deal with the address Eli Friedman2009-05-271-3/+12
| | | | | | of a reference correctly. llvm-svn: 72463
* When evaluating a VarDecl as a constant or determining whether it isDouglas Gregor2009-05-261-2/+11
| | | | | | | | an integral constant expression, maintain a cache of the value and the is-an-ICE flag within the VarDecl itself. This eliminates exponential-time behavior of the Fibonacci template metaprogram. llvm-svn: 72428
* Implement C++0x nullptr.Sebastian Redl2009-05-101-1/+3
| | | | llvm-svn: 71405
* Remove an unneeded special case.Daniel Dunbar2009-05-031-10/+1
| | | | llvm-svn: 70689
* Properly compute the alignment of typedefs that make use of theDouglas Gregor2009-04-301-24/+3
| | | | | | | | | | | | | | "aligned" attribute. Previously, we were skipping over these attributes when we jumped directly to the canonical type. Now, ASTContext::getTypeInfo walks through typedefs and other "non-canonical" types manually, looking for "aligned" attributes on typedefs. As part of this change, I moved the GNU-specific logic (such as determining the alignment of void or of a function pointer) out of the expression evaluator and into ASTContext::getTypeInfo. llvm-svn: 70497
* Minor simplification; also silences gcc warning.Eli Friedman2009-04-291-1/+1
| | | | llvm-svn: 70406
* PR4097: add logic to Evaluate to handle pointer equality comparisons.Eli Friedman2009-04-281-7/+16
| | | | llvm-svn: 70317
* Add handling for complex->int, int->complex float, and float->complex Eli Friedman2009-04-221-14/+38
| | | | | | | int. Note that constant int->complex float and float->complex int casts were being miscompiled. llvm-svn: 69821
* Use an ASTRecordLayout to compute the sizeof an interface, notDaniel Dunbar2009-04-211-7/+7
| | | | | | | | | addRecordToClass. - Among other things, this fixes a crash when applying sizeof to an interface with synthesized ivars, although things still aren't "correct" here. llvm-svn: 69675
* Fix <rdar://problem/6765383> clang-6: clang does not appear to support ↵Steve Naroff2009-04-161-0/+10
| | | | | | declaring a static Block 'const'. llvm-svn: 69306
* Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an ↵Anders Carlsson2009-04-101-0/+6
| | | | | | Expr as an LValue. llvm-svn: 68763
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-2/+2
| | | | | | No functionality change (really). llvm-svn: 68726
* Slight generalization for Evaluate with const variables.Eli Friedman2009-03-301-2/+2
| | | | llvm-svn: 68075
* Fix PR3868 by making Evaluate handle cases like "(long)&a + 4".Eli Friedman2009-03-241-6/+27
| | | | llvm-svn: 67593
* Minor Evaluate cleanup; add some boilerplate implementations to Eli Friedman2009-03-231-29/+26
| | | | | | Evaluate for __extension__ and __builtin_choose_expr. llvm-svn: 67506
* Minor enhancements to Evaluate.Eli Friedman2009-03-231-13/+25
| | | | llvm-svn: 67503
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-0/+1
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Minor cleanup for choose expressions: add a helper that returns the Eli Friedman2009-03-041-9/+3
| | | | | | chosen sub-expression, rather than just evaluating the condition. llvm-svn: 66018
* Fix obvious shortcoming in the implementations of Evaluate for Eli Friedman2009-02-281-3/+19
| | | | | | integer __real__ and __imag__. Not sure how I missed this. llvm-svn: 65677
* Change the AST generated for offsetof a bit so that it looks like a Eli Friedman2009-02-271-2/+10
| | | | | | | | normal expression, and change Evaluate and IRGen to evaluate it like a normal expression. This simplifies the code significantly, and fixes PR3396. llvm-svn: 65622
* Some minor improvements to Evaluate.Eli Friedman2009-02-271-3/+23
| | | | llvm-svn: 65613
* Add Type::hasPointerRepresentation predicate.Daniel Dunbar2009-02-261-8/+2
| | | | | | | | | - For types whose native representation is a pointer. - Use to replace ExprConstant.cpp:HasPointerEvalType, CodeGenFunction::isObjCPointerType. llvm-svn: 65569
* Remove short-circuit evaluation and the extension warnings. I'm Eli Friedman2009-02-261-43/+6
| | | | | | | | | pretty sure we want to keep constant expression verification outside of Evaluate. Because of that, the short-circuit evaluation doesn't generally make sense, and the comma warning doesn't make sense in its current form. llvm-svn: 65525
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-241-0/+1
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.Steve Naroff2009-02-231-2/+1
| | | | | | Remove support for "Class<P>". Will be making this an error. llvm-svn: 65332
* A few small improvements to Evaluate for stuff I noted in FIXMEs.Eli Friedman2009-02-231-17/+88
| | | | llvm-svn: 65305
OpenPOWER on IntegriCloud