| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
While it might change the meaning of the comment in rare circumstances,
it is better than violating the column limit.
llvm-svn: 270975
|
|
|
|
|
|
| |
FormatTest.cpp to CleanUpTest.cpp.
llvm-svn: 270971
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
#define MACRO(a) \
if (a) { \
f(); \
} else \
g()
After:
#define MACRO(a) \
if (a) { \
f(); \
} else \
g()
llvm-svn: 270028
|
|
|
|
|
|
|
|
|
|
| |
Before:
case a... b: break;
After:
case a ... b: break;
llvm-svn: 270027
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: [clang-format] Make formatReplacements() also sort #includes.
Reviewers: bkramer, djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20362
llvm-svn: 269924
|
|
|
|
|
|
|
|
|
|
| |
Before:
f(/*a=*/a, /*b=*/ ::b);
After:
f(/*a=*/a, /*b=*/::b);
llvm-svn: 268879
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
template <enum E> class A { public : E *f(); };
After:
template <enum E> class A {
public:
E *f();
};
llvm-svn: 268878
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
redundant code.
Summary:
After applying replacements, redundant code like extra commas or empty namespaces
might be introduced. Fixer can detect and remove any redundant code introduced by replacements.
The current implementation only handles redundant commas.
Reviewers: djasper, klimek
Subscribers: ioeric, mprobst, klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D18551
llvm-svn: 267416
|
|
|
|
|
|
|
| |
Specifically understand ellipses in parameter lists and treat trailing
reference qualifiers and the "{" as signals.
llvm-svn: 266599
|
|
|
|
|
|
|
|
|
|
| |
Indentation of the last line was reset to the initial indentation of the block when reaching EOF.
Patch by Maxime Beaulieu
Differential Revision: http://reviews.llvm.org/D19065
llvm-svn: 266321
|
|
|
|
|
|
|
|
|
|
| |
Use tabs to fill whitespace at the start of a line.
Patch by Maxime Beaulieu
Differential Revision: http://reviews.llvm.org/D19028
llvm-svn: 266320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
#define A \
if (a) \
label: \
f()
After:
#define A \
if (a) \
label: \
f()
llvm-svn: 265557
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While I am not personally convinced about the usefulness of this
construct, we should break it.
Before:
if (a) label:
f();
After:
if (a)
label:
f();
llvm-svn: 265545
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
MACRO(
abc).function() // wrap
<< abc;
After:
MACRO(abc).function() // wrap
<< abc;
llvm-svn: 265540
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
auto x = (X) this;
After:
auto x = (X)this;
This fixes llvm.org/PR27198.
llvm-svn: 265385
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
formatAndApplyAllReplacements takes a set of Replacements, applies them on a
Rewriter, and reformats the changed code.
Reviewers: klimek, djasper
Subscribers: ioeric, klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D17852
llvm-svn: 264745
|
|
|
|
| |
llvm-svn: 264289
|
|
|
|
|
|
| |
platform-related test case for MS compilers to avoid breaking buildbot.
llvm-svn: 264277
|
|
|
|
|
|
| |
This reverts commit r264253. It is breaking the buildbot http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/2203
llvm-svn: 264257
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Previously, format::getStyle assumes that the given file resides in
the real file system, which prevents the use of virtual file system in testing etc.
This patch adds a parameter in format::getStyle interface so that users can specify
the right file system. By default, the file system is the real file system.
Reviewers: djasper, klimek
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D18399
llvm-svn: 264253
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a regular expression to configure suffixes of an
included file to check whether it is the "main" include of the current
file. Previously, clang-format has allowed arbitrary suffixes on the
formatted file, which is still the case when no IncludeMainRegex is
specified.
llvm-svn: 263943
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a call takes a single argument, using AlwaysBreak can lead to lots
of wasted lines and additional indentation without improving the
readability in a significant way.
Before:
caaaaaaaaaaaall(
caaaaaaaaaaaall(
caaaaaaaaaaaall(
caaaaaaaaaaaaaaaaaaaaaaall(aaaaaaaaaaaaaa, aaaaaaaaa))));
After:
caaaaaaaaaaaall(caaaaaaaaaaaall(caaaaaaaaaaaall(
caaaaaaaaaaaaaaaaaaaaaaall(aaaaaaaaaaaaaa, aaaaaaaaa))));
llvm-svn: 263709
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns "foo" into 'foo' (or vice versa, depending on configuration).
This makes it more convenient to follow the Google JavaScript style
guide:
https://google.github.io/styleguide/javascriptguide.xml?showone=Strings#Strings
This functionality is behind the option "JavaScriptQuotes", which can be:
* "leave" (no re-quoting)
* "single" (change to single quotes)
* "double" (change to double quotes)
This also changes single quoted JavaScript string literals to be treated
as tok::string_literal, not tok::char_literal, which fixes two unrelated
tests.
Patch by Martin Probst. Thank you.
llvm-svn: 262534
|
|
|
|
|
|
| |
Patch by Erik Kessler, thank you.
llvm-svn: 262402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a commonly useful feature to have, and we have implemented it
multiple times with different kinds of bugs. This implementation
centralizes the idea in a set of functions that we can then use from the various
tools.
Reverts r262234, which is a revert of r262232, and puts the functions
into FOrmat.h, as they are closely coupled to clang-format, and we
otherwise introduce a cyclic dependency between libFormat and
libTooling.
Patch by Eric Liu.
llvm-svn: 262323
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ternary expressions.
Before:
return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaa : bbbbbbbbbbbbbbb +
cccccccccccccccc;
After:
return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
aaaaa :
bbbbbbbbbbbbbbb + cccccccccccccccc;
llvm-svn: 262293
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa]
[a].aaaaaaaaaaaaaaaaaaaaaa();
After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa][a]
.aaaaaaaaaaaaaaaaaaaaaa();
llvm-svn: 262292
|
|
|
|
|
|
| |
Cleanup for upcoming Clang warning -Wcomma. No functionality change intended.
llvm-svn: 261271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
<< aaa;
After:
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)
<< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
<< aaa;
llvm-svn: 260517
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, make it more expensive than breaking after the return
type of a function definition/declaration.
Before:
template <typename T>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa<
T>::aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa);
After:
template <typename T>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa);
llvm-svn: 260497
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
bbbbbbbbbbbb(aaaaaaaaaaaaaaaaaaaaaaaa, //
ccccccc(aaaaaaaaaaaaaaaaa, //
b));
After:
bbbbbbbbbbbb(aaaaaaaaaaaaaaaaaaaaaaaa, //
ccccccc(aaaaaaaaaaaaaaaaa, //
b));
This fixes llvm.org/PR24905.
llvm-svn: 260080
|
|
|
|
|
|
|
|
|
|
| |
Before:
f(a.operator() < A > ());
After:
f(a.operator()<A>());
llvm-svn: 259884
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
/*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :
ccccccccccccccccccccccccccc;
After:
int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
/*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :
ccccccccccccccccccccccccccc;
llvm-svn: 259670
|
|
|
|
|
|
| |
Patch by Matthew Whitehead, thank you.
llvm-svn: 259487
|
|
|
|
|
|
|
|
|
|
|
|
| |
initializers.
Before:
Constructor() : member([](A *a, B * b) {}) {}
After:
Constructor() : member([](A *a, B *b) {}) {}
llvm-svn: 259353
|
|
|
|
| |
llvm-svn: 259352
|
|
|
|
| |
llvm-svn: 259351
|
|
|
|
|
|
|
|
|
|
| |
Before:
a[ ::b::c];
After:
a[::b::c];
llvm-svn: 258123
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaa[bbbb]
.cccc();
After:
aaaa[bbbb].cccc();
llvm-svn: 257763
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After reading the style guides again, they don't actually say how to
pack or not pack array literals. Based on some user reports, array
initializers can unnecessarily get quite long if they contain many
small elements. Array literals with trailing commas are still formatted
one per line so that users have a way to opt out of the packing.
Before:
var array = [
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa
];
After:
var array = [
aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa,
aaaaaa, aaaaaa
];
llvm-svn: 257615
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As soon as a comment had whitespace changes inside of the token, we
couldn't identify the whole comment as a trailing comment anymore and
alignment stopped working. Add a new boolean to Change for this special
case and fix trailing comment identification to use it.
This also changes WhitespaceManager to sum the length of all Changes
inside of a token into the first Change.
Before this fix
int xy; // a
int z; //b
became
int xy; // a
int z; // b
with this patch we immediately get to:
int xy; // a
int z; // b
Differential Revision: http://reviews.llvm.org/D16058
llvm-svn: 257341
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaaaaaaaaa operator,(aaaaaaaaaaaaaaaaaaaaa &
aaaaaaaaaaaaaaaaaaaaaaaaaa) const;
After:
aaaaaaaaaaaaaaaaaaaaaa operator,(
aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaaaaaaaaaaaaaaaaaaa) const;
llvm-svn: 257330
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r257257 change the way clang-format enforces line breaks after a
templated type has been line-wrapped. This was to fix an incorrect line
break if BinPackParameters is set to false. However, it also leads to
an unwanted line break in a different case. Thus, for now, only do this
when BinPackParameters is false. This isn't ideal yet, but helps us
until we have a better solution.
With BinPackParameters:
Before:
void fffffffffff(aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaa> aaaaaaaaaa);
After:
void fffffffffff(
aaaaaaaaaaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaa>
aaaaaaaaaa);
llvm-svn: 257325
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
vector<int>
bbbbbbbbbbbbbbb);
After:
void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
vector<int> bbbbbbbbbbbbbbb);
llvm-svn: 257257
|
|
|
|
|
|
|
|
|
|
| |
Before:
bool operator, ();
After:
bool operator,();
llvm-svn: 257256
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (example is JS, but also applies to C++):
return [
aaaa()
.bbbbbbbb('A'),
aaaa().bbbbbbbb('B'),
aaaa().bbbbbbbb('C'),
];
After:
return [
aaaa().bbbbbbbb('A'),
aaaa().bbbbbbbb('B'),
aaaa().bbbbbbbb('C'),
];
llvm-svn: 257079
|
|
|
|
|
|
|
|
|
|
| |
Before:
MACRO((AA & a) { return 1; });
After:
MACRO((AA &a) { return 1; });
llvm-svn: 257062
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaa
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 256841
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang-format breaks multi-line streams after std::endl.
It now also break for '\n', the suggested replacement for std::endl:
http://llvm.org/docs/CodingStandards.html#avoid-std-endl
Before:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n' << bbbbbbbbbbbbbbbbbbbbbb
<< '\n';
llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n" << bbbb
<< "bbbbbbbbbbbbbbbbbb\n";
After:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n'
<< bbbbbbbbbbbbbbbbbbbbbb << '\n';
llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n"
<< bbbb << "bbbbbbbbbbbbbbbbbb\n";
This changeset ensure that multiline streams have a line break after:
- std::endl
- '\n'
- "\n"
- "Some Text\n"
Patch by Jean-Philippe Dufraigne, thank you.
llvm-svn: 256832
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaa)
.aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaaaaaaaaaaaaaa
.aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa)
.aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 256831
|