diff options
| author | John McCall <rjmccall@apple.com> | 2010-02-14 01:03:10 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-02-14 01:03:10 +0000 |
| commit | 38200b081abc43d0d19cf2b1ebd0fdc8b0e65078 (patch) | |
| tree | f1219a0152c93be253f83f064c21ef7e13d6436c /clang | |
| parent | 073a0c88ccbd33b44281555cd1dd9b4a07e9cc06 (diff) | |
| download | bcm5719-llvm-38200b081abc43d0d19cf2b1ebd0fdc8b0e65078.tar.gz bcm5719-llvm-38200b081abc43d0d19cf2b1ebd0fdc8b0e65078.zip | |
Improve the diagnostic given when referring to a tag type without a tag (in C)
or that's been hidden by a non-type (in C++).
The ideal C++ diagnostic here would note the hiding declaration, but this
is a good start.
llvm-svn: 96141
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticParseKinds.td | 2 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Parser/declarators.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 04e3daffe7b..bc26c3b0dad 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -173,7 +173,7 @@ def err_friend_invalid_in_context : Error< def err_unknown_typename : Error< "unknown type name %0">; def err_use_of_tag_name_without_tag : Error< - "use of tagged type %0 without '%1' tag">; + "must use '%1' tag to refer to type %0%select{| in this scope}2">; def err_expected_ident_in_using : Error< "expected an identifier in using directive">; def err_unexected_colon_in_nested_name_spec : Error< diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 01156a1e969..8aa69363bee 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -733,7 +733,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, if (TagName) { Diag(Loc, diag::err_use_of_tag_name_without_tag) - << Tok.getIdentifierInfo() << TagName + << Tok.getIdentifierInfo() << TagName << getLang().CPlusPlus << CodeModificationHint::CreateInsertion(Tok.getLocation(),TagName); // Parse this as a tag as if the missing tag were present. diff --git a/clang/test/Parser/declarators.c b/clang/test/Parser/declarators.c index 6dd32d9676b..91803c1c5d7 100644 --- a/clang/test/Parser/declarators.c +++ b/clang/test/Parser/declarators.c @@ -47,8 +47,8 @@ int test6() { return a; } // a should be declared. // Use of tagged type without tag. rdar://6783347 struct xyz { int y; }; enum myenum { ASDFAS }; -xyz b; // expected-error {{use of tagged type 'xyz' without 'struct' tag}} -myenum c; // expected-error {{use of tagged type 'myenum' without 'enum' tag}} +xyz b; // expected-error {{must use 'struct' tag to refer to type 'xyz'}} +myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum'}} float *test7() { // We should recover 'b' by parsing it with a valid type of "struct xyz", which |

