| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
| |
Now that the TokenAnnotator does not require stack space anymore,
reconstructing the lines has become the limiting factor. This patch
fixes that problem, allowing large files with multiple megabytes of
single unwrapped lines to be formatted.
llvm-svn: 182861
|
| |
|
|
|
|
|
|
|
|
| |
Gets rid of AnnotatedToken, putting everything into FormatToken.
FormatTokens are created once, and only referenced by pointer. This
enables multiple future features, like having tokens shared between
multiple UnwrappedLines (while there's still work to do to fully enable
that).
llvm-svn: 182859
|
| |
|
|
| |
llvm-svn: 182856
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an identifier is on its own line and it is all upper case, it is highly
likely that this is a macro that is meant to stand on a line by itself.
Before:
class A : public QObject {
Q_OBJECT A() {}
};
Ater:
class A : public QObject {
Q_OBJECT
A() {}
};
llvm-svn: 182855
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
With option enabled (e.g. in Google-style):
template <typename T>
void f() {}
With option disabled:
template <typename T> void f() {}
Enabling this for Google-style and Chromium-style, not sure which other
styles would prefer that.
llvm-svn: 182849
|
| |
|
|
|
|
|
| |
This brings the number of linkage computations in "clang -cc1" in SemaExpr.ii
from 58426 to 43134. With -emit-llvm the number goes from 161045 to 145461.
llvm-svn: 182823
|
| |
|
|
| |
llvm-svn: 182821
|
| |
|
|
|
|
| |
It was fixed back in r182750, but this is a nice testcase to have.
llvm-svn: 182818
|
| |
|
|
|
|
|
| |
C++ and C differ with respect to the handling of extern void
declarations. Enforce the C++ behavior in C++ mode.
llvm-svn: 182814
|
| |
|
|
|
|
|
| |
in an @selector expression has no implementation.
// rdar://14002507
llvm-svn: 182812
|
| |
|
|
| |
llvm-svn: 182811
|
| |
|
|
|
|
|
|
|
| |
ArrayToPointer decay evaluation
This gives slightly better precision, specifically, in cases where a non-typed region represents the array
or when the type is a non-array type, which can happen when an array is a result of a reinterpret_cast.
llvm-svn: 182810
|
| |
|
|
|
|
|
|
|
| |
It’s important for us to reason about the cast as it is used in std::addressof. The reason we did not
handle the cast previously was a crash on a test case (see commit r157478). The crash was in
processing array to pointer decay when the region type was not an array. Address the issue, by
just returning an unknown in that case.
llvm-svn: 182808
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch the linkage cache was only used by the entry level function
(getLinkage). The function that does the actual computation (getLVForDecl),
never looked at it.
This means that we would not reuse an entry in the cache when getLVForDecl did
a recursive call. This patch fixes that by adding another computation enum
value for when we don't care about the linkage at all and having getLVForDecl
check the cache in that case.
When running "clang -cc1" over SemaExpr.ii this brings the number of linkage
computations from 93749 to 58426. When running "clang -cc1 -emit-llvm -O3" it
goes from 198708 to 161444.
For SemaExpr.ii at least linkage computation is a small enough percentage of
the work that the time difference was in the noise.
When asserts are enabled this patch also causes clang to check the linkage
cache even on recursive calls.
llvm-svn: 182799
|
| |
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D745
llvm-svn: 182798
|
| |
|
|
| |
llvm-svn: 182796
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This made it necessary to remove an error detection which would let us
bail out of braced lists in certain situations of missing "}". However,
as we always entirely escape from the braced list on finding ";", this
should not be a big problem.
With this, we can no format braced lists with uniformat inits:
return { arg1, SomeType { parameter } };
llvm-svn: 182788
|
| |
|
|
|
|
|
| |
does not support large load/store of atomic objects.
// rdar://13973577
llvm-svn: 182781
|
| |
|
|
|
|
|
|
|
| |
operators on MemRegions
In addition to enabling more code reuse, this suppresses some false positives by allowing us to
compare an element region to its base. See the ptr-arith.cpp test cases for an example.
llvm-svn: 182780
|
| |
|
|
|
|
|
|
|
| |
Before: f( (*PointerToArray)[10]);
After: f((*PointerToArray)[10]);
This fixes llvm.org/PR16163
llvm-svn: 182777
|
| |
|
|
| |
llvm-svn: 182773
|
| |
|
|
|
|
| |
The FormatToken is now not copyable any more.
llvm-svn: 182772
|
| |
|
|
| |
llvm-svn: 182769
|
| |
|
|
|
|
|
|
|
|
|
| |
With this patch, we create all tokens in one go before parsing and pass
an ArrayRef<FormatToken*> to the UnwrappedLineParser. The
UnwrappedLineParser is switched to use pointer-to-token internally.
The UnwrappedLineParser still copies the tokens into the UnwrappedLines.
This will be fixed in an upcoming patch.
llvm-svn: 182768
|
| |
|
|
| |
llvm-svn: 182767
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To fully support this, we also need to expand tabs in the text before
the block comment. This patch breaks indentation when there was a
non-standard mixture of spaces and tabs used for indentation, but
fixes a regression in the simple case:
{
/*
* Comment.
*/
int i;
}
Is now formatted correctly, if there were tabs used for indentation
before.
llvm-svn: 182760
|
| |
|
|
|
|
|
|
|
|
|
| |
Block comment indentation of empty lines regressed, as we did not
have a test for it.
/* Comment with...
*
* empty line. */
is now formatted correctly again.
llvm-svn: 182757
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Before:
int (*func)(void*);
void f() { int(*func)(void*); }
After (consistent space after "int"):
int (*func)(void*);
void f() { int (*func)(void*); }
llvm-svn: 182756
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This gets turned into two ">" operators at the beginning in order to
simplify template parameter handling. Thus, we need a special case to
handle those two binary operators correctly.
With this patch, clang-format can now correctly handle cases like:
aaaaaa = aaaaaaa(aaaaaaa, // break
aaaaaa) >>
bbbbbb;
llvm-svn: 182754
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The coercion type serves two purposes:
1. Pad structs to a multiple of 64 bits, so they are passed
'left-aligned' in registers.
2. Expose aligned floating point elements as first-level elements, so
the code generator knows to pass them in floating point registers.
We also compute the InReg flag which indicates that the struct contains
aligned 32-bit floats. This flag is used by the code generator to pick
the right registers.
llvm-svn: 182753
|
| |
|
|
|
|
| |
Fixes PR16114.
llvm-svn: 182750
|
| |
|
|
|
|
| |
No intended functionality change.
llvm-svn: 182749
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- All integer arguments smaller than 64 bits are extended.
- Large structs are passed indirectly, not using 'byval'.
- Structs up to 32 bytes in size are returned in registers.
Some things are not implemented yet:
- EmitVAArg can be implemented in terms of the va_arg instruction.
- When structs are passed in registers, float members require special
handling because they are passed in the floating point registers.
- Structs are left-aligned when passed in registers. This may require
padding.
llvm-svn: 182745
|
| |
|
|
|
|
|
|
|
| |
This option is used to select a dynamic loader prefix to be used
at runtime. Currently this is implemented for the Linux toolchain.
Differential Revision: http://llvm-reviews.chandlerc.com/D851
llvm-svn: 182744
|
| |
|
|
| |
llvm-svn: 182742
|
| |
|
|
|
|
|
|
|
| |
Before: A < int&& > a;
After: A<int &&> a;
Also remove obsolete FIXMEs.
llvm-svn: 182741
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unify handling of whitespace when breaking protruding tokens with other
whitespace replacements.
As a side effect, the BreakableToken structure changed significantly:
- have a common base class for single-line breakable tokens, as they are
much more similar
- revamp handling of multi-line comments; we now calculate the
information about lines in multi-line comments similar to normal
tokens, and always issue replacements
As a result, we were able to get rid of special casing of trailing
whitespace deletion for comments in the whitespace manager and the
BreakableToken and fixed bugs related to tab handling and escaped
newlines.
llvm-svn: 182738
|
| |
|
|
|
|
| |
We were handling only local types in inline External functions before.
llvm-svn: 182737
|
| |
|
|
|
|
|
| |
This removes a duplicate from Decl.cpp and a followup patch will use
isExternallyVisible.
llvm-svn: 182735
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber(
Current.FormatTok.getStartOfNonWhitespace()) -
1;
After:
unsigned OriginalStartColumn =
SourceMgr.getSpellingColumnNumber(
Current.FormatTok.getStartOfNonWhitespace()) -
1;
llvm-svn: 182733
|
| |
|
|
| |
llvm-svn: 182732
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In general, we like to avoid line breaks like:
...
SomeParameter, OtherParameter).DoSomething(
...
as they tend to make code really hard to read (how would you even indent the
next line?). Previously we have implemented this in a hacky way, which has now
shown to lead to problems. This fixes a few weird looking formattings, such as:
Before:
aaaaa(
aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaa(aaaaa),
aaaaaaaaaaaaaaaaaaaaa);
After:
aaaaa(aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).aaaaa(aaaaa),
aaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 182731
|
| |
|
|
|
|
|
|
| |
If -fsanitize=leak is specified, link the program with the
LeakSanitizer runtime. Ignore this option when -fsanitize=address is specified,
because AddressSanitizer has this functionality built in.
llvm-svn: 182729
|
| |
|
|
| |
llvm-svn: 182720
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
@{ NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
: regularFont, };
Now:
@{ NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :
regularFont, };
':'s in dictionary literals (and the corresponding {}s) are now marked as
TT_ObjCDictLiteral too, which makes further improvements to dict literal
layout possible.
llvm-svn: 182716
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
John noticed that the fix for pr15930 (r181981) didn't handle indirect
uses of local types. For example, a pointer to local struct, or a
function that returns it.
One way to implement this would be to recursively look for local
types. This would look a lot like the linkage computation itself for
types.
To avoid code duplication and utilize the existing linkage cache, this
patch just makes the computation of "type with no linkage but
externally visible because it is from an inline function" part of the
linkage computation itself.
llvm-svn: 182711
|
| |
|
|
| |
llvm-svn: 182702
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When x is empty, x ## is suppressed, and when y gets expanded, the fact that it follows ## is not
available in the macro expansion result. The macro definition can be checked instead, the ## will
be available there regardless of what x expands to.
Fixes http://llvm.org/PR12767
Patch by Harald van Dijk!
llvm-svn: 182699
|
| |
|
|
|
|
| |
valid FileID (V2).
llvm-svn: 182698
|
| |
|
|
|
|
| |
rather than assuming it lives in the path. Patch by Eitan Adler!
llvm-svn: 182696
|