summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Sema/Obj-C: Narrow type, and simplify.Daniel Dunbar2010-04-021-14/+6
| | | | llvm-svn: 100210
* Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow ↵Daniel Dunbar2010-04-021-7/+5
| | | | | | type. llvm-svn: 100197
* Rework our handling of copy construction of temporaries, which was aDouglas Gregor2010-04-022-88/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | poor (and wrong) approximation of the actual rules governing when to build a copy and when it can be elided. The correct implementation is actually simpler than the approximation. When we only enumerate constructors as part of initialization (e.g., for direct initialization or when we're copying from a class type or one of its derived classes), we don't create a copy. When we enumerate all conversion functions, we do create a copy. Before, we created some extra copies and missed some others. The new test copy-initialization.cpp shows a case where we missed creating a (required, non-elidable) copy as part of a user-defined conversion, which resulted in a miscompile. This commit also fixes PR6757, where the missing copy made us reject well-formed code in the ternary operator. This commit also cleans up our handling of copy elision in the case where we create an extra copy of a temporary object, which became necessary now that we produce the right copies. The code that seeks to find the temporary object being copied has moved into Expr::getTemporaryObject(); it used to have two different not-quite-the-same implementations, one in Sema and one in CodeGen. Note that we still do not attempt to perform the named return value optimization, so we miss copy elisions for return values and throw expressions. llvm-svn: 100196
* If a constructor is a dependent context, just set the base and member ↵Anders Carlsson2010-04-021-107/+77
| | | | | | initializers as they are written. Fixes a bug where we wouldn't show initialization order warnings when instantiating. llvm-svn: 100180
* Diagnose multiple base and member initializers in class templates.Anders Carlsson2010-04-021-46/+40
| | | | llvm-svn: 100179
* More cleanup.Anders Carlsson2010-04-022-16/+8
| | | | llvm-svn: 100175
* Constify.Anders Carlsson2010-04-021-5/+5
| | | | llvm-svn: 100174
* Minor cleanup.Anders Carlsson2010-04-021-68/+79
| | | | llvm-svn: 100173
* Correct the calculation of access to more closely model the wording inJohn McCall2010-04-021-123/+206
| | | | | | the standard. llvm-svn: 100155
* Minor cleanup with the ternary operatorDouglas Gregor2010-04-011-2/+2
| | | | llvm-svn: 100144
* Overhaul checking of non-type template arguments that should refer toDouglas Gregor2010-04-013-172/+249
| | | | | | | | | | | an object or function. Our previous checking was too lax, and ended up allowing missing or extraneous address-of operators, among other evils. The new checking provides better diagnostics and adheres more closely to the standard. Fixes PR6563 and PR6749. llvm-svn: 100125
* Fix -Asserts warning, and protect against missing case.Daniel Dunbar2010-04-011-2/+3
| | | | llvm-svn: 100115
* Improve diagnostics when an elaborated-type-specifer containing aDouglas Gregor2010-03-313-4/+6
| | | | | | | | | | | | | | | | nested-name-specifier (e.g., "class T::foo") fails to find a tag member in the scope nominated by the nested-name-specifier. Previously, we gave a bland error: 'Nested' does not name a tag member in the specified scope which didn't actually say where we were looking, which was rather horrible when the nested-name-specifier was instantiated. Now, we give something a bit better: error: no class named 'Nested' in 'NoDepBase<T>' llvm-svn: 100060
* Change the representation of dependent elaborated-type-specifiersDouglas Gregor2010-03-313-14/+85
| | | | | | | | | | | | | | (such as "class T::foo") from an ElaboratedType of a TypenameType to a DependentNameType, which more accurately models the underlying concept. Improve template instantiation for DependentNameType nodes that represent nested-name-specifiers, by performing tag name lookup and checking the resulting tag appropriately. Fixes PR5681. There is still much testing and cleanup to do in this area. llvm-svn: 100054
* Extend DependentNameType with a keyword enum that specifies whetherDouglas Gregor2010-03-314-15/+27
| | | | | | | this was parsed as a typename-specifier, elaborated-type-specifier (including the kind), or just a dependent qualified type name. llvm-svn: 100039
* Re-bind non-dependent CXXTemporaryObjectExpr nodes as temporaries whenChandler Carruth2010-03-311-1/+1
| | | | | | | instantiating a template, which ensures the destructor is called. This fixes PR6671. llvm-svn: 100029
* Patch implements gcc's -Wno-protocol option to suppress warningFariborz Jahanian2010-03-312-11/+19
| | | | | | | on unimplemented methods in protocols adopted by a class. (radar 7056600). llvm-svn: 100028
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-3112-116/+93
| | | | | | the C-only "optimization". llvm-svn: 100022
* Rename TypenameType to DependentNameType in anticipation of someDouglas Gregor2010-03-315-28/+28
| | | | | | refactoring work in this area. llvm-svn: 100019
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-3112-93/+116
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-3112-116/+93
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Support __attribute__((unused)) on types. This suddenly started firingJohn McCall2010-03-312-3/+20
| | | | | | a lot for me on selfhosts, I dunno why. llvm-svn: 99981
* Fix PR6327: restore invariants when there's a parse error in an initializer.John McCall2010-03-312-0/+36
| | | | llvm-svn: 99980
* Regularize support for naming conversion functions in using decls.John McCall2010-03-314-19/+37
| | | | llvm-svn: 99979
* Remove silly temporary comment.John McCall2010-03-301-2/+0
| | | | llvm-svn: 99964
* Introduce a new kind of derived-to-base cast which bypasses the need forJohn McCall2010-03-301-4/+4
| | | | | | | null checks, and make sure we elide null checks when accessing base class members. llvm-svn: 99963
* Recognize __attribute__((NSObject)) directly appliedFariborz Jahanian2010-03-302-7/+11
| | | | | | on retain properties. (radar 7809468). llvm-svn: 99951
* Fix an oversight with access control for address-of-function.John McCall2010-03-301-0/+1
| | | | llvm-svn: 99942
* Remember the regparm attribute in FunctionType::ExtInfo.Rafael Espindola2010-03-302-2/+27
| | | | | | Fixes PR3782. llvm-svn: 99940
* Propagate the "found declaration" (i.e. the using declaration instead ofJohn McCall2010-03-3013-104/+267
| | | | | | | | | | | | | the underlying/instantiated decl) through a lot of API, including "intermediate" MemberExprs required for (e.g.) template instantiation. This is necessary because of the access semantics of member accesses to using declarations: only the base class *containing the using decl* need be accessible from the naming class. This allows us to complete an access-controlled selfhost, if there are no recent regressions. llvm-svn: 99936
* Improve diagnostics when printing a template instantiation backtraceDouglas Gregor2010-03-301-2/+14
| | | | | | | | | | involving substitution of deduced template arguments into a class template partial specialization or function template, or when substituting explicitly-specific template arguments into a function template. We now print the actual deduced argument bindings so the user can see what got deduced. llvm-svn: 99923
* the big refactoring bits of PR3782.Rafael Espindola2010-03-309-49/+49
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Add Support for 'warn_unused_result" attribute onFariborz Jahanian2010-03-302-6/+18
| | | | | | objective-c methods. (radar 7418262). llvm-svn: 99903
* Fix a bug where we would incorrectly report an error about initializing two ↵Anders Carlsson2010-03-301-11/+14
| | | | | | fields in an anonymous struct. llvm-svn: 99891
* Reduce nesting.Anders Carlsson2010-03-301-15/+15
| | | | llvm-svn: 99889
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-2910-64/+92
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Exit early from the simple form of Sema::RequireNonAbstractType(), forDouglas Gregor2010-03-291-0/+3
| | | | | | a 2.47% speedup in 403.gcc. llvm-svn: 99830
* Support __attribute__((packed)) (along with other attributes) at theDouglas Gregor2010-03-292-3/+5
| | | | | | end of a struct/class/union in C++, from Justin Bogner! llvm-svn: 99811
* Be a bit more consistent in using operator->Rafael Espindola2010-03-291-1/+1
| | | | | | | This patch moves some methods from QualType to Type and changes the users to use -> instead of . llvm-svn: 99805
* After performing template argument deduction for a function template,Douglas Gregor2010-03-286-137/+365
| | | | | | | | | | | | | | | | | | | | check deduced non-type template arguments and template template arguments against the template parameters for which they were deduced, performing conversions as appropriate so that deduced template arguments get the same treatment as explicitly-specified template arguments. This is the bulk of PR6723. Also keep track of whether deduction of a non-type template argument came from an array bound (vs. anywhere else). With this information, we enforce C++ [temp.deduct.type]p17, which requires exact type matches when deduction deduces a non-type template argument from something that is not an array bound. Finally, when in a SFINAE context, translate the "zero sized arrays are an extension" extension diagnostic into a hard error (for better standard conformance), which was a minor part of PR6723. llvm-svn: 99734
* Further improvement to point to categoryFariborz Jahanian2010-03-272-4/+11
| | | | | | whose protocolls methods needs implementation. llvm-svn: 99730
* Improve diagnostics on incomplete implementationFariborz Jahanian2010-03-271-3/+10
| | | | | | | | of objc classes; including which methods need be implemented and where they come from. WIP. llvm-svn: 99724
* Accumulate all functions and classes that the effective context isJohn McCall2010-03-271-35/+51
| | | | | | | | nested within, and suddenly local classes start working. Wouldn't be necessary if I hadn't used local classes in Clang in the first place. Or, well, wouldn't be necessary yet. :) llvm-svn: 99709
* Implement method friends in class templates and fix a few related problems.John McCall2010-03-272-31/+79
| | | | llvm-svn: 99708
* Remove unused static functionDouglas Gregor2010-03-261-17/+0
| | | | llvm-svn: 99666
* Put function templates instantiated from friend declarations in the correctJohn McCall2010-03-261-6/+15
| | | | | | lexical context. This is required for ADL to work properly; fixes PR6716. llvm-svn: 99665
* Compare namespaces properly when looking for redeclarations ofDouglas Gregor2010-03-261-1/+3
| | | | | | namespace aliases. Fixes PR6341. llvm-svn: 99664
* Add comment indicating that we intentionally don't add the noreturnTed Kremenek2010-03-261-0/+3
| | | | | | attribute to a FunctionDecl. llvm-svn: 99662
* When adding initializers to a constructor, be sure that we are lookingDouglas Gregor2010-03-261-1/+5
| | | | | | | | through the bases and fields of the definition of the class in which the constructor is declared, rather than some other declaration of that class. llvm-svn: 99661
* When trying to determine whether one operand of a conditionalDouglas Gregor2010-03-261-7/+9
| | | | | | | | | expression can be converted to the type of another, only apply the lvalue-to-rvalue conversion to the type of the expression we're converting, *not* the array-to-pointer or function-to-pointer conversions. Fixes PR6595. llvm-svn: 99652
OpenPOWER on IntegriCloud