[PATCH] D79425: [analyzer] StdLibraryFunctionsChecker: Add overload for adding the same summary for different names

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 09:08:38 PDT 2020


martong created this revision.
martong added reviewers: Szelethus, NoQ, baloghadamsoftware, balazske, steakhal.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.
Herald added a project: clang.

Adding a convenience function for makeing it easier to add the same summary for functions with different names.
E.g. we are going to use the same summary for

  char * strchr(const char *cs, int c);
  char * strrchr(const char * str, int character);


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79425

Files:
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -665,6 +665,11 @@
       for (const Summary &S : Summaries)
         operator()(Name, S);
     }
+    // Add the same summary for different names.
+    void operator()(std::vector<StringRef> Names, Summary S) {
+      for (StringRef Name : Names)
+        operator()(Name, S);
+    }
   } addToFunctionSummaryMap(ACtx, FunctionSummaryMap);
 
   // We are finally ready to define specifications for all supported functions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79425.262129.patch
Type: text/x-patch
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200505/de2a0ed3/attachment.bin>


More information about the cfe-commits mailing list