Commit Graph

42880 Commits

Author SHA1 Message Date
Jordan Rose fe856d58a3 [analyzer] Do a better job describing C++ member functions in the call stack.
Examples:
  Calling constructor for 'Foo'
  Entered call from 'Foo::create'

llvm-svn: 172832
2013-01-18 18:27:14 +00:00
Manuel Klimek 05d82b72f1 Fix comment.
llvm-svn: 172831
2013-01-18 18:24:28 +00:00
Manuel Klimek da08761bb2 Fixes issues around pulling in the next line in simple if statements.
llvm-svn: 172822
2013-01-18 14:46:43 +00:00
NAKAMURA Takumi d6a707f20e clang/test/CodeGen: Suppress a couple of tests on win32. It seems -fsanitize-blacklist doesn't accept DOSish pathnames.
llvm-svn: 172820
2013-01-18 14:11:04 +00:00
Manuel Klimek d3b92fa61e Fixes problems with line merging in the face of preprocessor directives.
This patch prepares being able to test for and fix more problems (see
FIXME in the test for example).

Previously we would output unwrapped lines for preprocessor directives
at the point where we also parsed the hash token. Since often
projections only terminate (and thus output their own unwrapped line)
after peeking at the next token, this would lead to the formatter seeing
the preprocessor directives out-of-order (slightly earlier). To be able
to correctly identify lines to merge, the formatter needs a well-defined
order of unwrapped lines, which this patch introduces.

llvm-svn: 172819
2013-01-18 14:04:34 +00:00
NAKAMURA Takumi 8b517f1076 clang-check: Introduce llvm::sys::PrintStackTraceOnErrorSignal()
llvm-svn: 172818
2013-01-18 13:46:48 +00:00
Will Dietz f54319c891 [ubsan] Add support for -fsanitize-blacklist
llvm-svn: 172808
2013-01-18 11:30:38 +00:00
Daniel Jasper 04468962ab Reduce penalty for splitting between ")" and ".".
').' is likely part of a builder pattern statement.
This is based upon a patch developed by Nico Weber. Thank you!

Before:
int foo() {
  return llvm::StringSwitch<Reference::Kind>(name).StartsWith(
      ".eh_frame_hdr", ORDER_EH_FRAMEHDR).StartsWith(
      ".eh_frame", ORDER_EH_FRAME).StartsWith(".init", ORDER_INIT).StartsWith(
      ".fini", ORDER_FINI).StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT);
}

After:
int foo() {
  return llvm::StringSwitch<Reference::Kind>(name)
         .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
         .StartsWith(".eh_frame", ORDER_EH_FRAME)
         .StartsWith(".init", ORDER_INIT).StartsWith(".fini", ORDER_FINI)
         .StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT);
}

Probably not ideal, but makes many cases much more readable.

The changes to overriding-ftemplate-comments.cpp don't seem better or
worse. We should address those soon.

llvm-svn: 172804
2013-01-18 10:56:38 +00:00
Daniel Jasper 997b08ce3c Also align trailing line comments in include directives.
Before:
  #include <a> // for x
  #include <a/b/c> // for yz
After:
  #include <a>     // for x
  #include <a/b/c> // for yz

llvm-svn: 172799
2013-01-18 09:19:33 +00:00
Daniel Jasper aa701fa3ad Let the formatter align trailing line comments where possible.
Before:
int a; // comment
int bbbbb; // comment

After:
int a;     // comment
int bbbbb; // comment

llvm-svn: 172798
2013-01-18 08:44:07 +00:00
Nico Weber a5510af53e Formatter: After case blocks, "break" goes on the same line as the "}", PR14907.
Before:
switch (foo) {
case a: {
  int a = g();
  h(a);
}
  break;
}

Now:
switch (foo) {
case a: {
  int a = g();
  h(a);
} break;
}

llvm-svn: 172789
2013-01-18 05:50:57 +00:00
Nico Weber e3025672e9 Formatter: Enable @encode test.
This doesn't work right with pointers to pointers, but that's likely just a
dupe of PR14884.

