| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Before we were only checking if the new declaration itself was marked extern
C. Fixes prpr14766.
llvm-svn: 172243
|
| |
|
|
| |
llvm-svn: 172239
|
| |
|
|
|
|
|
| |
Puts blocks always into multiple lines when they start with an ObjC
keyword or minus.
llvm-svn: 172238
|
| |
|
|
|
|
|
| |
if { foo; }
would previously crash clang-format.
llvm-svn: 172232
|
| |
|
|
|
|
|
|
| |
Now we correctly parse and format:
verifyFormat("struct foo a = { bar };
int n;
llvm-svn: 172229
|
| |
|
|
|
|
|
|
| |
void f() { return 42; }
The final change that implements the feature.
llvm-svn: 172225
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RefactoringTool::run() always writes the result of rewrites to disk.
Instead, make this optional and provide a method for getting the
refactoring results in a memory buffer instead.
Also made ClangTool polymorphic so RefactoringTool could inherit from it
to properly express the IS-A relationship. This change also provides
access to ClangTool's public interface, e.g. mapVirtualFile() which is
important once refactored buffers start living in memory instead of on
disk.
Reviewers: klimek
llvm-svn: 172219
|
| |
|
|
|
|
|
|
| |
This fixes llvm.org/PR14913.
Before: A *a = new(placement) A;
After: A *a = new (placement) A;
llvm-svn: 172212
|
| |
|
|
| |
llvm-svn: 172211
|
| |
|
|
|
|
| |
Objective-C runtime 1.7 or greater.
llvm-svn: 172207
|
| |
|
|
|
|
|
|
| |
Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.
llvm-svn: 172201
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(
aaaaaaaaaaaaa);
After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
GUARDED_BY(aaaaaaaaaaaaa);
Also did some formatting cleanups with clang-format on the way.
llvm-svn: 172200
|
| |
|
|
|
|
|
|
|
| |
Added option to put each constructor initializer on its own line
if not all initializers fit on a single line. Enabling this for
Google style now as the style guide (arguable) suggests it. Not
sure whether we also want it for LLVM.
llvm-svn: 172196
|
| |
|
|
| |
llvm-svn: 172195
|
| |
|
|
|
|
|
|
| |
As we keep adding more stuff to it, this structure is easier to
maintain. At one point we might think about making it an actual
class with specific accessors, etc.
llvm-svn: 172188
|
| |
|
|
|
|
| |
functionality change.
llvm-svn: 172185
|
| |
|
|
|
|
| |
can be fixed
llvm-svn: 172170
|
| |
|
|
|
|
| |
This will get rid of some false positives as well as false negatives.
llvm-svn: 172169
|
| |
|
|
| |
llvm-svn: 172168
|
| |
|
|
|
|
| |
external declarations with C language linkage.
llvm-svn: 172150
|
| |
|
|
|
|
|
|
|
|
|
|
| |
assertions.
To ensure that custom assertions/conditional would also be supported,
just check if the ivar that needs to be invalidated or set to nil is
compared against 0.
Unfortunately, this will not work for code containing 'assert(IvarName)'
llvm-svn: 172147
|
| |
|
|
|
|
|
|
|
|
| |
storage and thus is implicitly zero-initialized, no need to
do C++11 memory model. This patch unconditionally detects
such condition and zeroinitializer's the variable.
Patch has been commented on and OKed by Doug off-line.
// rdar://12897704
llvm-svn: 172144
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Objective-C method declarations look like this:
- (returntype)name:(type)argname anothername:(type)arg2name;
In google style, there's no space after the leading '-' but one after
"(returntype)" instead (but none after the argument types), see
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions
Not inserting the space after '-' is easy, but to insert the space after the
return type, the formatter needs to know that a closing parenthesis ends the
return type. To do this, I tweaked the code in parse() to check for this, which
in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to
parse(), because parse() runs before annotate().
(To keep things interesting, the return type is optional, but it's almost
always there in practice.)
http://llvm-reviews.chandlerc.com/D280
llvm-svn: 172140
|
| |
|
|
|
|
|
|
| |
In some cases, we just pick any ivar that needs invalidation and attach
the warning to it. Picking the first from DenseMap of pointer keys was
triggering non-deterministic output.
llvm-svn: 172134
|
| |
|
|
|
|
|
|
|
| |
Truncation happens regularly when find_first_not_of returns npos,
strings long enough to trigger bug here are implausible.
No functionality change intended (ignoring absurd string lengths).
llvm-svn: 172127
|
| |
|
|
|
|
|
| |
Decl is a VarDecl.
Part of rdar://12991541
llvm-svn: 172120
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
@property(assign, getter = isEditable) BOOL editable;
Now:
@property(assign, getter=isEditable) BOOL editable;
It'd be nice if some Apple person could let me know if spaces are preferred
around '=' in @synthesize lines (see FIXME in the test).
llvm-svn: 172110
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restructured the checker so that it could easily find two new classes of
issues:
- when a class contains an invalidatable ivar, but no declaration of an
invalidation method
- when a class contains an invalidatable ivar, but no definition of an
invalidation method in the @implementation.
The second case might trigger some false positives, for example, when
the method is defined in a category.
llvm-svn: 172104
|
| |
|
|
|
|
| |
// rdar://11577384
llvm-svn: 172102
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols
Most other places (function declarations, variable declarations) still get
this wrong, and since this looks very similiar to template instantiations to
the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some
places.
llvm-svn: 172099
|
| |
|
|
|
|
|
| |
This is the last step of pure shuffling stuff around, the next step will
be the actual feature.
llvm-svn: 172098
|
| |
|
|
|
|
|
|
|
|
| |
Before:
@ -4.5
Now:
@-4.5
llvm-svn: 172095
|
| |
|
|
|
|
|
|
| |
The first token in @implementation, @interface, and @protocol lines is now
marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked
LT_ObjCMethodDecl.
llvm-svn: 172093
|
| |
|
|
|
|
|
| |
This is the next step towards being able to configure multiple unwrapped
lines into one.
llvm-svn: 172092
|
| |
|
|
|
|
|
| |
an objectiveC object, use objc_exception_throw
to raise the exception. // rdar://12605907
llvm-svn: 172091
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This prepares the code for single line optimizations and changes the
dependencies between single-line-formats to the indent of the first
token.
Conceptually, the first token is "between" the lines anyway, as the
whitespace for the first token includes the previous end-of-line, which
needs to be escaped when inside a preprocessor directive.
llvm-svn: 172083
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.
For example, we now insert a newline before '};' in:
static SomeClass WithALoooooooooooooooooooongName = {
100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"
};
... while not inserting a newline here:
static SomeClass = { a, b, c, d, e, f, g, h, i, j,
looooooooooooooooooooooooooooooooooongname,
looooooooooooooooooooooooooooooong };
Also fixes the formating of (column limit 25):
int x = {
avariable,
b(alongervariable)
};
llvm-svn: 172076
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Uses DiagnosticsEngine to output diagnostics.
Reviewers: djasper, klimek
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D278
llvm-svn: 172071
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We're now formatting (column limit 25):
int x = {
avariable,
b(alongervariable) };
This also fixes:
Aaa({
int i;
}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccc));
... where we would previously break after the '},'.
Putting the closing curly into an extra line when there's a break
directly after the first curly will be done in a subsequent patch.
Paired with djasper.
llvm-svn: 172070
|
| |
|
|
|
|
|
| |
void f() {}
now gets formatted in one line.
llvm-svn: 172067
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before: int (^myBlock) (int) = ^(int num) {}
A<void ()>;
int (*b)(int);
After: int (^myBlock)(int) = ^(int num) {}
A<void()>;
int(*b)(int);
For function types and function pointer types, this patch only makes
the behavior consistent (for types that are keywords and other types).
For the latter function pointer type declarations, we'll probably
want to add a space after "int".
Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately
Moved the LangOpts-settings to a public place for use by tests
and clang-format binary.
llvm-svn: 172065
|
| |
|
|
|
|
| |
the backend if hard float ABI is selected under -mips16 mode.
llvm-svn: 172062
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we would not indent:
SOME_MACRO({
int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.
Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };
llvm-svn: 172058
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This fixes llvm.org/PR14684.
Before: int *pa = (int *) & a;
After: int *pa = (int *)&a;
We still don't understand all kinds of casts. I added a FIXME to
address that.
llvm-svn: 172056
|
| |
|
|
|
|
| |
enabled this extension for multiple targets.
llvm-svn: 172052
|
| |
|
|
|
|
|
| |
After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.
llvm-svn: 172050
|
| |
|
|
|
|
|
|
|
| |
This fixes llvm.org/PR14883, where clang-format would run into an
assertion on:
void f() { return } 42
llvm-svn: 172049
|
| |
|
|
|
|
|
| |
difference between type widths of a vector and the width of one of its elements
in the case of vector shifts. Use correct witdth in the vector case.
llvm-svn: 172047
|
| |
|
|
| |
llvm-svn: 172035
|
| |
|
|
|
|
| |
PR14825!
llvm-svn: 172031
|