summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-1/+48
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Don't crash when binding a reference to a temporary pointer created fromRichard Smith2013-01-151-0/+4
| | | | | | | | resolving an overloaded function reference within an initializer list. Previously we would try to resolve the overloaded function reference without first stripping off the InitListExpr wrapper. llvm-svn: 172517
* Only produce one -Wc++98-compat warning when initializing a reference from ↵Richard Smith2013-01-121-0/+1
| | | | | | an init list with multiple elements. llvm-svn: 172285
* PR14838: When a member reference is bound to a temporary, don't forget toRichard Smith2013-01-081-2/+2
| | | | | | | perform the semantic checks associated with the destruction of that temporary. It'll be destroyed at the end of the constructor. llvm-svn: 171818
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-17/+17
| | | | llvm-svn: 171367
* Fix for PR12222.Erik Verbruggen2012-12-251-5/+5
| | | | | | | | Changed getLocStart() and getLocEnd() to be required for Stmts, and make getSourceRange() optional. The default implementation for getSourceRange() is build the range by calling getLocStart() and getLocEnd(). llvm-svn: 171067
* PR13470: Ensure that copy-list-initialization isntantiates asRichard Smith2012-12-191-10/+16
| | | | | | | | | | | | copy-list-initialization (and doesn't add an additional copy step): Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it when instantiating initializers in order to correctly handle instantiation of copy-list-initialization. Teach TreeTransform that function arguments are initializations, and so need this special treatment too. Finally, remove some hacks which were working around SubstInitializer's shortcomings. llvm-svn: 170489
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-14/+10
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Implement C++03 [dcl.init]p5's checking for value-initialization of referencesRichard Smith2012-12-081-4/+64
| | | | | | | | properly, rather than faking it up by pretending that a reference member makes the default constructor non-trivial. That leads to rejects-valids when putting such types inside unions. llvm-svn: 169662
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+4
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Consistently use 'needsImplicit<special member>' to determine whether we needRichard Smith2012-12-011-5/+2
| | | | | | | an implicit special member, rather than sometimes using '!hasDeclared<special member>'. No functionality change. llvm-svn: 169075
* Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,Argyrios Kyrtzidis2012-11-281-9/+10
| | | | | | expose only the iterators instead. llvm-svn: 168770
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-271-7/+19
| | | | | | | | | | | objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
* Copy the decls returned by DeclContext::lookup_result to aArgyrios Kyrtzidis2012-11-131-12/+27
| | | | | | | | | new container so we can safely iterate over them. The container holding the lookup decls can under certain conditions be changed while iterating (e.g. because of deserialization). llvm-svn: 167816
* PR14021: Copy lookup results to ensure safe iteration.David Blaikie2012-10-181-2/+8
| | | | | | | | | | | | | | | | | Within the body of the loop the underlying map may be modified via Sema::AddOverloadCandidate -> Sema::CompareReferenceRelationship -> Sema::RequireCompleteType to avoid the use of invalid iterators the sequence is copied first. A reliable, though large, test case is available - it will be reduced and committed shortly. Patch by Robert Muth. Review by myself, Nico Weber, and Rafael Espindola. llvm-svn: 166188
* Tests for DR1507.Richard Smith2012-10-181-1/+2
| | | | llvm-svn: 166162
* Update comment to match DR1502.Richard Smith2012-10-171-2/+1
| | | | llvm-svn: 166158
* Cleaning up the self initialization checker.Richard Trieu2012-10-011-8/+0
| | | | | | | | | | | -Allow Sema to do more processing on the initial Expr before checking it. -Remove the special conditions in HandleExpr() -Move the code so that only one call site is needed. -Removed the function from Sema and only call it locally. -Warn on potentially evaluated reference variables, not just casts to r-values. -Update tests. llvm-svn: 164951
* When processing an InitListExpr and skipping the initialization of an invalidRichard Smith2012-09-281-0/+2
| | | | | | | record, skip at least one element from the InitListExpr to avoid an infinite loop if we're initializing an array of unknown bound. llvm-svn: 164851
* Move the null check outside of the loop, no functionality change.Argyrios Kyrtzidis2012-09-101-1/+4
| | | | llvm-svn: 163553
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-11/+8
| | | | | | No functionality change. llvm-svn: 162552
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-1/+1
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-4/+4
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-32/+32
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Fix a bunch of -Wdocumentation warnings.Dmitri Gribenko2012-08-231-1/+1
| | | | llvm-svn: 162452
* Simplify code, no functionality change.Benjamin Kramer2012-08-041-2/+1
| | | | llvm-svn: 161303
* Explicitly defaulted constructors cannot be used for default initialization.Aaron Ballman2012-07-311-1/+1
| | | | llvm-svn: 161088
* When testing whether we can perform copy or move initialization, beDouglas Gregor2012-07-311-2/+2
| | | | | | sure to supply an initialization location. Fixes <rdar://problem/11951661>. llvm-svn: 161084
* PR12670: Support for initializing an array of non-aggregate class type from anRichard Smith2012-07-071-41/+34
| | | | | | | initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge and Daniel Lunow. llvm-svn: 159896
* PR13273: When performing list-initialization with an empty initializer list,Richard Smith2012-07-051-109/+102
| | | | | | | | | | | actually perform value initialization rather than trying to fake it with a call to the default constructor. Fixes various bugs related to the previously-missing zero-initialization in this case. I've also moved this and the other list initialization 'special case' from TryConstructorInitialization into TryListInitialization where they belong. llvm-svn: 159733
* Still more Doxygen documentation fixes:James Dennett2012-06-141-1/+1
| | | | | | | | * Escape #, < and @ symbols where Doxygen would try to interpret them; * Fix several function param documentation where names had got out of sync; * Delete param documentation referring to parameters that no longer exist. llvm-svn: 158472
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-22/+22
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Add a warning for when an array-to-pointer decay is performed on an arrayRichard Smith2012-06-041-0/+49
| | | | | | | | | | | | | | | temporary or an array subobject of a class temporary, and the resulting value is used to initialize a pointer which outlives the temporary. Such a pointer is always left dangling after the initialization completes and the array's lifetime ends. In order to detect this situation, this change also adds an LValueClassification of LV_ArrayTemporary for temporaries of array type which aren't subobjects of class temporaries. These occur in C++11 T{...} and GNU C++ (T){...} expressions, when T is an array type. Previously we treated the former as a generic prvalue and the latter as a class temporary. llvm-svn: 157955
* A union can have a constexpr defaulted default constructor, if it has anRichard Smith2012-05-071-5/+4
| | | | | | | | | in-class initializer for one of its fields. Value-initialization of such a type should use the in-class initializer! The former was just a bug, the latter is a (reported) standard defect. llvm-svn: 156274
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-3/+3
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-23/+23
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Add missing -Wc++98-compat warnings for initializer list initializations whichRichard Smith2012-04-191-0/+15
| | | | | | initialize references, create std::initializer_list objects, or call constructors. llvm-svn: 155105
* When we determine that an initialization sequence failed due to anDouglas Gregor2012-04-101-3/+3
| | | | | | | | incomplete type, keep track of the actual type that was incomplete. Otherwise, we might fail to produce a diagnostic. Fixes PR12498. llvm-svn: 154432
* Fix several problems with protected access control:John McCall2012-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | - The [class.protected] restriction is non-trivial for any instance member, even if the access lacks an object (for example, if it's a pointer-to-member constant). In this case, it is equivalent to requiring the naming class to equal the context class. - The [class.protected] restriction applies to accesses to constructors and destructors. A protected constructor or destructor can only be used to create or destroy a base subobject, as a direct result. - Several places were dropping or misapplying object information. The standard could really be much clearer about what the object type is supposed to be in some of these accesses. Usually it's easy enough to find a reasonable answer, but still, the standard makes a very confident statement about accesses to instance members only being possible in either pointer-to-member literals or member access expressions, which just completely ignores concepts like constructor and destructor calls, using declarations, unevaluated field references, etc. llvm-svn: 154248
* Dependent-sequence initialization of a single element can be directDouglas Gregor2012-04-041-1/+2
| | | | | | list-initialization. Loosen an over-eager assertion to fix PR12453. llvm-svn: 153995
* Silence -Wunused-variable in -Asserts buildMatt Beaumont-Gay2012-04-021-0/+1
| | | | llvm-svn: 153885
* Properly handle explicit constructors in list-initialization. Fixes PR12120.Sebastian Redl2012-04-011-2/+27
| | | | llvm-svn: 153849
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-38/+10
| | | | | | member function is deleted. llvm-svn: 153773
* Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix upRichard Smith2012-03-231-2/+4
| | | | | | some calling code to actually pass in a non-null type, to avoid a crash. llvm-svn: 153358
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-42/+42
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-8/+3
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-16/+16
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* Turn explicit construction of temporaries using initializer list syntax into ↵Sebastian Redl2012-03-081-4/+8
| | | | | | CXXTemporaryObjectExprs, not just CXXConstructExprs, which have a worrying tendency to vanish. Fixes PR12167. llvm-svn: 152340
* Be smarter in discovering list-initialization of temporaries. Fixes PR12182.Sebastian Redl2012-03-071-1/+1
| | | | llvm-svn: 152231
* If the element type of an initializer list has a destructor, make sure we ↵Sebastian Redl2012-03-051-0/+13
| | | | | | check it. Fixes PR12178. llvm-svn: 152048
OpenPOWER on IntegriCloud