[PATCH] D38728: [analyzer] Use the signature of the primary template for issue hash calculation

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 08:42:41 PDT 2017

martong added inline comments.

Comment at: lib/StaticAnalyzer/Core/IssueHash.cpp:39
+  // primary template.
+  if (const FunctionDecl *InstantiatedFrom =
+          Target->getInstantiatedFromMemberFunction())
Could we use here FunctionDecl::getPrimaryTemplate() ? That seems more general, it handles both specializations and instantiations.

Comment at: test/Analysis/bug_hash_test.cpp:61
-// CHECK: <key>diagnostics</key>
+template <typename T>
+T f(T i) {
We could add a few more test cases:
- a function template in class template
- specializations vs instantiations
- the combination of the above two (?)

Comment at: test/Analysis/bug_hash_test.cpp:1363
 // CHECK-NEXT:  </dict>
+// CHECK-NEXT:  <dict>
+// CHECK-NEXT:   <key>path</key>
I am not sure if this is possible, but could we add unit test just for the `GetSignature` function? Instead of these huge plist files?

I am thinking something like this:



More information about the cfe-commits mailing list