summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR20769: Fix confusion when checking whether a prior default argument was inRichard Smith2014-08-271-6/+10
| | | | | | scope when checking for conflicts. llvm-svn: 216628
* More -Wuninitialized updatesRichard Trieu2014-08-271-4/+6
| | | | | | | | | | | Fix r216438 to catch more complicated self-initialized in std::move. For instance, "Foo f = std::move(cond ? OtherFoo : (UNUSED_VALUE, f));" Make sure that BinaryConditionalOperator, ConditionalOperator, BinaryOperator with comma operator, and OpaqueValueExpr perform the correct usage forwarding across the three uninitialized value checkers. llvm-svn: 216627
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-11/+11
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Passing a variable to std::move now counts as a use for -WuninitializedRichard Trieu2014-08-261-0/+15
| | | | llvm-svn: 216438
* [modules] Track the described template in an alias declaration that is theRichard Smith2014-08-261-0/+1
| | | | | | | pattern of an alias template declaration. Use this to merge alias templates properly when they're members of class template specializations. llvm-svn: 216437
* Don't assert on different DLL attributes in template and explicit ↵Hans Wennborg2014-08-241-11/+23
| | | | | | | | | | | | | | | | | | | | instantiation (PR20137) We would previously assert (a decl cannot have two DLL attributes) on this code: template <typename T> struct __declspec(dllimport) S { T f() { return T(); } }; template struct __declspec(dllexport) S<int>; The problem was that when instantiating, we would take the attribute from the template even if the instantiation itself already had an attribute. Also, don't inherit DLL attributes from the template to its members before instantiation, as the attribute may change. I couldn't figure out what MinGW does here, so I'm leaving that open. At least we're not asserting anymore. llvm-svn: 216340
* MS ABI: Inherit DLL attributes to partial class template specializationsHans Wennborg2014-08-231-0/+13
| | | | llvm-svn: 216333
* checkDLLAttribute: remove a redundant dyn_castHans Wennborg2014-08-231-21/+19
| | | | | | The same dyn_cast was done earlier in the function. No functionality change. llvm-svn: 216326
* MS ABI: Don't always instantiate all members of dllexported class templates ↵Hans Wennborg2014-08-211-1/+11
| | | | | | | | | | | | | | | | (PR20163) Normally we mark all members of exported classes referenced to get them emitted. However, MSVC doesn't do this for class templates that are implicitly specialized or just have an explicit instantiation declaration. For such specializations, the members are emitted when referenced. The exception is the case when the dllexport attribute is propagated from a base class to a base class template that doesn't have an explicit attribute: in this case all methods of the base class template do get instantiated. llvm-svn: 216145
* C++1y is now C++14!Aaron Ballman2014-08-191-9/+9
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid ↵Craig Topper2014-08-171-5/+5
| | | | | | needing to mention the size. llvm-svn: 215869
* Improve -Wuninitialized to catch const classes being used in their own copyRichard Trieu2014-08-121-6/+12
| | | | | | constructors. llvm-svn: 215471
* Factor out exception specification information fromRichard Smith2014-07-311-24/+20
| | | | | | | | FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care about the other ExtProtoInfo bits and just want to talk about the exception specification. llvm-svn: 214450
* Updating a comment related to the implementation of -Woverloaded-virtual, ↵Aaron Ballman2014-07-301-1/+8
| | | | | | | | and adding a FIXME to a test case. (Drive-by removal of trailing whitespace in the test case as well.) No functional changes. llvm-svn: 214362
* Avoid crash if default argument parsed with errors.Serge Pavlov2014-07-221-1/+4
| | | | | | | | | | | | | | If function parameters have default values, and that of the second parameter is parsed with errors, function declaration would have a parameter without default value that follows a parameter with that. Such declaration breaks logic of selecting overloaded function. As a solution, put opaque object as default value in such case. This patch fixes PR20055. Differential Revision: http://reviews.llvm.org/D4378 llvm-svn: 213594
* PR20356: Fix all Sema warnings with mismatched ext_/warn_ versusRichard Smith2014-07-191-1/+1
| | | | | | | | ExtWarn/Warnings. Mostly the name of the warning was changed to match the semantics, but in the PR20356 cases, the warning was about valid code, so the diagnostic was changed from ExtWarn to Warning instead. llvm-svn: 213443
* Mark the vtable used when defining implicit copy and move ctorsReid Kleckner2014-07-181-0/+3
| | | | | | | | | | I don't think other implicit members like copy assignment and move assignment require this treatment, because they should already be operating on a constructed object. Fixes PR20351. llvm-svn: 213346
* Track the difference betweenRichard Smith2014-07-171-2/+6
| | | | | | | | | | | | -- a constructor list initialization that unpacked an initializer list into constructor arguments and -- a list initialization that created as std::initializer_list and passed it as the first argument to a constructor in the AST. Use this flag while instantiating templates to provide the right semantics for the resulting initialization. llvm-svn: 213224
* Fix FriendDecl source location and range for class templates and function ↵Nikola Smiljanic2014-07-171-4/+3
| | | | | | declarations that don't start with 'friend' keyword. Add more unittests. llvm-svn: 213220
* Sema: Don't allow CVR qualifiers before structorsDavid Majnemer2014-07-081-4/+23
| | | | | | | | | We would silently accept volatile ~S() when the user probably intended to write virtual ~S(). This fixes PR20238. llvm-svn: 212555
* Introduce a FunctionDecl::getReturnTypeSourceRange() utilityAlp Toker2014-07-021-17/+25
| | | | | | | | | | This source range is useful for all kinds of diagnostic QOI and refactoring work, so let's make it more discoverable. This commit also makes use of the new function to enhance various diagnostics relating to return types and resolves an old FIXME. llvm-svn: 212154
* Convert some function arguments to use ArrayRef.Craig Topper2014-06-261-4/+2
| | | | llvm-svn: 211764
* MS ABI: Propagate class-level DLL attributes to class template ↵Hans Wennborg2014-06-251-4/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | specialization bases (PR11170) Consider the following code: template <typename T> class Base {}; class __declspec(dllexport) class Derived : public Base<int> {} When the base of an exported or imported class is a class template specialization, MSVC will propagate the dll attribute to the base. In the example code, Base<int> becomes a dllexported class. This commit makes Clang do the proopagation when the base hasn't been instantiated yet, and warns about it being unsupported otherwise. This is different from MSVC, which allows changing a specialization back and forth between dllimport and dllexport and seems to let the last one win. Changing the dll attribute after instantiation would be hard for us, and doesn't seem to come up in practice, so I think this is a reasonable limitation to have. MinGW doesn't do this kind of propagation. Differential Revision: http://reviews.llvm.org/D4264 llvm-svn: 211725
* [C++1z] Implement N3928: message in static_assert is optional.Richard Smith2014-06-201-5/+6
| | | | llvm-svn: 211394
* Fix/Improve SourceRange of explicitly defaulted membersDaniel Jasper2014-06-201-12/+25
| | | | | | | | | | | | | | | | When adding the implicit compound statement (required for Codegen?), the end location was previously overridden by the start location, probably based on the assumptions: * The location of the compound statement should be the member's location * The compound statement if present is the last element of a FunctionDecl This patch changes the location of the compound statement to the member's end location. Code review: http://reviews.llvm.org/D4175 llvm-svn: 211344
* Inherit dll attributes to static localsHans Wennborg2014-06-181-11/+0
| | | | | | | | This makes us handle static locals in exported/imported functions correctly. Differential Revision: http://reviews.llvm.org/D4136 llvm-svn: 211173
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-11/+6
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
* MS ABI: Fix inheritance model calculation in CRTPDavid Majnemer2014-06-131-0/+3
| | | | | | | | | | | | | | | | | CRTP-like patterns involve a class which inherits from another class using itself as a template parameter. However, the base class itself may try to create a pointer-to-member which involves the derived class. This is problematic because we may not have finished parsing the most derived classes' base specifiers yet. It turns out that MSVC simply uses the unspecified inheritance model instead of doing anything fancy. This fixes PR19987. llvm-svn: 210886
* Check the access of operator delete from the destructor contextReid Kleckner2014-06-121-1/+3
| | | | | | | | | | | | Previously we would do the access check from the context of MarkVTableUsed. Also update this test to C++11, since that is typically used with the MS C++ ABI. Fixes PR20005. llvm-svn: 210850
* Don't inherit dllimport to inline move assignment operatorsHans Wennborg2014-06-111-2/+15
| | | | | | | | | | | | | | Current MSVC versions don't have move assignment operators, so we can't rely on them being available in the dll. If we have the definition, we can just use that directly. This breaks pointer equality, but should work fine otherwise. When there is an MSVC version that supports move assignment, we can key this off the -fmsc-ver option. http://reviews.llvm.org/D4105 llvm-svn: 210715
* Don't inherit dll attributes to deleted methods (PR19988)Hans Wennborg2014-06-101-3/+2
| | | | | | | | | | | | | We would previously end up with an error when instantiating the following template: template <typename> struct __declspec(dllimport) S { void foo() = delete; }; S<int> s; error: attribute 'dllimport' cannot be applied to a deleted function llvm-svn: 210550
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-091-0/+2
| | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. llvm-svn: 210498
* Fix typosAlp Toker2014-06-061-1/+1
| | | | llvm-svn: 210328
* The exception-declaration for a function-try-block cannot redeclare aAaron Ballman2014-06-021-4/+8
| | | | | | | function parameter. One of our existing test cases was XFAILed because of this. This fixes the issue and un-XFAILs the test. llvm-svn: 210026
* Diagnose dll attribute on member of class that already has a dll attributeHans Wennborg2014-05-311-7/+16
| | | | | | Differential Revision: http://reviews.llvm.org/D3973 llvm-svn: 209954
* Start adding support for dllimport/dllexport on classes (PR11170)Hans Wennborg2014-05-301-0/+57
| | | | | | | | | | | | | | | | This implements the central part of support for dllimport/dllexport on classes: allowing the attribute on class declarations, inheriting it to class members, and forcing emission of exported members. It's based on Nico Rieck's patch from http://reviews.llvm.org/D1099. This patch doesn't propagate dllexport to bases that are template specializations, which is an interesting problem. It also doesn't look at the rules when redeclaring classes with different attributes, I'd like to do that separately. Differential Revision: http://reviews.llvm.org/D3877 llvm-svn: 209908
* Sema: Functions with dll attributes cannot be deletedNico Rieck2014-05-291-0/+15
| | | | llvm-svn: 209827
* Refactoring. Remove Owned method from Sema.Nikola Smiljanic2014-05-291-9/+8
| | | | llvm-svn: 209812
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-47/+47
| | | | | | takeAs to getAs. llvm-svn: 209800
* Consolidate some note diagnosticsAlp Toker2014-05-281-2/+2
| | | | | | | | | These note diags have the same message and can be unified further but for now let's just bring them together. Incidental change: Display a source range in the final attr diagnostic. llvm-svn: 209728
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-176/+183
| | | | llvm-svn: 209613
* PR19352 - getLocation() points to the wrong position for FriendDeclsNikola Smiljanic2014-05-231-1/+3
| | | | llvm-svn: 209511
* DeclVisitor is not used here.Yaron Keren2014-05-211-1/+0
| | | | llvm-svn: 209285
* Fixed spelling.Yaron Keren2014-05-201-1/+1
| | | | llvm-svn: 209224
* Consolidate single void paramter checkingAlp Toker2014-05-111-8/+1
| | | | | | | | Also correct argument/parameter terminology. No change in functionality. llvm-svn: 208498
* Don't emit -Wnon-virtual-dtor on final classes, since it's not a problem there.David Blaikie2014-05-091-1/+2
| | | | | | | | | The base class is the culprit/risk here - a sealed/final derived class with virtual functions and a non-virtual dtor can't accidentally be polymorphically destroyed (if the base class's dtor is protected - which also suppresses this warning). llvm-svn: 208449
* StringRefize and take out an old FIXMEAlp Toker2014-05-051-3/+4
| | | | llvm-svn: 207962
* Rewrite NRVO determination. Track NRVO candidates on the parser Scope and ↵Nick Lewycky2014-05-031-4/+4
| | | | | | | | apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal. Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith. llvm-svn: 207890
* Handle -fdelayed-template-parsing of out-of-line definitions ofHans Wennborg2014-05-021-33/+41
| | | | | | | | | | | class template member classes (PR19613) Also improve this code in general by implementing suggestions from Richard. Differential Revision: http://reviews.llvm.org/D3555?id=9020 llvm-svn: 207822
* Make typo-correction of inheriting constructors work a bit better. LimitRichard Smith2014-05-011-53/+118
| | | | | | | correction to direct base class members, and recover properly after we apply such a correction. llvm-svn: 207731
OpenPOWER on IntegriCloud