summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* More incremental progress towards not including Expr.h in Sema.h.John McCall2010-08-251-35/+31
| | | | llvm-svn: 112044
* Move some of SemaOverload's API to various places in Overload.h, and killJohn McCall2010-08-241-40/+15
| | | | | | some of it off completely. llvm-svn: 111957
* Remove a header dependency from Sema.h at the cost of some type safety.John McCall2010-08-241-2/+6
| | | | | | If someone wants to fix this some other way.... llvm-svn: 111905
* Struggle mightily against header inclusion in Sema.h.John McCall2010-08-241-0/+1
| | | | llvm-svn: 111904
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-15/+15
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Relax the construction of a definition for implicit, trivial defaultChandler Carruth2010-08-231-4/+15
| | | | | | | | | | | | | | | constructors. We perform semantic checking when creating the definition, and this isn't needed in certain contexts (value initialization) but is in others (default initialization). This fixes PR7948. We add explicit code to the default initialization path to ensure the definition is both present and valid. Doug, please review. I think this follows your latest suggestion, and it ended up remarkably cleaner than I anticipated. Also let me know if similar logic should be followed for destructors and copy-constructors. llvm-svn: 111802
* Sundry incremental steps towards killing off Action.John McCall2010-08-231-14/+9
| | | | llvm-svn: 111795
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-1/+1
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Don't try to initialize a reference with a constructed temporary if eitherJohn McCall2010-08-171-0/+5
| | | | | | of the classes is invalid. A class is invalid if a base is invalid. llvm-svn: 111227
* PR3344: Downgrade "too many braces around scalar initializer" to a warning.Eli Friedman2010-08-141-7/+7
| | | | llvm-svn: 111067
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-3/+3
| | | | llvm-svn: 110945
* Allow reference binding of a reference of Objective-C object type toDouglas Gregor2010-08-071-5/+44
| | | | | | | | an lvalue of another, compatible Objective-C object type (e.g., a subclass). Introduce a new initialization sequence step kind to describe this binding, along with a new cast kind. Fixes PR7741. llvm-svn: 110513
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-9/+9
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Make sure that implicit qualification and derived-to-base conversions of ↵Sebastian Redl2010-07-261-4/+8
| | | | | | xvalues preserve xvalue-ness. Unfortunately I have no idea how to test this property; there doesn't seem to be a syntactical construct that triggers such a conversion and still allows the distinction between prvalues and xvalues to be made. llvm-svn: 109406
* Added extra check when looking for location of '=' inFariborz Jahanian2010-07-211-2/+3
| | | | | | a copy initialization. llvm-svn: 109025
OpenPOWER on IntegriCloud