summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove Expr::hasSideEffects. It doesn't work anywayDouglas Gregor2009-01-281-2/+2
| | | | llvm-svn: 63254
* Improvements to code-generation and semantic analysis of designatedDouglas Gregor2009-01-281-37/+75
| | | | | | | | | | | | initializers. - We now initialize unions properly when a member other than the first is named by a designated initializer. - We now provide proper semantic analysis and code generation for GNU array-range designators *except* that side effects will occur more than once. We warn about this. llvm-svn: 63253
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-97/+345
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* More APSInt appeasementDouglas Gregor2009-01-231-12/+20
| | | | llvm-svn: 62884
* Hopefully the last of the APSInt signedness issues with initializers. Fixes ↵Douglas Gregor2009-01-231-0/+1
| | | | | | PR clang/3378 llvm-svn: 62876
* Make sure all of the isUnsigned flags line up when comparing initializer ↵Douglas Gregor2009-01-231-3/+7
| | | | | | values, to really really fix PR clang/3377 llvm-svn: 62858
* Properly manage the bit-widths of APInts/APSInts in array initialization.Douglas Gregor2009-01-231-7/+12
| | | | | | Fixes PR clang/3377 llvm-svn: 62851
* Reimplement the handling of the "current object" in designatorDouglas Gregor2009-01-221-145/+197
| | | | | | | | | | | initializers, so that we are within the appropriate subobject after we've processed a multi-designator designation. We're matching GCC and EDG's behavior on all examples I've found thus far. *Huge* thanks to Eli Friedman for pointing out my fundamental misunderstanding of "current object" in the C99 spec. llvm-svn: 62812
* Initial implementation of semantic analysis and ASTs for C99Douglas Gregor2009-01-221-33/+358
| | | | | | | | | | | | | | | | | | designated initializers. This implementation should cover all of the constraints in C99 6.7.8, including long, complex designations and computing the size of incomplete array types initialized with a designated initializer. Please see the new test-case and holler if you find cases where this doesn't work. There are still some wrinkles with GNU's anonymous structs and anonymous unions (it isn't clear how these should work; we'll just follow GCC's lead) and with designated initializers for the members of a union. I'll tackle those very soon. CodeGen is still nonexistent, and there's some leftover code in the parser's representation of designators that I'll also need to clean up. llvm-svn: 62737
* Introduce support for C++0x explicit conversion operators (N2437)Douglas Gregor2009-01-141-1/+1
| | | | | | | | | | Small cleanup in the handling of user-defined conversions. Also, implement an optimization when constructing a call. We avoid recomputing implicit conversion sequences and instead use those conversion sequences that we computed as part of overload resolution. llvm-svn: 62231
* Revert my previous, failed attempt to pretty-print anonymous struct/union ↵Douglas Gregor2009-01-081-1/+0
| | | | | | accesses well. Added a FIXME so we know to revisit this later llvm-svn: 61951
* Fix printing of member references to avoid displaying implicitly-generated ↵Douglas Gregor2009-01-071-0/+1
| | | | | | member references, e.g., for anonymous struct/unions or implicit 'this' in member functions llvm-svn: 61885
* Address some comments on the name lookup/DeclContext patch from ChrisDouglas Gregor2008-12-111-1/+1
| | | | llvm-svn: 60897
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-1/+1
| | | | | | | | instead of converting them to strings first. This also fixes a bunch of minor inconsistencies in the diagnostics emitted by clang and adds a bunch of FIXME's to DiagnosticKinds.def. llvm-svn: 59948
* remove the last old-fashioned Diag method. Transition complete!Chris Lattner2008-11-201-2/+2
| | | | llvm-svn: 59714
* remove one more old-style Diag method.Chris Lattner2008-11-191-13/+12
| | | | llvm-svn: 59589
* Remember whether an initlist had a designator in the AST.Chris Lattner2008-10-261-1/+2
| | | | llvm-svn: 58218
* Support initialization of incomplete array with zero size (asDaniel Dunbar2008-08-181-10/+9
| | | | | | extension). llvm-svn: 54946
* More #include cleaningDaniel Dunbar2008-08-111-1/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* Minor #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | - Drop TokenKinds.h from Action.h - Move DeclSpec.h from Sema.h into individual Sema .cpp files llvm-svn: 54625
* InitListChecker::CheckListElementTypes(): Check for function types and issue ↵Steve Naroff2008-08-101-3/+4
| | | | | | an appropriate diagnostic. llvm-svn: 54614
* Make sure to count the struct elements correctly; here, we want the Eli Friedman2008-08-091-1/+2
| | | | | | | | member count. The count returned by numStructUnionElements is the number of initializers that will be consumed, not the number of members to iterate through. Fixes PR2534. llvm-svn: 54601
* Finally fix PR2189. This makes a fairly invasive but important change toChris Lattner2008-08-041-3/+6
| | | | | | | | | | move getAsArrayType into ASTContext instead of being a method on type. This is required because getAsArrayType(const AT), where AT is a typedef for "int[10]" needs to return ArrayType(const int, 10). Fixing this greatly simplifies getArrayDecayedType, which is a good sign. llvm-svn: 54317
* -Changes to TagDecl:Argyrios Kyrtzidis2008-06-091-1/+1
| | | | | | | | | Added TagKind enum. Added getTagKind() method. Added convenience methods: isEnum(), isStruct(), isUnion(), isClass(). -RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one. llvm-svn: 52160
* For struct initialization, check compatibility with the unqualified Eli Friedman2008-06-091-1/+3
| | | | | | | | type; this isn't explicitly stated in the standard, but it doesn't really make sense for them to have an effect here. Fixes the included testcase, sent to me by Steve Naroff. llvm-svn: 52113
* Count the number of initializable members correctly in structs/unions Eli Friedman2008-05-251-2/+6
| | | | | | with unnamed members. llvm-svn: 51557
* Diagnose implicit init list for empty aggregate, like struct {}. Fixes Eli Friedman2008-05-251-0/+7
| | | | | | PR2151 (by not creating the empty implicit init list). llvm-svn: 51556
* Move the error checking for variable-sized objects so we don't Eli Friedman2008-05-251-20/+19
| | | | | | double-report errors; fixes PR2362. llvm-svn: 51555
* Be a bit more defensive in SemaInit.Eli Friedman2008-05-201-1/+7
| | | | llvm-svn: 51301
* Adjust warning so that it doesn't fire when there is an error.Eli Friedman2008-05-191-3/+4
| | | | llvm-svn: 51269
* Add errors for some illegal constructs (specifically, "int a = {{3}};" Eli Friedman2008-05-191-10/+14
| | | | | | and "int a = {};"). I'll adjust the tests in a bit. llvm-svn: 51265
* Some more SemaInit cleanup.Eli Friedman2008-05-191-36/+42
| | | | llvm-svn: 51262
* Various fixes; solves (almost) all of the test regressions that would be Eli Friedman2008-05-191-112/+79
| | | | | | caused by enabling SemaInit. llvm-svn: 51261
* Several fixes to SemaInit.cpp. It's still not enabled (since it fails a few ↵Steve Naroff2008-05-061-31/+48
| | | | | | tests). Expect to enable it very soon. llvm-svn: 50688
* Replace Sema::CheckInitializerListTypes() with a helper class ↵Steve Naroff2008-05-011-0/+292
(InitListChecker) that synthesizes implicit InitListExpr's when appropriate (see InitListExpr comments in Expr.h for more details). I also moved the code to SemaInit.cpp, to help reduce clutter in SemaDecl.cpp. NOTE: This work is incomplete and still fails many tests (as a result, it isn't enabled yet). Nevertheless, I wanted to check it in so I can work on it from home. llvm-svn: 50544
OpenPOWER on IntegriCloud