Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-format messes up returning negative numbers #15203

Closed Quuxplusone closed 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR15203
Status RESOLVED INVALID
Importance P enhancement
Reported by Brett Wilson (brettw@gmail.com)
Reported on 2013-02-07 17:38:37 -0800
Last modified on 2013-02-08 01:12:03 -0800
Version trunk
Hardware PC Linux
CC djasper@google.com, klimek@google.com, nicolasweber@gmx.de
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
clang-format (LLVM version 3.3svn) converts
  return -1;
to
  return - 1;

It should know about negative numbers. It doesn't seem to mess up
  asdf = asdf * -2;
however (it doesn't insert a space there).
Quuxplusone commented 11 years ago

No, it doesn't. There is even a test for it:

unittests/Format/FormatTests.cpp (l. 1503)

Could you please verify that this really happens for you and if so, paste a reduced version of the code where it happens?

Quuxplusone commented 11 years ago
Sorry if I'm doing something stupid. I checked out the code using Chromium's
checkout script and built it today.

odor[~] local/src2/src/third_party/llvm-build/Release+Asserts/bin/clang-format
-version
LLVM (http://llvm.org/):
  LLVM version 3.3svn
  Optimized build with assertions.
  Built Feb  7 2013 (14:00:39).
  Default target: x86_64-unknown-linux-gnu
  Host CPU: corei7

odor[~] cat test.cc

int foo() {
  return -1;
}

odor[~] local/src2/src/third_party/llvm-build/Release+Asserts/bin/clang-format
< test.cc

int foo() {
  return - 1;
}

odor[~] cd local/src2/src/third_party/llvm

odor[~/local/src2/src/third_party/llvm] svn info
Path: .
URL: https://llvm.org/svn/llvm-project/llvm/trunk
Repository Root: https://llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 170392
Node Kind: directory
Schedule: normal
Last Changed Author: echristo
Last Changed Rev: 170390
Last Changed Date: 2012-12-17 16:31:01 -0800 (Mon, 17 Dec 2012)

odor[~/local/src2/src/third_party/llvm] svn status
?       projects/compiler-rt
Quuxplusone commented 11 years ago
> Last Changed Rev: 170390
> Last Changed Date: 2012-12-17 16:31:01 -0800 (Mon, 17 Dec 2012)

That might explain it, this would mean it is an almost two months old version.
I am not actually sure on how clang-format makes it into the chromium
repository. Adding Nico, who might have some insides into this.
Quuxplusone commented 11 years ago
The script is here
http://src.chromium.org/viewvc/chrome/trunk/src/tools/clang/scripts/update.sh?revision=174285&view=markup
and it looks like the version is hardcoded and Nico just manually updates it
from time to time. I guess I'll just wait for the next update. Thanks for the
help.