summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [modules] Fix some more cases where we used to reject a conflict between twoRichard Smith2015-11-171-3/+5
| | | | | | | declarations that are not simultaneously visible, and where at least one of them has internal/no linkage. llvm-svn: 253283
* Use Sema::getLocForEndOfToken instead of Preprocessor::getLocForEndOfToken. NFCCraig Topper2015-11-151-3/+3
| | | | llvm-svn: 253155
* [modules] Simplify and generalize the existing rule for finding hiddenRichard Smith2015-11-121-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | declarations in redeclaration lookup. A declaration is now visible to lookup if: * It is visible (not in a module, or in an imported module), or * We're doing redeclaration lookup and it's externally-visible, or * We're doing typo correction and looking for unimported decls. We now support multiple modules having different internal-linkage or no-linkage definitions of the same name for all entities, not just for functions, variables, and some typedefs. As previously, if multiple such entities are visible, any attempt to use them will result in an ambiguity error. This patch fixes the linkage calculation for a number of entities where we previously didn't need to get it right (using-declarations, namespace aliases, and so on). It also classifies enumerators as always having no linkage, which is a slight deviation from the C++ standard's definition, but not an observable change outside modules (this change is being discussed on the -core reflector currently). This also removes the prior special case for tag lookup, which made some cases of this work, but also led to bizarre, bogus "must use 'struct' to refer to type 'Foo' in this scope" diagnostics in C++. llvm-svn: 252960
* [SemaDeclCXX] Use isTemplateParamScope() rather than accessing raw bits.Davide Italiano2015-11-111-2/+2
| | | | llvm-svn: 252793
* [Sema] Remove an unreachable llvm_unreachableDavid Majnemer2015-10-211-1/+0
| | | | | | No functionality change is intended. llvm-svn: 250935
* Roll-back r250822.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-041-2/+2
| | | | llvm-svn: 249259
* [Sema] Don't crash when friending an unqualified templated constructorDavid Majnemer2015-09-301-7/+23
| | | | | | | | | | Unqualified templated constructors cannot be friended and our lack of a diagnostic led to violated invariants. Instead, raise a diagnostic when processing the friend declaration. This fixes PR20251. llvm-svn: 248953
* Don't correct non-class using declarations to class members.Kaelyn Takata2015-09-301-0/+4
| | | | | | | Such declarations would be invalid anyway, and trying to make the correction will lead to a crash. Fixes PR 24781. llvm-svn: 248928
* [modules] A using-declaration doesn't introduce a new entity, just a new nameRichard Smith2015-09-151-1/+2
| | | | | | | for an existing entity, and as such a using-declaration doesn't need to conflict with a hidden entity (nor vice versa). llvm-svn: 247654
* Add a new frontend warning for referencing members from the handler of a ↵Aaron Ballman2015-09-011-3/+4
| | | | | | | | constructor or destructor function-try-block, which is UB in C++. This corresponds to the CERT secure coding rule ERR53-CPP. llvm-svn: 246548
* PR24612: Don't bail out of checking a constexpr function before checkingRichard Smith2015-08-281-3/+3
| | | | | | | whether it can ever produce a constant expression in the case where it has a void return type and no return statements. llvm-svn: 246347
* Delay emitting members of dllexport classes until the class is fully parsed ↵Hans Wennborg2015-08-151-39/+67
| | | | | | | | | | | | | | | | | (PR23542) This enables Clang to correctly handle code such as: struct __declspec(dllexport) S { int x = 42; }; where it would otherwise error due to trying to generate the default constructor before the in-class initializer for x has been parsed. Differential Revision: http://reviews.llvm.org/D11850 llvm-svn: 245139
* [AST] Turn the callbacks of lookupInBases and forallBases into a function_refBenjamin Kramer2015-07-251-101/+85
| | | | | | | | | This lets us pass functors (and lambdas) without void * tricks. On the downside we can't pass CXXRecordDecl's Find* members (which are now type safe) to lookupInBases directly, but a lambda trampoline is a small price to pay. No functionality change intended. llvm-svn: 243217
* Silence a -Wtype-limits warning; NFC.Aaron Ballman2015-07-201-1/+1
| | | | llvm-svn: 242670
* [Sema] Make an assertion stricter.Davide Italiano2015-07-191-1/+1
| | | | | | We now check for the exact range of IdealIndex. llvm-svn: 242652
* [Sema] Refactor Sema::ImplicitExceptionSpecification::CalledDeclDavide Italiano2015-07-161-16/+14
| | | | | | This (hopefully) brings more clarity. No functional changes (intended). llvm-svn: 242483
* Switch users of the 'for (StmtRange range = stmt->children(); range; ↵Benjamin Kramer2015-07-021-10/+9
| | | | | | | | | ++range)‘ pattern to range for loops. The pattern was born out of the lack of range-based for loops in C++98 and is somewhat obscure. No functionality change intended. llvm-svn: 241300
* Rework parsing of pure-specifiers. Perform the grammar matching andRichard Smith2015-06-301-3/+9
| | | | | | disambiguation in the parser rather than trying to do it in Sema. llvm-svn: 241032
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-10/+10
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-10/+10
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [MS Compatibility] Handle cleanups we create for a ctor closureDavid Majnemer2015-06-111-0/+1
| | | | | | This fixes PR23801. llvm-svn: 239503
* Enable DLL attribute propagation on explicit instantiation definitions (PR23770)Hans Wennborg2015-06-091-57/+57
| | | | | | | | This is a follow-up to r225570 which enabled adding DLL attributes when a class template goes from explicit instantiation declaration to explicit instantiation definition. llvm-svn: 239375
* Enable propagation of dll attributes to previously instantiated base class ↵Hans Wennborg2015-06-091-6/+22
| | | | | | | | | | | | | | | templates in some cases It is safe to add a dll attribute if the base class template previously only had an explicit instantiation declaration, or was implicitly instantiated. I both those cases, the members would not have been codegenned yet. In the case of explicit instantiation declaration this is natural, and for implicit instantiations, codegen is deferred (see r225570). This is work towards fixing PR23770. llvm-svn: 239373
* Narrow the -Wunsupported-dll-base-class-template warning.Hans Wennborg2015-06-091-16/+8
| | | | | | | | | | | | | Don't warn about not being able to propagate dll attribute to a base class template when that base already has a different attribute. MSVC doesn't actually try to do this; the first attribute that was propagated takes precedence, so Clang is already doing the right thing and there's no need to warn. (This is a step towards fixing PR21718.) llvm-svn: 239372
* clang-cl: Handle dll attributes in explicit class template specialization ↵Hans Wennborg2015-05-271-18/+18
| | | | | | | | | | definitions (PR23667) Previously, we wouldn't call checkDLLAttribute() after the class template specialization definition if the class template was already instantiated by an explicit class template specialization declaration. llvm-svn: 238266
* [Sema] Don't crash on out-of-line virtual constexpr functionsDavid Majnemer2015-05-221-1/+2
| | | | | | | | | | The method wasn't an overrider but didn't have 'virtual' textually written because our CXXMethodDecl was an out-of-line definition. Make sure we use the canonical decl instead. This fixes PR23629. llvm-svn: 237999
* [modules] Support merging a parsed default function/template argument with ↵Richard Smith2015-05-201-27/+51
| | | | | | an imported but hidden one. llvm-svn: 237814
* Give isCompatibleWithMSVC a better interfaceDavid Majnemer2015-05-111-1/+1
| | | | | | | We now use an enum which maps the marketing name (almost always a year) to the major version number. llvm-svn: 236967
* [MS ABI] Import move assignment operatorsDavid Majnemer2015-05-111-9/+9
| | | | | | | MSVC 2015 changed behavior from 2013; it imports move assignment operators. llvm-svn: 236966
* PR23373: A defaulted union copy constructor that is not trivial must still beRichard Smith2015-04-291-2/+6
| | | | | | emitted as a memcpy. llvm-svn: 236142
* Don't dllimport/export class members with internal linkage (PR23308)Hans Wennborg2015-04-221-0/+3
| | | | | | | | | | For example, a function taking a parameter with internal linkage will itself have internal linkage since it cannot be called outside the translation unit. Differential Revision: http://reviews.llvm.org/D9182 llvm-svn: 235471
* Use the most recent previous decl to check if inline is added after a definitionReid Kleckner2015-04-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This affects this test case: void foo(); template <typename T> class C { friend inline void foo(); }; inline void foo() {} C<int> c; Here, we instantiate the foo friend decl and add it to foo's redecl chain. However, our previous decl pointer happens to reference the first declaration of foo, which is not marked inline. When we check to see if foo was already defined, we implicitly search all previous decls. We should do the same for the inline check, instead of just checking this particular previous decl. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D8872 llvm-svn: 234374
* Minor simplification: do typo-correction before handling inheritingRichard Smith2015-04-011-20/+24
| | | | | | | constructors, instead of having the typo-correction code also dispatch to the inheriting constructor special case. llvm-svn: 233833
* [Sema] Implement DR777Benjamin Kramer2015-03-271-7/+7
| | | | | | | | A parameter pack after a default argument is now valid. PR23029. llvm-svn: 233377
* [Sema] Diagnose default argument on a parameter pack.Benjamin Kramer2015-03-271-2/+11
| | | | | | | | This is ill-formed (and cannot be used anyways). PR23028. llvm-svn: 233376
* MS ABI: Build C++ default argument exprs for exported template classesReid Kleckner2015-03-171-1/+1
| | | | | | This was an omission from r232229. llvm-svn: 232554
* MS ABI: Delay default constructor closure checking until the outermost class ↵Reid Kleckner2015-03-171-0/+38
| | | | | | | | | | | | | | | | | scope ends Previously, we would error out on this code because the default argument wasn't parsed until the end of Outer: struct __declspec(dllexport) Outer { struct __declspec(dllexport) Inner { Inner(void *p = 0); }; }; Now we do the checking on the closing brace of Outer instead of Inner. llvm-svn: 232519
* Sema: Properly track mangling number/name for linkage for using declsDavid Majnemer2015-03-111-1/+6
| | | | | | | | | | | | Using declarations which are aliases to struct types have their name used as the struct type's name for linkage purposes. Otherwise, make sure to give an anonymous struct defined inside a using declaration a mangling number to disambiguate it from other anonymous structs in the same context. This fixes PR22809. llvm-svn: 231909
* Wrap to 80 columns. No behavior change.Nico Weber2015-03-071-2/+3
| | | | llvm-svn: 231573
* Sema: Caught exception objects should be unqualifiedDavid Majnemer2015-03-031-1/+1
| | | | | | | | The exception object should be unqualified. Using a qualified exception object results in the wrong copy constructor getting called when the catch handler executes. llvm-svn: 231054
* Rework our handling of key functions. We used to track a complete list of allRichard Smith2015-02-281-3/+0
| | | | | | | | | | | | | | dynamic classes in the translation unit and check whether each one's key function is defined when we got to the end of the TU (and when we got to the end of each module). This is really terrible for modules performance, since it causes unnecessary deserialization of every dynamic class in every compilation. We now use a much simpler (and, in a modules build, vastly more efficient) system: when we see an out-of-line definition of a virtual function, we check whether that function was in fact its class's key function. (If so, we need to emit the vtable.) llvm-svn: 230830
* [modules] Properly check whether a declaration is std::initializer_list. ThisRichard Smith2015-02-241-1/+1
| | | | | | | bug is not actually modules-specific, but it's a little tricky to tickle it outside of modules builds, so submitting with the reduced testcase I have. llvm-svn: 230303
* Cleanup: remove artificial division between lookup results and const lookupRichard Smith2015-02-211-1/+1
| | | | | | | results. No-one was ever modifying a lookup result, and it would not be reasonable to do so. llvm-svn: 230123
* Improve diagnostic when failing to synthesize implicit member due to ↵Hans Wennborg2015-02-211-0/+6
| | | | | | | | | | | | | | dllexport (PR22591) This is only a problem in C++03 mode targeting MS ABI (MinGW doesn't export inline methods, and C++11 marks these methods implicitly deleted). Since targeting the MS ABI in pre-C++11 mode is a rare configuration, this will probably not get fixed, but we can at least have a better error message. llvm-svn: 230115
* Don't dllexport inline methods when targeting MinGW.Hans Wennborg2015-02-191-2/+2
| | | | | | | | | MinGW neither imports nor exports such methods. The import bit was committed earlier, in r221154, and this takes care of the export part. This also partially fixes PR22591. llvm-svn: 229922
* FIX PR 18432, default args, friends & late-parsed members.Nathan Sidwell2015-02-191-1/+3
| | | | | | | | | | | | Sema::MergeCXXFunctionDecl: propagate hasUnparsedDefaultArg to new decl. Parser::HandleMemberFunctionDeclDelays: check hasUnparsedDefaultArg flag. Parser::ParseLexedMethodDeclaration: handle inherited unparsed default arg case. llvm-svn: 229852
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-2/+2
| | | | | | requiring the macro. NFC; Clang edition. llvm-svn: 229339
* Code cleanupNathan Sidwell2015-01-301-7/+4
| | | | | | | Parser::ParseLexedMethodDeclaration: Use local var for Param Sema::MergeCXXFunctionDecls: Use hasInheritedDefaultArg llvm-svn: 227577
OpenPOWER on IntegriCloud