diff options
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 78 |
1 files changed, 28 insertions, 50 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 7da171b655..678ecfc9a3 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -9341,8 +9341,6 @@ void ASTReader::diagnoseOdrViolations() { case Decl::Field: return Field; case Decl::CXXMethod: - case Decl::CXXConstructor: - case Decl::CXXDestructor: return CXXMethod; case Decl::TypeAlias: return TypeAlias; @@ -9671,30 +9669,17 @@ void ASTReader::diagnoseOdrViolations() { break; } case CXXMethod: { - enum { - DiagMethod, - DiagConstructor, - DiagDestructor, - } FirstMethodType, - SecondMethodType; - auto GetMethodTypeForDiagnostics = [](const CXXMethodDecl* D) { - if (isa<CXXConstructorDecl>(D)) return DiagConstructor; - if (isa<CXXDestructorDecl>(D)) return DiagDestructor; - return DiagMethod; - }; const CXXMethodDecl *FirstMethod = cast<CXXMethodDecl>(FirstDecl); const CXXMethodDecl *SecondMethod = cast<CXXMethodDecl>(SecondDecl); - FirstMethodType = GetMethodTypeForDiagnostics(FirstMethod); - SecondMethodType = GetMethodTypeForDiagnostics(SecondMethod); auto FirstName = FirstMethod->getDeclName(); auto SecondName = SecondMethod->getDeclName(); - if (FirstMethodType != SecondMethodType || FirstName != SecondName) { + if (FirstName != SecondName) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodName) - << FirstMethodType << FirstName; + << FirstName; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodName) - << SecondMethodType << SecondName; + << SecondName; Diagnosed = true; break; @@ -9705,11 +9690,11 @@ void ASTReader::diagnoseOdrViolations() { if (FirstDeleted != SecondDeleted) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodDeleted) - << FirstMethodType << FirstName << FirstDeleted; + << FirstName << FirstDeleted; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodDeleted) - << SecondMethodType << SecondName << SecondDeleted; + << SecondName << SecondDeleted; Diagnosed = true; break; } @@ -9722,10 +9707,10 @@ void ASTReader::diagnoseOdrViolations() { (FirstVirtual != SecondVirtual || FirstPure != SecondPure)) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodVirtual) - << FirstMethodType << FirstName << FirstPure << FirstVirtual; + << FirstName << FirstPure << FirstVirtual; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodVirtual) - << SecondMethodType << SecondName << SecondPure << SecondVirtual; + << SecondName << SecondPure << SecondVirtual; Diagnosed = true; break; } @@ -9740,10 +9725,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstStatic != SecondStatic) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodStatic) - << FirstMethodType << FirstName << FirstStatic; + << FirstName << FirstStatic; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodStatic) - << SecondMethodType << SecondName << SecondStatic; + << SecondName << SecondStatic; Diagnosed = true; break; } @@ -9753,10 +9738,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstVolatile != SecondVolatile) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodVolatile) - << FirstMethodType << FirstName << FirstVolatile; + << FirstName << FirstVolatile; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodVolatile) - << SecondMethodType << SecondName << SecondVolatile; + << SecondName << SecondVolatile; Diagnosed = true; break; } @@ -9766,10 +9751,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstConst != SecondConst) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodConst) - << FirstMethodType << FirstName << FirstConst; + << FirstName << FirstConst; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodConst) - << SecondMethodType << SecondName << SecondConst; + << SecondName << SecondConst; Diagnosed = true; break; } @@ -9779,10 +9764,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstInline != SecondInline) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodInline) - << FirstMethodType << FirstName << FirstInline; + << FirstName << FirstInline; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodInline) - << SecondMethodType << SecondName << SecondInline; + << SecondName << SecondInline; Diagnosed = true; break; } @@ -9792,10 +9777,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstNumParameters != SecondNumParameters) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodNumberParameters) - << FirstMethodType << FirstName << FirstNumParameters; + << FirstName << FirstNumParameters; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodNumberParameters) - << SecondMethodType << SecondName << SecondNumParameters; + << SecondName << SecondNumParameters; Diagnosed = true; break; } @@ -9815,27 +9800,24 @@ void ASTReader::diagnoseOdrViolations() { FirstParamType->getAs<DecayedType>()) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodParameterType) - << FirstMethodType << FirstName << (I + 1) << FirstParamType - << true << ParamDecayedType->getOriginalType(); + << FirstName << (I + 1) << FirstParamType << true + << ParamDecayedType->getOriginalType(); } else { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodParameterType) - << FirstMethodType << FirstName << (I + 1) << FirstParamType - << false; + << FirstName << (I + 1) << FirstParamType << false; } if (const DecayedType *ParamDecayedType = SecondParamType->getAs<DecayedType>()) { ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodParameterType) - << SecondMethodType << SecondName << (I + 1) - << SecondParamType << true + << SecondName << (I + 1) << SecondParamType << true << ParamDecayedType->getOriginalType(); } else { ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodParameterType) - << SecondMethodType << SecondName << (I + 1) - << SecondParamType << false; + << SecondName << (I + 1) << SecondParamType << false; } ParameterMismatch = true; break; @@ -9846,10 +9828,10 @@ void ASTReader::diagnoseOdrViolations() { if (FirstParamName != SecondParamName) { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodParameterName) - << FirstMethodType << FirstName << (I + 1) << FirstParamName; + << FirstName << (I + 1) << FirstParamName; ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodParameterName) - << SecondMethodType << SecondName << (I + 1) << SecondParamName; + << SecondName << (I + 1) << SecondParamName; ParameterMismatch = true; break; } @@ -9860,14 +9842,12 @@ void ASTReader::diagnoseOdrViolations() { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodParameterSingleDefaultArgument) - << FirstMethodType << FirstName << (I + 1) - << (FirstInit == nullptr) + << FirstName << (I + 1) << (FirstInit == nullptr) << (FirstInit ? FirstInit->getSourceRange() : SourceRange()); ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodParameterSingleDefaultArgument) - << SecondMethodType << SecondName << (I + 1) - << (SecondInit == nullptr) + << SecondName << (I + 1) << (SecondInit == nullptr) << (SecondInit ? SecondInit->getSourceRange() : SourceRange()); ParameterMismatch = true; break; @@ -9878,13 +9858,11 @@ void ASTReader::diagnoseOdrViolations() { ODRDiagError(FirstMethod->getLocation(), FirstMethod->getSourceRange(), MethodParameterDifferentDefaultArgument) - << FirstMethodType << FirstName << (I + 1) - << FirstInit->getSourceRange(); + << FirstName << (I + 1) << FirstInit->getSourceRange(); ODRDiagNote(SecondMethod->getLocation(), SecondMethod->getSourceRange(), MethodParameterDifferentDefaultArgument) - << SecondMethodType << SecondName << (I + 1) - << SecondInit->getSourceRange(); + << SecondName << (I + 1) << SecondInit->getSourceRange(); ParameterMismatch = true; break; |