[PATCH] D71612: [analyzer] Add PlacementNewChecker

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 08:57:42 PST 2019


whisperity added a comment.

Are buffers otherwise modelled by the Analyser, such as results of the `malloc` family and `alloca` intentionally not matched, or are there some tests missing regarding this?



================
Comment at: clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp:115-117
+          llvm::formatv("Argument of default placement new provides storage "
+                        "capacity of {0} bytes, but the allocated type "
+                        "requires storage capacity of {1} bytes",
----------------
This message might be repeating phrases too much, and seems long. Also, I would expect things like //default placement new// or //argument of placement new// to be confusing. Not every person running Clang SA knows the nitty-gritty of the standard by heart...

More nitpicking: even the "default" (what does this even mean, again?) placement new takes **two** arguments, albeit written in a weird grammar, so there is no "argument of" by the looks of it. I really think this is confusing.

Something more concise, simpler, still getting the meaning across:

> Storage provided to placement new is only `N` bytes, whereas allocating a `T` requires `M` bytes



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71612





More information about the cfe-commits mailing list