aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-07-20 17:43:15 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-07-20 17:43:15 +0000
commitd33c868d386ef47c2942e2dbff0d9955a8591fa9 (patch)
tree43c9c09bf73be1c4594e0bec8b254c21e3f8eb3f /lib
parent89021b0c71c53c88927b588431859a041bec2802 (diff)
Issue a more descriptive diagnostics when mis-declaring
a destructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76436 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp4
-rw-r--r--lib/Parse/ParseDeclCXX.cpp6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index cefd325248..75831ccbba 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2194,13 +2194,13 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
SourceLocation NameLoc = Tok.getLocation();
SourceLocation EndLoc;
CXXScopeSpec *SS = afterCXXScope? &D.getCXXScopeSpec() : 0;
- TypeResult Type = ParseClassName(EndLoc, SS);
+ TypeResult Type = ParseClassName(EndLoc, SS, true);
if (Type.isInvalid())
D.SetIdentifier(0, TildeLoc);
else
D.setDestructor(Type.get(), TildeLoc, NameLoc);
} else {
- Diag(Tok, diag::err_expected_class_name);
+ Diag(Tok, diag::err_destructor_class_name);
D.SetIdentifier(0, TildeLoc);
}
goto PastIdentifier;
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 88e027db02..b9b2979911 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -427,7 +427,8 @@ void Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
/// simple-template-id
///
Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
- const CXXScopeSpec *SS) {
+ const CXXScopeSpec *SS,
+ bool DestrExpected) {
// Check whether we have a template-id that names a type.
if (Tok.is(tok::annot_template_id)) {
TemplateIdAnnotation *TemplateId
@@ -457,7 +458,8 @@ Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
TypeTy *Type = Actions.getTypeName(*Tok.getIdentifierInfo(),
Tok.getLocation(), CurScope, SS);
if (!Type) {
- Diag(Tok, diag::err_expected_class_name);
+ Diag(Tok, DestrExpected ? diag::err_destructor_class_name
+ : diag::err_expected_class_name);
return true;
}