llvm-svn: 172785
2013-01-18 05:11:47 +00:00
Douglas Gregor 6a7cb9f8bc Revert Clang r172620 and r172629, which caused a hang when building
complicated modules (<rdar://problem/13038265>). Unfortunately, this
un-fixes <rdar://problem/13016031>.

llvm-svn: 172783
2013-01-18 04:34:14 +00:00
Nico Weber 250fe71366 Formatter: The contents of @selector() should be formatted as a selector.
Before: @selector(foo: )
Now: @selector(foo:)
llvm-svn: 172781
2013-01-18 02:43:57 +00:00
Douglas Gregor 62ffead1ad When checking the parameter types of an Objective-C method, don't
decay the parameter type immediately; let CheckParameter() do its
job. Fixes <rdar://problem/12071218>.

llvm-svn: 172780
2013-01-18 01:41:40 +00:00
Chad Rosier 92c487d13c [ms-inline asm] Test case for r172773.
llvm-svn: 172774
2013-01-18 00:51:29 +00:00
Douglas Gregor f4e43315a9 One can override an Objective-C ARC ownership qualifier that came from
a template parameter; make that also include one that came from
'auto'. Fixes <rdar://problem/12078752>.

llvm-svn: 172770
2013-01-17 23:59:28 +00:00
Richard Smith 5011a0022a Some builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
to visit them.

llvm-svn: 172769
2013-01-17 23:46:04 +00:00
Douglas Gregor cd78037ad1 In Objective-C ARC, completely ignore ownership qualifiers on the
return type of a function by canonicalizing them away. They are
useless anyway, and conflict with our rules for template argument
deduction and __strong. Fixes <rdar://problem/12367446>.

llvm-svn: 172768
2013-01-17 23:36:45 +00:00
Anna Zaks 0e9c94199c [analyzer] DirectIvarAssignment: allow suppression annotation on Ivars.
llvm-svn: 172766
2013-01-17 23:24:58 +00:00
Richard Smith d33f5201b5 Defer checking for unsequenced operations on the RHS of && and || in order to
reduce stack usage and hopefully bring back the linux x86_64 buildbot.

llvm-svn: 172765
2013-01-17 23:18:09 +00:00
Jordan Rose 1eb342920b Format strings: don't ever convert %+d to %lu.
Presumably, if the printf format has the sign explicitly requested, the user
wants to treat the data as signed.

This is a fix-up for r172739, and also includes several test changes that
didn't make it into that commit.

llvm-svn: 172762
2013-01-17 22:34:10 +00:00
Richard Smith 0015f09877 Parsing support for C11's _Noreturn keyword. No semantics yet.
llvm-svn: 172761
2013-01-17 22:16:11 +00:00
Richard Smith 01a7fba820 -Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
unsequenced operations in the RHS. We don't compare the RHS with the rest of
the expression yet; such checks will need care to avoid diagnosing unsequenced
operations which are both in conditionally-evaluated subexpressions which
actually can't occur together, such as in '(b && ++x) + (!b && ++x)'.

llvm-svn: 172760
2013-01-17 22:06:26 +00:00
Kevin Enderby ae2ec4745f We want the dwarf AT_producer for assembly source files to match clang's
AT_producer.  Which includes clang's version information so we can tell
which version of the compiler was used.

This is second of the two steps to allow us to do this.  The first was a
change to llvm-mc with revision 172630 to provide a method to set the
AT_producer string.  This second step has the clang driver passing the value
of getClangFullVersion() via the new flag -dwarf-debug-producer when invoking
the integrated assembler on assembly source files.  Then using the new
setDwarfDebugProducer() method to set the AT_producer string.

rdar://12888242

llvm-svn: 172758
2013-01-17 21:38:06 +00:00
Peter Collingbourne 24c67c6a63 Do not pass -pie flag to linker if -shared specified. This matches
the gcc driver and makes it possible to add -pie to $CC or similar and
have it apply in the right places.

llvm-svn: 172753
2013-01-17 20:17:16 +00:00
Chad Rosier e343bc83f0 [ms-inline asm] Updates and test case for r172743.
Part of rdar://12576868

llvm-svn: 172744
2013-01-17 19:22:48 +00:00
Chad Rosier 4edf11fcf0 [ms-inline asm] Extend the Sema interface to get the size and length of a
VarDecl.
Part of rdar://12576868

llvm-svn: 172742
2013-01-17 19:21:24 +00:00
Jordan Rose aa7a3b3e75 Format strings: correct signedness if already correcting width (%d,%u).
It is valid to do this:
  printf("%u", (int)x);

But if we see this:
  printf("%lu", (int)x);

...our fixit should suggest %d, not %u.

llvm-svn: 172739
2013-01-17 18:47:16 +00:00
Jordan Rose b169ccc118 Convert test/FixIt/format-darwin.m to use relative line numbers.
llvm-svn: 172738
2013-01-17 18:47:12 +00:00
Joey Gouly 1d58cdbf4e Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.
llvm-svn: 172732
2013-01-17 17:35:00 +00:00
Nico Weber 80a82761bd Formatter: Get bit tests in ifs right.
It's generally not possible to know if 'a' '*' 'b' is a multiplication
expression or a variable declaration with a purely lexer-based approach. The
formatter currently uses a heuristic that classifies this token sequence as a
multiplication in rhs contexts (after '=' or 'return') and as a declaration
else.

Because of this, it gets bit tests in ifs, such as "if (a & b)" wrong. However,
declarations in ifs always have to be followed by '=', so this patch changes
the formatter to classify '&' as an operator if it's at the start of an if
statement.

Before:
  if (a& b)
  if (int* b = f())

Now:
  if (a & b)
  if (int* b = f())

llvm-svn: 172731
2013-01-17 17:17:19 +00:00
Dmitri Gribenko 764ea24cfd Documentation: formatting
llvm-svn: 172729
2013-01-17 17:04:54 +00:00
Daniel Jasper fefb1e6257 Allow breaking after the trailing const after a function declaration.
Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const GUARDED_BY(
    aaaaaaaaaaaaa);

After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const
    GUARDED_BY(aaaaaaaaaaaaa);

llvm-svn: 172718
2013-01-17 13:31:52 +00:00
Chandler Carruth 0153800601 Add initial rough support for synthesizing linker options when passed
-fopenmp in the link step on Linux. There is probably more tweaking that
will need to take place to get good support for linking the relevant
libraries on all Linux distributions and/or on other platforms, but this
get's the ball moving and allows Clang to build programs which contain
OpenMP pragmas that can be safely ignored by a compiler that doesn't
implement them, and yet makes direct calls into the OpenMP runtime.

llvm-svn: 172715
2013-01-17 13:19:29 +00:00
Daniel Jasper 11cb81cd6f Improve handling of comments in static initializers.
Also adding more tests.

We can now keep the formatting of something like:

static SomeType type = { aaaaaaaaaaaaaaaaaaaa, /* comment */
                         aaaaaaaaaaaaaaaaaaaa /* comment */,
                         /* comment */ aaaaaaaaaaaaaaaaaaaa,
                         aaaaaaaaaaaaaaaaaaaa, // comment
                         aaaaaaaaaaaaaaaaaaaa };

Note that the comment in the first line is handled like a trailing line comment
as that is likely what the user intended.

llvm-svn: 172711
2013-01-17 12:53:34 +00:00
David Blaikie b61b815fc8 Improve -Wreorder to handle cases of anonymous class member ordering
llvm-svn: 172707
2013-01-17 08:49:22 +00:00
NAKAMURA Takumi 98154a917f clang/test/Index/code-completion-skip-bodies.cpp: Check stdout and stderr individually, rather than mixed output of stdout and stderr with 2>&1.
XFAIL(s) are removed.

llvm-svn: 172705
2013-01-17 07:27:55 +00:00
Nico Weber 772fbfda45 Revert most of r172140.
r172140 changed the formatter to produce "-(id) foo" instead of "- (id)foo"
in google style, with a link to
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions
as reference.  But now that I look at that link again, it seems I didn't
read it very carefully the first time round.

llvm-svn: 172703
2013-01-17 06:14:50 +00:00
David Blaikie 3fc2f9114a ArrayRef-ize some ctor initializer related APIs
llvm-svn: 172701
2013-01-17 05:26:25 +00:00
David Blaikie 3ae79d9b8b Remove some unnecessary casts
llvm-svn: 172700
2013-01-17 05:26:21 +00:00
David Blaikie af64e141d3 Add test for PR12938, fixed by Richard Smith in r172691
llvm-svn: 172697
2013-01-17 02:43:00 +00:00
Matt Beaumont-Gay 978cca9f49 Suppress all -Wunused-value warnings from macro body expansions.
This is inspired by a number of false positives in real code, including
PR14968. I've added test cases reduced from these false positives to
test/Sema/unused-expr.c, as well as corresponding test cases that pass the
offending expressions as arguments to a no-op macro to ensure that we do warn
there.

This also removes my previous tweak from r166522/r166534, so that we warn on
unused cast expressions in macro arguments.

There were several test cases that were using -Wunused-value to test general
diagnostic emission features; I changed those to use other warnings or warn on
a macro argument expression. I stared at the test case for PR14399 for a while
with Richard Smith and we believe the new test case exercises the same
codepaths as before.

llvm-svn: 172696
2013-01-17 02:06:08 +00:00
Douglas Gregor eaa75a69ad Add a comment for Daniel
llvm-svn: 172695
2013-01-17 01:58:31 +00:00
Richard Smith 7fc772c0bd Test that we correctly handle reversion of line splicing etc in raw string
literals. As suggested by Sean Silva.

llvm-svn: 172694
2013-01-17 01:46:13 +00:00
Richard Smith 2ae0164fba Attempt to work around bug in older GCCs to fix buildbot.
llvm-svn: 172693
2013-01-17 01:40:50 +00:00
Daniel Dunbar 69e4746439 [IRgen] Update modules autolink metadata to use module flags (as now specified
in the LangRef).

llvm-svn: 172692
2013-01-17 01:35:06 +00:00
Richard Smith 10876ef571 Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).

