summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Unnest; no functionality change.John McCall2010-11-111-42/+42
| | | | llvm-svn: 118753
* Add a variant of GCC-style vector types for ARM NEON.Bob Wilson2010-11-101-1/+1
| | | | | | | | | NEON vector types need to be mangled in a special way to comply with ARM's ABI, similar to some of the AltiVec-specific vector types. This patch is mostly just renaming a bunch of "AltiVecSpecific" things, since they will no longer be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum. llvm-svn: 118724
* Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor2010-11-081-8/+30
| | | | | | | | | constructor template will not be used to copy a class object to a value of its own type. We were eliminating all constructor templates whose specializations look like a copy constructor, which eliminated important candidates. Fixes PR8182. llvm-svn: 118418
* When attempting reference binding to an overloaded function, alsoDouglas Gregor2010-11-081-10/+13
| | | | | | | consider that we might be trying to bind a reference to a class type, which involves a constructor call. Fixes PR7425. llvm-svn: 118407
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-081-1/+6
| | | | | | Faisal Vali, tweaked by me. Fixes PR8230. llvm-svn: 118400
* Don't remove the init expression from the initializer list if it had a ↵Argyrios Kyrtzidis2010-10-301-1/+0
| | | | | | | | | semantic error. We already flag the error with InitListChecker's hadError and we mess up the AST unnecessarily. Fixes rdar://8605381. llvm-svn: 117760
* When list-initializing a vector, try to copy-initialize from vectors insteadJohn McCall2010-10-301-53/+82
| | | | | | | | of descending into the subelements. rdar://problem/8345836 llvm-svn: 117749
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-261-1/+1
| | | | | | anymore. llvm-svn: 117357
* Improve the tracking of source locations for parentheses in constructor calls.Chandler Carruth2010-10-251-5/+14
| | | | | | | | | | | | This adds them where missing, and traces them through PCH. We fix at least one bug in the extents found by the Index library, and make a lot of refactoring tools which care about the exact formulation of a constructor call easier to write. Also some minor cleanups to more consistently follow the friend pattern instead of the setter pattern when rebuilding a serialized AST. Patch originally by Samuel Benzaquen. llvm-svn: 117254
* Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor2010-10-121-1/+3
| | | | | | | | | | | | | | | that are suppressed during template argument deduction. This change queues diagnostics computed during template argument deduction. Then, if the resulting function template specialization or partial specialization is chosen by overload resolution or partial ordering (respectively), we will emit the queued diagnostics at that point. This addresses most of PR6784. However, the check for unnamed/local template arguments (which existed before this change) is still only skin-deep, and needs to be extended to look deeper into types. It must be improved to finish PR6784. llvm-svn: 116373
* Allow a string literal to initialize a tail array (PR8217), patch Chris Lattner2010-10-101-1/+2
| | | | | | by Pierre Habouzit! llvm-svn: 116165
* This patch fixes multiple issues in clang's designated init builder andDouglas Gregor2010-10-081-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | completes support for C1X anonymous struct/union init features: * Indexed anonymous member initializers should not be expanded. Doing so makes little sense and would cause unresolvable semantic ambiguity in valid code (regression introduced by r69153). * Subobject initialization of (possibly nested) anonymous members are now referred to with paths relative to the naming record context, eliminating the synthesis of incorrect implicit InitListExprs that caused CodeGen to assert. * Field lookup was missing a null check in IdentifierInfo comparison which caused lookup for a known (already resolved) field to match the first unnamed data member it encountered leading to silent miscompilation. * Subobject paths are no longer built using the general purpose Sema::BuildAnonymousStructUnionMemberPath(). If any corner cases crop up, we will now assert earlier in Sema instead of passing invalid InitListExprs through to CodeGen. Fixes PR6955, from Alp Toker! llvm-svn: 116098
* In Sema's TryRefInitWithConversionFunction, suppress user conversions for ↵Argyrios Kyrtzidis2010-10-051-2/+4
| | | | | | | | | the overload candidates. Fixes an infinite recursion in overload resolution for rdar://8499524. Many thanks to Doug! llvm-svn: 115588
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-2/+1
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
* When performing overload resolution, only compare the final conversionDouglas Gregor2010-09-121-7/+8
| | | | | | | sequences for two conversion functions when in fact we are in the text of initialization by a user-defined conversion sequences. Fixes PR8034. llvm-svn: 113724
* Use the new-initialization code for initializing scalars with aDouglas Gregor2010-09-081-5/+10
| | | | | | | | function-style cast. Previously, we had a (redundant, incorrect) semantic-checking path for non-class types, which allowed value-initialization of a reference type and then crashed. llvm-svn: 113415
* Provide proper type-source location information forDouglas Gregor2010-09-081-4/+14
| | | | | | | | CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the process. llvm-svn: 113319
* Rename DeclContext::getLookupContext to getRedeclContext and change its ↵Sebastian Redl2010-08-311-1/+1
| | | | | | semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them. llvm-svn: 112563
* One who seeks knowledge learns something new every day.John McCall2010-08-261-32/+28
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* Work around a gcc warning.John McCall2010-08-261-0/+1
| | | | llvm-svn: 112192
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-6/+6
| | | | | | to the new constants. llvm-svn: 112047
OpenPOWER on IntegriCloud