diff options
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 982f59272e9..e9cb51dec6e 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8957,6 +8957,7 @@ void ASTReader::diagnoseOdrViolations() { ProtectedSpecifer, StaticAssert, Field, + CXXMethod, Other } FirstDiffType = Other, SecondDiffType = Other; @@ -8982,6 +8983,8 @@ void ASTReader::diagnoseOdrViolations() { return StaticAssert; case Decl::Field: return Field; + case Decl::CXXMethod: + return CXXMethod; } }; @@ -9068,6 +9071,7 @@ void ASTReader::diagnoseOdrViolations() { FieldSingleMutable, FieldSingleInitializer, FieldDifferentInitializers, + MethodName, }; // These lambdas have the common portions of the ODR diagnostics. This @@ -9288,6 +9292,25 @@ void ASTReader::diagnoseOdrViolations() { break; } + case CXXMethod: { + const CXXMethodDecl *FirstMethod = cast<CXXMethodDecl>(FirstDecl); + const CXXMethodDecl *SecondMethod = cast<CXXMethodDecl>(SecondDecl); + IdentifierInfo *FirstII = FirstMethod->getIdentifier(); + IdentifierInfo *SecondII = SecondMethod->getIdentifier(); + if (FirstII->getName() != SecondII->getName()) { + ODRDiagError(FirstMethod->getLocation(), + FirstMethod->getSourceRange(), MethodName) + << FirstII; + ODRDiagNote(SecondMethod->getLocation(), + SecondMethod->getSourceRange(), MethodName) + << SecondII; + + Diagnosed = true; + break; + } + + break; + } } if (Diagnosed == true) |