We used to incorrectly parse
aaaaaa ? aaaaaa(aaaaaa) : aaaaaaaa;
Due to an l_paren being followed by a colon, we assumed it to be part of
a constructor initializer. Thus, we never found the colon belonging to
the conditional expression, marked the line as bing incorrect and did
not format it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172621 91177308-0d34-0410-b5e6-96231b3b80d8
Previously we would serialize the macro redefinitions as a list, part of
the identifier, and try to chain them together across modules individually
without having the info that they were already chained at definition time.
Change this by serializing the macro redefinition chain and then try
to synthesize the chain parts across modules. This allows us to correctly
pinpoint when 2 different definitions are ambiguous because they came from
unrelated modules.
Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH
is redefined without undef'ing it first.
rdar://13016031
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172620 91177308-0d34-0410-b5e6-96231b3b80d8
Various reasons seem to speak against it, so I am disabling this for
now.
Changed tests to still test this option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172618 91177308-0d34-0410-b5e6-96231b3b80d8
"Bin-packing" here means allowing multiple parameters on one line, if a
function call/declaration is spread over multiple lines.
This is required by the Chromium style guide and probably desired for
the Google style guide. Not making changes to LLVM style as I don't have
enough data.
With this enabled, we format stuff like:
aaaaaaaaaaaaaaa(aaaaaaaaaa,
aaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172617 91177308-0d34-0410-b5e6-96231b3b80d8
Leave a quick "// Uncomment this." hint to enable the debug output in
tests. FIXME: figure out whether we want to enable debug command line
handling for all tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172608 91177308-0d34-0410-b5e6-96231b3b80d8
This makes the tedious fitsIntoLimit() method unnecessary and I can
replace one hack (constructor initializers) by a slightly better hack.
Furthermore, this will enable calculating whether a certain part of a
line fits into the limit for future modifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172604 91177308-0d34-0410-b5e6-96231b3b80d8
It was quite convoluted leading to us accidentally introducing O(N^2)
complexity while copying from UnwrappedLine to AnnotatedLine. We might
still want to improve the datastructure in AnnotatedLine (most
importantly not put them in a vector where they need to be copied on
vector resizing but that will be done as a follow-up.
This fixes most of the regression in llvm.org/PR14959.
No formatting changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172602 91177308-0d34-0410-b5e6-96231b3b80d8
order. Describe static data members to metadata using new interfaces.
Part of PR14471.
Patch by Paul Robinson!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172591 91177308-0d34-0410-b5e6-96231b3b80d8
parameters (per C++ [temp.param]p8) when computing the type of a
reference to a non-type template parameter. Fixes <rdar://problem/13000548>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172585 91177308-0d34-0410-b5e6-96231b3b80d8
overriding and overridden method, allow the overridden method to have
a narrower contract (introduced earlier, deprecated/obsoleted later)
than the overriding method. Fixes <rdar://problem/12992023>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172567 91177308-0d34-0410-b5e6-96231b3b80d8
This is an optimization that djasper spottet. For now, we do not format
anything after the first token that belongs to such an implicit string
literal. All our state is not made for handling that anyway, so we'll
revisit this if we find a problem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172537 91177308-0d34-0410-b5e6-96231b3b80d8
Treat tokens inside <> for includes and everything from the second token
of a warning / error on as an implicit string literal, e.g. do not
change its whitespace at all.
Now correctly formats:
#include < path with space >
#error Leave all white!!!!! space* alone!
Note that for #error and #warning we still format the space up to the
first token of the text, so:
# error Text
will become
#error Text
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172536 91177308-0d34-0410-b5e6-96231b3b80d8
We used to incorrectly identify some operators (*, &, +, -, etc.) if
there were comments around them.
Example:
Before: int a = /**/ - 1;
After: int a = /**/ -1;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172533 91177308-0d34-0410-b5e6-96231b3b80d8
This switches to parsing record definitions only if we can clearly
identify them. We're specifically allowing common patterns for
visibility control through macros and attributes, but we cannot
currently fix all instances. This fixes all known bugs we have though.
Before:
static class A f() {
return g();
} int x;
After:
static class A f() {
return g();
}
int x;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172530 91177308-0d34-0410-b5e6-96231b3b80d8
resolving an overloaded function reference within an initializer list.
Previously we would try to resolve the overloaded function reference without
first stripping off the InitListExpr wrapper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172517 91177308-0d34-0410-b5e6-96231b3b80d8
with function definitions.
We really should remove Parser::isDeclarationAfterDeclarator entirely, since
it's meaningless in C++11 (an open brace could be either a function definition
or an initializer, which is what it's trying to differentiate between). The
other caller of it happens to be correct right now...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172510 91177308-0d34-0410-b5e6-96231b3b80d8
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172504 91177308-0d34-0410-b5e6-96231b3b80d8
warning options to setup diagnostic state, but should not be emitting warnings as these would be
rudndant with what the frontend emits.
rdar://13001556
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172497 91177308-0d34-0410-b5e6-96231b3b80d8