llvm-svn: 172691
2013-01-17 01:30:42 +00:00
Richard Smith c406cb7364 Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
expressions which have undefined behavior due to multiple unsequenced
modifications or an unsequenced modification and use of a variable.

llvm-svn: 172690
2013-01-17 01:17:56 +00:00
NAKAMURA Takumi 8c6cbe776b clang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.
llvm-svn: 172689
2013-01-17 01:07:09 +00:00
Douglas Gregor eed4979db9 Treat hidden Objective-C protocol definitions as if they were
undefined, and don't find methods or protocols within those protocol
definitions. This completes <rdar://problem/10634711>.

llvm-svn: 172686
2013-01-17 00:38:46 +00:00
Dmitri Gribenko ae73417b69 Implement a fixit for -Wmain-return-type
llvm-svn: 172684
2013-01-17 00:26:13 +00:00
Fariborz Jahanian c889205567 objC block layout: Patch reorders block layout to
produce more inline layout metadata. // rdar://12752901

llvm-svn: 172683
2013-01-17 00:25:06 +00:00
Matt Beaumont-Gay e9fe5308ca Fix a typo introduced in r172665.
llvm-svn: 172682
2013-01-17 00:21:55 +00:00
Argyrios Kyrtzidis 6b4f341ecd [objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
if we can see the elements of the arrays.

for example:

 NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]];

