NoQ added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp:68
     : IILockGuard(nullptr), IIUniqueLock(nullptr),
-      LockFn("lock"), UnlockFn("unlock"), SleepFn("sleep"), GetcFn("getc"),
-      FgetsFn("fgets"), ReadFn("read"), RecvFn("recv"),
-      PthreadLockFn("pthread_mutex_lock"),
-      PthreadTryLockFn("pthread_mutex_trylock"),
-      PthreadUnlockFn("pthread_mutex_unlock"),
-      MtxLock("mtx_lock"),
-      MtxTimedLock("mtx_timedlock"),
-      MtxTryLock("mtx_trylock"),
-      MtxUnlock("mtx_unlock"),
+      LockFn({"lock"}), UnlockFn({"unlock"}), SleepFn({"sleep"}), 
GetcFn({"getc"}),
+      FgetsFn({"fgets"}), ReadFn({"read"}), RecvFn({"recv"}),
----------------
I wish the old syntax for simple C functions was preserved.

This could be accidentally achieved by using `ArrayRef<StringRef>` instead of 
`std::vector<StringRef>` for your constructor's argument.


================
Comment at: lib/StaticAnalyzer/Core/CallEvent.cpp:273-280
+    std::string Regex = "^::(.*)?";
+    Regex += llvm::join(CD.QualifiedName, "(.*)?::(.*)?") + "(.*)?$";
+
+    auto Matches = match(namedDecl(matchesName(Regex)).bind("Regex"), *ND,
+                         LCtx->getAnalysisDeclContext()->getASTContext());
+
+    if (Matches.empty())
----------------
Uhm, i think we don't need to flatten the class name to a string and then regex 
to do this.

We can just unwrap the declaration and see if the newly unwrapped layer matches 
the expected name on every step, until all expected names have been found.


Repository:
  rC Clang

https://reviews.llvm.org/D48027



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to