[PATCH] D101921: [MC] Make it possible for targets to define their own MCObjectFileInfo

Philipp Krones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 13 01:26:15 PDT 2021


flip1995 added a comment.

In D101921#2754426 <https://reviews.llvm.org/D101921#2754426>, @MaskRay wrote:

> Can `createMCObjectFileInfo` return `MCObjectFileInfo` instead of `std::unique_ptr<MCObjectFileInfo>`?

`createMCObjectfileInfo` returns a `MCObjectFileInfo *` similar to every other `create*` function in `TargetRegistry.h`.



================
Comment at: clang/lib/Parse/ParseStmtAsm.cpp:590
+
   if (!MAI || !MII || !MOFI || !STI) {
     Diag(AsmLoc, diag::err_msasm_unable_to_create_target)
----------------
MaskRay wrote:
> Can `MOFI` be null? (i.e. can createMCObjectFileInfo guarantee no-null return value?)
> 
> Consider moving the construction below the checks.
You're right. The `createMCObjectFileInfo` always returns a no-null value. I'll move the construction and remove the check for `MOFI`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101921



More information about the cfe-commits mailing list