summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-01 23:51:29 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-01 23:51:29 +0000
commit170512fa78cd11eed92878859dff0e55771ebad5 (patch)
tree343bbd563c7ca9c894ec79d5a839e5962e8c6428 /clang/lib/Sema/SemaTemplate.cpp
parent7803c9546b17270068dd4804b7ef0bf5586178fd (diff)
downloadbcm5719-llvm-170512fa78cd11eed92878859dff0e55771ebad5.tar.gz
bcm5719-llvm-170512fa78cd11eed92878859dff0e55771ebad5.zip
Add some more code modification hints
llvm-svn: 68261
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index abc3ac08e9f..d30726c766a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -462,12 +462,14 @@ Sema::ActOnClassTemplate(Scope *S, unsigned TagSpec, TagKind TK,
// template declaration (7.1.5.3).
RecordDecl *PrevRecordDecl = PrevClassTemplate->getTemplatedDecl();
if (PrevRecordDecl->getTagKind() != Kind) {
- Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
+ Diag(KWLoc, diag::err_use_with_wrong_tag)
+ << Name
+ << CodeModificationHint::CreateReplacement(KWLoc,
+ PrevRecordDecl->getKindName());
Diag(PrevRecordDecl->getLocation(), diag::note_previous_use);
- return true;
+ Kind = PrevRecordDecl->getTagKind();
}
-
// Check for redefinition of this class template.
if (TK == TK_Definition) {
if (TagDecl *Def = PrevRecordDecl->getDefinition(Context)) {
@@ -1974,7 +1976,10 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagKind TK,
case DeclSpec::TST_class: Kind = TagDecl::TK_class; break;
}
if (ClassTemplate->getTemplatedDecl()->getTagKind() != Kind) {
- Diag(KWLoc, diag::err_use_with_wrong_tag) << ClassTemplate;
+ Diag(KWLoc, diag::err_use_with_wrong_tag)
+ << ClassTemplate
+ << CodeModificationHint::CreateReplacement(KWLoc,
+ ClassTemplate->getTemplatedDecl()->getKindName());
Diag(ClassTemplate->getTemplatedDecl()->getLocation(),
diag::note_previous_use);
Kind = ClassTemplate->getTemplatedDecl()->getTagKind();
OpenPOWER on IntegriCloud