Typz updated this revision to Diff 103935.
Typz added a comment.
Complete refactor to make the processing much more generic
https://reviews.llvm.org/D33440
Files:
include/clang/Format/Format.h
lib/Format/Format.cpp
lib/Format/FormatToken.h
lib/Format/FormatTokenLexer.cpp
lib/Format/Fo
djasper added a comment.
I generally would not be opposed to such a patch. However, note that this might
be hard to get right. We had significant performance problems in the past with
ForEachMacros as we used to match every single identifier against the regex
stored in there. For for loops you
Typz added a comment.
Digging back, it seem the issue was that I had this code:
void foo(..) { Q_UNUSED(a) Q_UNUSED(b) }
which got wrapped because the line was too long:
void foo(..) {
Q_UNUSED(a) Q_UNUSED(b)
}
I definitely understand your concern about introduceing special h
djasper added a comment.
I don't. Only if they start out to be on the same line. As long as I start with:
class C {
void foo(int a, int b) {
Q_UNUSED(a)
Q_UNUSED(a)
return b;
}
};
clang-format leaves this alone. That's good enough I think and we don't want to
add m
Typz added a comment.
Without this patch, macros with no trailing semicolon _in the body of a
function_ are not handled properly, so I get:
int foo(int a, int b) {
Q_UNUSED(a) return b;
}
class Foo {
void bar(int a, int b) { Q_UNUSED(a) Q_UNUSED(b) }
}
https://reviews.llvm.o
djasper added a comment.
clang-format already has logic to detect semicolon-less macro invocations an in
fact this already does behave as I would expect. What are you fixing?
https://reviews.llvm.org/D33440
___
cfe-commits mailing list
cfe-commits@
Typz created this revision.
Herald added a subscriber: klimek.
These macros are used in the body of function, and actually contain
the trailing semicolon: they should thus be automatically followed by
a new line, and not get merged with the next line.
void foo(int a, int b) {
Q_UNUSED(a)