[PATCH] D86998: [llvm-dwarfdump] Warn user when it encounters no null terminated strings.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 01:24:56 PDT 2020
jhenderson added inline comments.
================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:533
+ Error Err = Error::success();
+ cantFail(std::move(Err));
+
----------------
Higuoxing wrote:
> MaskRay wrote:
> > `operator bool` sets the checked state if Error is in a success state.
> >
> > So you can just run: `(void)!Err`
> >
> > If you want to ensure an Error in a success state is also checked (not in this case), `ErrorAsOutParameter ...(&Err)`
> Thanks. Actually I'm not sure about it. I didn't find anything about creating a checked error in [LLVM Programmer's manual](https://llvm.org/docs/ProgrammersManual.html).
>
> I usually do it using
>
> ```
> Error Err = Error::success();
> cantFail(std::move(Err));
> ```
>
> Can we record it in programmer's manual?
Do you actually need this here? It seems to me a `cantFail(std::move(Err));` after the loop might be more appropriate. The `getCStr` function handles the `Error` that gets passed in, so that it doesn't need checking beforehand.
================
Comment at: llvm/test/tools/llvm-dwarfdump/debug-str.yaml:48
+
+## c) Test that llvm-dwarfdump emits a warning when it encounters a no null terminated string.
+
----------------
I think this reads better.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86998/new/
https://reviews.llvm.org/D86998
More information about the llvm-commits
mailing list