summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a failure (which led to a crash) in constant emission code with vector ↵Eli Friedman2011-12-221-1/+2
| | | | | | compound literals. llvm-svn: 147111
* Make sure we correctly zero-initialize unions containing a pointer to data ↵Eli Friedman2011-12-071-7/+11
| | | | | | member as the first field. PR11487. llvm-svn: 146009
* Use static storage duration for file-scope compound literals, even when theyRichard Smith2011-11-221-0/+6
| | | | | | appear in non-constant initializers in C++. llvm-svn: 145087
* Constant expression evaluation: add support for evaluation of member pointersRichard Smith2011-11-171-0/+1
| | | | | | and base-to-derived casts, and add proper handling of temporaries. llvm-svn: 144926
* Represent an APValue based on a Decl as that Decl, rather than a DeclRefExprRichard Smith2011-11-121-22/+23
| | | | | | | | or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to static member functions and static data members are now emitted as constant expressions. llvm-svn: 144468
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-2/+3
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* Constant expression evaluation: support for arrays.Richard Smith2011-11-071-0/+3
| | | | llvm-svn: 143922
* Rip out CK_GetObjCProperty.John McCall2011-11-071-1/+0
| | | | llvm-svn: 143910
* Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-011-7/+1
| | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. llvm-svn: 143417
* Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith2011-10-291-1/+1
| | | | | | | | implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
* Don't try to emit CK_LValueBitCast casts as constants. PR9558.Eli Friedman2011-10-241-1/+1
| | | | llvm-svn: 142863
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-2/+7
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* PR11124: Don't overwrite memory outside of a base class when performing ↵Eli Friedman2011-10-141-0/+5
| | | | | | zero-initialization before running its constructor. llvm-svn: 141933
* Constant expression evaluation refactoring:Richard Smith2011-10-101-2/+1
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-4/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Add list initialization for complex numbers in C. Essentially, this allows ↵Eli Friedman2011-09-191-0/+16
| | | | | | | | "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description. <rdar://problem/9397672>. llvm-svn: 140090
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-4/+4
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-0/+1
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+2
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Declare and define implicit move constructor and assignment operator.Sebastian Redl2011-08-301-2/+2
| | | | | | | | | This makes the code duplication of implicit special member handling even worse, but the cleanup will have to come later. For now, this works. Follow-up with tests for explicit defaulting and enabling the __has_feature flag to come. llvm-svn: 138821
* Cleanup to use helper.Eli Friedman2011-08-231-1/+1
| | | | llvm-svn: 138369
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Convert ConstantExpr::getGetElementPtr andJay Foad2011-07-211-1/+1
| | | | | | ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. llvm-svn: 135673
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-24/+24
| | | | llvm-svn: 135370
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-151-0/+5
| | | | | | | | to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
* De-constify Types in StructType::get() and TargetData::getIntPtrType().Jay Foad2011-07-111-3/+3
| | | | llvm-svn: 134893
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+1
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* Update to match mainline ConstantStruct::get API change. Also, use Chris Lattner2011-06-201-4/+20
| | | | | | | | | | | ConvertType on InitListExprs as they are being converted. This is needed for a forthcoming patch, and improves the IR generated anyway (see additional type names in testcases). This patch also converts a bunch of std::vector's in CGObjCMac to use C arrays. There are a ton more that should be converted as well. llvm-svn: 133413
* Automatic Reference Counting.John McCall2011-06-151-0/+2
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-201-4/+4
| | | | | | | | | | | | | Type::isUnsignedIntegerOrEnumerationType(), which are like Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also consider the underlying type of a C++0x scoped enumeration type. Audited all callers to the existing functions, switching those that need to also handle scoped enumeration types (e.g., those that deal with constant values) over to the new functions. Fixes PR9923 / <rdar://problem/9447851>. llvm-svn: 131735
* Finish off rules for z-length bitfields in ms_structFariborz Jahanian2011-05-031-2/+1
| | | | | | structs. // rdar://8823265 llvm-svn: 130783
* More rule enforcement of zero bitfields for ms_struct.Fariborz Jahanian2011-05-021-1/+2
| | | | llvm-svn: 130696
* ms_struct patch for initialization and field access irgen.Fariborz Jahanian2011-04-281-1/+15
| | | | | | // rdar://8823265 - wip. llvm-svn: 130451
* ForArgyrios Kyrtzidis2011-04-211-1/+9
| | | | | | | | | | | | | | double data[20000000] = {0}; we would blow out the memory by creating 20M Exprs to fill out the initializer. To fix this, if the initializer list initializes an array with more elements than there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression that specifies an expression to be used for value initialization of the rest of the elements. Fixes rdar://9275920. llvm-svn: 129896
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-0/+4
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-2/+0
| | | | | | | | | for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. llvm-svn: 129331
* More __unknown_anytype work.John McCall2011-04-111-0/+1
| | | | llvm-svn: 129269
* Remove CK_DynamicToNull.Anders Carlsson2011-04-111-1/+0
| | | | llvm-svn: 129265
* As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind whichAnders Carlsson2011-04-101-0/+1
| | | | | | | | | | | | | | | | | | represents a dynamic cast where we know that the result is always null. For example: struct A { virtual ~A(); }; struct B final : A { }; struct C { }; bool f(B* b) { return dynamic_cast<C*>(b); } llvm-svn: 129256
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-0/+1
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* supported: AltiVec vector initialization with a single literal according to ↵Anton Yartsev2011-03-271-6/+23
| | | | | | PIM section 2.5.1 - after initialization all elements have the value specified by the literal llvm-svn: 128375
* Eliminate some literal '8's in FillInNullDataMemberPointers() by switchingKen Dyck2011-03-221-5/+6
| | | | | | to CharUnits. No change in functionality intended. llvm-svn: 128047
* Use CharUnits's new increment operator. No change in functionality intended.Ken Dyck2011-03-191-2/+2
| | | | llvm-svn: 127938
* Replace literal '8's with CharWidth in AppendBitField. No change inKen Dyck2011-03-191-13/+15
| | | | | | functionality intended. llvm-svn: 127927
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-1/+1
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* Convert alignment values to CharUnits. No change in functionality intended.Ken Dyck2011-03-181-18/+18
| | | | llvm-svn: 127848
* Convert getSizeInBytes() to getSizeInChars(), which returns its result inKen Dyck2011-03-181-9/+10
| | | | | | CharUnits. No change in functionality intended. llvm-svn: 127846
OpenPOWER on IntegriCloud