Rafael Espindola
96b033006d
Use std::error_code instead of llvm::error_code.
...
This is an update for a llvm api change.
llvm-svn: 210688
2014-06-11 19:05:55 +00:00
Daniel Jasper
4ac7de7199
clang-format: Fix pointer/reference detection after decltype.
...
Before:
[](const decltype(*a) & value) {}
After:
[](const decltype(*a)& value) {}
llvm-svn: 210643
2014-06-11 07:35:16 +00:00
Daniel Jasper
17062ff550
clang-format: [JS] Treat dict literals similar to objc method exprs.
...
Before:
return {
link:
function() {
f(); //
}
};
return {
a: a,
link: function() {
f(); //
}
}
After:
return {
link: function() {
f(); //
}
};
return {
a: a,
link: function() {
f(); //
}
};
llvm-svn: 210537
2014-06-10 14:44:02 +00:00
Daniel Jasper
ecaba17996
clang-format: Increase penalty for wrapping array subscript expressions
...
Before:
aaaaaaaaaaa aaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaa[0].aaaaaaa
[0].aaaaaaaaaaaaaaaaaaaaaa();
After:
aaaaaaaaaaa aaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaa[0]
.aaaaaaa[0]
.aaaaaaaaaaaaaaaaaaaaaa();
llvm-svn: 210529
2014-06-10 13:27:57 +00:00
Daniel Jasper
908180574e
clang-format: Fix enum formatting with specific comment.
...
Before:
enum Fruit { //
APPLE,
PEAR };
After:
enum Fruit { //
APPLE,
PEAR
};
llvm-svn: 210522
2014-06-10 10:42:26 +00:00
Daniel Jasper
da18fd86c7
clang-format: Support variadic lambda captures.
...
Before:
return [ i, args... ]{};
After:
return [i, args...] {};
llvm-svn: 210514
2014-06-10 06:39:03 +00:00
Daniel Jasper
3251fff0e3
clang-format: Handle multiline strings inside ternary expressions.
...
With AlwaysSplitBeforeMultilineStrings, clang-format would not find any
valid solution.
llvm-svn: 210513
2014-06-10 06:27:23 +00:00
Richard Trieu
ddd01cec0e
Removing an "if (this == nullptr)" check from two print methods. The condition
...
will never be true in a well-defined context. The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.
llvm-svn: 210498
2014-06-09 22:53:25 +00:00
Craig Topper
416fa34b87
[C++11] Use 'nullptr'. Unittests edition.
...
llvm-svn: 210423
2014-06-08 08:38:12 +00:00
Alp Toker
62438dab83
Fix RecursiveASTVisitor to visit types in ObjCPropertyDecl
...
Patch by Mathieu Baudet!
llvm-svn: 210339
2014-06-06 15:05:09 +00:00
Daniel Jasper
58cb2edd69
clang-format: Fix incorrect indentation.
...
Before (JavaScript example, but can extend to other languages):
return {
a: 'E',
b: function() {
return function() {
f(); // This is wrong.
};
}
};
After:
return {
a: 'E',
b: function() {
return function() {
f(); // This is better.
};
}
};
llvm-svn: 210334
2014-06-06 13:49:04 +00:00
Nikola Smiljanic
357af64d78
Add first set of tests for FriendDecl source range and location.
...
llvm-svn: 210306
2014-06-06 04:40:35 +00:00
Samuel Benzaquen
f56a29924f
Add hasLocalStorage/hasGlobalStorage matchers.
...
Summary:
Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes.
Update the doc. Also add them to the dynamic registry.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D4034
llvm-svn: 210278
2014-06-05 18:22:14 +00:00
Daniel Jasper
a69ca9be12
clang-format: Leave empty lines within UnwrappedLines.
...
These are commonly used to structure things like enums or long braced
lists. There doesn't seem to be a good reason to have the behavior in
such structures be different from the behavior between statements.
llvm-svn: 210183
2014-06-04 12:40:57 +00:00
Alp Toker
1d257e1d0a
Remove the last remaining llvm/Config/config.h includes
...
This corrects long-standing misuses of LLVM's internal config.h.
In most cases the public llvm-config.h header was intended and we can now
remove the old hacks thanks to LLVM r210144.
The config.h header is private, won't be installed and should no longer be
included by clang or other modules.
llvm-svn: 210145
2014-06-04 03:28:55 +00:00
Daniel Jasper
114a2bc9d2
clang-format: Refactor indentation behavior for multiple nested blocks.
...
This fixes a few oddities when formatting multiple nested JavaScript
blocks, e.g.:
Before:
promise.then(
function success() {
doFoo();
doBar();
},
[], function error() {
doFoo();
doBaz();
});
promise.then([],
function success() {
doFoo();
doBar();
},
function error() {
doFoo();
doBaz();
});
After:
promise.then(
function success() {
doFoo();
doBar();
},
[],
function error() {
doFoo();
doBaz();
});
promise.then([],
function success() {
doFoo();
doBar();
},
function error() {
doFoo();
doBaz();
});
llvm-svn: 210097
2014-06-03 12:02:45 +00:00
Daniel Jasper
7d028298ce
clang-format: Fix special case of binary operator detection.
...
There is a pattern where evaluation order is used as control flow.
This patch special-cases a commonly occuring version of this pattern.
Before:
Aaaaa *aaa = nullptr;
// ...
aaa &&aaa->f();
After:
Aaaaa *aaa = nullptr;
// ...
aaa && aaa->f();
llvm-svn: 210017
2014-06-02 11:54:20 +00:00
Daniel Jasper
4afc6b3e16
clang-format: No space between ")" and braced init list.
...
Before:
auto j = decltype(i) {};
After:
auto j = decltype(i){};
This fixes llvm.org/PR19892.
llvm-svn: 210013
2014-06-02 10:57:55 +00:00
Daniel Jasper
e18ff37e08
clang-format: Fix Allman brace breaking of enums.
...
Before:
enum Side
{ LEFT,
RIGHT };
After:
enum Side
{
LEFT,
RIGHT
};
This fixes llvm.org/PR19911.
llvm-svn: 210011
2014-06-02 10:17:32 +00:00
Daniel Jasper
e3f907fded
clang-format: Fix trailing const (etc.) with Allman brace style.
...
Before:
void someLongFunction(int someLongParameter)
const
{
}
After:
void someLongFunction(
int someLongParameter) const
{
}
This fixes llvm.org/PR19912.
llvm-svn: 210010
2014-06-02 09:52:08 +00:00
Rafael Espindola
3ae0620a45
There is no std::errc:success, remove the llvm one.
...
llvm-svn: 209959
2014-05-31 03:20:52 +00:00
Rafael Espindola
fd148d0b6f
Use make_error_code in preparation for making errc an enum class.
...
llvm-svn: 209956
2014-05-31 02:23:01 +00:00
Richard Smith
46dd5bba44
Take PrintingPolicy::SuppressUnwrittenScope into account when printing the
...
qualified name of a NamedDecl. Patch by Volodymyr Sapsai!
llvm-svn: 209924
2014-05-30 22:16:51 +00:00
Daniel Jasper
d39312ec84
clang-format: Don't break before a case's colon.
...
Before (with just the right line length:
switch (a) {
case some_namespace::some_constant
:
return;
}
After:
switch (a) {
case some_namespace::
some_constant:
return;
}
llvm-svn: 209725
2014-05-28 10:09:11 +00:00
Daniel Jasper
335ff26631
clang-format: Format array and dict literals similar to blocks.
...
Especially, reduce the amount of indentation if it doesn't increase
readability.
Before:
NSMutableDictionary* dictionary = [NSMutableDictionary
dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
After:
NSMutableDictionary* dictionary =
[NSMutableDictionary dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
llvm-svn: 209720
2014-05-28 09:11:53 +00:00
Manuel Klimek
a2c2a4faa0
Make equalsNode work with pointers to subtypes.
...
llvm-svn: 209652
2014-05-27 12:31:10 +00:00
Manuel Klimek
909b5c94c0
Adds child traversal matchers for IfStmt's then and else branches.
...
llvm-svn: 209649
2014-05-27 10:04:12 +00:00
Manuel Klimek
2af0a91cc4
Allow hasBody on CXXForRangeStmt nodes and update the docs.
...
llvm-svn: 209647
2014-05-27 07:45:18 +00:00
Daniel Jasper
ba1b6bb667
clang-format: Keep '{' of dict literals on the same line in Allman style
...
Before:
void f()
{
[object
someMethod:@
{ @"a" : @"b" }];
}
After:
void f()
{
[object someMethod:@{ @"a" : @"b" }];
}
This fixes llvm.org/PR19854.
llvm-svn: 209615
2014-05-26 07:24:34 +00:00
Manuel Klimek
8651081bbe
Add the hasRangeInit() matcher for range-based for loop.
...
llvm-svn: 209533
2014-05-23 17:49:03 +00:00
Daniel Jasper
565ed5ed08
clang-format: Don't use Allman brace breaking for ObjC blocks.
...
It just seems wrong. This fixes llvm.org/PR19736.
llvm-svn: 209440
2014-05-22 13:53:55 +00:00
Daniel Jasper
bd630737bd
clang-format: Fix corner case in AllowShortBlocksOnASingleLine.
...
Before:
template <int> struct A4 { A4() { }
};
After:
template <int i> struct A4 {
A4() {}
};
This fixes llvm.org/PR19813 (at least the part that isn't working as
intended).
llvm-svn: 209438
2014-05-22 13:25:26 +00:00
Daniel Jasper
91b032ab55
clang-format: Fix braced list detection.
...
Before:
static_assert(std::is_integral<int> {} + 0, "");
int a = std::is_integral<int> {}
+ 0;
After:
static_assert(std::is_integral<int>{} + 0, "");
int a = std::is_integral<int>{} + 0;
llvm-svn: 209431
2014-05-22 12:46:38 +00:00
Daniel Jasper
438059e509
clang-format: Fix incorrect braced init identification.
...
Before:
int foo(int i) {
return fo1 {}
(i);
}
int foo(int i) {
return fo1 {}
(i);
}
After:
int foo(int i) { return fo1{}(i); }
int foo(int i) { return fo1{}(i); }
This fixes llvm.org/PR19812.
llvm-svn: 209428
2014-05-22 12:11:13 +00:00
Daniel Jasper
49802ef93b
clang-format: [JS] Understand line breaks in concatenated strings.
...
Before:
var literal = 'hello ' + 'world';
After:
var literal = 'hello ' +
'world';
There is no reason to concatenated two string literals with a '+' unless
the line break is intended.
llvm-svn: 209413
2014-05-22 09:10:04 +00:00
Daniel Jasper
3948516a03
clang-format: Correctly identify multiplications in braces init lists.
...
Before:
int i{a *b};
After:
int i{a * b};
Also fix unrelated issue where braced init lists were counted as blocks
and prevented single-line functions.
llvm-svn: 209412
2014-05-22 09:00:33 +00:00
Daniel Jasper
5f3ea477cf
clang-format: Correctly calculate line lenghts for nest blocks.
...
If simple (one-statement) blocks can be inlined, the length needs to be
calculated correctly.
Before (in JavaScript but this also affects lambdas, etc.):
var x = {
valueOf: function() { return 1; }
};
After:
var x = {valueOf: function() { return 1; }};
llvm-svn: 209410
2014-05-22 08:36:53 +00:00
Justin Bogner
44fa45034b
VirtualFileSystem: Fix a few directory traversal bugs in VFSWriter
...
There are a couple of issues with writing VFS maps that are awkward to
fix within the current mutually recursive approach. Instead, replace
the algorithm with an iterative version that uses an explicit stack of
directories.
Includes tests for cases the old approach was tripping on.
llvm-svn: 209332
2014-05-21 22:46:51 +00:00
Daniel Jasper
2a958321c8
clang-format: Fix corner case working around one-per-line dict literals.
...
Before:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb'
};
After:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa',
b: 'bbbbbbbbbbbbbbbbbb'
};
llvm-svn: 209296
2014-05-21 13:26:58 +00:00
Daniel Jasper
5ebb2f3625
clang-format: Fix incorrect macro call detection.
...
In:
struct A {
A()
noexcept(....) {}
};
'A()' is not a macro call.
This fixes llvm.org/PR19814.
llvm-svn: 209294
2014-05-21 13:08:17 +00:00
Daniel Jasper
b16b969d7c
clang-format: [JS] Support different function literal style.
...
Before:
goog.array.forEach(array, function() {
doSomething();
doSomething();
},
this);
After:
goog.array.forEach(array, function() {
doSomething();
doSomething();
}, this);
llvm-svn: 209291
2014-05-21 12:51:23 +00:00
Alp Toker
b671e34c36
SourceManager: Use setMainFileID() consistently
...
Eliminate createMainFileID() / createMainFileIDForMemBuffer() utility
functions. These didn't add much convenience and conflated two distinct
operations.
This change makes things easier to follow by providing a consistent interface
and getting rid of a bunch of cast-to-voids.
llvm-svn: 209266
2014-05-21 01:12:41 +00:00
Justin Bogner
5719614b77
libclang: Give each VirtualFileOverlay unit test its own name
...
llvm-svn: 209257
2014-05-20 23:52:11 +00:00
Justin Bogner
1c078f2b1f
VirtualFileSystem: Fix false positives in YAMLVFSWriter::containedIn
...
Checking if a path starts with another path isn't sufficient for
determining if one is contained within the heirarchy of the other.
We need to ensure that the substring ends at a directory boundary.
llvm-svn: 209250
2014-05-20 22:12:58 +00:00
Daniel Jasper
069e5f4858
clang-format: [JS] Understand top-level function literals properly.
...
llvm-svn: 209205
2014-05-20 11:14:57 +00:00
Richard Smith
1be902c02f
[modules] Fix ODR violation: there's another clang::TypeLocVisitor elsewhere.
...
llvm-svn: 209169
2014-05-19 22:34:38 +00:00
Daniel Jasper
7f0c517168
clang-format: Don't force line breaks in ObjC calls with ColumnLimit 0.
...
Before:
[self.x a:b c:d];
Got reformatted toi (with ColumnLimit set to 0):
[self.x a:b
c:d];
llvm-svn: 209114
2014-05-19 08:06:34 +00:00
Daniel Jasper
0dd5291e69
clang-format: [JS] Support ES6 destructuring assignments.
...
Before:
var[a, b, c] = [1, 2, 3];
After:
var [a, b, c] = [1, 2, 3];
llvm-svn: 209113
2014-05-19 07:37:07 +00:00
Daniel Jasper
78214397a3
clang-format: [JS] Support for EC6 arrow functions.
...
Before:
var b = a.map((x) = > x + 1);
After:
var b = a.map((x) => x + 1);
llvm-svn: 209112
2014-05-19 07:27:02 +00:00
Joey Gouly
0d9a2b2205
[ASTMatchers] Move the 'isImplicit' matcher from CXXConstructorDecl to Decl.
...
llvm-svn: 209006
2014-05-16 19:31:08 +00:00
Alp Toker
6ac2cd01d2
Rename SourceManager::createFileIDForMemBuffer()
...
It makes more sense to just overload createFileID().
Gardening only.
llvm-svn: 209002
2014-05-16 17:23:01 +00:00
Ben Langmuir
5bf828dd34
Switch another write_escaped to yaml::escape
...
I missed one in r206443.
llvm-svn: 208941
2014-05-16 01:38:59 +00:00
Daniel Jasper
17605d3961
clang-format: Add option to allow short blocks on a single line.
...
With AllowShortBlocksOnASingleLine, clang-format allows:
if (a) { return; }
Based on patch by Gonzalo BG, thank you!
llvm-svn: 208765
2014-05-14 09:33:35 +00:00
Daniel Jasper
0a1e5ace26
clang-format: Don't break in the middle of ">>".
...
Before:
zzzzzzzzzz = bbbbbbbbbbbbbbbbb >
> aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
zzzzzzzzzz
= bbbbbbbbbbbbbbbbb
>> aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaa);
This fixes llvm.org/PR19731.
llvm-svn: 208672
2014-05-13 08:01:47 +00:00
Daniel Jasper
fb4333b093
clang-format: [JS] Basic support for escape sequences in regex literals.
...
Before:
var regex = /\\/ g; // This isn't even recognized as regex.
After:
var regex = /\\/g; // It now is.
llvm-svn: 208539
2014-05-12 11:29:50 +00:00
Benjamin Kramer
f3ca269839
Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.
...
Required pulling LambdaExpr::Capture into its own header.
No functionality change.
llvm-svn: 208470
2014-05-10 16:31:55 +00:00
Daniel Jasper
8951908218
clang-format: [JS] Fix spacing in dict literals.
...
Before:
someVariable = {'a':[{}]};
After:
someVariable = {'a': [{}]};
llvm-svn: 208403
2014-05-09 10:26:08 +00:00
Daniel Jasper
04a71a45ff
clang-format: Initial support for try-catch.
...
Most of this patch was created by Alexander Rojas in
http://reviews.llvm.org/D2555
Thank you!
Synced and addressed review comments.
llvm-svn: 208302
2014-05-08 11:58:24 +00:00
Daniel Jasper
c03e16a7bc
clang-format: [JS] support closures in container literals.
...
Before:
return {body: {setAttribute: function(key, val) {this[key] = val;
}
, getAttribute : function(key) { return this[key]; }
, style : {
direction:
''
}
}
}
;
After:
return {
body: {
setAttribute: function(key, val) { this[key] = val; },
getAttribute: function(key) { return this[key]; },
style: {direction: ''}
}
};
llvm-svn: 208292
2014-05-08 09:25:39 +00:00
Daniel Jasper
ea2d042f89
clang-format: Fix binary operator detection before lambdas.
...
Before:
bool foo = true&& [] { return false; }();
After:
bool foo = true && [] { return false; }();
llvm-svn: 208288
2014-05-08 08:50:10 +00:00
Daniel Jasper
f7405c129e
clang-format: [JS] Support regex literals after 'return'.
...
llvm-svn: 208285
2014-05-08 07:45:18 +00:00
Daniel Jasper
f9ae312fc0
clang-format: [JS] Initial support for regex literals.
...
llvm-svn: 208281
2014-05-08 07:01:45 +00:00
Nikola Smiljanic
e08a91ecd2
Enable alternative tokens by default for clang-format.
...
Patch by Bobby Moretti.
llvm-svn: 208269
2014-05-08 00:05:13 +00:00
Daniel Jasper
79dffb4128
clang-format: Be slightly more aggressive on single-line functions.
...
So that JS functions can also be merged into a single line.
Before:
var func = function() {
return 1;
};
After:
var func = function() { return 1; };
llvm-svn: 208176
2014-05-07 09:48:30 +00:00
Daniel Jasper
8acf822b6f
clang-format: Fix corner cases for comments in if conditions.
...
Before:
if ( // a
x + 3) { ..
After:
if ( // a
x + 3) { ..
llvm-svn: 208175
2014-05-07 09:23:05 +00:00
Daniel Jasper
7a2d60e328
clang-format: Fix bad space before braced initializer.
...
Before:
new int {1};
After:
new int{1};
llvm-svn: 208168
2014-05-07 07:59:03 +00:00
Daniel Jasper
484033b188
clang-format: [JS] Keep space after closure style comments.
...
Before:
var x = /** @type {foo} */ (bar);
After:
var x = /** @type {foo} */(bar);
llvm-svn: 208093
2014-05-06 14:41:29 +00:00
Daniel Jasper
166c19bd37
clang-format: [JS] Keep space between 'return' and '['.
...
llvm-svn: 208090
2014-05-06 14:12:21 +00:00
Daniel Jasper
4a39c84c91
clang-format: [JS] Don't indent in goog.scope blocks.
...
Before:
goog.scope(function() {
var x = a.b;
var y = c.d;
}); // goog.scope
After:
goog.scope(function() {
var x = a.b;
var y = c.d;
}); // goog.scope
llvm-svn: 208088
2014-05-06 13:54:10 +00:00
Dinesh Dwivedi
2e92e66f66
Fixed one issue with casting
...
Before:
(void) SimplifyICmpOperands(Cond, LHS, RHS);
After:
(void)SimplifyICmpOperands(Cond, LHS, RHS);
Differential Revision: http://reviews.llvm.org/D3615
llvm-svn: 208080
2014-05-06 11:46:49 +00:00
Daniel Jasper
f10a28d705
clang-format: Understand functions with decltype return type.
...
Before:
decltype(long_name_forcing_break)
f() {}
After:
decltype(long_name_forcing_break)
f() {}
llvm-svn: 207965
2014-05-05 13:48:09 +00:00
Dinesh Dwivedi
76f98f8047
Added some heuristics to identify c style casting
...
Before:
void f() { my_int a = (my_int) * b; }
void f() { return P ? (my_int) * P : (my_int)0; }
After:
void f() { my_int a = (my_int)*b; }
void f() { return P ? (my_int)*P : (my_int)0; }
Differential Revision: http://reviews.llvm.org/D3576
llvm-svn: 207964
2014-05-05 13:14:35 +00:00
Daniel Jasper
0e6c51c889
clang-format: Improve understanding of decltype.
...
Before:
SomeFunction([](decltype(x), A * a) {});
After:
SomeFunction([](decltype(x), A *a) {});
llvm-svn: 207961
2014-05-05 12:36:29 +00:00
Dinesh Dwivedi
afe6fb6f05
Fix bug in clang-format while merging short function
...
Before:
#ifdef _DEBUG
int foo( int i = 0 )
#else
int foo( int i = 5 )
#endif { return i; }
After:
#ifdef _DEBUG
int foo( int i = 0 )
#else
int foo( int i = 5 )
#endif
{
return i;
}
llvm-svn: 207958
2014-05-05 11:36:35 +00:00
Daniel Jasper
9509f18836
clang-format: Fix import statements with ColumnLimit: 0
...
These used to interact badly with AlwaysBreakBeforeMultilineStrings.
llvm-svn: 207955
2014-05-05 08:08:07 +00:00
Alp Toker
0804343733
Eliminate ASTContext's DelayInitialization flag
...
Having various possible states of initialization following construction doesn't
add value here.
Also remove the unused size_reserve parameter.
llvm-svn: 207897
2014-05-03 03:46:04 +00:00
Dinesh Dwivedi
ea3aca8b67
Fixes issue with Allman BreakBeforeBraces for Objective C @interface
...
Before:
@interface BSApplicationController () {
@private
id _extraIvar;
}
@end
After:
@interface BSApplicationController ()
{
@private
id _extraIvar;
}
@end
llvm-svn: 207849
2014-05-02 17:01:46 +00:00
Alp Toker
9663780e35
Reformat code following Preprocessor constructor updates
...
Landing this separately to make the previous commits easy to follow at home.
llvm-svn: 207826
2014-05-02 03:43:38 +00:00
Alp Toker
1ae02f68be
Factor TargetInfo pointer/DelayInitialization bool pair out of Preprocessor ctor
...
The Preprocessor::Initialize() function already offers a clear interface to
achieve this, further reducing the confusing number of states a newly
constructed preprocessor can have.
llvm-svn: 207825
2014-05-02 03:43:30 +00:00
Daniel Jasper
883ae9d9a3
clang-format: Don't bin-pack text-proto-formatted options.
...
Before:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
bbbbbbb: BBBB, bbbb: BBB}];
After:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA,
bbbbbbb: BBBB,
bbbb: BBB}];
llvm-svn: 207538
2014-04-29 15:54:14 +00:00
Daniel Jasper
35995679c6
clang-format: Allow single-line function in WebKit style.
...
Before:
void f() {
return; }
After:
void f() { return; }
llvm-svn: 207527
2014-04-29 14:05:20 +00:00
Daniel Jasper
942d971c84
clang-format: Improve binary operator detection.
...
Before:
*(int *)(p &~3UL) = 0;
After:
*(int *)(p & ~3UL) = 0;
This fixes llvm.org/PR19464.
llvm-svn: 207405
2014-04-28 09:19:28 +00:00
Daniel Jasper
031e2409f9
clang-format: Fixes spaces in case statements.
...
This fixes llvm.org/PR19482.
Before:
switch (a) {
case(B) :
return;
}
After:
switch (a) {
case (B):
return;
}
llvm-svn: 207402
2014-04-28 07:48:36 +00:00
Daniel Jasper
437c3f5188
clang-format: Don't wrap after @interface.
...
This fixes llvm.org/PR19450.
Before:
@interface
BookmarkHomeHandsetViewController ()<BookmarkAllCollectionViewDelegate,
BookmarkFolderCollectionViewDelegate,
BookmarkMenuViewControllerDelegate,
BookmarkSearchViewControllerDelegate> {
}
After:
@interface aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ()<
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {
}
llvm-svn: 207400
2014-04-28 07:34:48 +00:00
Daniel Jasper
66935020c4
clang-format: Fix bug when aligning trailing /**/-comments in macros.
...
Previously this could lead to a column limit violation with the
required escaped newlines.
llvm-svn: 207351
2014-04-27 10:03:19 +00:00
David Blaikie
103a2de0b4
Push unique_ptr ownership of ASTUnits further back into their factories.
...
llvm-svn: 207237
2014-04-25 17:01:33 +00:00
David Blaikie
39808ff901
Improve ownership of ASTUnits in libTooling by using std::unique_ptr.
...
llvm-svn: 207229
2014-04-25 14:49:37 +00:00
Kostya Serebryany
d0f841ce4a
fix a test-only leak found by lsan, PR19521
...
llvm-svn: 207223
2014-04-25 12:58:42 +00:00
Nico Weber
655af097a1
Fix a tiny test-only leak, found by LSan.
...
llvm-svn: 207137
2014-04-24 19:04:10 +00:00
Nico Weber
dbd07fadae
Fix two leaks found by LSan (one is test-only).
...
The result of llvm::MemoryBuffer::getMemBuffer() needs to be freed. Don't
pass "don't free" flag to overrideFileContents() to fix.
llvm-svn: 207075
2014-04-24 04:58:41 +00:00
Nico Weber
4fcf0c7b29
Fix two test-only leaks found by LSan.
...
The result of getBufferForFile() must be freed.
(Should we change functions that expect the caller to assume ownership so
that they return unique_ptrs instead? Then the type system makes sure we get
this right.)
llvm-svn: 207074
2014-04-24 04:26:18 +00:00
Nico Weber
52fbbb16a1
Fix four more test-only leaks found by LSan.
...
Tool::run() doesn't take ownership of the passed action.
llvm-svn: 207071
2014-04-24 03:48:09 +00:00
Nico Weber
7c3ccb032e
Fix 3 test-only leaks found by LSan.
...
llvm-svn: 207068
2014-04-24 03:30:22 +00:00
John Thompson
2d94bbb0c0
Quick fix for layering that broke shared library build.
...
llvm-svn: 207011
2014-04-23 19:04:32 +00:00
John Thompson
2255f2ce90
Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
...
llvm-svn: 206977
2014-04-23 12:57:01 +00:00
Chandler Carruth
1034666777
[Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
...
definition below all of the header #include lines, clang edition.
If you want more details about this, you can see some of the commits to
Debug.h in LLVM recently. This is just the clang section of a cleanup
I've done for all uses of DEBUG_TYPE in LLVM.
llvm-svn: 206849
2014-04-22 03:17:02 +00:00
Alexander Kornienko
67d9c8c87e
Fix alignment of trailing block comments.
...
Summary:
This patch ensures that the lines of the block comments retain relative
column offsets. In order to do this WhitespaceManager::Changes representing
continuation of block comments keep a pointer on the change representing the
whitespace change before the block comment, and a relative column offset to this
change, so that the correct column can be reconstructed at the end of alignment
process.
Fixes http://llvm.org/PR19325
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D3408
llvm-svn: 206472
2014-04-17 16:12:46 +00:00
Daniel Jasper
ae8e0d8da9
clang-format: Respect BinPackParameters in Cpp11BracedListStyle.
...
With BinPackParameters=false and Cpp11BracedListStyle=true (i.e. mostly
for Chromium):
Before:
const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff,
ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk};
After:
const Aaaaaa aaaaa = {aaaaa,
bbbbb,
ccccc,
ddddd,
eeeee,
ffffff,
ggggg,
hhhhhh,
iiiiii,
jjjjjj,
kkkkkk};
This fixes llvm.org/PR19359. I am not sure we'll want this in all cases
in the long run, but I'll guess we'll get feedback on that.
llvm-svn: 206458
2014-04-17 11:32:02 +00:00
Ben Langmuir
a56071c5fb
When writing YAML in libclang, use yaml::escape instead of write_escaped
...
The YAMLParser has its own escaped string representation, and does not
handle octal escape sequences. When writing the virtual file system to a
YAML file, use yaml::escape().
llvm-svn: 206443
2014-04-17 03:31:02 +00:00
Daniel Jasper
0e61784ae5
clang-format: Add special case to reduce indentaiton in streams.
...
This is similar to how we treat assignments and seems to be generally
desirable.
Before:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 206384
2014-04-16 12:26:54 +00:00