[PATCH] D81915: [ObjectYAML][DWARF] Let writeVariableSizedInteger() return Error.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 06:04:07 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:59
+    return createStringError(errc::not_supported,
+                             "invalid integer write size: " + utostr(Size));
+
----------------
`createStringError` follows printf style formatting rules, so this can be:
```
    return createStringError(errc::not_supported,
                             "invalid integer write size: %zu", Size);
```
and then no need to include the header.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:135-136
+        return createStringError(errc::not_supported,
+                                 "unable to write debug_aranges address: " +
+                                     toString(std::move(Err)));
+      cantFail(writeVariableSizedInteger(Descriptor.Length, Range.AddrSize, OS,
----------------
Similarly, consider using `%s`:

```
        return createStringError(errc::not_supported,
                                 "unable to write debug_aranges address: %s",
                                     toString(std::move(Err)).c_str());
```

Same goes below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81915





More information about the llvm-commits mailing list