| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (when aligning & to the right):
SomeType MemberFunction(const Deleted &) const&;
After:
SomeType MemberFunction(const Deleted &) const &;
This also applies to variable declarations, e.g.:
int const * a;
However, this form is very uncommon (most people would write
"const int* a" instead) and contracting to "const*" might actually send
the wrong signal of what the const binds to.
llvm-svn: 272537
|
|
|
|
|
|
|
|
|
|
| |
Before:
auto s = sizeof...(Ts)-1;
After:
auto s = sizeof...(Ts) - 1;
llvm-svn: 272536
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
[]() //
-> int {
return 1; //
};
After:
[]() //
-> int {
return 1; //
};
llvm-svn: 272535
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Do not insert whitespace preceding the "!" postfix operator. This is an
incomplete fix, but should cover common usage.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D21204
llvm-svn: 272524
|
|
|
|
| |
llvm-svn: 272465
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This also fixes union type formatting in function parameter types.
Before: function x(path: number| string) {}
After: function x(path: number|string) {}
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D21206
llvm-svn: 272330
|
|
|
|
| |
llvm-svn: 272143
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The JavaScript import sorter has a corner condition that can cause the overall
source text length to shrink. This change circumvents the issue by appending
trailing space in the line after the import blocks to match at least the
previous source code length.
This needs a better long term fix, but this fixes the immediate issue.
Reviewers: alexeagle, djasper
Subscribers: klimek
Differential Revision: http://reviews.llvm.org/D21108
llvm-svn: 272142
|
|
|
|
|
|
| |
This could lead to column limit violations.
llvm-svn: 272125
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
.. and simplify it.
Before:
void A::f()&& {}
void f() && {}
After:
void A::f() && {}
void f() && {}
llvm-svn: 272124
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: make header guard identification stricter with Lexer.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20959
llvm-svn: 271883
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inserting new headers.
Summary:
[clang-format] skip empty lines and comments in the top of the code when inserting new headers.
Pair-programmed with @hokein
Reviewers: djasper
Subscribers: ioeric, cfe-commits, hokein, klimek
Differential Revision: http://reviews.llvm.org/D20898
llvm-svn: 271664
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: ASI did not handle the ES6 `as` operator correctly.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20817
llvm-svn: 271401
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: E.g. sort `import {b, a} from 'x';` into `import {a, b} from 'x';`.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20798
llvm-svn: 271400
|
|
|
|
| |
llvm-svn: 271280
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replacement with cleanupAroundReplacements().
Summary:
When a replacement's offset is set to UINT_MAX or -1U, it is treated as
a header insertion replacement by cleanupAroundReplacements(). The new #include
directive is then inserted into the correct block.
Reviewers: klimek, djasper
Subscribers: klimek, cfe-commits, bkramer
Differential Revision: http://reviews.llvm.org/D20734
llvm-svn: 271276
|
|
|
|
| |
llvm-svn: 271191
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Shebang lines (`#!/bin/blah`) can be used in JavaScript scripts to indicate
they should be run using e.g. node. This change treats # lines on the first line
as line comments.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20632
llvm-svn: 271185
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Only treat the sequence `async function` as the start of a function expression,
as opposed to every occurrence of the token `async` (whoops).
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20737
llvm-svn: 271184
|
|
|
|
|
|
|
|
|
| |
Refactors AnnotatedLine.startsWith/endsWith by extracting the core functionality
into FormatToken.startsSequence/endsSequence. This allows checking tokens within
the pointered linked list structure with a lookahead, automatically ignoring
comments, which is useful in many places (e.g. see subsequent commit).
llvm-svn: 271183
|
|
|
|
|
|
|
| |
While it might change the meaning of the comment in rare circumstances,
it is better than violating the column limit.
llvm-svn: 270975
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This change automatically sorts ES6 imports and exports into four groups:
absolute imports, parent imports, relative imports, and then exports. Exports
are sorted in the same order, but not grouped further.
To keep JS import sorting out of Format.cpp, this required extracting the
TokenAnalyzer infrastructure to separate header and implementation files.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20198
llvm-svn: 270203
|
|
|
|
|
|
|
|
| |
Otherwise, clang-format can get confused with statements like:
x.for = 1;
llvm-svn: 270188
|
|
|
|
|
|
|
|
|
|
| |
Before:
const[a, b, c] = [1, 2, 3];
After:
const [a, b, c] = [1, 2, 3];
llvm-svn: 270029
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 269889
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
colon in constructor initializer.
Summary: Make clang-format cleaner remove redundant commas/colons in constructor initializer list.
Reviewers: klimek, djasper
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D19804
llvm-svn: 269888
|
|
|
|
|
|
|
| |
This also reduces complexity to O(n) from O(n^2) by avoiding backtracking
re-parses, and fixes length calculation.
llvm-svn: 269748
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Simply looking at the final text greatly simplifies the algorithm and also
fixes a reported issue. This requires duplicating the "actual encoding width"
logic, but that seems cleaner than the column acrobatics before.
Reviewers: djasper, bkramer
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D20208
llvm-svn: 269747
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20200
llvm-svn: 269282
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch corresponds to reviews:
http://reviews.llvm.org/D15120
http://reviews.llvm.org/D19125
It adds support for the __float128 keyword, literals and target feature to
enable it. Based on the latter of the two aforementioned reviews, this feature
is enabled on Linux on i386/X86 as well as SystemZ.
This is also the second attempt in commiting this feature. The first attempt
did not enable it on required platforms which caused failures when compiling
type_traits with -std=gnu++11.
If you see failures with compiling this header on your platform after this
commit, it is likely that your platform needs to have this feature enabled.
llvm-svn: 268898
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 267860
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
http://reviews.llvm.org/D18551.
Summary: Make SourceManager in Environment, WhitespaceManager, and FormatTokenAnalyzer etc constant members.
Reviewers: djasper, klimek
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D19587
llvm-svn: 267859
|
|
|
|
| |
llvm-svn: 267858
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For generators, see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators
async functions are not quite in the spec yet, but stage 3 and already widely used:
http://tc39.github.io/ecmascript-asyncawait/
Reviewers: djasper
Subscribers: klimek
Differential Revision: http://reviews.llvm.org/D19204
llvm-svn: 267368
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: When there are comments in the line, one token may be checked multiple times.
Reviewers: mprobst, djasper
Subscribers: ioeric, cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D19106
llvm-svn: 266803
|
|
|
|
| |
llvm-svn: 266790
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
`interface` can be used as a fee standing identifier in JavaScript/TypeScript.
This change uses the heuristic of whether it's followed by another identifier
as an indication.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D19240
llvm-svn: 266789
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Change `import` and `export` parsing to special case the renaming
syntax (`import x, {y as bar} ...`, `export {x}`) and otherwise just
parse a regular structural element.
This simplifies the code a bit and should be more correct - it's easier
to recognise the specific import syntax than to recognise arbitrary
expressions and declarations.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D19242
llvm-svn: 266743
|
|
|
|
|
|
|
| |
Specifically understand ellipses in parameter lists and treat trailing
reference qualifiers and the "{" as signals.
llvm-svn: 266599
|
|
|
|
|
| |
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266594
|
|
|
|
|
|
|
|
|
|
| |
Since this patch provided support for the __float128 type but disabled it
on all platforms by default, some platforms can't compile type_traits with
-std=gnu++11 since there is a specialization with __float128.
This reverts the patch until D19125 is approved (i.e. we know which platforms
need this support enabled).
llvm-svn: 266460
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
Including VirtualFileSystem.h in the clangFormat.h indirectly includes <atomic>.
This header is blocked when compiling with /clr.
Patch by Maxime Beaulieu
Differential Revision: http://reviews.llvm.org/D19064
llvm-svn: 266319
|