History log of /llvm-project/clang/lib/Format/Format.cpp (Results 301 – 325 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b55dea4e 23-Aug-2019 Nico Weber <nicolasweber@gmx.de>

clang-format: Disable across-block include reordering.

Differential Revision: https://reviews.llvm.org/D66650

llvm-svn: 369759


# 8798c8de 23-Aug-2019 Fangrui Song <maskray@google.com>

[clang-format] Recognize ECMAScript module .mjs as JavaScript

PR43085.

Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules.
A specific extension (and associated content

[clang-format] Recognize ECMAScript module .mjs as JavaScript

PR43085.

Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules.
A specific extension (and associated content type javascript/esm) is
introduced to differentiate it from CommonJS modules and solve some
interoperability problems.

Differential Revision: https://reviews.llvm.org/D66584
Patch by Fergal Daly

llvm-svn: 369732

show more ...


# 2b3d49b6 14-Aug-2019 Jonas Devlieghere <jonas@devlieghere.com>

[Clang] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
o

[Clang] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

Differential revision: https://reviews.llvm.org/D66259

llvm-svn: 368942

show more ...


# 10234da7 11-Aug-2019 Owen Pan <owenpiano@gmail.com>

[clang-format] Expand AllowShortBlocksOnASingleLine for WebKit

See PR40840

Differential Revision: https://reviews.llvm.org/D66059

llvm-svn: 368539


# db4ad360 10-Aug-2019 Owen Pan <owenpiano@gmail.com>

[clang-format] Add SpaceInEmptyBlock option for WebKit

See PR40840

Differential Revision: https://reviews.llvm.org/D65925

llvm-svn: 368507


# 9131e925 02-Aug-2019 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug that doesn't break braces before unions for Allman
Differential Revision: https://reviews.llvm.org/D65631

llvm-svn: 367648


# ff9f4b54 29-Jul-2019 Nico Weber <nicolasweber@gmx.de>

clang-format clang/lib/Format

llvm-svn: 367225


# 5a43ba8a 24-Jul-2019 Fangrui Song <maskray@google.com>

[Format] getFormattingLangOpts: make LS_Auto uses LS_Cpp11 lexing rule

Suggested by sammccall in post-commit review of D65183

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org

[Format] getFormattingLangOpts: make LS_Auto uses LS_Cpp11 lexing rule

Suggested by sammccall in post-commit review of D65183

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D65194

llvm-svn: 366883

show more ...


# 00e8ac3b 24-Jul-2019 Fangrui Song <maskray@google.com>

[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI

Preparatory change for D65043.

We current use `!=LS_Cpp03` to enable language standards 11,14,17, and
2a. `>=LS_Cpp11` i

[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI

Preparatory change for D65043.

We current use `!=LS_Cpp03` to enable language standards 11,14,17, and
2a. `>=LS_Cpp11` is better if we decide to add new LanguageStandard in
the future.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D65183

llvm-svn: 366876

show more ...


# d9212ef7 22-Jul-2019 Ben Hamilton <benhamilton@google.com>

Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.

Summary:
Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.

Before:

Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.

Summary:
Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.

Before:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo,
FooValueThree};
```

After:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo) {
FooValueOne = 1,
FooValueTwo,
FooValueThree
};
```

Contributed by heijink.

Reviewers: benhamilton, krasimir

Reviewed By: benhamilton

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65012

llvm-svn: 366719

show more ...


# 04ee232f 02-Jul-2019 Sam McCall <sam.mccall@gmail.com>

clang-format: Add new style option AlignConsecutiveMacros

This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor

clang-format: Add new style option AlignConsecutiveMacros

This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor macros on consecutive lines.

I've worked in many projects (embedded, mostly) where header files full
of large, well-aligned "#define" blocks are a common pattern. We
normally avoid using clang-format on these files, since it ruins any
existing alignment in said blocks. This style option will align "simple"
PP macros (no parameters) and PP macros with parameter lists on
consecutive lines.

Related Bugzilla entry (thanks mcuddie):
https://llvm.org/bugs/show_bug.cgi?id=20637

Patch by Nick Renieris (VelocityRa)!

Differential Revision: https://reviews.llvm.org/D28462

llvm-svn: 364938

show more ...


# e8a301f8 06-Jun-2019 Francois Ferrand <thetypz@gmail.com>

clang-format: better handle namespace macros

Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittes

clang-format: better handle namespace macros

Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittest-cpp's SUITE macro:

TESTSUITE(Foo) {
TEST(MyFirstTest) {
assert(0);
}
} // TESTSUITE(Foo)

This patch deals with this cases by introducing a new option to specify
lists of namespace macros. Internally, it re-uses the system already in
place for foreach and statement macros, to ensure there is no impact on
performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: acoomans, cfe-commits, klimek

Tags: #clang

Differential Revision: https://reviews.llvm.org/D37813

llvm-svn: 362740

show more ...


# c5227a1f 29-May-2019 Francois Ferrand <thetypz@gmail.com>

[clang-format] Allow configuring list of function-like macros that resolve to a type

Summary:
Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way simi

[clang-format] Allow configuring list of function-like macros that resolve to a type

Summary:
Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way similar to `typeof()`.

This is enough to:
- Prevent misinterpreting declarations of pointers to such types as expressions (`STACK_OF(int) * foo` -> `STACK_OF(int) *foo`),
- Avoid surprising line breaks in variable/struct field declarations (`STACK_OF(int)\nfoo;` -> `STACK_OF(int) foo;`, see https://bugs.llvm.org/show_bug.cgi?id=30353).

Reviewers: Typz, krasimir, djasper

Reviewed By: Typz

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57184

llvm-svn: 361986

show more ...


# 899d1392 24-Apr-2019 Fangrui Song <maskray@google.com>

Use llvm::stable_sort

llvm-svn: 359098


# 806d5741 08-Apr-2019 Owen Pan <owenpiano@gmail.com>

[clang-format] Add AfterCaseLabel to BraceWrapping

Fixes PR38686

> llvm-svn: 52527

llvm-svn: 357957


# 91f60b44 08-Apr-2019 Reuben Thomas <reuben.thomas@me.com>

[clang-format] Optionally insert a space after unary ! operator

llvm-svn: 357908


# ffff4921 04-Apr-2019 Nico Weber <nicolasweber@gmx.de>

Updating Chromium's Java import order

Adding in androidx as another import group.

Differential Revision: https://reviews.llvm.org/D60203

Patch from Sam Maier <smaier@chromium.org>!

llvm-svn: 3577

Updating Chromium's Java import order

Adding in androidx as another import group.

Differential Revision: https://reviews.llvm.org/D60203

Patch from Sam Maier <smaier@chromium.org>!

llvm-svn: 357700

show more ...


# 00e7ae9f 04-Apr-2019 Krasimir Georgiev <krasimir@google.com>

[clang-format] Preserve include blocks in ObjC Google style

Summary:
r357567 started to regroup include block for Google style; it was meant to apply
only for C++. This patch reverts this for ObjC.

[clang-format] Preserve include blocks in ObjC Google style

Summary:
r357567 started to regroup include block for Google style; it was meant to apply
only for C++. This patch reverts this for ObjC.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: thakis, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60263

llvm-svn: 357695

show more ...


# 925bb20c 03-Apr-2019 Krasimir Georgiev <krasimir@google.com>

[clang-format] Do not emit replacements while regrouping if Cpp includes are OK

Summary:
Currently clang-format would always emit a replacement for multi-block #include
sections if `IBS_Regroup`, ev

[clang-format] Do not emit replacements while regrouping if Cpp includes are OK

Summary:
Currently clang-format would always emit a replacement for multi-block #include
sections if `IBS_Regroup`, even if the sections are correct:
```
% cat ~/test.h
#include <a.h>

#include "b.h"
% bin/clang-format --output-replacements-xml -style=google ~/test.h
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='0' length='30'>#include &lt;a.h>&#10;&#10;#include "b.h"</replacement>
</replacements>
%
```

This change makes clang-format not emit replacements in this case.
The logic is similar to the one implemented for Java in r354452.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60199

llvm-svn: 357599

show more ...


# 0f4d5f85 03-Apr-2019 Eric Liu <ioeric@google.com>

[clang-format] Regroup #includes into blocks for Google style

Summary:
Regrouping #includes in blocks separated by blank lines when sorting C++ #include
headers was implemented recently, and it has

[clang-format] Regroup #includes into blocks for Google style

Summary:
Regrouping #includes in blocks separated by blank lines when sorting C++ #include
headers was implemented recently, and it has been preferred in Google's C++ style guide:
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

Reviewers: sammccall, klimek

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60116

llvm-svn: 357567

show more ...


# 88335c21 30-Mar-2019 Paul Hoad <mydeveloperday@gmail.com>

[clang-format] [PR41187] moves Java import statements to the wrong location if code contains statements that start with the word import

Summary:
Import sorting of java file, incorrectly move import

[clang-format] [PR41187] moves Java import statements to the wrong location if code contains statements that start with the word import

Summary:
Import sorting of java file, incorrectly move import statement to after a function beginning with the word import.

Make 1 character change to regular expression to ensure there is always at least one space/tab after the word import

Previously clang-format --style="LLVM" would format

```
import X;

class C {
void m() {
importFile();
}
}
```
as

```
class C {
void m() {
importFile();
import X;
}
}
```

Reviewers: djasper, klimek, reuk, JonasToth

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D59684

llvm-svn: 357345

show more ...


# 08a940d6 30-Mar-2019 Reuben Thomas <reuben.thomas@me.com>

[clang-format]: Add NonEmptyParentheses spacing option

This patch aims to add support for the following rules from the JUCE coding standards:

- Always put a space before an open parenthesis that co

[clang-format]: Add NonEmptyParentheses spacing option

This patch aims to add support for the following rules from the JUCE coding standards:

- Always put a space before an open parenthesis that contains text - e.g. foo (123);
- Never put a space before an empty pair of open/close parenthesis - e.g. foo();

Patch by Reuben Thomas

Differential Revision: https://reviews.llvm.org/D55170

llvm-svn: 357344

show more ...


# a83e2dbb 26-Mar-2019 Ronald Wampler <rdwampler@gmail.com>

[clang-format] Add style option AllowShortLambdasOnASingleLine

Summary:
This option `AllowShortLambdasOnASingleLine` similar to the other `AllowShort*` options, but applied to C++ lambdas.

Reviewer

[clang-format] Add style option AllowShortLambdasOnASingleLine

Summary:
This option `AllowShortLambdasOnASingleLine` similar to the other `AllowShort*` options, but applied to C++ lambdas.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57687

llvm-svn: 357027

show more ...


# c6deae45 23-Mar-2019 Paul Hoad <mydeveloperday@gmail.com>

Clang-format: add finer-grained options for putting all arguments on one line

Summary:
Add two new options,
AllowAllArgumentsOnNextLine and
AllowAllConstructorInitializersOnNextLine. These mirror t

Clang-format: add finer-grained options for putting all arguments on one line

Summary:
Add two new options,
AllowAllArgumentsOnNextLine and
AllowAllConstructorInitializersOnNextLine. These mirror the existing
AllowAllParametersOfDeclarationOnNextLine and allow me to support an
internal style guide where I work. I think this would be generally
useful, some have asked for it on stackoverflow:

https://stackoverflow.com/questions/30057534/clang-format-binpackarguments-not-working-as-expected

https://stackoverflow.com/questions/38635106/clang-format-how-to-prevent-all-function-arguments-on-next-line

Reviewers: djasper, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: jkorous, MyDeveloperDay, aol-nnov, lebedev.ri, uohcsemaj, cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D40988

Patch By: russellmcc (Russell McClellan)

llvm-svn: 356834

show more ...


# cbb726d0 21-Mar-2019 Paul Hoad <mydeveloperday@gmail.com>

[clang-format] Add basic support for formatting C# files

Summary:

This revision adds basic support for formatting C# files with clang-format, I know the barrier to entry is high here so I'm sendin

[clang-format] Add basic support for formatting C# files

Summary:

This revision adds basic support for formatting C# files with clang-format, I know the barrier to entry is high here so I'm sending this revision in to test the water as to whether this might be something we'd consider landing.

Tracking in Bugzilla as:
https://bugs.llvm.org/show_bug.cgi?id=40850

Justification:
C# code just looks ugly in comparison to the C++ code in our source tree which is clang-formatted.

I've struggled with Visual Studio reformatting to get a clean and consistent style, I want to format our C# code on saving like I do now for C++ and i want it to have the same style as defined in our .clang-format file, so it consistent as it can be with C++. (Braces/Breaking/Spaces/Indent etc..)

Using clang format without this patch leaves the code in a bad state, sometimes when the BreakStringLiterals is set, it fails to compile.

Mostly the C# is similar to Java, except instead of JavaAnnotations I try to reuse the TT_AttributeSquare.

Almost the most valuable portion is to have a new Language in order to partition the configuration for C# within a common .clang-format file, with the auto detection on the .cs extension. But there are other C# specific styles that could be added later if this is accepted. in particular how `{ set;get }` is formatted.

Reviewers: djasper, klimek, krasimir, benhamilton, JonasToth

Reviewed By: klimek

Subscribers: llvm-commits, mgorny, jdoerfert, cfe-commits

Tags: #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D58404

llvm-svn: 356662

show more ...


1...<<11121314151617181920>>...47