[compiler-rt] r253608 - Tell clang-format that (most) sanitizers are written using Google style guide.

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 16:57:39 PST 2015


On Fri, Nov 20, 2015 at 4:22 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2015-Nov-20, at 13:01, Kostya Serebryany <kcc at google.com> wrote:
> >
> >
> >
> > On Fri, Nov 20, 2015 at 11:43 AM, Duncan P. N. Exon Smith via
> llvm-commits <llvm-commits at lists.llvm.org> wrote:
> >
> > > On 2015-Nov-19, at 14:11, Alexey Samsonov via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> > >
> > > Author: samsonov
> > > Date: Thu Nov 19 16:11:10 2015
> > > New Revision: 253608
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=253608&view=rev
> > > Log:
> > > Tell clang-format that (most) sanitizers are written using Google
> style guide.
> >
> > I'm guessing this isn't a change of policy, but I didn't know about it.
> > Why don't they use the LLVM style?
> >
> > Because they were initially developed outside of the llvm tree, we were
> not even sure the code will be ever accepted.
> >
> >   Is that documented in the coding
> > standards?
> > no
> > Should it be?
> >
> > I don't think so.
> > I believe the coding style already tells to use whatever style is in use
> in a given file.
> >
>
> But it says that all new files should use LLVM style, and we
> generally expect to migrate files over time to use LLVM style.
>

I've committed .clang-format only to several subdirectories of
compiler-rt/lib (so stuff like builtins, profile etc.)
is not affected.

>
> This change would make all new files use the Google style.
>

That's probably fine: when the new file is created it's often the case that
90%
if its contents are moved from existing file - we do split and merge files
and move the code around
somewhat frequently. It would be pain to re-format the piece of code when
it's moved.

Mixing of styles is already somewhat confusing in UBSan, which is written
in LLVM style, but uses functionality
from sanitizer_common written in Google style. I would like to see less of
this happening.


> I guess I'm also wondering whether this is something we should
> accept generally for big patches that are originally developed
> out of tree.  Were the sanitizers a special exception, or is
> this how we do things now?
>
> I know LLDB and libc++ also have their own coding styles, so
> this isn't exactly the first precedent, but this is still kind
> of surprising to me (as I guess I mistakenly thought that
> llvm.git, clang.git, clang-tools-extra.git, and compiler_rt.git
> were in general agreement).
>

There's a dark corner of the compiler-rt you were not aware of, and will
not be happy to
learn about (we hate it as well) - we actually have a script which enforces
Google coding style
(not just whitespaces) at test-time and it's been around since day1 of
sanitizers in compiler-rt. My change
kind of keeps the status-quo and makes its harder for clang-format user to
accidentally make the
script unhappy about the code modified.

So I don't think compiler-rt was "in agreement" there.


>
> >
> > >
> > > Added:
> > >    compiler-rt/trunk/lib/asan/.clang-format
> > >    compiler-rt/trunk/lib/dfsan/.clang-format
> > >    compiler-rt/trunk/lib/interception/.clang-format
> > >    compiler-rt/trunk/lib/lsan/.clang-format
> > >    compiler-rt/trunk/lib/msan/.clang-format
> > >    compiler-rt/trunk/lib/safestack/.clang-format
> > >    compiler-rt/trunk/lib/sanitizer_common/.clang-format
> > >    compiler-rt/trunk/lib/tsan/.clang-format
> > >
> > > Added: compiler-rt/trunk/lib/asan/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/asan/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/asan/.clang-format Thu Nov 19 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/dfsan/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/dfsan/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/dfsan/.clang-format Thu Nov 19 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/interception/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/interception/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/interception/.clang-format Thu Nov 19
> 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/lsan/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/lsan/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/lsan/.clang-format Thu Nov 19 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/msan/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/msan/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/msan/.clang-format Thu Nov 19 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/safestack/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/safestack/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/safestack/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/safestack/.clang-format Thu Nov 19 16:11:10
> 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/sanitizer_common/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/sanitizer_common/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/sanitizer_common/.clang-format Thu Nov 19
> 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > > Added: compiler-rt/trunk/lib/tsan/.clang-format
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/.clang-format?rev=253608&view=auto
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/tsan/.clang-format (added)
> > > +++ compiler-rt/trunk/lib/tsan/.clang-format Thu Nov 19 16:11:10 2015
> > > @@ -0,0 +1 @@
> > > +BasedOnStyle: Google
> > >
> > >
> > > _______________________________________________
> > > llvm-commits mailing list
> > > llvm-commits at lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
>
>


-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151120/36e4ed0f/attachment.html>


More information about the llvm-commits mailing list