aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/DiagnosticKinds.def22
-rw-r--r--lib/Sema/SemaDecl.cpp48
-rw-r--r--lib/Sema/SemaDeclCXX.cpp16
-rw-r--r--lib/Sema/SemaDeclObjC.cpp30
-rw-r--r--lib/Sema/SemaStmt.cpp8
-rw-r--r--test/Parser/argument_redef.c2
-rw-r--r--test/Sema/array-declared-as-incorrect-type.c6
-rw-r--r--test/Sema/enum.c6
-rw-r--r--test/Sema/function.c8
-rw-r--r--test/Sema/implicit-decl.c2
-rw-r--r--test/Sema/merge-decls.c4
-rw-r--r--test/Sema/predefined-function.c8
-rw-r--r--test/Sema/redefinition.c4
-rw-r--r--test/Sema/struct-compat.c8
-rw-r--r--test/Sema/switch-duplicate-defaults.c10
-rw-r--r--test/Sema/switch.c14
-rw-r--r--test/Sema/tentative-decls.c12
-rw-r--r--test/Sema/typedef-redef.c2
-rw-r--r--test/SemaCXX/class-names.cpp4
-rw-r--r--test/SemaCXX/condition.cpp40
-rw-r--r--test/SemaCXX/constructor.cpp2
-rw-r--r--test/SemaCXX/conversion-function.cpp4
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp2
-rw-r--r--test/SemaCXX/default1.cpp2
-rw-r--r--test/SemaCXX/destructor.cpp4
-rw-r--r--test/SemaCXX/fntype-decl.cpp4
-rw-r--r--test/SemaCXX/namespace.cpp18
-rw-r--r--test/SemaCXX/overload-decl.cpp16
-rw-r--r--test/SemaCXX/typedef-redecl.cpp6
-rw-r--r--test/SemaObjC/DoubleMethod.m2
-rw-r--r--test/SemaObjC/alias-test-1.m4
-rw-r--r--test/SemaObjC/alias-test-2.m2
-rw-r--r--test/SemaObjC/check-dup-decl-methods-1.m10
-rw-r--r--test/SemaObjC/check-dup-objc-decls-1.m8
-rw-r--r--test/SemaObjC/class-conforming-protocol-1.m4
-rw-r--r--test/SemaObjC/class-def-test-1.m6
-rw-r--r--test/SemaObjC/class-impl-1.m4
-rw-r--r--test/SemaObjC/conflicting-ivar-test-1.m4
-rw-r--r--test/SemaObjC/ivar-sem-check-1.m4
39 files changed, 177 insertions, 183 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def
index cbf7590058..c3000f19bd 100644
--- a/include/clang/Basic/DiagnosticKinds.def
+++ b/include/clang/Basic/DiagnosticKinds.def
@@ -28,6 +28,14 @@
DIAG(note_previous_definition, NOTE,
"previous definition is here")
+DIAG(note_previous_declaration, NOTE,
+ "previous declaration is here")
+DIAG(note_previous_implicit_declaration, NOTE,
+ "previous implicit declaration is here")
+DIAG(note_previous_use, NOTE,
+ "previous use is here")
+DIAG(note_duplicate_case_prev, NOTE,
+ "previous case defined here")
//===----------------------------------------------------------------------===//
@@ -484,12 +492,8 @@ DIAG(warn_using_decl, WARNING,
"using")
DIAG(warn_also_found_decl, WARNING,
"also found")
-DIAG(error_duplicate_method_decl, ERROR,
+DIAG(err_duplicate_method_decl, ERROR,
"duplicate declaration of method '%0'")
-DIAG(err_previous_declaration, ERROR,
- "previous declaration is here")
-DIAG(err_previous_implicit_declaration, ERROR,
- "previous implicit declaration is here")
DIAG(err_undeclared_protocol, ERROR,
"cannot find protocol declaration for %0")
DIAG(err_missing_sel_definition, ERROR,
@@ -877,12 +881,6 @@ DIAG(err_param_default_argument_references_this, ERROR,
DIAG(err_param_default_argument_nonfunc, ERROR,
"default arguments can only be specified for parameters in a function"
" declaration")
-DIAG(err_previous_definition, ERROR,
- "previous definition is here")
-DIAG(err_previous_use, ERROR,
- "previous use is here")
-DIAG(err_first_label, ERROR,
- "first label is here")
// C++ Overloading Semantic Analysis.
DIAG(err_ovl_diff_return_type, ERROR,
@@ -1491,8 +1489,6 @@ DIAG(warn_case_value_overflow, WARNING,
"overflow converting case value to switch condition type (%0 to %1)")
DIAG(err_duplicate_case, ERROR,
"duplicate case value '%0'")
-DIAG(err_duplicate_case_prev, ERROR,
- "previous case value occurrence defined here")
DIAG(warn_case_empty_range, WARNING,
"empty case range specified")
DIAG(err_typecheck_statement_requires_scalar, ERROR,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index c3b130255b..8ffafadd3e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -326,7 +326,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
if (!Old) {
Diag(New->getLocation(), diag::err_redefinition_different_kind)
<< New->getDeclName();
- Diag(OldD->getLocation(), diag::err_previous_definition);
+ Diag(OldD->getLocation(), diag::note_previous_definition);
return New;
}
@@ -338,7 +338,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
Diag(New->getLocation(), diag::err_redefinition_different_typedef)
<< New->getUnderlyingType().getAsString()
<< Old->getUnderlyingType().getAsString();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
return Old;
}
@@ -365,7 +365,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
}
Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
@@ -419,7 +419,7 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) {
if (!Old) {
Diag(New->getLocation(), diag::err_redefinition_different_kind)
<< New->getDeclName();
- Diag(OldD->getLocation(), diag::err_previous_definition);
+ Diag(OldD->getLocation(), diag::note_previous_definition);
return New;
}
@@ -427,11 +427,11 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) {
// implicit declaration, or a declaration.
diag::kind PrevDiag;
if (Old->isThisDeclarationADefinition())
- PrevDiag = diag::err_previous_definition;
+ PrevDiag = diag::note_previous_definition;
else if (Old->isImplicit())
- PrevDiag = diag::err_previous_implicit_declaration;
+ PrevDiag = diag::note_previous_implicit_declaration;
else
- PrevDiag = diag::err_previous_declaration;
+ PrevDiag = diag::note_previous_declaration;
QualType OldQType = Context.getCanonicalType(Old->getType());
QualType NewQType = Context.getCanonicalType(New->getType());
@@ -538,7 +538,7 @@ void Sema::CheckForFileScopedRedefinitions(Scope *S, VarDecl *VD) {
VD->getStorageClass() != VarDecl::Extern &&
VD->getStorageClass() != VarDecl::PrivateExtern) {
Diag(VD->getLocation(), diag::err_redefinition) << VD->getDeclName();
- Diag(OldDecl->getLocation(), diag::err_previous_definition);
+ Diag(OldDecl->getLocation(), diag::note_previous_definition);
}
}
}
@@ -558,7 +558,7 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
if (!Old) {
Diag(New->getLocation(), diag::err_redefinition_different_kind)
<< New->getDeclName();
- Diag(OldD->getLocation(), diag::err_previous_definition);
+ Diag(OldD->getLocation(), diag::note_previous_definition);
return New;
}
@@ -569,7 +569,7 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
QualType NewCType = Context.getCanonicalType(New->getType());
if (OldCType != NewCType && !Context.typesAreCompatible(OldCType, NewCType)) {
Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
// C99 6.2.2p4: Check if we have a static decl followed by a non-static.
@@ -577,20 +577,20 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
(Old->getStorageClass() == VarDecl::None ||
Old->getStorageClass() == VarDecl::Extern)) {
Diag(New->getLocation(), diag::err_static_non_static) << New->getName();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
// C99 6.2.2p4: Check if we have a non-static decl followed by a static.
if (New->getStorageClass() != VarDecl::Static &&
Old->getStorageClass() == VarDecl::Static) {
Diag(New->getLocation(), diag::err_non_static_static) << New->getName();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
// Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
if (New->getStorageClass() != VarDecl::Extern && !New->isFileVarDecl()) {
Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
- Diag(Old->getLocation(), diag::err_previous_definition);
+ Diag(Old->getLocation(), diag::note_previous_definition);
}
return New;
}
@@ -2076,7 +2076,7 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) {
const FunctionDecl *Definition;
if (FD->getBody(Definition)) {
Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
- Diag(Definition->getLocation(), diag::err_previous_definition);
+ Diag(Definition->getLocation(), diag::note_previous_definition);
}
PushDeclContext(FD);
@@ -2257,7 +2257,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// struct or something similar.
if (PrevTagDecl->getTagKind() != Kind) {
Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
- Diag(PrevDecl->getLocation(), diag::err_previous_use);
+ Diag(PrevDecl->getLocation(), diag::note_previous_use);
// Recover by making this an anonymous redefinition.
Name = 0;
PrevDecl = 0;
@@ -2269,7 +2269,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// Diagnose attempts to redefine a tag.
if (PrevTagDecl->isDefinition()) {
Diag(NameLoc, diag::err_redefinition) << Name;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
// If this is a redefinition, recover by making this struct be
// anonymous, which will make any later references get the previous
// definition.
@@ -2291,7 +2291,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// The tag name clashes with a namespace name, issue an error and
// recover by making this tag be anonymous.
Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
Name = 0;
}
}
@@ -2394,7 +2394,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
// struct or something similar.
if (PrevTagDecl->getTagKind() != Kind) {
Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
- Diag(PrevDecl->getLocation(), diag::err_previous_use);
+ Diag(PrevDecl->getLocation(), diag::note_previous_use);
// Recover by making this an anonymous redefinition.
Name = 0;
PrevDecl = 0;
@@ -2414,7 +2414,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
if (RecordDecl* DefRecord =
cast<RecordDecl>(PrevTagDecl)->getDefinition(Context)) {
Diag(NameLoc, diag::err_redefinition) << Name;
- Diag(DefRecord->getLocation(), diag::err_previous_definition);
+ Diag(DefRecord->getLocation(), diag::note_previous_definition);
// If this is a redefinition, recover by making this struct be
// anonymous, which will make any later references get the previous
// definition.
@@ -2441,7 +2441,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
// The tag name clashes with a namespace name, issue an error and
// recover by making this tag be anonymous.
Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
Name = 0;
}
}
@@ -2717,7 +2717,7 @@ void Sema::ActOnFields(Scope* S,
// outer S.
Diag(DefRecord->getLocation(), diag::err_nested_redefinition)
<< DefRecord->getKindName();
- Diag(RecLoc, diag::err_previous_definition);
+ Diag(RecLoc, diag::note_previous_definition);
Record->setInvalidDecl();
return;
}
@@ -2822,7 +2822,7 @@ void Sema::ActOnFields(Scope* S,
break;
}
}
- Diag(PrevLoc, diag::err_previous_definition);
+ Diag(PrevLoc, diag::note_previous_definition);
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
@@ -2880,7 +2880,7 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
Diag(IdLoc, diag::err_redefinition_of_enumerator) << Id;
else
Diag(IdLoc, diag::err_redefinition) << Id;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
delete Val;
return 0;
}
@@ -2943,7 +2943,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
// E0 = sizeof(enum e0 { E1 })
// };
Diag(Enum->getLocation(), diag::err_nested_redefinition) << Enum->getName();
- Diag(EnumLoc, diag::err_previous_definition);
+ Diag(EnumLoc, diag::note_previous_definition);
Enum->setInvalidDecl();
return;
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index a92ad9582e..d9f3bc652e 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -197,7 +197,7 @@ Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) {
Diag(NewParam->getLocation(),
diag::err_param_default_argument_redefinition)
<< NewParam->getDefaultArg()->getSourceRange();
- Diag(OldParam->getLocation(), diag::err_previous_definition);
+ Diag(OldParam->getLocation(), diag::note_previous_definition);
} else if (OldParam->getDefaultArg()) {
// Merge the old default argument into the new parameter
NewParam->setDefaultArg(OldParam->getDefaultArg());
@@ -1112,7 +1112,7 @@ Sema::DeclTy *Sema::ActOnConstructorDeclarator(CXXConstructorDecl *ConDecl) {
if (!IsOverload(ConDecl, ClassDecl->getConstructors(), MatchedDecl)) {
Diag(ConDecl->getLocation(), diag::err_constructor_redeclared)
<< SourceRange(ConDecl->getLocation());
- Diag((*MatchedDecl)->getLocation(), diag::err_previous_declaration)
+ Diag((*MatchedDecl)->getLocation(), diag::note_previous_declaration)
<< SourceRange((*MatchedDecl)->getLocation());
ConDecl->setInvalidDecl();
return ConDecl;
@@ -1157,9 +1157,9 @@ Sema::DeclTy *Sema::ActOnDestructorDeclarator(CXXDestructorDecl *Destructor) {
if (CXXDestructorDecl *PrevDestructor = ClassDecl->getDestructor()) {
Diag(Destructor->getLocation(), diag::err_destructor_redeclared);
Diag(PrevDestructor->getLocation(),
- PrevDestructor->isThisDeclarationADefinition()?
- diag::err_previous_definition
- : diag::err_previous_declaration);
+ PrevDestructor->isThisDeclarationADefinition() ?
+ diag::note_previous_definition
+ : diag::note_previous_declaration);
Destructor->setInvalidDecl();
return Destructor;
}
@@ -1188,8 +1188,8 @@ Sema::DeclTy *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
Diag(Conversion->getLocation(), diag::err_conv_function_redeclared);
Diag(OtherConv->getLocation(),
OtherConv->isThisDeclarationADefinition()?
- diag::err_previous_definition
- : diag::err_previous_declaration);
+ diag::note_previous_definition
+ : diag::note_previous_declaration);
Conversion->setInvalidDecl();
return (DeclTy *)Conversion;
}
@@ -1272,7 +1272,7 @@ Sema::DeclTy *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
// This is an invalid name redefinition.
Diag(Namespc->getLocation(), diag::err_redefinition_different_kind)
<< Namespc->getDeclName();
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
Namespc->setInvalidDecl();
// Continue on to push Namespc as current DeclContext and return it.
}
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index c030a370e4..7a7b3767b8 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -68,7 +68,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
}
ObjCInterfaceDecl* IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
@@ -102,7 +102,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
PrevDecl = LookupDecl(SuperName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(SuperLoc, diag::err_redefinition_different_kind) << SuperName;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
}
else {
// Check that super class is previously defined
@@ -149,7 +149,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
}
else {
Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
- Diag(ADecl->getLocation(), diag::err_previous_declaration);
+ Diag(ADecl->getLocation(), diag::note_previous_declaration);
}
return 0;
}
@@ -458,7 +458,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
}
else {
// Is there an interface declaration of this class; if not, warn!
@@ -475,7 +475,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(SuperClassLoc, diag::err_redefinition_different_kind)
<< SuperClassname;
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
} else {
SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!SDecl)
@@ -486,7 +486,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
// super class.
Diag(SuperClassLoc, diag::err_conflicting_super_class)
<< SDecl->getDeclName();
- Diag(SDecl->getLocation(), diag::err_previous_definition);
+ Diag(SDecl->getLocation(), diag::note_previous_definition);
}
}
}
@@ -559,14 +559,14 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_type)
<< ImplIvar->getIdentifier()
<< ImplIvar->getType() << ClsIvar->getType();
- Diag(ClsIvar->getLocation(), diag::err_previous_definition);
+ Diag(ClsIvar->getLocation(), diag::note_previous_definition);
}
// TODO: Two mismatched (unequal width) Ivar bitfields should be diagnosed
// as error.
else if (ImplIvar->getIdentifier() != ClsIvar->getIdentifier()) {
Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_name)
<< ImplIvar->getIdentifier() << ClsIvar->getIdentifier();
- Diag(ClsIvar->getLocation(), diag::err_previous_definition);
+ Diag(ClsIvar->getLocation(), diag::note_previous_definition);
return;
}
--numIvars;
@@ -728,7 +728,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
TypedefDecl *TDD = dyn_cast<TypedefDecl>(PrevDecl);
if (!TDD || !isa<ObjCInterfaceType>(TDD->getUnderlyingType())) {
Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ Diag(PrevDecl->getLocation(), diag::note_previous_definition);
}
}
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
@@ -907,9 +907,9 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl,
: false;
if (isInterfaceDeclKind && PrevMethod && !match
|| checkIdenticalMethods && match) {
- Diag(Method->getLocation(), diag::error_duplicate_method_decl)
+ Diag(Method->getLocation(), diag::err_duplicate_method_decl)
<< Method->getSelector().getName();
- Diag(PrevMethod->getLocation(), diag::err_previous_declaration);
+ Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
} else {
insMethods.push_back(Method);
InsMap[Method->getSelector()] = Method;
@@ -924,9 +924,9 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl,
: false;
if (isInterfaceDeclKind && PrevMethod && !match
|| checkIdenticalMethods && match) {
- Diag(Method->getLocation(), diag::error_duplicate_method_decl)
+ Diag(Method->getLocation(), diag::err_duplicate_method_decl)
<< Method->getSelector().getName();
- Diag(PrevMethod->getLocation(), diag::err_previous_declaration);
+ Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
} else {
clsMethods.push_back(Method);
ClsMap[Method->getSelector()] = Method;
@@ -1117,9 +1117,9 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
}
if (PrevMethod) {
// You can never have two method definitions with the same name.
- Diag(ObjCMethod->getLocation(), diag::error_duplicate_method_decl)
+ Diag(ObjCMethod->getLocation(), diag::err_duplicate_method_decl)
<< ObjCMethod->getSelector().getName();
- Diag(PrevMethod->getLocation(), diag::err_previous_declaration);
+ Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
}
return ObjCMethod;
}
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 204d161f56..8cd223fc39 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -195,7 +195,7 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
// multiply defined, reject it now.
if (LabelDecl->getSubStmt()) {
Diag(IdentLoc, diag::err_redefinition_of_label) << LabelDecl->getID();
- Diag(LabelDecl->getIdentLoc(), diag::err_previous_definition);
+ Diag(LabelDecl->getIdentLoc(), diag::note_previous_definition);
return SubStmt;
}
@@ -390,7 +390,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch,
if (DefaultStmt *DS = dyn_cast<DefaultStmt>(SC)) {
if (TheDefaultStmt) {
Diag(DS->getDefaultLoc(), diag::err_multiple_default_labels_defined);
- Diag(TheDefaultStmt->getDefaultLoc(), diag::err_first_label);
+ Diag(TheDefaultStmt->getDefaultLoc(), diag::note_duplicate_case_prev);
// FIXME: Remove the default statement from the switch block so that
// we'll return a valid AST. This requires recursing down the
@@ -436,7 +436,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch,
Diag(CaseVals[i+1].second->getLHS()->getLocStart(),
diag::err_duplicate_case) << CaseVals[i].first.toString(10);
Diag(CaseVals[i].second->getLHS()->getLocStart(),
- diag::err_duplicate_case_prev);
+ diag::note_duplicate_case_prev);
// FIXME: We really want to remove the bogus case stmt from the substmt,
// but we have no way to do this right now.
CaseListIsErroneous = true;
@@ -520,7 +520,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch,
Diag(CR->getLHS()->getLocStart(), diag::err_duplicate_case)
<< OverlapVal.toString(10);
Diag(OverlapStmt->getLHS()->getLocStart(),
- diag::err_duplicate_case_prev);
+ diag::note_duplicate_case_prev);
// FIXME: We really want to remove the bogus case stmt from the substmt,
// but we have no way to do this right now.
CaseListIsErroneous = true;
diff --git a/test/Parser/argument_redef.c b/test/Parser/argument_redef.c
index d831d48b5a..16263f4357 100644
--- a/test/Parser/argument_redef.c
+++ b/test/Parser/argument_redef.c
@@ -1,6 +1,6 @@
/* RUN: clang -fsyntax-only -verify %s
*/
-int foo(int A) { /* expected-error {{previous definition is here}} */
+int foo(int A) { /* expected-note {{previous definition is here}} */
int A; /* expected-error {{redefinition of 'A'}} */
}
diff --git a/test/Sema/array-declared-as-incorrect-type.c b/test/Sema/array-declared-as-incorrect-type.c
index e7dd458dc0..9b7d8b7a74 100644
--- a/test/Sema/array-declared-as-incorrect-type.c
+++ b/test/Sema/array-declared-as-incorrect-type.c
@@ -3,14 +3,14 @@
extern int a1[];
int a1[1];
-extern int a2[]; // expected-error {{previous definition is here}}
+extern int a2[]; // expected-note {{previous definition is here}}
float a2[1]; // expected-error {{redefinition of 'a2'}}
extern int a3[][2];
int a3[1][2];
-extern int a4[][2]; // expected-error {{previous definition is here}}
+extern int a4[][2]; // expected-note {{previous definition is here}}
int a4[2]; // expected-error {{redefinition of 'a4'}}
-extern int a5[1][2][3]; // expected-error {{previous definition is here}}
+extern int a5[1][2][3]; // expected-note {{previous definition is here}}
int a5[3][2][1]; // expected-error {{redefinition of 'a5'}}
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index ba93aaa2ee..b06882b4d3 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -30,8 +30,8 @@ int test2(int i)
}
// PR2020
-union u0; // expected-error {{previous use is here}}
-enum u0 { U0A }; // expected-error {{error: use of 'u0' with tag type that does not match previous declaration}}
+union u0; // expected-note {{previous use is here}}
+enum u0 { U0A }; // expected-error {{use of 'u0' with tag type that does not match previous declaration}}
// rdar://6095136
@@ -52,6 +52,6 @@ void test4() {
enum someenum {}; // expected-warning {{use of empty enum extension}}
// <rdar://problem/6093889>
-enum e0 { // expected-error {{previous definition is here}}
+enum e0 { // expected-note {{previous definition is here}}
E0 = sizeof(enum e0 { E1 }) // expected-error {{nested redefinition}}
};
diff --git a/test/Sema/function.c b/test/Sema/function.c
index 152205dd24..7c67bbaa63 100644
--- a/test/Sema/function.c
+++ b/test/Sema/function.c
@@ -6,15 +6,15 @@ void f(double (* restrict a)[5]);
int foo (__const char *__path);
int foo(__const char *__restrict __file);
-void func(const char*); //expected-error{{previous declaration is here}}
-void func(char*); //expected-error{{conflicting types for 'func'}}
+void func(const char*); // expected-note {{previous declaration is here}}
+void func(char*); // expected-error{{conflicting types for 'func'}}
void g(int (*)(const void **, const void **));
void g(int (*compar)()) {
}
-void h(); //expected-error{{previous declaration is here}}
-void h (const char *fmt, ...) {} //expected-error{{conflicting types for 'h'}}
+void h(); // expected-note {{previous declaration is here}}
+void h (const char *fmt, ...) {} // expected-error{{conflicting types for 'h'}}
// PR1965
int t5(b); // expected-error {{parameter list without types}}
diff --git a/test/Sema/implicit-decl.c b/test/Sema/implicit-decl.c
index ea40e61afb..099cf9d20e 100644
--- a/test/Sema/implicit-decl.c
+++ b/test/Sema/implicit-decl.c
@@ -7,7 +7,7 @@ void func() {
int32_t *vector[16];
const char compDesc[16 + 1];
int32_t compCount = 0;
- if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error{{previous implicit declaration is here}}
+ if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}}
}
return ((void *)0);
}
diff --git a/test/Sema/merge-decls.c b/test/Sema/merge-decls.c
index 50ce478769..b26532c5ea 100644
--- a/test/Sema/merge-decls.c
+++ b/test/Sema/merge-decls.c
@@ -3,7 +3,7 @@
void foo(void);
void foo(void) {}
void foo(void);
-void foo(void); // expected-error{{previous declaration is here}}
+void foo(void); // expected-note {{previous declaration is here}}
void foo(int); // expected-error {{conflicting types for 'foo'}}
@@ -14,6 +14,6 @@ int funcdef()
int funcdef();
-int funcdef2() { return 0; } // expected-error{{previous definition is here}}
+int funcdef2() { return 0; } // expected-note {{previous definition is here}}
int funcdef2() { return 0; } // expected-error {{redefinition of 'funcdef2'}}
diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c
index e8c396525d..2a254cceb7 100644
--- a/test/Sema/predefined-function.c
+++ b/test/Sema/predefined-function.c
@@ -4,7 +4,7 @@ char *funk(int format);
enum Test {A=-1};
char *funk(enum Test x);
-int eli(f