Граф коммитов

41972 Коммитов

Автор SHA1 Сообщение Дата
Daniel Jasper 1f2b07898f Fix parsing error in conditional expressions.
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
2013-01-16 16:23:19 +00:00
Argyrios Kyrtzidis 7f69b1ab4f [PCH/Modules] Change how macro [re]definitions are de/serialized.
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
2013-01-16 16:19:38 +00:00
Daniel Jasper 48bd7b72b8 Improve understanding of unary operators.
Before: int x = ** a;
After:  int x = **a;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172619 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 16:04:06 +00:00
Daniel Jasper df3736aa70 Disable inlining of short ifs in Google style.
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
2013-01-16 15:44:34 +00:00
Daniel Jasper 0df6acdf4f Add option to avoid "bin-packing" of parameters.
"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
2013-01-16 14:59:02 +00:00
Manuel Klimek ca547dbbb1 Add debugging support for split penalties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172616 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 14:55:28 +00:00
Manuel Klimek 8fa3799916 Use standard llvm Debug.h support for debugging output.
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
2013-01-16 12:31:12 +00:00
Alexander Kornienko 51c23fa34b Clang Format: A couple of tests for the trailing stuff case
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172607 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 11:45:16 +00:00
Alexander Kornienko d881875b6c Clang Format: Handle missing semicolon
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 11:43:46 +00:00
Alexey Samsonov a40548c36d Fix uninitialized bool flag access in SanitizerArgs parser
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172605 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 11:34:36 +00:00
Daniel Jasper 3f8cdbf993 Calculate the total length of a line up to each token up front.
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
2013-01-16 10:41:46 +00:00
Daniel Jasper cbb6c41f3c Change the datastructure for UnwrappedLines.
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
2013-01-16 09:10:19 +00:00
Daniel Jasper 6b825c2e1e Never merge < and ::, as it produces different tokens.
Before: vector<::Type> t;
After:  vector< ::Type> t;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 07:19:28 +00:00
Daniel Jasper 55b08e769f Remove errors were if statements were incorrectly put on a single line.
Before: if (a)  // This comment confused clang-format f();
After:  if (a)  // No more confusion
          f();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172600 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 07:02:34 +00:00
NAKAMURA Takumi 05a10ff30b clang/test/Driver/darwin-sdkroot.c: Suppress this on msys bash, to introduce the feature "shell-preserves-root".
MSYS transforms '/' to 'X:/mingwroot/'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172598 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 06:10:16 +00:00
Anna Zaks d7b1d2467d [analyzer] Add an annotation to allow suppression of direct ivar
assignment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172597 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:36:00 +00:00
Anna Zaks 79ccd56354 [analyzer] Fix warning typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172596 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:35:57 +00:00
Anna Zaks 64eb070234 [analyzer] Refactor: parameter rename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:35:54 +00:00
Douglas Gregor f43b7214e8 Add -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
users can explicitly enable/disable modules autolinking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172592 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:23:41 +00:00
Eric Christopher 0395de3600 Collect both normal and static data members of a class in source
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
2013-01-16 01:22:32 +00:00
Dmitri Gribenko 44a1efe44e Documentation: fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172588 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:17:05 +00:00
Douglas Gregor 52fb37a52c Document the redeclaration and overriding restrictions on the
availability attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 01:12:31 +00:00
Douglas Gregor 72daa3f2de One can have an unavailable method overridden by an available method,
but not vice-versa. Fix bug introduced in r172567 and noticed by
Jordan, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172586 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 00:54:48 +00:00
Douglas Gregor b9df75f1b8 Apply adjustment to function- and array-typed non-type template
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
2013-01-16 00:52:15 +00:00
David Greene ed6355d56c Fix signed/unsigned Compare
Do some casting to avoid a signed/unsigned compare.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172571 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 23:13:49 +00:00
David Greene cc41a94688 Avoid unsigned Compare to int
Cast arithmetic results to avoid comparison of an unsigned to an int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172570 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 23:13:47 +00:00
Douglas Gregor f4d918fdf7 When checking availability attributes for consistency between an
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
2013-01-15 22:43:08 +00:00
David Greene 041e6aab2f Fix Casting
Use const_cast<> to avoid a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172565 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:51 +00:00
David Greene 3cfa5324ef Fix Casting
Use const_cast<> to avoid a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172564 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:49 +00:00
David Greene 527ce9fb91 Fix Casting
Use const_cast<> to avoid a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:48 +00:00
David Greene 61eacf0f4f Fix Casting
Use const_cast<> to avoid a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172562 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:46 +00:00
David Greene 16303fcc56 Fix Cast
Properly use const_cast to fix a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:45 +00:00
David Greene 644448393e Fix Casting
Make the const_cast explicit to silence a compiler warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172560 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:43 +00:00
David Greene 5ba58a1b3c Fix Const Cast
Do proper casting to avoid a cast-away-const error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172559 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:41 +00:00
David Greene 3f7b3a754e Fix Cast
Avoid a cast-away-const error by properly using const_cast<>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172558 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:40 +00:00
David Greene c23e69d761 Fix Cast Code
Eliminate a cast and resulting cast-qual warning by using a temporary
as the target of memcpy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172557 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:39 +00:00
Aaron Ballman 6b716c5856 Typo correction; no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172555 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 21:59:46 +00:00
Daniel Dunbar 321425445f [driver/Darwin] Adjust SDKROOT handling code to not generate "-isysroot /".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172548 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 20:33:56 +00:00
Dmitri Gribenko ef8e498b3a Add a test for -Wsemicolon-before-method-body fixit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172545 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 18:29:04 +00:00
Manuel Klimek 1913230366 Do not traverse the break-state when we know we cannot break anyway.
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
2013-01-15 16:41:02 +00:00
Manuel Klimek 407a31afff Fix formatting of preprocessor directives (incluces, warnings & errors).
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
2013-01-15 15:50:27 +00:00
Daniel Jasper b369c2cb31 Improve operator kind detection in presence of comments.
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
2013-01-15 14:27:39 +00:00
Manuel Klimek 47ea7f6410 Fixes various bugs around the keywords class, struct and union.
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
2013-01-15 13:38:33 +00:00
Alexander Kornienko 51ccafd666 Resolved merge error with r172323 (llvm::X -> X)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172528 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 12:20:21 +00:00
Richard Smith 02d65ee373 Don't crash when binding a reference to a temporary pointer created from
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
2013-01-15 07:58:29 +00:00
Richard Smith a121eb3af0 PR14950: Fix out-of-bounds function parameter access in literal operator lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 07:12:59 +00:00
Richard Smith d3e723e288 PR14918: Don't confuse braced-init-lists after template variable declarations
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
2013-01-15 06:49:38 +00:00
Douglas Gregor 50a70cd118 Add -fopenmp -cc1 option and wire it up to define _OPENMP, from Alexey Bataev!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172509 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 06:45:29 +00:00
Richard Smith 5c52166525 Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
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
2013-01-15 02:48:13 +00:00
Chad Rosier 08e79d2f07 [driver] Warnings for warning options are handled by the frontend. The driver needs to process the
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
2013-01-15 01:21:53 +00:00