[PATCH] D68162: [analyzer][MallocChecker][NFC] Communicate the allocation family information to auxiliary functions with template parameters

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 27 18:56:04 PDT 2019


NoQ added a comment.

Thank you, fantastic finding!

> in fact we know it //compile time//

Yeah, but is it accidental or is there a good reason behind always having this information at compile time? 'Cause i don't want to restrict the code to always provide this information at compile time if we're not sure it'll always be able to provide it in compile time.

My mental model for this sort of stuff is something like this:

  CallDescriptionMap M = {
    "malloc", {&MallocChecker::MallocMemAux, AF_Malloc},
    "alloca", {&MallocChecker::MallocMemAux, AF_Alloca},
  };
  
  void checkPostCall(const CallEvent &Call, CheckerContext &C) {
    if (Info *I = M.lookup(Call))
      I->first(I->second, C, Call);
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68162





More information about the cfe-commits mailing list