Skip to content
Snippets Groups Projects
Commit 6e026d67 authored by Richard Trieu's avatar Richard Trieu
Browse files

[ODRHash] Avoid taking the types of FunctionDecl's

FunctionDecl already hashes most of the information in the function's type.
Add hashing of the return type, and skip hashing the function's type to avoid
redundancy and extra work when computing the hash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307986 91177308-0d34-0410-b5e6-96231b3b80d8
parent c0534f87
No related branches found
No related tags found
No related merge requests found
...@@ -246,7 +246,9 @@ public: ...@@ -246,7 +246,9 @@ public:
} }
void VisitValueDecl(const ValueDecl *D) { void VisitValueDecl(const ValueDecl *D) {
AddQualType(D->getType()); if (!isa<FunctionDecl>(D)) {
AddQualType(D->getType());
}
Inherited::VisitValueDecl(D); Inherited::VisitValueDecl(D);
} }
...@@ -305,6 +307,8 @@ public: ...@@ -305,6 +307,8 @@ public:
Hash.AddSubDecl(Param); Hash.AddSubDecl(Param);
} }
AddQualType(D->getReturnType());
Inherited::VisitFunctionDecl(D); Inherited::VisitFunctionDecl(D);
} }
......
...@@ -517,6 +517,20 @@ S14 s14; ...@@ -517,6 +517,20 @@ S14 s14;
// expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}} // expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}}
// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}} // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}}
#endif #endif
#if defined(FIRST)
struct S15 {
int A() { return 0; }
};
#elif defined(SECOND)
struct S15 {
long A() { return 0; }
};
#else
S15 s15;
// expected-error@first.h:* {{'Method::S15::A' from module 'FirstModule' is not present in definition of 'Method::S15' in module 'SecondModule'}}
// expected-note@second.h:* {{declaration of 'A' does not match}}
#endif
} // namespace Method } // namespace Method
// Naive parsing of AST can lead to cycles in processing. Ensure // Naive parsing of AST can lead to cycles in processing. Ensure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment