[PATCH] D91844: [llvm][clang] Add checks for the smart pointers with the possibility to be null

Ella Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 22 19:11:38 PST 2020


OikawaKirie added a comment.

In D91844#2408897 <https://reviews.llvm.org/D91844#2408897>, @dexonsmith wrote:

> Is it possible to split these up into separate patches for unrelated code?

Since these are reported by one static scan, and these reported places cannot be categorized with others, I choose to submit them in one patch for simplicity and avoiding spam. If it is necessary to separate them one by one, I will close this review and start a new one for each of them.

Or, maybe you are thinking of just separating the patch of clang with llvm? If so, I will start a new review just for the patch of clang and leave the patches of llvm here.



================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:1346-1353
   if (!Ptr) {
     // Search in reverse order so that the most-derived type is handled first.
     ArrayRef<std::pair<Record*, SMRange>> Bases = Search->getSuperClasses();
     for (const auto &Base : llvm::reverse(Bases)) {
       if ((Ptr = createArgument(Arg, Attr, Base.first)))
         break;
     }
----------------
dexonsmith wrote:
> Can we just add a single assertion here? It looks to me like every caller wants a valid return.
Ok, I will add an assertion here (below line 1353) in the new submits, and remove all other assertions I added in this file together with the checks on this pointer after the assertion (line 1355 and 1358).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91844



More information about the cfe-commits mailing list