summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve error recovery in C++: when we hit 'implicit int' cases in C++,Chris Lattner2009-06-261-5/+4
| | | | | | | | | | these are usually because the parser was thoroughly confused. In addition to typing the value being declared as an int and hoping for the best, we mark the value as invalid so we don't get chains of errors when it is used downstream. In C, implicit int actually is valid, so typing the thing as int is good and marking it invalid is bad. :) llvm-svn: 74266
* Allow initializing a vector with a vector in addition to allowing a list Eli Friedman2009-06-131-1/+1
| | | | | | of the elements. Issue reported on cfe-dev by Mattias Holm. llvm-svn: 73292
* Fix for PR4285: allow intializing a const wchar_t array with a wide Eli Friedman2009-05-311-8/+10
| | | | | | string. llvm-svn: 72663
* Remove VarDecl from CXXConstructExpr.Anders Carlsson2009-05-301-2/+2
| | | | llvm-svn: 72633
* Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't ↵Anders Carlsson2009-05-301-6/+3
| | | | | | need to take a VarDecl anymore. (It still does, but it won't for long) llvm-svn: 72630
* Make sure we don't give the wrong warning, and make sure not to set Eli Friedman2009-05-291-6/+9
| | | | | | | hadError (suppressing future diagnostics) if we didn't print an error. llvm-svn: 72588
* Add an assertion so that we don't accidentally build constant arrays of Eli Friedman2009-05-291-1/+1
| | | | | | VLAs. llvm-svn: 72587
* Revert r72575, which isn't really right, and fix up other code to Eli Friedman2009-05-291-20/+20
| | | | | | handle the construct in question correctly. llvm-svn: 72581
* Avoid dumping during semantic analysis when checking array types whenMike Stump2009-05-291-15/+16
| | | | | | a vla is used. llvm-svn: 72575
* Fix another test case.Anders Carlsson2009-05-271-0/+8
| | | | llvm-svn: 72478
* Relax an assert to an if check.Anders Carlsson2009-05-271-3/+3
| | | | llvm-svn: 72477
* Create CXXConstructExprs when constructing via copy initialization.Anders Carlsson2009-05-271-2/+10
| | | | llvm-svn: 72474
* Template instantiation for GNU array-range designators.Douglas Gregor2009-05-211-1/+1
| | | | llvm-svn: 72234
* Template instantiation for C99 designated initializers, because weDouglas Gregor2009-05-211-5/+16
| | | | | | | | can. Also, delay semantic analysis of initialization for value-dependent as well as type-dependent expressions, since we can't always properly type-check a value-dependent expression. llvm-svn: 72233
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-2/+3
| | | | llvm-svn: 72210
* PR3009: Get rid of bogus warning for scalar compound literals.Eli Friedman2009-05-161-1/+1
| | | | | | | | | This patch isn't quite ideal in that it eliminates the warning for constructs like "int a = {1};", where the braces are in fact redundant. However, that would have required a bunch of refactoring, and it's much less likely to cause confusion compared to redundant nested braces. llvm-svn: 71939
* Reflow some comments.Mike Stump2009-05-161-18/+16
| | | | llvm-svn: 71936
* Replace more release+static_cast with takeAs.Anders Carlsson2009-05-011-2/+1
| | | | llvm-svn: 70567
* fix PR4073 by making designated initializer checking code useChris Lattner2009-04-251-28/+16
| | | | | | | | | | | | | | VerifyIntegerConstantExpression instead of isIntegerConstantExpr. This makes it ext-warn but tolerate things that fold to a constant but that are not valid i-c-e's. There must be a bug in the i-c-e computation though, because it doesn't catch this case even with pedantic. This also switches the later code to use EvaluateAsInt which is simpler and handles everything that evaluate does. llvm-svn: 70081
* Attempt to fix a read-after-free running test/Sema/designated-initializers.c.Eli Friedman2009-04-161-3/+3
| | | | | | Douglas, can you check that this is doing the right thing? llvm-svn: 69298
* Implement support for designated initializers that refer to members ofDouglas Gregor2009-04-151-12/+85
| | | | | | anonymous structs or unions. Fixes PR3778. llvm-svn: 69153
* Switch designated-initializer checking from using designator iteratorsDouglas Gregor2009-04-151-16/+17
| | | | | | to using designator indices. No functionality change. llvm-svn: 69147
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-11/+16
| | | | | | No functionality change (really). llvm-svn: 68726
* Add some more code modification hintsDouglas Gregor2009-04-011-1/+3
| | | | llvm-svn: 68261
* Make our diagnostics about the obsolete GNU designated-initializerDouglas Gregor2009-03-281-2/+2
| | | | | | | syntax into extension warnings, and provide code-modification hints showing how to fix the problem. llvm-svn: 67885
* Fix a thinko in the pre-allocation strategy for structured initializerDouglas Gregor2009-03-211-2/+10
| | | | | | | | | | lists. The code wasn't accounting for the distinction between the top-level call to getStructuredSubobjectInit and later calls that occur deeper in the hierarchy. This problem manifested itself as over-allocation in cases where we have large arrays of small structures (<rdar://problem/6707362>). llvm-svn: 67452
* When building the structured initializer list, pre-allocate storage inDouglas Gregor2009-03-201-0/+26
| | | | | | | | | | | its vectors based on the subobject type we're initializing and the (unstructured) initializer list. This eliminates some malloc thrashing when parsing initializers (from 117 vector reallocations down to 0 when parsing Cocoa.h). We can't always pre-allocate the right amount of storage, since designated initializers can cause us to initialize in non-predictable patterns. llvm-svn: 67421
* Allow flexible array initializers that are not surrounded byDouglas Gregor2009-03-201-6/+19
| | | | | | | | braces. We now build the appropriate fully-structured initializer list for such things. Per PR3618, verified that we're getting the right code generation. llvm-svn: 67353
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-1/+1
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Fix PR3509 by providing correct starting locations for initializer listsDouglas Gregor2009-03-011-11/+11
| | | | llvm-svn: 65777
* Eliminate CXXRecordTypeDouglas Gregor2009-02-281-2/+2
| | | | llvm-svn: 65671
* fix a bozobug.Chris Lattner2009-02-261-0/+1
| | | | llvm-svn: 65589
* ok, not as broken as I thought, just confusing. This allows Chris Lattner2009-02-261-1/+1
| | | | | | | initialization of wchar_t arrays with wide strings, and generalizes wchar_size.c to work on all targets. llvm-svn: 65586
* allow wide strings to initialize arrays compatible with wchar_t. Chris Lattner2009-02-261-6/+25
| | | | | | | Unfortunately this doesn't work yet because wchar_t is completely broken in C. llvm-svn: 65585
* handle @encode interactions with array initializers.Chris Lattner2009-02-241-17/+21
| | | | llvm-svn: 65401
* rename CheckStringLiteralInit to CheckStringInit and pass in the Chris Lattner2009-02-241-19/+26
| | | | | | string size as an argument. llvm-svn: 65400
* make SemaRef be a reference to sema, not a pointer.Chris Lattner2009-02-241-78/+78
| | | | llvm-svn: 65399
* move InitListChecker to be private to SemaInit.cppChris Lattner2009-02-241-4/+3
| | | | llvm-svn: 65398
* Make CheckSingleInitializer a static function in SemaInit.cppChris Lattner2009-02-241-13/+13
| | | | llvm-svn: 65397
* make CheckStringLiteralInit a static function in SemaInit.cppChris Lattner2009-02-241-18/+19
| | | | llvm-svn: 65396
* change IsStringLiteralInit into a static function in SemaInit.cppChris Lattner2009-02-241-7/+8
| | | | llvm-svn: 65395
* move some initialization checking code from SemaDecl.cppChris Lattner2009-02-241-3/+156
| | | | | | to SemaInit.cpp, no functionality change. llvm-svn: 65394
* Downgrade the "excess elements in initializer" errors to warnings *inDouglas Gregor2009-02-181-4/+10
| | | | | | C*. They're required errors in C++. llvm-svn: 64964
* Fix a bug with designated initializers where we were stepping out of aDouglas Gregor2009-02-121-8/+7
| | | | | | | | | union subobject initialization before checking whether the next initiailizer was actually a designated initializer. This led to spurious "excess elements in union initializer" errors. Thanks to rdivacky for reporting the bug! llvm-svn: 64392
* When handling "the rest" of a designated array subobject, maybe sureDouglas Gregor2009-02-091-1/+1
| | | | | | | | to tell it that it wasn't (directly) designated. This way, we unwind back to the explicit initializer list properly rather than getting stuck in the wrong subobject. Fixes llvm.org/PR3519 llvm-svn: 64155
* Implement semantic analysis for the GNU flexible array initializationDouglas Gregor2009-02-041-27/+127
| | | | | | | | | | | | | extension. The interaction with designated initializers is a bit... interesting... but we follow GNU's lead and don't permit too much crazy code in this area. Also, make the "excess initializers" error message a bit more informative. Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561 llvm-svn: 63785
* Add iterators to LookupResult, allowing one to iterate over theDouglas Gregor2009-02-021-0/+2
| | | | | | | non-ambiguous name lookup results without allocating any memory, e.g., for sets of overloaded functions. llvm-svn: 63549
* Check value-initializations that occur when an initializer listDouglas Gregor2009-02-021-17/+106
| | | | | | provides too few elements. llvm-svn: 63525
* Upgrade the "excess elements in array initializer" warning to anDouglas Gregor2009-01-301-2/+3
| | | | | | | error, since both C99 and C++ consider it an error. For reference, GCC makes this a warning while G++ makes it an error. llvm-svn: 63435
* Implement and test aggregate initialization in C++. Major changes:Douglas Gregor2009-01-301-31/+155
| | | | | | | | | | | | | | | | - Support initialization of reference members; complain if any reference members are left uninitialized. - Use C++ copy-initialization for initializing each element (falls back to constraint checking in C) - Make sure we diagnose when one tries to provide an initializer list for a non-aggregate. - Don't complain about empty initializers in C++ (they are permitted) - Unrelated but necessary: don't bother trying to convert the decl-specifier-seq to a type when we're dealing with a C++ constructor, destructor, or conversion operator; it results in spurious warnings. llvm-svn: 63431
OpenPOWER on IntegriCloud