[PATCH] Insert override at the same line as the end of the function declaration
Ehsan Akhgari
ehsan.akhgari at gmail.com
Sun Apr 26 18:34:26 PDT 2015
Hi alexfh,
The existing check converts the code pattern below:
void f()
{
}
to:
void f()
override {
}
which is fairly sub-optimal. This patch fixes this by inserting the
override keyword on the same line as the function declaration if
possible, so that we instead get:
void f() override
{
}
We do this by looking for the last token before the start of the body
and inserting the override keyword at the end of its location. Note
that we handle const, volatile and ref-qualifiers correctly.
http://reviews.llvm.org/D9286
Files:
clang-tidy/misc/UseOverrideCheck.cpp
test/clang-tidy/misc-use-override-keep-virtual.cpp
test/clang-tidy/misc-use-override.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9286.24449.patch
Type: text/x-patch
Size: 5747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150427/63c829db/attachment.bin>
More information about the cfe-commits
mailing list