[PATCH] D67865: [clang-tidy] Finds uses of OSRead* calls on macOS that may mask unexpected behavior due to unaligned reads

Dave MacLachlan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 15:11:11 PDT 2019


dmaclach marked 5 inline comments as done.
dmaclach added inline comments.


================
Comment at: clang-tidy/objc/AvoidOSReadCheck.cpp:21
+void AvoidOSReadCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+      callExpr(callee((functionDecl(hasAnyName(
----------------
Eugene.Zelenko wrote:
> Please add check if language is Objective-C.
So this isn't specific to Objective C, and applies to all C based languages. This is more Darwin specific. I based this CL on the AvoidSpinlockCheck which is very similar in this respect. If we want to do clean up on this later we should probably do them together.


================
Comment at: docs/clang-tidy/checks/objc-avoid-osread.rst:6
+
+Finds usages of ``OSRead{Big|Little}Int{16|32|64}`` and associated functions which
+should be avoided due to potential unaligned read problems.
----------------
Eugene.Zelenko wrote:
> Please synchronize with sentence in Release Notes.
Done. I coped this version into the release notes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67865/new/

https://reviews.llvm.org/D67865





More information about the cfe-commits mailing list