[PATCH] D97251: [llvm] Add assertions for the smart pointers with the possibility to be null in ClangAttrEmitter

Ella Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 21:16:51 PST 2021


OikawaKirie added a comment.

As a recursive function it is, the original patch in D91844 <https://reviews.llvm.org/D91844> was adding assertions where the function is called other places in the file.

To confirm it will not lead to a crash here, I re-build my code base with clang and clang-tools-extra enabled. Everything seems to be good.

What do you think about the assertion? Should it be located just here or where the function is called?

Refer to D91844 <https://reviews.llvm.org/D91844> for more details about the previous version.



================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:1364
 
+  assert(Ptr && "Cannot create argument.");
+
----------------
Just as what has been suggested by @dexonsmith in D91844, I add the assertion here. However, as a recursive function it is (line 1359), I still concern whether the assertion here will lead to a crash.

What do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97251



More information about the cfe-commits mailing list