The %p format wasn't correctly passing along flags and modifiers to the
integer conversion behind the scenes. This patch fixes that behavior, as
well as changing the nullptr behavior to be a string conversion behind
the scenes.
Details
Details
- Reviewers
sivachandra lntue jhuber6 - Commits
- rGdd51ae81d8d3: [libc] Fix printf %p format
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks.
libc/src/stdio/printf_core/ptr_converter.h | ||
---|---|---|
23–24 | Why do we need to cast nullptr here? Also do we have the raw value itself? We could just check that for zero. |
libc/src/stdio/printf_core/ptr_converter.h | ||
---|---|---|
23–24 | I'm not sure why that cast is there. I've removed it. The reason we check the pointer is because the value is a pointer, so it gets stored in the pointer member. |
libc/src/stdio/printf_core/ptr_converter.h | ||
---|---|---|
32–37 | This is now unreachable. You can remove the else from the above and this return statement. |
Why do we need to cast nullptr here? Also do we have the raw value itself? We could just check that for zero.