-->

 NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" };

rdar://12428166

llvm-svn: 172679
2013-01-16 23:54:48 +00:00
Rafael Espindola b306900200 Delay linkage checks when validating the weakref attribute.
llvm-svn: 172678
2013-01-16 23:49:06 +00:00
Aaron Ballman f96361e6cb Fixes crash when illegal function definitions are deleted or defaulted. Fixes PR14577.
llvm-svn: 172676
2013-01-16 23:39:10 +00:00
Rafael Espindola 7d9669e432 Simplify code. No functionality change.
llvm-svn: 172673
2013-01-16 23:21:32 +00:00
David Blaikie f157e90135 Remove unnecessary initialization i Added in r172668.
echristo already fixed this in r172649, but I'll leave the reformatting in
since I'm in the blame history for it now anyway.

llvm-svn: 172672
2013-01-16 23:18:16 +00:00
David Blaikie 5bb700360c Readd an open paren that was lost while reformatting code.
llvm-svn: 172669
2013-01-16 23:13:42 +00:00
David Blaikie 687cd95941 Fix -Wreorder warning.
Rewrapping courtesy of clang-format.

llvm-svn: 172668
2013-01-16 23:13:36 +00:00
Rafael Espindola f1d2f0ea21 Check for internal weak decls after merging.
This fixes pr14946. The problem was that the linkage computation was done too
early, so things like "extern int a;" would be given external linkage, even if
a previous declaration was static.

