summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/nested-name-spec.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't crash when forming a destructor name on an incomplete type.John McCall2017-06-111-0/+7
| | | | | | | | Fixes PR25156. Patch by Don Hinton! llvm-svn: 305169
* Print nested name specifiers for typedefs and type aliasesAlex Lorenz2017-03-101-2/+2
| | | | | | | | | | | | Printing typedefs or type aliases using clang_getTypeSpelling() is missing the namespace they are defined in. This is in contrast to other types that always yield the full typename including namespaces. Patch by Michael Reiher! Differential Revision: https://reviews.llvm.org/D29944 llvm-svn: 297465
* Fix a crash on invalid code.Richard Trieu2016-10-281-0/+18
| | | | | | | | | | | | The diagnostic was attempting to access the QualType of a TypeDecl by calling TypeDecl::getTypeForDecl. However, the Type pointer stored there is lazily loaded by functions in ASTContext. In most cases, the pointer is loaded and this does not cause a problem. However, when more that 50 or so unknown types are seen beforehand, this causes the Type to not be loaded, passing a null Type to the diagnostics, leading to the crash. Using ASTContext::getTypeDeclType will give a proper QualType for all cases. llvm-svn: 285370
* Handle unscoped enumeration in nested name specifier.Serge Pavlov2015-01-181-2/+27
| | | | | | | | | | If an unscoped enum is used as a nested name specifier and the language dialect is not C++ 11, issue an extension warning. This fixes PR16951. Differential Revision: http://reviews.llvm.org/D6389 llvm-svn: 226413
* Update error message text.Serge Pavlov2015-01-181-5/+5
| | | | | | | | | Previously if an enumeration was used in a nested name specifier in pre-C++11 language dialect, error message was 'XXX is not a class, namespace, or scoped enumeration'. This patch removes the word 'scoped' as in C++11 any enumeration may be used in this context. llvm-svn: 226410
* Improve error recovery around colon.Serge Pavlov2014-07-161-0/+99
| | | | | | | | | | | | Recognize additional cases, when '::' is mistyped as ':'. This is a fix to RP18587 - colons have too much protection in member-declarations Review is tracked by http://reviews.llvm.org/D3653. This is an attempt to recommit the fix, initially committed as r212957 but then reverted in r212965 as it broke self-build. In the updated patch ParseDirectDeclarator turns on colon protection in for context as well. llvm-svn: 213120
* Revert "Improve error recovery around colon."Reid Kleckner2014-07-141-99/+0
| | | | | | | | This reverts commit r212957. It broke the self-host on code like this from LLVM's option library: for (auto Arg: filtered(Id0, Id1, Id2)) llvm-svn: 212965
* Improve error recovery around colon.Serge Pavlov2014-07-141-0/+99
| | | | | | | | | Recognize additional cases, when '::' is mistyped as ':'. This is a fix to RP18587 - colons have too much protection in member-declarations. Differential Revision: http://reviews.llvm.org/D3653 llvm-svn: 212957
* Improve error recovery around colon.Serge Pavlov2014-04-131-3/+2
| | | | | | | | | | Parse of nested name spacifier is modified so that it properly recovers if colon is mistyped as double colon in case statement. This patch fixes PR15133. Differential Revision: http://llvm-reviews.chandlerc.com/D2870 llvm-svn: 206135
* Improve diagnostic for using non-class/namespace/scoped enum in a nested ↵David Blaikie2014-02-091-5/+8
| | | | | | | | | | | | | | | name specifier. Rather than simply saying "X is not a class or namespace", clarify what X is by providing the aka type in the case where X is a type, or pointing to the named declaration if there's an unambiguous one to refer to. In the ambiguous case, the ambiguities are already enumerated (though could be clarified by describing what kind of entities they are) Included a few FIXMEs in tests where some further improvements could be made. llvm-svn: 201038
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-141-1/+1
| | | | | | | | | | This patch was submitted to the list for review and didn't receive a LGTM. (In fact one explicit objection and one query were raised.) This reverts commit r197295. llvm-svn: 197299
* Don't require -re suffix on -verify directives with regexes.Hans Wennborg2013-12-141-1/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 llvm-svn: 197295
* Change semantics of regex expectations in the diagnostic verifierHans Wennborg2013-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 llvm-svn: 197092
* Implement DR482: namespace members can be redeclared with a qualified nameRichard Smith2013-12-051-1/+1
| | | | | | | | | | within their namespace, and such a redeclaration isn't required to be a definition any more. Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5 category (but keep Clang 3.4 yellow for now). llvm-svn: 196481
* PR17567: Improve diagnostic for a mistyped constructor name. If we see somethingRichard Smith2013-10-151-3/+1
| | | | | | | | | | | that looks like a function declaration, except that it's missing a return type, try typo-correcting it to the relevant constructor name. In passing, fix a bug where the missing-type-specifier recovery codepath would drop a preceding scope specifier on the floor, leading to follow-on diagnostics and incorrect recovery for the auto-in-c++98 hack. llvm-svn: 192644
* Reword a diagnostic to avoid a confusing implication that it might be talkingRichard Smith2013-08-231-1/+1
| | | | | | about a declaration within a return type. llvm-svn: 189083
* Fix crash w/BlockDecl and invalid qualified decl.Eli Friedman2013-08-121-1/+2
| | | | | | | | | I'm not really satisfied with the ad-hoc nature of Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it. Fixes <rdar://problem/14639501>. llvm-svn: 188208
* Fix r184381 so the test doesn't fail. Sorry for the inconvenience, I ↵Eli Friedman2013-06-191-1/+1
| | | | | | thought I had checked it. llvm-svn: 184382
* Extra test for diagnostic in Sema::BuildCXXNestedNameSpecifier.Eli Friedman2013-06-191-0/+3
| | | | llvm-svn: 184381
* Don't mark a type specifier as "owned" if there is no declaration to own.Douglas Gregor2013-05-141-0/+10
| | | | | | | This simplifies error recovery elsewhere, eliminating the crash in <rdar://problem/13853540>. llvm-svn: 181846
* Promote the warning about extra qualification on a declaration from aDouglas Gregor2012-09-131-4/+4
| | | | | | | | warning to an error. C++ bans it, and both GCC and EDG diagnose it as an error. Microsoft allows it, so we still warn in Microsoft mode. Fixes <rdar://problem/11135644>. llvm-svn: 163831
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-181-2/+1
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* Ignore corrections to functions with bodies when deciding whichKaelyn Uhrain2012-06-071-6/+2
| | | | | | correction to use for an invalid function redeclaration. llvm-svn: 158177
* Allow CorrectTypo to add/modify nested name qualifiers to typos thatKaelyn Uhrain2012-06-061-2/+18
| | | | | | | | | are otherwise too short to try to correct. The TODOs added to two of the tests are for existing deficiencies in the typo correction code that could be exposed by using longer identifiers. llvm-svn: 158109
* PR12500: Improve the wording of the diagnostic for a redefinition of a nameRichard Smith2012-04-131-1/+1
| | | | | | in the wrong namespace scope. Patch by Jonathan Sauer! llvm-svn: 154656
* Unify and fix our checking of C++ [dcl.meaning]p1's requirementsDouglas Gregor2012-03-281-1/+1
| | | | | | | | | concerning qualified declarator-ids. We now diagnose extraneous qualification at namespace scope (which we had previously missed) and diagnose these qualification errors for all kinds of declarations; it was rather uneven before. Fixes <rdar://problem/11135644>. llvm-svn: 153577
* Diagnose tag and class template declarations with qualifiedDouglas Gregor2012-03-171-1/+2
| | | | | | declarator-ids that occur at class scope. Fixes PR8019. llvm-svn: 153002
* Give nicer note when a member redeclaration has or lacks 'const'Kaelyn Uhrain2011-10-101-3/+3
| | | | llvm-svn: 141555
* Match type names and give more info for out-of-line function definition errors.Kaelyn Uhrain2011-08-041-2/+2
| | | | | | | | | | | | | | Having a function declaration and definition with different types for a parameter where the types have same (textual) name can occur when an unqualified type name resolves to types in different namespaces in each location. The error messages have been extended by adding notes that point to the first parameter of the function definition that doesn't match the declaration, instead of a generic "member declaration nearly matches". The generic message is still used in cases where the mismatch is not in the paramenter list, such as mismatched cv qualifiers on the member function itself. llvm-svn: 136891
* Update test for r133934.John McCall2011-06-271-1/+1
| | | | llvm-svn: 133942
* Only do delayed diagnostics if there were no errors when parsing the decl.Argyrios Kyrtzidis2011-06-241-0/+19
| | | | | | Fixes crash in http://llvm.org/PR10109 & rdar://9584039. llvm-svn: 133816
* Test case for previous commitDouglas Gregor2011-02-241-0/+3
| | | | llvm-svn: 126360
* When the out-of-line definition differs from the declaration in the return type,Argyrios Kyrtzidis2011-02-051-0/+5
| | | | | | | | | say "out-of-line definition differ from the declaration in the return type" instead of the silly "functions that differ only in their return type cannot be overloaded". Addresses rdar://7980179. llvm-svn: 124939
* Generalize the checking for qualification of (non-friend) classDouglas Gregor2010-10-131-0/+10
| | | | | | | | members. Provide a hard error when the qualification doesn't match the current class type, or a warning + Fix-it if it does match the current class type. Fixes PR8159. llvm-svn: 116445
* Better diagnostic for superfluous scope specifier inside a class definition ↵Francois Pichet2010-10-011-0/+4
| | | | | | | | | | | for member functions. + Fixit. Example: class A { void A::foo(); //warning: extra qualification on member 'foo' }; llvm-svn: 115347
* Make this grossness default to the error it should always be.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108511
* Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.Chandler Carruth2010-07-161-1/+1
| | | | llvm-svn: 108505
* Make sure to search semantic scopes and appropriate template-parameterDouglas Gregor2010-05-141-0/+16
| | | | | | | scopes during unqualified name lookup that has fallen out to namespace scope. Fixes PR7133. llvm-svn: 103766
* Turn access control on by default in -cc1.John McCall2010-04-091-1/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Make CXXScopeSpec invalid when incomplete, and propagate that into anyJeffrey Yasskin2010-04-081-5/+3
| | | | | | | Declarator that depends on it. This fixes several redundant errors and bad recoveries. llvm-svn: 100779
* Fix some redundant errors by changing CXXScopeSpec::isSet calls intoJeffrey Yasskin2010-04-071-3/+3
| | | | | | isNotEmpty calls. llvm-svn: 100722
* Improve diagnostics when an elaborated-type-specifer containing aDouglas Gregor2010-03-311-1/+1
| | | | | | | | | | | | | | | | 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
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-7/+7
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Fix an assertion-on-error during tentative constructor parsing byJohn McCall2010-02-261-2/+3
| | | | | | | | | | propagating error conditions out of the various annotate-me-a-snowflake routines. Generally (but not universally) removes redundant diagnostics as well as, you know, not crashing on bad code. On the other hand, I have just signed myself up to fix fiddly parser errors for the next week. Again. llvm-svn: 97221
* Fix the crash-on-invalid from PR6259.John McCall2010-02-081-0/+9
| | | | llvm-svn: 95554
* Fix two redefinitions in test cases that weren't diagnosed yet, but will be ↵Sebastian Redl2010-01-261-1/+1
| | | | | | soon. llvm-svn: 94565
* Improve the reporting of non-viable overload candidates by noting the reasonJohn McCall2010-01-131-1/+1
| | | | | | | | why the candidate is non-viable. There's a lot we can do to improve this, but it's a good start. Further improvements should probably be integrated with the bad-initialization reporting routines. llvm-svn: 93277
* 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
* Just push a new scope when parsing an out-of-line variable definition.John McCall2009-12-191-0/+13
| | | | | | | 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 more of Sema::CheckInitializerTypes over toDouglas Gregor2009-12-191-2/+2
| | | | | | | | | | InitializationSequence. Specially, switch initialization of a C++ class type (either copy- or direct-initialization). Also, make sure that we create an elidable copy-construction when performing copy initialization of a C++ class variable. Fixes PR5826. llvm-svn: 91750
OpenPOWER on IntegriCloud