summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Thread a source location into the template-argument deduction routines. ThereJohn McCall2010-02-081-2/+3
| | | | | | | may be some other places that could take advantage of this new information, but I haven't really looked yet. llvm-svn: 95600
* Add support for threadsafe statics, and make them the default (matching gcc).Anders Carlsson2010-02-061-1/+1
| | | | | | Daniel, I'd appreciate a review of the driver/cc1 parts. llvm-svn: 95508
* A dependent initializer with zero arguments should return a NULLDouglas Gregor2010-02-051-0/+3
| | | | | | | initializer (for no initialization) rather than a ParenListExpr with zero arguments in it. llvm-svn: 95382
* Revert the new reference binding code; I came up with a way simpler solution ↵Anders Carlsson2010-02-031-17/+2
| | | | | | for the reference binding bug that is preventing self-hosting. llvm-svn: 95223
* Fix this comment.John McCall2010-02-021-1/+1
| | | | llvm-svn: 95104
* Access checking for implicit user-defined conversions.John McCall2010-02-011-14/+30
| | | | llvm-svn: 94971
* Start creating CXXBindReferenceExpr nodes when binding complex types to ↵Anders Carlsson2010-01-311-3/+19
| | | | | | references. llvm-svn: 94964
* Diagnose binding a non-const reference to a vector element.Anders Carlsson2010-01-311-1/+9
| | | | llvm-svn: 94963
* Rework base and member initialization in constructors, with severalDouglas Gregor2010-01-311-9/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (necessarily simultaneous) changes: - CXXBaseOrMemberInitializer now contains only a single initializer rather than a set of initialiation arguments + a constructor. The single initializer covers all aspects of initialization, including constructor calls as necessary but also cleanup of temporaries created by the initializer (which we never handled before!). - Rework + simplify code generation for CXXBaseOrMemberInitializers, since we can now just emit the initializer as an initializer. - Switched base and member initialization over to the new initialization code (InitializationSequence), so that it - Improved diagnostics for the new initialization code when initializing bases and members, to match the diagnostics produced by the previous (special-purpose) code. - Simplify the representation of type-checked constructor initializers in templates; instead of keeping the fully-type-checked AST, which is rather hard to undo at template instantiation time, throw away the type-checked AST and store the raw expressions in the AST. This simplifies instantiation, but loses a little but of information in the AST. - When type-checking implicit base or member initializers within a dependent context, don't add the generated initializers into the AST, because they'll look like they were explicit. - Record in CXXConstructExpr when the constructor call is to initialize a base class, so that CodeGen does not have to infer it from context. This ensures that we call the right kind of constructor. There are also a few "opportunity" fixes here that were needed to not regress, for example: - Diagnose default-initialization of a const-qualified class that does not have a user-declared default constructor. We had this diagnostic specifically for bases and members, but missed it for variables. That's fixed now. - When defining the implicit constructors, destructor, and copy-assignment operator, set the CurContext to that constructor when we're defining the body. llvm-svn: 94952
* Eliminate yet another old-school PerformCopyInitialization.Anders Carlsson2010-01-301-1/+3
| | | | llvm-svn: 94874
* Fix reference-binding when we have a reference to const volatile type;Douglas Gregor2010-01-291-1/+2
| | | | | | | previously, we were allowing this to bind to a temporary. Now, we don't; add test-cases and improve diagnostics. llvm-svn: 94831
* Fix reference binding of const lvalue references to bit-fields, whichDouglas Gregor2010-01-291-3/+195
| | | | | | | | | | | | | | | | | requires a temporary. Previously, we were building an initialization sequence that bound to the bit-field as if it were a real lvalue. Note that we previously (and still) diagnose binding of non-const references to bit-fields, as we should. There's no real way to test that this code is correct, since reference binding does not *currently* have any representation in the AST. This fix should make it easier for that to happen, so I've verified this fix with... Added InitializationSequence::dump(), to print an initialization sequence for debugging purposes. llvm-svn: 94826
* Simplify InitListChecker::CheckReferenceTypeAnders Carlsson2010-01-291-11/+10
| | | | llvm-svn: 94793
* Pass access specifiers around in overload resolution.John McCall2010-01-261-14/+25
| | | | llvm-svn: 94485
* Code simplification; this should have no visible effects.Eli Friedman2010-01-251-33/+2
| | | | llvm-svn: 94427
* Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes ↵Anders Carlsson2010-01-241-16/+28
| | | | | | the bug where array elements and member initializers weren't copied correctly. llvm-svn: 94340
* Change all InitializedEntity pointers over to be references.Anders Carlsson2010-01-231-137/+81
| | | | llvm-svn: 94335
* Start passing InitializedEntity to CheckDesignatedInitializer.Anders Carlsson2010-01-231-9/+22
| | | | llvm-svn: 94334
* More init work, adding more entity parameters.Anders Carlsson2010-01-231-10/+27
| | | | llvm-svn: 94332
* Use the new init code for member subobjects.Anders Carlsson2010-01-231-6/+18
| | | | llvm-svn: 94329
* Switch some array initialization over to the new init code.Anders Carlsson2010-01-231-7/+22
| | | | llvm-svn: 94327
* Baby steps towards migrating the InitListChecker over to the new ↵Anders Carlsson2010-01-231-33/+65
| | | | | | initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++. llvm-svn: 94325
* When an InitializedEntity is passed to CheckSingleInitializer, call the new ↵Anders Carlsson2010-01-231-22/+36
| | | | | | Sema::PerformCopyInitialization overload. llvm-svn: 94324
* Change CheckSingleInitializer to take/return OwningExprResults instead. No ↵Anders Carlsson2010-01-231-24/+46
| | | | | | functionality change. llvm-svn: 94316
* Separate EK_ArrayOrVectorElement into EK_ArrayElement and EK_VectorElement; ↵Anders Carlsson2010-01-231-9/+18
| | | | | | arrays and vectors are pretty different beasts in C++. Doug, please review/comment. llvm-svn: 94279
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-6/+5
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* Fix the CodeGen half of PR5911 by changing reference initialization toChandler Carruth2010-01-121-8/+12
| | | | | | | correctly look through arrays to see cv-qualifiers. Also enhances the routine for doing this to preserve more type sugaring for diagnostics. llvm-svn: 93252
* So I was sitting around, trying vainly to think of something to commit, and thenJohn McCall2010-01-121-7/+12
| | | | | | | | I said to myself, self, why don't you go add a couple of parameters to a method and then fail to use them, and I thought that sounded like a pretty good idea, so I did it. llvm-svn: 93233
* Introduce a specific representation for the ambiguous implicit conversionJohn McCall2010-01-121-6/+11
| | | | | | | sequence. Lots of small relevant changes. Fixes some serious problems with ambiguous conversions; also possibly improves associated diagnostics. llvm-svn: 93214
* Change the printing of OR_Deleted overload results to print all the candidates,John McCall2010-01-081-7/+8
| | | | | | | | | | | | | | | not just the viable ones. This is reasonable because the most common use of deleted functions is to exclude some implicit conversion during calls; users therefore will want to figure out why some other options were excluded. Started sorting overload results. Right now it just sorts by location in the translation unit (after putting viable functions first), but we can do better than that. Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better self-documentation. llvm-svn: 92990
* Whenever we emit a typo-correction diagnostic, also emit a noteDouglas Gregor2010-01-071-0/+3
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* Move the allocation of designators in DesignatedInitExpr to theDouglas Gregor2010-01-061-1/+1
| | | | | | ASTContext. Fixes <rdar://problem/7495428>. llvm-svn: 92867
* Typo correction for C99 designated field initializers, e.g.,Douglas Gregor2010-01-011-15/+53
| | | | | | | | | | test/FixIt/typo.c:19:4: error: field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'? .bunds. ^~~~~ bounds llvm-svn: 92376
* Switch parameter-passing for calls via function pointers (where weDouglas Gregor2009-12-221-1/+5
| | | | | | don't have a FunctionDecl) over to InitializationSequence. llvm-svn: 91906
* Switch InitializedEntity from TypeLoc down to just QualTypes, since we don't ↵Douglas Gregor2009-12-221-73/+36
| | | | | | use the location information but we did spend a bunch of time building faked-up TypeLocs llvm-svn: 91905
* Switch initialization of parameters in a call over toDouglas Gregor2009-12-221-4/+19
| | | | | | | | | | | InitializationSequence (when a FunctionDecl is present). This required a few small fixes to initialization sequences: - Make sure to use the adjusted parameter type for initialization of function parameters. - Implement transparent union calling semantics in C llvm-svn: 91902
* Zap CheckInitializerTypes.Eli Friedman2009-12-221-112/+0
| | | | llvm-svn: 91884
* Switch compound literals over to InitializationSequence.Eli Friedman2009-12-221-1/+1
| | | | llvm-svn: 91882
* Switch file-scope assignment initialization over to InitializationSequence.Eli Friedman2009-12-221-1/+5
| | | | llvm-svn: 91881
* Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor2009-12-221-1/+1
| | | | | | since the context is available in the Decl llvm-svn: 91862
* When filling in value initializations within an initializer list, beDouglas Gregor2009-12-221-65/+86
| | | | | | | sure to fill in the initialized member of a union when a member was explicitly designated. Fixes PR5843. llvm-svn: 91858
* Fix review comment; no visible change.Eli Friedman2009-12-201-28/+29
| | | | llvm-svn: 91797
* Switch default-initialization of variables of class type (or array thereof) ↵Douglas Gregor2009-12-201-1/+2
| | | | | | over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one llvm-svn: 91796
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-191-11/+32
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* Switch more of Sema::CheckInitializerTypes over toDouglas Gregor2009-12-191-80/+43
| | | | | | | | | | InitializationSequence. Specially, switch initialization of a C++ class type (either copy- or direct-initialization). Also, make sure that we create an elidable copy-construction when performing copy initialization of a C++ class variable. Fixes PR5826. llvm-svn: 91750
* Switch the initialization required by return statements over to theDouglas Gregor2009-12-181-32/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | new InitializationSequence. This fixes some bugs (e.g., PR5808), changed some diagnostics, and caused more churn than expected. What's new: - InitializationSequence now has a "C conversion sequence" category and step kind, which falls back to - Changed the diagnostics for returns to always have the result type of the function first and the type of the expression second. CheckSingleAssignmentConstraints to peform checking in C. - Improved ASTs for initialization of return values. The ASTs now capture all of the temporaries we need to create, but intentionally do not bind the tempoary that is actually returned, so that it won't get destroyed twice. - Make sure to perform an (elidable!) copy of the class object that is returned from a class. - Fix copy elision in CodeGen to properly see through the subexpressions that occur with elidable copies. - Give "new" its own entity kind; as with return values and thrown objects, we don't bind the expression so we don't call a destructor for it. Note that, with this patch, I've broken returning move-only types in C++0x. We'll fix it later, when we tackle NRVO. llvm-svn: 91669
* When value-initializing a class with no user-defined constructors butDouglas Gregor2009-12-161-10/+34
| | | | | | | with a non-trivial default constructor, zero-initialize the storage and then call the default constructor. Fixes PR5800. llvm-svn: 91548
* In Sema::CheckInitializerTypes, replace a use of CheckReferenceInit with an ↵Douglas Gregor2009-12-161-5/+11
| | | | | | InitializationSequence llvm-svn: 91542
* Eliminate Sema::CheckValueInitialization; its callers now useDouglas Gregor2009-12-161-93/+120
| | | | | | | | | | | | | | InitializationSequence to perform the actual initialization. Also, introduced the notion of a tree of initialized entities, so that we can know where an initialization began when dealing with nested initializations (as occur when performing list initialization). This will, eventually, be useful for producing better diagnostics when list initialization fails, because we can show the path from the top-level object being initialized down to the actual subobject where initialization failed. llvm-svn: 91516
* Fix semantic diagnostics that embed English works, from Nicola Gigante!Douglas Gregor2009-12-161-7/+7
| | | | llvm-svn: 91503
OpenPOWER on IntegriCloud