When applying this check to the unit tests, it would hit an assertion:
llvm/tools/clang/lib/Lex/Lexer.cpp:1056: clang::SourceLocation clang::Lexer::getSourceLocation(const char*, unsigned int) const: Assertion `PP && "This doesn't work on raw lexers"' failed.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tidy/modernize/RedundantVoidArgCheck.cpp | ||
---|---|---|
131 ↗ | (On Diff #38815) | What happens if instead you pass the range through Lexer::makeFileCharRange? This might be a way to enable fixes at least in some trivial cases involving macros. |
Comment Actions
Use Lexer::makeFileCharRange (and a few changes due to clang-format).
It seems to work as well.
Comment Actions
Can you add a test where a void argument is removed in a macro (which would be the whole point of using the makeFileCharRange instead of just bailing out on all macros)?
E.g. does this work in a simple case like this one?
#define M(x) x M(void f(void) {}) // CHECK-FIXES: M(void f() {})