[libc-commits] [PATCH] D156168: [libc][NFC] Simplify assert message generation
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Jul 24 18:44:39 PDT 2023
sivachandra accepted this revision.
sivachandra added inline comments.
================
Comment at: libc/src/__support/libc_assert.h:32
const char *funcname) {
- char line_str[IntegerToString::dec_bufsize<unsigned>()];
- // dec returns an optional, will always be valid for this size buffer
- auto line_number = IntegerToString::dec(line, line_str);
- __llvm_libc::write_to_stderr(filename);
- __llvm_libc::write_to_stderr(":");
- __llvm_libc::write_to_stderr(*line_number);
- __llvm_libc::write_to_stderr(": Assertion failed: '");
- __llvm_libc::write_to_stderr(assertion);
- __llvm_libc::write_to_stderr("' in function: '");
+ __llvm_libc::write_to_stderr(error_str);
__llvm_libc::write_to_stderr(funcname);
----------------
With this change I think it is better to inline these calls also in the macro below. The format relation ship between `error_str` and `funcname` is decided in that macro so keep it there.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156168/new/
https://reviews.llvm.org/D156168
More information about the libc-commits
mailing list