summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop most of InitializationSequence::SequenceKind's values. They didn't ↵Sebastian Redl2011-06-051-56/+12
| | | | | | | | really contain any information that the step array didn't contain too. This makes debugging dumps a bit less informative, but probably not significantly so. The advantage is that the redundancy is gone, so the code is easier to understand. ReferenceBinding is still there, because it is used in some unclear code. llvm-svn: 132667
* Remove more references to FailedSequence.Sebastian Redl2011-06-051-3/+3
| | | | llvm-svn: 132666
* Remove all references to InitializationSequence::FailedSequence from outside ↵Sebastian Redl2011-06-051-1/+1
| | | | | | SemaInit.cpp. Replace them with the boolean conversion or the new Failed() function. This is a first step towards removing InitializationSequence::SequenceKind. No functionality change. llvm-svn: 132664
* Implement defaulting of destructors.Alexis Hunt2011-05-121-0/+15
| | | | llvm-svn: 131260
* Make it so that we actually generate definitions for explicitlyAlexis Hunt2011-05-121-1/+1
| | | | | | | | | | defaulted default constructors. As it happens, making sure that we handle out-of-line defaulted functions properly will involved making sure that we actually parse them correctly, so that's coming after. llvm-svn: 131224
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-1/+2
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* Fix delegating constructors stylistic issues.Alexis Hunt2011-05-031-2/+1
| | | | | | Material bugfixes to come this afternoon. llvm-svn: 130782
* Fully implement delegating constructors!Alexis Hunt2011-05-011-7/+10
| | | | | | | | | | As far as I know, this implementation is complete but might be missing a few optimizations. Exceptions and virtual bases are handled correctly. Because I'm an optimist, the web page has appropriately been updated. If I'm wrong, feel free to downgrade its support categories. llvm-svn: 130642
* Don't waste memory if the initializer expression is empty.Argyrios Kyrtzidis2011-04-281-4/+8
| | | | llvm-svn: 130420
* PR4304: Add warning for designators in strict c89 mode.Eli Friedman2011-04-241-0/+3
| | | | llvm-svn: 130117
* Use the ArrayFiller to fill out "holes" in the array initializer due to ↵Argyrios Kyrtzidis2011-04-211-1/+6
| | | | | | | | designated initializers, avoiding to create separate Exprs for each one. llvm-svn: 129933
* ForArgyrios Kyrtzidis2011-04-211-7/+16
| | | | | | | | | | | | | | 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
* In C++, when initializing an array from a pascal string, it's OK if the arrayAnders Carlsson2011-04-141-0/+9
| | | | | | | is 1 element smaller than the string, because we can just strip off the last null character. This matches GCC. llvm-svn: 129490
* PR9669: implement correct checking for [dcl.init.string]p2.Eli Friedman2011-04-111-5/+14
| | | | llvm-svn: 129260
* Use ExprResult& instead of Expr *& in SemaJohn Wiegley2011-04-081-67/+90
| | | | | | | | | | | | | | | | | | | | | | | | | This patch authored by Eric Niebler. Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr pointers as in/out parameters (Expr *&). This is especially true for the routines that apply implicit conversions to nodes in-place. This design is workable only as long as those conversions cannot fail. If they are allowed to fail, they need a way to report their failures. The typical way of doing this in clang is to use an ExprResult, which has an extra bit to signal a valid/invalid state. Returning ExprResult is de riguour elsewhere in the Sema interface. We suggest changing the Expr *& parameters in the Sema interface to ExprResult &. This increases interface consistency and maintainability. This interface change is important for work supporting MS-style C++ properties. For reasons explained here <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>, seemingly trivial operations like rvalue/lvalue conversions that formerly could not fail now can. (The reason is that given the semantics of the feature, getter/setter method lookup cannot happen until the point of use, at which point it may be found that the method does not exist, or it may have the wrong type, or overload resolution may fail, or it may be inaccessible.) llvm-svn: 129143
* Implement delegating constructors partially.Alexis Hunt2011-02-261-0/+7
| | | | | | | | | | | This successfully performs constructor lookup and verifies that a delegating initializer is the only initializer present. This does not perform loop detection in the initialization, but it also doesn't codegen delegating constructors at all, so this won't cause runtime infinite loops yet. llvm-svn: 126552
* Remove the FIXME I introduced last night, and pull the logic forChandler Carruth2011-02-251-3/+8
| | | | | | | | | | marking selected overloads into the callers. This allows a few callers to skip it altogether (they would have anyways because they weren't interested in successful overloads) or defer until after further checks take place much like the check required for PR9323 to avoid marking unused copy constructors. llvm-svn: 126503
* Rough fix for PR9323 that prevents Clang from marking copy constructorChandler Carruth2011-02-251-1/+3
| | | | | | | | | | | | | | | | declarations as referenced when in fact we're not going to even form a call in the AST. This is significant because we attempt to allow as an extension classes with intentionally private and undefined copy constructors to have temporaries bound to references, and so shouldn't warn about the lack of definition for that copy constructor when the class is internal. Doug, John wasn't really satisfied with the presence of overloading at all. This is a stop-gap and there may be a better solution. If you can give me some hints for how you'd prefer to see this solved, I'll happily switch things over. llvm-svn: 126480
* Implement the GNU C extension which permits the initialization of anDouglas Gregor2011-02-221-4/+101
| | | | | | array from a constant array compound literal. Fixes PR9261. llvm-svn: 126230
* Reorganize subelement initialization checking, no functionality change.John McCall2011-02-211-70/+82
| | | | llvm-svn: 126116
* Small optimization: avoid redundant checks of whether a type is an arrayJohn McCall2011-02-211-21/+25
| | | | | | when checking an initialization. llvm-svn: 126115
* implement a tiny amount of codegen support for gnu array range Chris Lattner2011-02-191-2/+7
| | | | | | | | designators: allowing codegen when the element initializer is a constant or something else without a side effect. This unblocks enough to let process.c in the linux kernel build, PR9257. llvm-svn: 126056
* Handle the resolution of a reference to a function template (whichDouglas Gregor2011-02-191-4/+8
| | | | | | | | includes explicitly-specified template arguments) to a function template specialization in cases where no deduction is performed or deduction fails. Patch by Faisal Vali, fixes PR7505! llvm-svn: 126048
* When initializing struct members, the important thing is that the ↵Argyrios Kyrtzidis2011-02-011-1/+2
| | | | | | | | | | "initializing" expression is compatible, not having the same type. Fix rdar://8183908 in which compatible vector types weren't initialized properly leading to a crash. llvm-svn: 124637
* Fixed parameter names.Abramo Bagnara2011-01-271-2/+2
| | | | llvm-svn: 124408
* Fix whitespace.NAKAMURA Takumi2011-01-271-348/+348
| | | | llvm-svn: 124364
* 7bit-ize.NAKAMURA Takumi2011-01-271-3/+3
| | | | llvm-svn: 124363
* Fix a horrible bug in our handling of C-style casting, where a C-styleDouglas Gregor2011-01-271-10/+11
| | | | | | | | | | | derived-to-base cast that also casts away constness (one of the cases for static_cast followed by const_cast) would be treated as a bit-cast rather than a derived-to-base class, causing miscompiles and heartburn. Fixes <rdar://problem/8913298>. llvm-svn: 124340
* Implement the preference for move-construction over copy-constructionDouglas Gregor2011-01-211-4/+4
| | | | | | | | | | | | when returning an NRVO candidate expression. For example, this properly picks the move constructor when dealing with code such as MoveOnlyType f() { MoveOnlyType mot; return mot; } The previously-XFAIL'd rvalue-references test case now works, and has been moved into the appropriate paragraph-specific test case. llvm-svn: 123992
* Promote the static getNRVOCandidate() function, which computed theDouglas Gregor2011-01-211-1/+1
| | | | | | | | | | | | | NRVO candidate for a return statement, to Sema::getCopyElisionCandidate(), and teach it enough to also determine the NRVO candidate for a throw expression. We still don't use the latter information, however. Along the way, implement core issue 1148, which eliminates copy elision from catch parameters and clarifies that copy elision cannot occur from function parameters (which we already implemented). llvm-svn: 123982
* Improve the diagnostic that complains about binding an rvalueDouglas Gregor2011-01-211-0/+1
| | | | | | reference to an lvalue. llvm-svn: 123953
* More work to bring reference binding up to the latest C++0xDouglas Gregor2011-01-211-6/+11
| | | | | | | | | | specification. In particular, an rvalue reference can bind to an initializer expression that is an lvalue if the referent type and the initializer expression type are not reference-related. This is a newer formulation to the previous "rvalue references can never bind to lvalues" rule. llvm-svn: 123952
* When performing reference binding via a conversion function, performDouglas Gregor2011-01-211-7/+2
| | | | | | | type checking based on the actual reference type we're trying to bind the result to, rather than stripping the reference. llvm-svn: 123950
* Start refactoring reference binding to more closely match the C++0xDouglas Gregor2011-01-201-34/+35
| | | | | | | working paper's structure. The only functional change here is that we now handling binding to array rvalues, which we would previously reject. llvm-svn: 123918
* Add some tests for reference-collapsing and referencing bindingDouglas Gregor2011-01-201-3/+1
| | | | | | | | | involving rvalue references, to start scoping out what is and what isn't implemented. In the process, tweak some standards citations, type desugaring, and teach the tentative parser about && in ptr-operator. llvm-svn: 123913
* Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,Douglas Gregor2011-01-201-2/+1
| | | | | | | so allow it to propagate the failure outward. Fixes the crashing part of <rdar://problem/8876150>. llvm-svn: 123863
* Emit an extension diagnostic for C99 designated initializers that appear in ↵Douglas Gregor2011-01-161-0/+5
| | | | | | C++ code llvm-svn: 123582
* MSVC doesn't require an accessible copy-constructor when binding a temporary ↵Francois Pichet2010-12-311-1/+1
| | | | | | | | | | class object to a const-reference. Note: this is not a C++0x behavior change, it was already like that in MSVC 2003. This fixes a compile error when parsing MSVC header files with clang. llvm-svn: 122644
* Redesign the way anonymous fields are handled in designated-initializers.Francois Pichet2010-12-221-67/+31
| | | | | | Previously designated anonymous fields were found via name lookup. This redesign uses the fact that an IndirectFieldDecl declaration will always follow an anonymous implicit field to remove the special case of name lookup. llvm-svn: 122387
* Bump up property conversion earlier in the initialization process. FixesJohn McCall2010-12-071-1/+5
| | | | | | the failed compile in PR8751. llvm-svn: 121192
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-9/+13
| | | | | | | | 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
* Don't crash when initializing a subaggregate in C from a property r-value.John McCall2010-12-041-0/+1
| | | | llvm-svn: 120899
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-5/+11
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* When we're performing an explicit cast of some sort, don't complainDouglas Gregor2010-12-021-6/+4
| | | | | | | | | about deprecated Objective-C pointer conversions. Plus, make sure to actually set an appropriate AssignmentAction when performing an implicit conversion from an InitializationSequence. Fixes regressions in the GCC DejaGNU testsuite. llvm-svn: 120744
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-2/+2
| | | | llvm-svn: 120084
* Major anonymous union/struct redesign.Francois Pichet2010-11-211-0/+5
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-201-6/+4
| | | | llvm-svn: 119886
* Assorted work leading towards the elimination of CK_Unknown.John McCall2010-11-151-1/+1
| | | | llvm-svn: 119138
* When performing initialization of a copy of a temporary object, useDouglas Gregor2010-11-121-3/+5
| | | | | | | direct-initialization (rather than copy-initialization) to initialize the temporary, allowing explicit constructors. Fixes PR8342. llvm-svn: 118880
* Extend the bitfield-truncation warning to initializations.John McCall2010-11-111-1/+8
| | | | | | rdar://problem/8652606 llvm-svn: 118773
OpenPOWER on IntegriCloud