summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove broken fix-it when a default function argument has beenDouglas Gregor2010-01-131-10/+10
| | | | | | | redefined. There's a FIXME with an apology about why we don't try to do better here. Fixes <rdar://problem/7513023>. llvm-svn: 93274
* So I was sitting around, trying vainly to think of something to commit, and thenJohn McCall2010-01-121-4/+4
| | | | | | | | 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-15/+12
| | | | | | | sequence. Lots of small relevant changes. Fixes some serious problems with ambiguous conversions; also possibly improves associated diagnostics. llvm-svn: 93214
* Eliminate an embarrassing performance regression in C/ObjC, where weDouglas Gregor2010-01-111-0/+2
| | | | | | | | | | were performing name lookup for template names in C/ObjC and always finding nothing. Turn off such lookup unless we're in C++ mode, along with the check that determines whether the given identifier is a "current class name", and assert that we don't make this mistake again. llvm-svn: 93207
* Add support for out-of-line definitions of conversion functionDouglas Gregor2010-01-111-4/+7
| | | | | | | | templates. Previously, a little thinko in the code that replaced a conversion function template with its redeclaration was causing some very weird lookup behavior. llvm-svn: 93166
* Implement name lookup for conversion function template specializationsDouglas Gregor2010-01-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | (C++ [temp.mem]p5-6), which involves template argument deduction based on the type named, e.g., given struct X { template<typename T> operator T*(); } x; when we call x.operator int*(); we perform template argument deduction to determine that T=int. This template argument deduction is needed for template specialization and explicit instantiation, e.g., template<> X::operator float*() { /* ... */ } and when calling or otherwise naming a conversion function (as in the first example). This fixes PR5742 and PR5762, although there's some remaining ugliness that's causing out-of-line definitions of conversion function templates to fail. I'll look into that separately. llvm-svn: 93162
* Change the printing of OR_Deleted overload results to print all the candidates,John McCall2010-01-081-4/+4
| | | | | | | | | | | | | | | 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
* When we typo-correct a base class initializer, point to the base classDouglas Gregor2010-01-071-1/+8
| | | | | | specifier that we corrected to. llvm-svn: 92878
* Whenever we emit a typo-correction diagnostic, also emit a noteDouglas Gregor2010-01-071-0/+2
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* Fix marking of virtual members for nested classes whose first non-pure ↵Douglas Gregor2010-01-061-5/+31
| | | | | | virtual function has a body inlined in the class llvm-svn: 92855
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-061-1/+1
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Make our marking of virtual members functions in a class beDouglas Gregor2010-01-061-51/+14
| | | | | | | | | | | | | | | | | | | | | deterministic and work properly with templates. Once a class that needs a vtable has been defined, we now do one if two things: - If the class has no key function, we place the class on a list of classes whose virtual functions will need to be "marked" at the end of the translation unit. The delay until the end of the translation unit is needed because we might see template specializations of these virtual functions. - If the class has a key function, we do nothing; when the key function is defined, the class will be placed on the aforementioned list. At the end of the translation unit, we "mark" all of the virtual functions of the classes on the list as used, possibly causing template instantiation and other classes to be added to the list. This gets LLVM's lib/Support/CommandLine.cpp compiling again. llvm-svn: 92821
* Improve key-function computation for templates. In particular:Douglas Gregor2010-01-051-10/+22
| | | | | | | | | | | | | | | | - All classes can have a key function; templates don't change that. non-template classes when computing the key function. - We always mark all of the virtual member functions of class template instantiations. - The vtable for an instantiation of a class template has weak linkage. We could probably use available_externally linkage for vtables of classes instantiated by explicit instantiation declarations (extern templates), but GCC doesn't do this and I'm not 100% that the ABI permits it. llvm-svn: 92753
* It's OK for a return type to be incomplete if it's being defined.Anders Carlsson2009-12-311-3/+6
| | | | llvm-svn: 92367
* Make sure that an overriding return type is complete before checking if it's ↵Anders Carlsson2009-12-311-0/+9
| | | | | | covariant. Fixes PR5920. llvm-svn: 92365
* Typo correction for C++ base and member initializers, e.g.,Douglas Gregor2009-12-311-32/+88
| | | | | | | | | | | | | | | test/FixIt/typo.cpp:41:15: error: initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'? Derived() : base(), ^~~~ Base test/FixIt/typo.cpp:42:15: error: initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'? ember() { } ^~~~~ member llvm-svn: 92355
* improve diagnostics for case when a field type is unknown byChris Lattner2009-12-311-1/+2
| | | | | | | not emitting a follow-on error about 'int', which the user never wrote. PR5924. llvm-svn: 92339
* Correctly refer to element CVR qualifications when determining if a type isChandler Carruth2009-12-291-4/+12
| | | | | | | | | | more or less cv-qualified than another during implicit conversion and overload resolution ([basic.type.qualifier] p5). Factors the logic out of template deduction and into the ASTContext so it can be shared. This fixes several aspects of PR5542, but not all of them. llvm-svn: 92248
* Attempted fix for PR5884; this code will be dead soon, but this fix shouldEli Friedman2009-12-251-3/+2
| | | | | | help for the moment. llvm-svn: 92165
* Remove some dead variables clang-analyzer found.Benjamin Kramer2009-12-251-3/+0
| | | | llvm-svn: 92162
* Make copy constructor elimination work in more cases; the case in questionEli Friedman2009-12-241-0/+4
| | | | | | here affects clang-on-clang. llvm-svn: 92151
* Egregious, disgusting workaround for PR5866. We need to rework how weDouglas Gregor2009-12-241-0/+3
| | | | | | | | keep track of friends within templates, which will provide a real for PR5866. For now, this makes sure we don't do something entirely stupid with friends of specializations. llvm-svn: 92143
* Fix -Asserts warning.Daniel Dunbar2009-12-241-2/+1
| | | | llvm-svn: 92137
* Allow the first parameter of operator new to be a cv-qualifiedDouglas Gregor2009-12-221-1/+1
| | | | | | | | size_t. Also, fix an issue with initialization of parameters in calls, where we weren't removing the cv-qualifiers on the parameter type itself. Fixes PR5823. llvm-svn: 91941
* Switch Sema::AddCXXDirectInitializerToDecl over to InitializationSequenceDouglas Gregor2009-12-221-35/+32
| | | | llvm-svn: 91927
* Switch default arguments over to InitializationSequence.Eli Friedman2009-12-221-1/+5
| | | | llvm-svn: 91883
* Stop diagnosing the use of inner classes as friends. ddunbar asked whetherJohn McCall2009-12-221-7/+4
| | | | | | | | | this was useful, and on review Doug and I decided it was probably on the level of a bug in the standard and therefore not worth a warning even in -pedantic. If someone disagrees and urgently wants clang++ to warn about this in strict c++98 mode, we can talk about it. llvm-svn: 91868
* Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor2009-12-221-2/+2
| | | | | | since the context is available in the Decl llvm-svn: 91862
* Reorganize the base-lookup bits of ActOnMemInitializer in order to betterJohn McCall2009-12-211-8/+24
| | | | | | support diagnostics and error recovery. llvm-svn: 91825
* Refactor to remove more dependencies on PreDeclaratorDC. I seem to have madeJohn McCall2009-12-191-48/+14
| | | | | | | the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can live with that; they'll need to be fixed more holistically anyhow. llvm-svn: 91771
* Just push a new scope when parsing an out-of-line variable definition.John McCall2009-12-191-33/+43
| | | | | | | Magically fixes all the terrible lookup problems associated with not pushing a new scope. Resolves an ancient xfail and an LLVM misparse. llvm-svn: 91769
* Switch the initialization required by return statements over to theDouglas Gregor2009-12-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Correctly calcluate abstract-ness in the case where an implicitly declaredEli Friedman2009-12-161-3/+6
| | | | | | method overrides a pure virtual method. llvm-svn: 91558
* When value-initializing a class with no user-defined constructors butDouglas Gregor2009-12-161-5/+7
| | | | | | | with a non-trivial default constructor, zero-initialize the storage and then call the default constructor. Fixes PR5800. llvm-svn: 91548
* Fix semantic diagnostics that embed English works, from Nicola Gigante!Douglas Gregor2009-12-161-3/+3
| | | | llvm-svn: 91503
* Successive anonymous namespaces name the same scope. I misinterpreted theJohn McCall2009-12-161-14/+35
| | | | | | standard the last time. Fixes PR5766. llvm-svn: 91493
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-3/+6
| | | | | | | | | | | | | | | | | | | | | than using its own partial implementation of initialization. Switched CheckInitializerTypes over to InitializedEntity/InitializationKind, to help move us closer to InitializationSequence. Added InitializedEntity::getName() to retrieve the name of the entity, for diagnostics that care about such things. Implemented support for default initialization in InitializationSequence. Clean up the determination of the "source expressions" for an initialization sequence in InitializationSequence::Perform. Taught CXXConstructExpr to store more location information. llvm-svn: 91492
* ShouldDestroyTemporaries? I don't think so.Anders Carlsson2009-12-151-2/+2
| | | | llvm-svn: 91450
* Fix some diagnostic-related FIXMEs, from Nicola GiganteDouglas Gregor2009-12-151-2/+2
| | | | llvm-svn: 91433
* More improvements to checking allocation and deallocation functions.Anders Carlsson2009-12-131-44/+76
| | | | llvm-svn: 91244
* Fix tyop.Anders Carlsson2009-12-121-1/+1
| | | | llvm-svn: 91204
* Correctly diagnose [basic.stc.dynamic.allocation]p1Anders Carlsson2009-12-121-11/+29
| | | | llvm-svn: 91190
* Factor operator new declaration checking out into a separate function.Anders Carlsson2009-12-121-19/+24
| | | | llvm-svn: 91189
* More work on improving the operator delete diagnostics.Anders Carlsson2009-12-121-9/+19
| | | | llvm-svn: 91187
* Fix build.Anders Carlsson2009-12-111-7/+1
| | | | llvm-svn: 91182
* Improve diagnostics for malformed delete operator function declarations.Anders Carlsson2009-12-111-4/+55
| | | | llvm-svn: 91180
* Random string-related cleanups.Benjamin Kramer2009-12-111-3/+1
| | | | llvm-svn: 91119
* Check if the target of a using decl is already declared in this scope beforeJohn McCall2009-12-111-12/+15
| | | | | | | doing any of the other redeclaration checks. We were missing a few cases. Fixes PR 5752. llvm-svn: 91096
* Implement access declarations. Most of the work here is parsing them, whichJohn McCall2009-12-111-0/+13
| | | | | | | | | | | | is difficult because they're so terribly, terribly ambiguous. We implement access declarations in terms of using declarations, which is quite reasonable. However, we should really persist the access/using distinction in the AST and use the appropriate name in diagnostics. This isn't a priority, so I'll just file a PR and hope someone else does it. :) llvm-svn: 91095
* Improve the diagnostic when a new declaration conflicts with a using shadowJohn McCall2009-12-101-12/+5
| | | | | | | | declaration. Rename note_using_decl to note_using, which is possibly less confusing. Add a test for non-class-scope using decl collisions and be sure to note the case we can't diagnose yet. llvm-svn: 91057
OpenPOWER on IntegriCloud