llvm-svn: 172667
2013-01-16 23:11:15 +00:00
David Blaikie 3302f2bd46 PR14964: intrinsic headers using non-reserved identifiers
Several of the intrinsic headers were using plain non-reserved identifiers.
C++11 17.6.4.3.2 [global.names] p1 reservers names containing a double
begining with an underscore followed by an uppercase letter for any use.

I think I got them all, but open to being corrected. For the most part I
didn't bother updating function-like macro parameter names because I don't
believe they're subject to any such collission - though some function-like
macros already follow this convention (I didn't update them in part because
the churn was more significant as several function-like macros use the double
underscore prefixed version of the same name as a parameter in their
implementation)

llvm-svn: 172666
2013-01-16 23:08:36 +00:00
Douglas Gregor 048fbfa302 Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

  visible_categories_iterator: Iterates over all visible categories
  and extensions, hiding any that have their "hidden" bit set. This is
  by far the most commonly used iterator.

  known_categories_iterator: Iterates over all categories and
  extensions, ignoring the "hidden" bit. This tends to be used for
  redeclaration-like traversals.

  visible_extensions_iterator: Iterates over all visible extensions,
  hiding any that have their "hidden" bit set.

  known_extensions_iterator: Iterates over all extensions, whether
  they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.
 

llvm-svn: 172665
2013-01-16 23:00:23 +00:00
Peter Collingbourne e8baf33712 Use getProcessTriple in clang-interpreter.
llvm-svn: 172664
2013-01-16 22:37:09 +00:00
Richard Smith e826c1a134 Add raw string literal versus C preprocessor test, suggested by James Dennett.
llvm-svn: 172660
2013-01-16 21:43:09 +00:00
Tim Northover bd7c169664 Fix recent test for more diverse environments.
I think the main issue was the lack of -ffreestanding, which pulled in
the host's stdint.h. After that things went rapidly downhill.

llvm-svn: 172653
2013-01-16 20:35:54 +00:00
Tim Northover 4ef746768b Correct order of operands forwarding NEON vfma to LLVM fma
llvm-svn: 172650
2013-01-16 20:13:15 +00:00
Eric Christopher 5e4696d2f5 Move initialization of ParsingIfOrElifDirective down next to the macro
initializations to fix Wreorder warning.

llvm-svn: 172649
2013-01-16 20:09:36 +00:00
Eric Christopher 37d05cded7 Add testcase missed yesterday. Patch from Paul Robinson.
llvm-svn: 172648
2013-01-16 19:54:35 +00:00
Aaron Ballman 1f0fa91bed Adding verbiage to the Language Extensions document about __has_include and __has_include_next only being allowed within preprocessor directives.
llvm-svn: 172643
2013-01-16 19:51:19 +00:00
Aaron Ballman 6ce0000dd5 No longer crashing with an assert when __has_include or __has_include_next is used outside of a preprocessor directive. This fixes PR14837.
llvm-svn: 172639
2013-01-16 19:32:21 +00:00
Douglas Gregor 77f49a4902 Teach global selector lookup to ignore hidden methods, which occur
when the methods are declared in a submodule that has not yet been
imported. Part of <rdar://problem/10634711>. 

