summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove some dead variables clang-analyzer found.Benjamin Kramer2009-12-251-2/+0
| | | | llvm-svn: 92162
* Update for the intrinsic changes in llvm: the object size intrinsicEric Christopher2009-12-231-1/+2
| | | | | | | only takes a boolean second argument now. Update tests accordingly. Currently the builtin still accepts the full range for compatibility. llvm-svn: 91983
* Use StringRef.getAsInteger instead of temporary string + strtol. No intended ↵Benjamin Kramer2009-12-111-9/+3
| | | | | | functionality change. llvm-svn: 91118
* Clean up enum constants so that they're finally sane. Fixes PR3173 and aEli Friedman2009-12-101-10/+2
| | | | | | recently introduced crash. llvm-svn: 91070
* Fix for PR5447: teach Evaluate to deal with floating-point conditionals.Eli Friedman2009-12-041-2/+10
| | | | llvm-svn: 90521
* Add recursion guards to ice-checking and evaluation for declrefs, so weEli Friedman2009-12-031-4/+13
| | | | | | don't infinitely recurse for cases we can't evaluate. llvm-svn: 90480
* Remove VISIBILITY_HIDDEN from lib/AST.Benjamin Kramer2009-11-281-8/+7
| | | | llvm-svn: 90043
* Teach Evaluate to handle member expressions referring to enum constants andEli Friedman2009-11-241-8/+21
| | | | | | | | static member constants. No significant visible difference at the moment because it conservatively assumes the base has side effects. I'm planning to use this for CodeGen. llvm-svn: 89738
* Intercept sizeof and alignof references before they get into ASTContext ↵Sebastian Redl2009-11-231-2/+16
| | | | | | methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590. llvm-svn: 89668
* Add constant evaluation for comma operator with floating-point operand. FixesEli Friedman2009-11-161-1/+13
| | | | | | PR5449. llvm-svn: 88885
* Added support for static variables which requireFariborz Jahanian2009-11-051-8/+7
| | | | | | initialization before main. Fixes pr5396. llvm-svn: 86145
* Refine volatile handling, specifically, we must have the canonicalMike Stump2009-11-031-2/+2
| | | | | | | type to look at the volatile specifier. I found these all from just hand auditing the code. llvm-svn: 85967
* silence a warning.Chris Lattner2009-11-031-1/+1
| | | | llvm-svn: 85931
* When determining whether a reference to a static data member is anDouglas Gregor2009-11-011-6/+10
| | | | | | | | | integral constant expression, make sure to find where the initializer was provided---inside or outside the class definition---since that can affect whether we have an integral constant expression (and, we need to see the initializer itself). llvm-svn: 85741
* Fix one more bug with __builtin_object_size.Mike Stump2009-10-291-1/+1
| | | | llvm-svn: 85538
* Fix some issues Daniel pointed out.Mike Stump2009-10-291-3/+4
| | | | llvm-svn: 85526
* optimize out some ifdefs.Chris Lattner2009-10-291-4/+0
| | | | llvm-svn: 85453
* Implement clang support for indirect branch and address of labelChris Lattner2009-10-281-0/+5
| | | | | | | | using the new LLVM support for this. This is temporarily hiding behind horrible and ugly #ifdefs until the time when the optimizer is stable (hopefully a week or so). Until then, lets make it "opt in" :) llvm-svn: 85446
* Refine __builtin_object_size. Don't try and get a size for thingsMike Stump2009-10-281-7/+12
| | | | | | that don't have sizes. llvm-svn: 85435
* __builtin_object_size refinements. Ensure we handle expressions withMike Stump2009-10-271-2/+62
| | | | | | | | | | side-effects up front, as when we switch to the llvm intrinsic call for __builtin_object_size later, it will have two evaluations. We also finish off the intrinsic version of the code so we can just turn it on once llvm has the intrinsic. llvm-svn: 85324
* __builtin_object_size refinements. Also handle stack based objects. WIP.Mike Stump2009-10-261-1/+28
| | | | llvm-svn: 85174
* __builtin_object_size refinements. When we run out of object, be sureMike Stump2009-10-261-1/+5
| | | | | | to clamp at 0 bytes left. WIP. llvm-svn: 85157
* Be sure to zero-extend. And refactor.Mike Stump2009-10-261-6/+1
| | | | llvm-svn: 85140
* __builtin_object_size refinements. WIP.Mike Stump2009-10-261-0/+30
| | | | llvm-svn: 85136
* Ignore No-op casts when evaluating lvalue expressions. Fixes PR5122.Anders Carlsson2009-10-031-0/+10
| | | | llvm-svn: 83267
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-1/+1
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
* implement support for __builtin_eh_return_data_regno on x86-32 and x86-64.Chris Lattner2009-09-231-0/+6
| | | | | | This implements PR5034 and rdar://6836445. llvm-svn: 82614
* 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
OpenPOWER on IntegriCloud