summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/nested-name-spec.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria intoJohn McCall2009-12-181-2/+15
| | | | | | | | | | | | | | | different functions and pick the function at lookup initialization time. In theory we could actually divide the criteria functions into N different functions for the N cases, but it's so not worth it. Among other things, lets us invoke LookupQualifiedName without recomputing IDNS info every time. Do some refactoring in SemaDecl to avoid an awkward special case in LQN that was only necessary for redeclaration testing for anonymous structs/unions --- which could be done more efficiently with a scoped lookup anyway. llvm-svn: 91676
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.Chris Lattner2009-12-071-5/+3
| | | | | | This time with a fix to bail out when in a dependent context. llvm-svn: 90730
* revert my previous patch, it is breaking something and I don't have timeChris Lattner2009-12-061-3/+5
| | | | | | to fix it ATM. llvm-svn: 90717
* this is really about both PR's, 4452 is "don't crash", 4451 is "recover nicely".Chris Lattner2009-12-061-1/+1
| | | | llvm-svn: 90714
* implement PR4451, improving error recovery for a mistaken : where a :: wasChris Lattner2009-12-061-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | intended. On the first testcase in the bug, we now produce: cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier y:a a2; ^ :: instead of: t.cc:8:1: error: C++ requires a type specifier for all declarations x:a a2; ^ t.cc:8:2: error: invalid token after top level declarator x:a a2; ^ ; t.cc:9:11: error: use of undeclared identifier 'a2' x::a a3 = a2; ^ llvm-svn: 90713
* Remove unnecessary -fms-extensions=0 from tests (this command line syntax is ↵Daniel Dunbar2009-11-291-1/+1
| | | | | | going away). llvm-svn: 90066
* Implement the rules in C++ [basic.link] and C99 6.2.2 for computingDouglas Gregor2009-11-251-1/+0
| | | | | | | | | | | the linkage of a declaration. Switch the lame (and completely wrong) NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(), along with the "can this declaration be a template argument?" check that started all of this. Fixes -fsyntax-only for PR5597. llvm-svn: 89891
* Disabling some MS extensions which cause these tests to failJohn Thompson2009-10-271-1/+1
| | | | llvm-svn: 85236
* Improve diagnostics when the parser encounters a declarator with anDouglas Gregor2009-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | unknown type name, e.g., foo::bar x; when "bar" does not refer to a type in "foo". With this change, the parser now calls into the action to perform diagnostics and can try to recover by substituting in an appropriate type. For example, this allows us to easily diagnose some missing "typename" specifiers, which we now do: test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename' prior to dependent type name 'A<T>::type' A<T>::type A<T>::f() { return type(); } ^~~~~~~~~~ typename Fixes PR3990. llvm-svn: 84053
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-6/+6
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Rewrite of our handling of name lookup in C++ member access expressions, e.g.,Douglas Gregor2009-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | x->Base::f We no longer try to "enter" the context of the type that "x" points to. Instead, we drag that object type through the parser and pass it into the Sema routines that need to know how to perform lookup within member access expressions. We now implement most of the crazy name lookup rules in C++ [basic.lookup.classref] for non-templated code, including performing lookup both in the context of the type referred to by the member access and in the scope of the member access itself and then detecting ambiguities when the two lookups collide (p1 and p4; p3 and p7 are still TODO). This change also corrects our handling of name lookup within template arguments of template-ids inside the nested-name-specifier (p6; we used to look into the scope of the object expression for them) and fixes PR4703. I have disabled some tests that involve member access expressions where the object expression has dependent type, because we don't yet have the ability to describe dependent nested-name-specifiers starting with an identifier. llvm-svn: 80843
* Fix a crash that occurs in this C++ case:Argyrios Kyrtzidis2009-07-211-1/+4
| | | | | | | | | struct foo { static bool value; }; bool (foo::value); // crash because of parens llvm-svn: 76538
* Improve error recovery in C++: when we hit 'implicit int' cases in C++,Chris Lattner2009-06-261-2/+1
| | | | | | | | | | these are usually because the parser was thoroughly confused. In addition to typing the value being declared as an int and hoping for the best, we mark the value as invalid so we don't get chains of errors when it is used downstream. In C, implicit int actually is valid, so typing the thing as int is good and marking it invalid is bad. :) llvm-svn: 74266
* fix PR4452, a crash on invalid. The error recovery is still terrible in ↵Chris Lattner2009-06-261-0/+24
| | | | | | | | this case but at least we don't crash :) llvm-svn: 74264
* Make the implicit-int handling error recovery stuff handle C++Chris Lattner2009-04-141-3/+3
| | | | | | | | | | | | | | | | | | | nested name specifiers. Now we emit stuff like: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~ ^ instead of: t.cpp:8:16: error: invalid token after top level declarator static foo::X P; ^ This is inspired by a really awful error message I got from g++ when I misspelt diag::kind as diag::Kind. llvm-svn: 69086
* Fix some C++ error recovery problems in init declarator parsingChris Lattner2009-04-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that I noticed working on other things. Instead of emitting: t2.cc:1:8: error: use of undeclared identifier 'g' int x(*g); ^ t2.cc:1:10: error: expected ')' int x(*g); ^ t2.cc:1:6: note: to match this '(' int x(*g); ^ We now only emit: t2.cc:1:7: warning: type specifier missing, defaults to 'int' int x(*g); ^ Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still not great, we now produce both of: void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \ expected-error {{variable has incomplete type 'void'}} The second diagnostic should be silenced by something getting marked invalid. I don't plan to fix this though. llvm-svn: 68919
* Add some more code modification hintsDouglas Gregor2009-04-011-2/+2
| | | | llvm-svn: 68261
* Tighten the setAccess assert. We now allow AS_none if the decl contex is not ↵Anders Carlsson2009-03-251-1/+0
| | | | | | | | a C++ record decl. Also, fix fallout from the change. llvm-svn: 67717
* Improve handling of base initializers. We now parse initializers in out of ↵Anders Carlsson2009-03-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | line decls, such as: class C { C() { } int a; }; C::C() : a(10) { } We also diagnose when initializers are used on declarations that aren't constructors: t.cpp:1:10: error: only constructors take base initializers void f() : a(10) { } ^ Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.) llvm-svn: 67672
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Template instantiation for the declarations of member functions withinDouglas Gregor2009-03-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | a class template. At present, we can only instantiation normal methods, but not constructors, destructors, or conversion operators. As ever, this contains a bit of refactoring in Sema's type-checking. In particular: - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator (handling the declarator itself) and CheckFunctionDeclaration (checking for the the function declaration), the latter of which is also used by template instantiation. - We were performing the adjustment of function parameter types in three places; collect those into a single new routine. - When the type of a parameter is adjusted, allocate an OriginalParmVarDecl to keep track of the type as it was written. - Eliminate a redundant check for out-of-line declarations of member functions; hide more C++-specific checks on function declarations behind if(getLangOptions().CPlusPlus). llvm-svn: 67575
* Fix various problems with matching out-of-line definitions of staticDouglas Gregor2009-03-111-0/+14
| | | | | | | | | class members to the corresponding in-class declaration. Diagnose the erroneous use of 'static' on out-of-line definitions of class members. llvm-svn: 66740
* Add basic, hackish support for instantiation of typedefs in a classDouglas Gregor2009-03-111-2/+6
| | | | | | | | | template. More importantly, start to sort out the issues regarding complete types and nested-name-specifiers, especially the question of: when do we instantiate a class template specialization that occurs to the left of a '::' in a nested-name-specifier? llvm-svn: 66662
* Improve recovery from ill-formed scope specifiers. Fixes PR3670.Douglas Gregor2009-03-061-4/+7
| | | | llvm-svn: 66286
* Make the test cases failing due to exact diagnostic matching XFAIL.Sebastian Redl2009-02-081-0/+2
| | | | llvm-svn: 64080
* Diagnose attempts to define a namespace member out-of-line when noDouglas Gregor2009-02-061-0/+25
| | | | | | matching member exists. Thanks to Piotr Rak for reporting the problem! llvm-svn: 63939
* Add support for out-of-line definitions of conversion functions and member ↵Douglas Gregor2008-12-261-0/+20
| | | | | | operators llvm-svn: 61442
* Partial fix for qualified name lookup, such that the lookup of N inDouglas Gregor2008-12-161-5/+18
| | | | | | | | | N::X only skips those entities specified in C++ [basic.lookup.qual]p1. Note that both EDG and GCC currently get this wrong. EDG has confirmed that the bug will be fixed in a future version. llvm-svn: 61079
* Diagnose erroneous uses of out-of-line member definitions and scopeDouglas Gregor2008-12-151-2/+19
| | | | | | | | | | | | | | specifiers. Specifically: * Determine when an out-of-line function definition does not match any declaration within the class or namespace (including coping with overloaded functions). * Complain about typedefs and parameters that have scope specifiers. * Complain about out-of-line declarations that aren't also definitions. * Complain about non-static data members being declared out-of-line. * Allow cv-qualifiers on out-of-line member function definitions. llvm-svn: 61058
* make the 'to match this' diagnostic a note.Chris Lattner2008-11-231-1/+1
| | | | llvm-svn: 59921
* add support for inserting a DeclarationName into a diagnostic directlyChris Lattner2008-11-231-2/+2
| | | | | | | without calling getAsString(). This implicitly puts quotes around the name, so diagnostics need to be tweaked to accommodate this. llvm-svn: 59916
* Take care another assert:Argyrios Kyrtzidis2008-11-191-0/+7
| | | | | | | | | | | | | | | | | | | | struct A { struct B; }; struct A::B { void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one." }; Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g: namespace A { struct S; } struct A::S {}; // getParent() == namespace 'A' // getLexicalParent() == translation unit llvm-svn: 59650
* Fix this:Argyrios Kyrtzidis2008-11-191-0/+3
| | | | | | | | | | | | With this snippet: void f(a::b); An assert is hit: Assertion failed: CachedTokens[CachedLexPos-1].getLocation() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token", file ..\..\lib\Lex\PPCaching.cpp, line 98 Introduce Preprocessor::RevertCachedTokens that reverts a specific number of tokens when backtracking is enabled. llvm-svn: 59636
* Introduce ScopedDecl::getLexicalDeclContext() which is different from ↵Argyrios Kyrtzidis2008-11-091-0/+9
| | | | | | | | | | | | | ScopedDecl::getDeclContext() when there are nested-names. e.g.: namespace A { void f(); // SemanticDC (getDeclContext) == LexicalDC (getLexicalDeclContext) == 'namespace A' } void A::f(); // SemanticDC == namespace 'A' // LexicalDC == global namespace llvm-svn: 58948
* Implement Sema support for C++ nested-name-specifiers.Argyrios Kyrtzidis2008-11-081-0/+56
llvm-svn: 58916
OpenPOWER on IntegriCloud