llvm-svn: 172635
2013-01-16 18:47:38 +00:00
Argyrios Kyrtzidis da4ba87181 [libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is
null before using it.

llvm-svn: 172632
2013-01-16 18:13:00 +00:00
Argyrios Kyrtzidis 8078a5a449 [PCH/Modules] The iterator may become invalidated because a new macro can be added
while deserializing a macro, make sure to copy/move what we need from it.

Fixes clang-x86_64-debian-fast bot.

llvm-svn: 172629
2013-01-16 17:42:07 +00:00
Reed Kotler 373feca7a0 First step in implementation of mips16 and nomips16 attributes.
Waiting for new llvm attribute code for the next step.

llvm-svn: 172626
2013-01-16 17:10:28 +00:00
Argyrios Kyrtzidis fbd7c2d3b2 [libclang] In clang_getCursorType, don't crash if the translation unit is not
set on the cursor; return a null type in such a case.

llvm-svn: 172625
2013-01-16 17:04:31 +00:00
Daniel Jasper 69987d5415 Fix a bug where we would move a following line into a comment.
Before: Constructor() : a(a), // comment a(a) {}
After:  Constructor() : a(a), // comment
                        a(a) {}

Needed this as a quick fix. Will add more tests for this in a future
commit.

llvm-svn: 172624
2013-01-16 17:00:50 +00:00
Argyrios Kyrtzidis 99b0a6a03a [preprocessor] Call the MacroUndefined callback even when the macro was not defined.
Patch by Enea Zaffanella!

llvm-svn: 172623
2013-01-16 16:52:44 +00:00
Daniel Jasper 8c5fba9f87 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.

llvm-svn: 172621
2013-01-16 16:23:19 +00:00
Argyrios Kyrtzidis f40f67af43 [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

llvm-svn: 172620
2013-01-16 16:19:38 +00:00
Daniel Jasper a1dc93a5bd Improve understanding of unary operators.
Before: int x = ** a;
After:  int x = **a;
llvm-svn: 172619
2013-01-16 16:04:06 +00:00
Daniel Jasper ced17f8cd5 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.

llvm-svn: 172618
2013-01-16 15:44:34 +00:00
Daniel Jasper 9278eb95e3 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();

llvm-svn: 172617
2013-01-16 14:59:02 +00:00
Manuel Klimek 249981040b Add debugging support for split penalties.
llvm-svn: 172616
2013-01-16 14:55:28 +00:00
Manuel Klimek ab3dc000ca 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.

llvm-svn: 172608
2013-01-16 12:31:12 +00:00
Alexander Kornienko ae6e53c15d Clang Format: A couple of tests for the trailing stuff case
llvm-svn: 172607
2013-01-16 11:45:16 +00:00
Alexander Kornienko 1231e066a8 Clang Format: Handle missing semicolon
llvm-svn: 172606
2013-01-16 11:43:46 +00:00
Alexey Samsonov f7a247654a Fix uninitialized bool flag access in SanitizerArgs parser
llvm-svn: 172605
2013-01-16 11:34:36 +00:00
Daniel Jasper a67a8f062b 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.

llvm-svn: 172604
2013-01-16 10:41:46 +00:00
Daniel Jasper daffc0dd4c 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.

llvm-svn: 172602
2013-01-16 09:10:19 +00:00
Daniel Jasper 736c14fac4 Never merge < and ::, as it produces different tokens.
Before: vector<::Type> t;
After:  vector< ::Type> t;
llvm-svn: 172601
2013-01-16 07:19:28 +00:00
Daniel Jasper c36492b598 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();
llvm-svn: 172600
2013-01-16 07:02:34 +00:00
NAKAMURA Takumi 6c8127cc73 clang/test/Driver/darwin-sdkroot.c: Suppress this on msys bash, to introduce the feature "shell-preserves-root".
MSYS transforms '/' to 'X:/mingwroot/'.

llvm-svn: 172598
2013-01-16 06:10:16 +00:00
Anna Zaks 6519564c97 [analyzer] Add an annotation to allow suppression of direct ivar
assignment

llvm-svn: 172597
2013-01-16 01:36:00 +00:00
Anna Zaks 8a023580c7 [analyzer] Fix warning typo.
llvm-svn: 172596
2013-01-16 01:35:57 +00:00
Anna Zaks 0c34c1a25f [analyzer] Refactor: parameter rename.
llvm-svn: 172595
2013-01-16 01:35:54 +00:00
Douglas Gregor c60437fb89 Add -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
users can explicitly enable/disable modules autolinking.

llvm-svn: 172592
2013-01-16 01:23:41 +00:00
Eric Christopher 91a3190a28 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!

llvm-svn: 172591
2013-01-16 01:22:32 +00:00
Dmitri Gribenko fb5b2245c1 Documentation: fix typo
llvm-svn: 172588
2013-01-16 01:17:05 +00:00