History log of /llvm-project/clang/lib/Format/Format.cpp (Results 401 – 425 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# e56e9a4f 30-Oct-2017 Krasimir Georgiev <krasimir@google.com>

Keep MSVC2015 happy after r316903

llvm-svn: 316906


# 9ad83fe7 30-Oct-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Format raw string literals

Summary:
This patch adds raw string literal formatting.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, mgorny

Differential Revision

[clang-format] Format raw string literals

Summary:
This patch adds raw string literal formatting.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, mgorny

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

llvm-svn: 316903

show more ...


# a84e7870 26-Sep-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Add ext/ to google include categories

Summary: This adds an ext/ header include category for google style.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

[clang-format] Add ext/ to google include categories

Summary: This adds an ext/ header include category for google style.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 314211

show more ...


# 89628f64 20-Sep-2017 Manuel Klimek <klimek@google.com>

clang-format clang-format.

llvm-svn: 313744


# d6ce937f 15-Sep-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] New flag - BraceWrapping.AfterExternBlock

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **"extern C part"**

**Problem:**

Due to the lack of "brace wrapping extern" fla

[clang-format] New flag - BraceWrapping.AfterExternBlock

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **"extern C part"**

**Problem:**

Due to the lack of "brace wrapping extern" flag, clang format does parse the block after **extern** keyword moving the opening bracket to the header line always!

**Patch description:**

A new style added, new configuration flag - **BraceWrapping.AfterExternBlock** that allows us to decide whether we want a break before brace or not.

Reviewers: djasper, krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

Contributed by @PriMee!

llvm-svn: 313354

show more ...


# 82c9a0ec 13-Sep-2017 Sylvestre Ledru <sylvestre@debian.org>

SplitEmptyFunction should be true in the Mozilla coding style

Summary:
As defined here: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
See for the downstream b

SplitEmptyFunction should be true in the Mozilla coding style

Summary:
As defined here: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
See for the downstream bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1399359

Reviewers: Typz, djasper

Reviewed By: Typz

Subscribers: klimek, cfe-commits

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

llvm-svn: 313182

show more ...


# ad47c907 30-Aug-2017 Krasimir Georgiev <krasimir@google.com>

clang-format: Add preprocessor directive indentation

Summary:
This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocesso

clang-format: Add preprocessor directive indentation

Summary:
This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocessor statements inside if/ifdef/endif. This takes previous work from fmauch (https://github.com/fmauch/clang/tree/preprocessor_indent) and makes it into a full feature.
The context of this patch is that I'm a VMware intern, and I implemented this because VMware needs the feature. As such, some decisions were made based on what VMware wants, and I would appreciate suggestions on expanding this if necessary to use-cases other people may want.

This adds a new enum config option, `IndentPPDirectives`. Values are:

* `PPDIS_None` (in config: `None`):
```
#if FOO
#if BAR
#include <foo>
#endif
#endif
```
* `PPDIS_AfterHash` (in config: `AfterHash`):
```
#if FOO
# if BAR
# include <foo>
# endif
#endif
```
This is meant to work whether spaces or tabs are used for indentation. Preprocessor indentation is independent of indentation for non-preprocessor lines.

Preprocessor indentation also attempts to ignore include guards with the checks:
1. Include guards cover the entire file
2. Include guards don't have `#else`
3. Include guards begin with
```
#ifndef <var>
#define <var>
```

This patch allows `UnwrappedLineParser::PPBranchLevel` to be decremented to -1 (the initial value is -1) so the variable can be used for indent tracking.

Defects:
* This patch does not handle the case where there's code between the `#ifndef` and `#define` but all other conditions hold. This is because when the #define line is parsed, `UnwrappedLineParser::Lines` doesn't hold the previous code line yet, so we can't detect it. This is out of the scope of this patch.

* This patch does not handle cases where legitimate lines may be outside an include guard. Examples are `#pragma once` and `#pragma GCC diagnostic`, or anything else that does not change the meaning of the file if it's included multiple times.

* This does not detect when there is a single non-preprocessor line in front of an include-guard-like structure where other conditions hold because `ScopedLineState` hides the line.

* Preprocessor indentation throws off `TokenAnnotator::setCommentLineLevels` so the indentation of comments immediately before indented preprocessor lines is toggled on each run. Fixing this issue appears to be a major change and too much complexity for this patch.

Contributed by @euhlmann!

Reviewers: djasper, klimek, krasimir

Reviewed By: djasper, krasimir

Subscribers: krasimir, mzeren-vmw, cfe-commits

Tags: #clang

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

llvm-svn: 312125

show more ...


# 86873030 29-Aug-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Refactor likely xml a bit, NFC

llvm-svn: 312000


# a2e7d0de 29-Aug-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Do not format likely xml

Summary:
This patch detects the leading '<' in likely xml files and stops formatting in
that case. A recent use of a Qt xml file with a .ts extension triggere

[clang-format] Do not format likely xml

Summary:
This patch detects the leading '<' in likely xml files and stops formatting in
that case. A recent use of a Qt xml file with a .ts extension triggered this:
http://doc.qt.io/qt-4.8/linguist-ts-file-format.html

Reviewers: djasper

Reviewed By: djasper

Subscribers: sammccall, cfe-commits, klimek

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

llvm-svn: 311999

show more ...


# 26b144cc 03-Jul-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Support text proto messages

Summary: This patch adds support for textual protocol buffer messages.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek, mgorny

[clang-format] Support text proto messages

Summary: This patch adds support for textual protocol buffer messages.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek, mgorny

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

llvm-svn: 307029

show more ...


# 25639842 30-Jun-2017 Richard Smith <richard-llvm@metafoo.co.uk>

Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR

This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the

Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR

This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.

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

Corresponding LLVM change is r306878.

llvm-svn: 306881

show more ...


# ad72256d 30-Jun-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: add options to merge empty record body

Summary:
This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
c

clang-format: add options to merge empty record body

Summary:
This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
class, struct, union and namespace):
* SplitEmptyClass
* SplitEmptyStruct
* SplitEmptyUnion
* SplitEmptyNamespace

The `SplitEmptyFunction` option name has also been simplified/
shortened (from `SplitEmptyFunctionBody`).

These options are helpful when the correspond AfterXXX option is
enabled, to allow merging the empty record:

class Foo
{};

In addition, this fixes an unexpected merging of short records, when
the AfterXXXX options are used, which caused to be formatted like
this:

class Foo
{ void Foo(); };

This is now properly formatted as:

class Foo
{
void Foo();
};

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 306874

show more ...


# d676ab13 29-Jun-2017 Chandler Carruth <chandlerc@gmail.com>

[clang-format] Switch to case-insensitive header matching and use it to
improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sort

[clang-format] Switch to case-insensitive header matching and use it to
improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sorting:
- We have gmock headers now, so it adds support for those to one of the
categories.
- LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that
suffix for finding a main header.
- At times the test file's case may not match the header file's case, so
switch to case-insensitive regex matching of header names.

With this set of changes, I can't spot any misbehaviors when re-sorting
all of LLVM's unittest '#include' lines.

Thanks to Eric and Daniel for help testing and refining the patch during
review!

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

llvm-svn: 306759

show more ...


# ac16a201 23-Jun-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Add a SortUsingDeclaration option and enable it by default

Summary:
This patch adds a `SortUsingDeclaration` style option and enables it for llvm
style.

Reviewers: klimek

Reviewed B

[clang-format] Add a SortUsingDeclaration option and enable it by default

Summary:
This patch adds a `SortUsingDeclaration` style option and enables it for llvm
style.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek

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

llvm-svn: 306094

show more ...


# d3f0e3de 21-Jun-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: introduce InlineOnly short function style

Summary:
This is the same as Inline, except it does not imply all empty
functions are merged: with this style, empty functions are merged only

clang-format: introduce InlineOnly short function style

Summary:
This is the same as Inline, except it does not imply all empty
functions are merged: with this style, empty functions are merged only
if they also match the 'inline' criteria (i.e. defined in a class).

This is helpful to avoid inlining functions in implementations files.

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: klimek, rengolin, cfe-commits

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

llvm-svn: 305912

show more ...


# b03877ab 21-Jun-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Support sorting using declarations

Summary:
This patch adds UsingDeclarationsSorter, a TokenAnalyzer that sorts consecutive
using declarations.

Reviewers: klimek

Reviewed By: klimek

[clang-format] Support sorting using declarations

Summary:
This patch adds UsingDeclarationsSorter, a TokenAnalyzer that sorts consecutive
using declarations.

Reviewers: klimek

Reviewed By: klimek

Subscribers: Typz, djasper, cfe-commits, klimek, mgorny

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

llvm-svn: 305901

show more ...


# e56a829e 14-Jun-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: Add CompactNamespaces option

Summary:
Add CompactNamespaces option, to pack namespace declarations on the
same line (somewhat similar to C++17 nested namespace definition).

With this

clang-format: Add CompactNamespaces option

Summary:
Add CompactNamespaces option, to pack namespace declarations on the
same line (somewhat similar to C++17 nested namespace definition).

With this option, consecutive namespace declarations are kept on the
same line:

namespace foo { namespace bar {
...
}} // namespace foo::bar

Reviewers: krasimir, djasper, klimek

Reviewed By: djasper

Subscribers: kimgr, cfe-commits, klimek

Tags: #clang-tools-extra

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

llvm-svn: 305384

show more ...


# 2a81ca8d 13-Jun-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: add option to merge empty function body

Summary:
This option supplements the AllowShortFunctionsOnASingleLine flag, to
merge empty function body at the beginning of the line: e.g. when

clang-format: add option to merge empty function body

Summary:
This option supplements the AllowShortFunctionsOnASingleLine flag, to
merge empty function body at the beginning of the line: e.g. when the
function is not short-enough and breaking braces after function.

int f()
{}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 305272

show more ...


# 816a9668 29-May-2017 Martin Probst <martin@probst.io>

clang-format: [JS] do not clean up duplicated commas.

Summary:
In JavaScript, duplicated commas have semantic meaning.
x = [a,,b];

The statement above creates an array with three entries, the m

clang-format: [JS] do not clean up duplicated commas.

Summary:
In JavaScript, duplicated commas have semantic meaning.
x = [a,,b];

The statement above creates an array with three entries, the middle being undefined. Because clang-format should not change semantics, disable this cleanup in JS.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 304141

show more ...


# a6b6d51b 24-May-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: Introduce BreakConstructorInitializers option

Summary:
This option replaces the BreakConstructorInitializersBeforeComma option with an enum, thus introducing a mode where the colon sta

clang-format: Introduce BreakConstructorInitializers option

Summary:
This option replaces the BreakConstructorInitializersBeforeComma option with an enum, thus introducing a mode where the colon stays on the same line as constructor declaration:

// When it fits on line:
Constructor() : initializer1(), initializer2() {}

// When it does not fit:
Constructor() :
initializer1(), initializer2()
{}

// When ConstructorInitializerAllOnOneLineOrOnePerLine = true:
Constructor() :
initializer1(),
initializer2()
{}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303739

show more ...


# 9976efa8 22-May-2017 Francois Ferrand <thetypz@gmail.com>

clang-format: Allow customizing the penalty for breaking assignment

Summary:
Add option to customize the penalty for breaking assignment

This allows increasing the priority of the assignment, to pr

clang-format: Allow customizing the penalty for breaking assignment

Summary:
Add option to customize the penalty for breaking assignment

This allows increasing the priority of the assignment, to prefer spliting
an operation instead of splitting the assignment, e.g. :

int a = bbbbbbbbbbbbbbbb +
cccccccccccccccc;

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303534

show more ...


# 2083f31b 09-May-2017 Martin Probst <martin@probst.io>

clang-format: [JS] keep triple slash directives intact.

Summary:
TypeScript uses triple slash directives of the form:
/// <reference path="..."/>

For various non-source instructions that should

clang-format: [JS] keep triple slash directives intact.

Summary:
TypeScript uses triple slash directives of the form:
/// <reference path="..."/>

For various non-source instructions that should not be wrapped.

Reference:
https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 302523

show more ...


# 7fdbb3fe 08-May-2017 Daniel Jasper <djasper@google.com>

[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, wit

[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, with options Left (prev.
true), Right (prev. false), and a new option DontAlign.

When set to DontAlign, the backslashes are placed just after the last token in each line:
#define EXAMPLE \
do { \
int x = aaaaa; \
int b; \
int dddddddddd; \
} while (0)

Patch by jtbandes. Thank you!

llvm-svn: 302428

show more ...


Revision tags: llvmorg-4.0.1-rc1
# bcda54b6 21-Apr-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Replace IncompleteFormat by a struct with Line

Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by

[clang-format] Replace IncompleteFormat by a struct with Line

Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 300985

show more ...


# dc06518f 05-Apr-2017 Nico Weber <nicolasweber@gmx.de>

clang-format: Support formatting utf-8 character literals in C++11+ mode.

clang-format <<END
auto c1 = u8'a';
auto c2 = u'a';
END

Before:
auto c1 = u8 'a';
auto c2 = u'a';

Now:
auto c1 = u8'

clang-format: Support formatting utf-8 character literals in C++11+ mode.

clang-format <<END
auto c1 = u8'a';
auto c2 = u'a';
END

Before:
auto c1 = u8 'a';
auto c2 = u'a';

Now:
auto c1 = u8'a';
auto c2 = u'a';

Patch from Denis Gladkikh <llvm@denis.gladkikh.email>!

llvm-svn: 299574

show more ...


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