]> granicus.if.org Git - clang/log
clang
11 years agoAllow breaking after the trailing const after a function declaration.
Daniel Jasper [Thu, 17 Jan 2013 13:31:52 +0000 (13:31 +0000)]
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);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172718 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd initial rough support for synthesizing linker options when passed
Chandler Carruth [Thu, 17 Jan 2013 13:19:29 +0000 (13:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172715 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove handling of comments in static initializers.
Daniel Jasper [Thu, 17 Jan 2013 12:53:34 +0000 (12:53 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172711 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove -Wreorder to handle cases of anonymous class member ordering
David Blaikie [Thu, 17 Jan 2013 08:49:22 +0000 (08:49 +0000)]
Improve -Wreorder to handle cases of anonymous class member ordering

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172707 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang/test/Index/code-completion-skip-bodies.cpp: Check stdout and stderr individuall...
NAKAMURA Takumi [Thu, 17 Jan 2013 07:27:55 +0000 (07:27 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172705 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert most of r172140.
Nico Weber [Thu, 17 Jan 2013 06:14:50 +0000 (06:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172703 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef-ize some ctor initializer related APIs
David Blaikie [Thu, 17 Jan 2013 05:26:25 +0000 (05:26 +0000)]
ArrayRef-ize some ctor initializer related APIs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172701 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove some unnecessary casts
David Blaikie [Thu, 17 Jan 2013 05:26:21 +0000 (05:26 +0000)]
Remove some unnecessary casts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172700 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd test for PR12938, fixed by Richard Smith in r172691
David Blaikie [Thu, 17 Jan 2013 02:43:00 +0000 (02:43 +0000)]
Add test for PR12938, fixed by Richard Smith in r172691

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172697 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSuppress all -Wunused-value warnings from macro body expansions.
Matt Beaumont-Gay [Thu, 17 Jan 2013 02:06:08 +0000 (02:06 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172696 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a comment for Daniel
Douglas Gregor [Thu, 17 Jan 2013 01:58:31 +0000 (01:58 +0000)]
Add a comment for Daniel

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172695 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTest that we correctly handle reversion of line splicing etc in raw string
Richard Smith [Thu, 17 Jan 2013 01:46:13 +0000 (01:46 +0000)]
Test that we correctly handle reversion of line splicing etc in raw string
literals. As suggested by Sean Silva.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172694 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAttempt to work around bug in older GCCs to fix buildbot.
Richard Smith [Thu, 17 Jan 2013 01:40:50 +0000 (01:40 +0000)]
Attempt to work around bug in older GCCs to fix buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172693 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[IRgen] Update modules autolink metadata to use module flags (as now specified
Daniel Dunbar [Thu, 17 Jan 2013 01:35:06 +0000 (01:35 +0000)]
[IRgen] Update modules autolink metadata to use module flags (as now specified
in the LangRef).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172692 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement C++11 semantics for [[noreturn]] attribute. This required splitting
Richard Smith [Thu, 17 Jan 2013 01:30:42 +0000 (01:30 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
Richard Smith [Thu, 17 Jan 2013 01:17:56 +0000 (01:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172690 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.
NAKAMURA Takumi [Thu, 17 Jan 2013 01:07:09 +0000 (01:07 +0000)]
clang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172689 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTreat hidden Objective-C protocol definitions as if they were
Douglas Gregor [Thu, 17 Jan 2013 00:38:46 +0000 (00:38 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172686 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement a fixit for -Wmain-return-type
Dmitri Gribenko [Thu, 17 Jan 2013 00:26:13 +0000 (00:26 +0000)]
Implement a fixit for -Wmain-return-type

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172684 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjC block layout: Patch reorders block layout to
Fariborz Jahanian [Thu, 17 Jan 2013 00:25:06 +0000 (00:25 +0000)]
objC block layout: Patch reorders block layout to
produce more inline layout metadata. // rdar://12752901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172683 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a typo introduced in r172665.
Matt Beaumont-Gay [Thu, 17 Jan 2013 00:21:55 +0000 (00:21 +0000)]
Fix a typo introduced in r172665.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172682 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
Argyrios Kyrtzidis [Wed, 16 Jan 2013 23:54:48 +0000 (23:54 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172679 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDelay linkage checks when validating the weakref attribute.
Rafael Espindola [Wed, 16 Jan 2013 23:49:06 +0000 (23:49 +0000)]
Delay linkage checks when validating the weakref attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172678 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes crash when illegal function definitions are deleted or defaulted. Fixes PR14577.
Aaron Ballman [Wed, 16 Jan 2013 23:39:10 +0000 (23:39 +0000)]
Fixes crash when illegal function definitions are deleted or defaulted.  Fixes PR14577.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172676 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSimplify code. No functionality change.
Rafael Espindola [Wed, 16 Jan 2013 23:21:32 +0000 (23:21 +0000)]
Simplify code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172673 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove unnecessary initialization i Added in r172668.
David Blaikie [Wed, 16 Jan 2013 23:18:16 +0000 (23:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172672 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReadd an open paren that was lost while reformatting code.
David Blaikie [Wed, 16 Jan 2013 23:13:42 +0000 (23:13 +0000)]
Readd an open paren that was lost while reformatting code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172669 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix -Wreorder warning.
David Blaikie [Wed, 16 Jan 2013 23:13:36 +0000 (23:13 +0000)]
Fix -Wreorder warning.

Rewrapping courtesy of clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172668 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCheck for internal weak decls after merging.
Rafael Espindola [Wed, 16 Jan 2013 23:11:15 +0000 (23:11 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172667 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR14964: intrinsic headers using non-reserved identifiers
David Blaikie [Wed, 16 Jan 2013 23:08:36 +0000 (23:08 +0000)]
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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172666 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRework the traversal of Objective-C categories and extensions to
Douglas Gregor [Wed, 16 Jan 2013 23:00:23 +0000 (23:00 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172665 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse getProcessTriple in clang-interpreter.
Peter Collingbourne [Wed, 16 Jan 2013 22:37:09 +0000 (22:37 +0000)]
Use getProcessTriple in clang-interpreter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172664 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd raw string literal versus C preprocessor test, suggested by James Dennett.
Richard Smith [Wed, 16 Jan 2013 21:43:09 +0000 (21:43 +0000)]
Add raw string literal versus C preprocessor test, suggested by James Dennett.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172660 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix recent test for more diverse environments.
Tim Northover [Wed, 16 Jan 2013 20:35:54 +0000 (20:35 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172653 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCorrect order of operands forwarding NEON vfma to LLVM fma
Tim Northover [Wed, 16 Jan 2013 20:13:15 +0000 (20:13 +0000)]
Correct order of operands forwarding NEON vfma to LLVM fma

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172650 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove initialization of ParsingIfOrElifDirective down next to the macro
Eric Christopher [Wed, 16 Jan 2013 20:09:36 +0000 (20:09 +0000)]
Move initialization of ParsingIfOrElifDirective down next to the macro
initializations to fix Wreorder warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172649 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd testcase missed yesterday. Patch from Paul Robinson.
Eric Christopher [Wed, 16 Jan 2013 19:54:35 +0000 (19:54 +0000)]
Add testcase missed yesterday. Patch from Paul Robinson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172648 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdding verbiage to the Language Extensions document about __has_include and __has_inc...
Aaron Ballman [Wed, 16 Jan 2013 19:51:19 +0000 (19:51 +0000)]
Adding verbiage to the Language Extensions document about __has_include and __has_include_next only being allowed within preprocessor directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172643 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoNo longer crashing with an assert when __has_include or __has_include_next is used...
Aaron Ballman [Wed, 16 Jan 2013 19:32:21 +0000 (19:32 +0000)]
No longer crashing with an assert when __has_include or __has_include_next is used outside of a preprocessor directive.  This fixes PR14837.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172639 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTeach global selector lookup to ignore hidden methods, which occur
Douglas Gregor [Wed, 16 Jan 2013 18:47:38 +0000 (18:47 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172635 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is
Argyrios Kyrtzidis [Wed, 16 Jan 2013 18:13:00 +0000 (18:13 +0000)]
[libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is
null before using it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172632 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[PCH/Modules] The iterator may become invalidated because a new macro can be added
Argyrios Kyrtzidis [Wed, 16 Jan 2013 17:42:07 +0000 (17:42 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172629 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFirst step in implementation of mips16 and nomips16 attributes.
Reed Kotler [Wed, 16 Jan 2013 17:10:28 +0000 (17:10 +0000)]
First step in implementation of mips16 and nomips16 attributes.
Waiting for new llvm attribute code for the next step.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172626 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] In clang_getCursorType, don't crash if the translation unit is not
Argyrios Kyrtzidis [Wed, 16 Jan 2013 17:04:31 +0000 (17:04 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172625 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a bug where we would move a following line into a comment.
Daniel Jasper [Wed, 16 Jan 2013 17:00:50 +0000 (17:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172624 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[preprocessor] Call the MacroUndefined callback even when the macro was not defined.
Argyrios Kyrtzidis [Wed, 16 Jan 2013 16:52:44 +0000 (16:52 +0000)]
[preprocessor] Call the MacroUndefined callback even when the macro was not defined.

Patch by Enea Zaffanella!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172623 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix parsing error in conditional expressions.
Daniel Jasper [Wed, 16 Jan 2013 16:23:19 +0000 (16:23 +0000)]
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

11 years ago[PCH/Modules] Change how macro [re]definitions are de/serialized.
Argyrios Kyrtzidis [Wed, 16 Jan 2013 16:19:38 +0000 (16:19 +0000)]
[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

11 years agoImprove understanding of unary operators.
Daniel Jasper [Wed, 16 Jan 2013 16:04:06 +0000 (16:04 +0000)]
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

11 years agoDisable inlining of short ifs in Google style.
Daniel Jasper [Wed, 16 Jan 2013 15:44:34 +0000 (15:44 +0000)]
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

11 years agoAdd option to avoid "bin-packing" of parameters.
Daniel Jasper [Wed, 16 Jan 2013 14:59:02 +0000 (14:59 +0000)]
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

11 years agoAdd debugging support for split penalties.
Manuel Klimek [Wed, 16 Jan 2013 14:55:28 +0000 (14:55 +0000)]
Add debugging support for split penalties.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172616 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse standard llvm Debug.h support for debugging output.
Manuel Klimek [Wed, 16 Jan 2013 12:31:12 +0000 (12:31 +0000)]
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

11 years agoClang Format: A couple of tests for the trailing stuff case
Alexander Kornienko [Wed, 16 Jan 2013 11:45:16 +0000 (11:45 +0000)]
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

11 years agoClang Format: Handle missing semicolon
Alexander Kornienko [Wed, 16 Jan 2013 11:43:46 +0000 (11:43 +0000)]
Clang Format: Handle missing semicolon

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172606 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix uninitialized bool flag access in SanitizerArgs parser
Alexey Samsonov [Wed, 16 Jan 2013 11:34:36 +0000 (11:34 +0000)]
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

11 years agoCalculate the total length of a line up to each token up front.
Daniel Jasper [Wed, 16 Jan 2013 10:41:46 +0000 (10:41 +0000)]
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

11 years agoChange the datastructure for UnwrappedLines.
Daniel Jasper [Wed, 16 Jan 2013 09:10:19 +0000 (09:10 +0000)]
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

11 years agoNever merge < and ::, as it produces different tokens.
Daniel Jasper [Wed, 16 Jan 2013 07:19:28 +0000 (07:19 +0000)]
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

11 years agoRemove errors were if statements were incorrectly put on a single line.
Daniel Jasper [Wed, 16 Jan 2013 07:02:34 +0000 (07:02 +0000)]
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

11 years agoclang/test/Driver/darwin-sdkroot.c: Suppress this on msys bash, to introduce the...
NAKAMURA Takumi [Wed, 16 Jan 2013 06:10:16 +0000 (06:10 +0000)]
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

11 years ago[analyzer] Add an annotation to allow suppression of direct ivar
Anna Zaks [Wed, 16 Jan 2013 01:36:00 +0000 (01:36 +0000)]
[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

11 years ago[analyzer] Fix warning typo.
Anna Zaks [Wed, 16 Jan 2013 01:35:57 +0000 (01:35 +0000)]
[analyzer] Fix warning typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172596 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Refactor: parameter rename.
Anna Zaks [Wed, 16 Jan 2013 01:35:54 +0000 (01:35 +0000)]
[analyzer] Refactor: parameter rename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172595 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
Douglas Gregor [Wed, 16 Jan 2013 01:23:41 +0000 (01:23 +0000)]
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

11 years agoCollect both normal and static data members of a class in source
Eric Christopher [Wed, 16 Jan 2013 01:22:32 +0000 (01:22 +0000)]
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

11 years agoDocumentation: fix typo
Dmitri Gribenko [Wed, 16 Jan 2013 01:17:05 +0000 (01:17 +0000)]
Documentation: fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172588 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDocument the redeclaration and overriding restrictions on the
Douglas Gregor [Wed, 16 Jan 2013 01:12:31 +0000 (01:12 +0000)]
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

11 years agoOne can have an unavailable method overridden by an available method,
Douglas Gregor [Wed, 16 Jan 2013 00:54:48 +0000 (00:54 +0000)]
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

11 years agoApply adjustment to function- and array-typed non-type template
Douglas Gregor [Wed, 16 Jan 2013 00:52:15 +0000 (00:52 +0000)]
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

11 years agoFix signed/unsigned Compare
David Greene [Tue, 15 Jan 2013 23:13:49 +0000 (23:13 +0000)]
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

11 years agoAvoid unsigned Compare to int
David Greene [Tue, 15 Jan 2013 23:13:47 +0000 (23:13 +0000)]
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

11 years agoWhen checking availability attributes for consistency between an
Douglas Gregor [Tue, 15 Jan 2013 22:43:08 +0000 (22:43 +0000)]
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

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:51 +0000 (22:09 +0000)]
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

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:49 +0000 (22:09 +0000)]
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

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:48 +0000 (22:09 +0000)]
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

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:46 +0000 (22:09 +0000)]
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

11 years agoFix Cast
David Greene [Tue, 15 Jan 2013 22:09:45 +0000 (22:09 +0000)]
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

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:43 +0000 (22:09 +0000)]
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

11 years agoFix Const Cast
David Greene [Tue, 15 Jan 2013 22:09:41 +0000 (22:09 +0000)]
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

11 years agoFix Cast
David Greene [Tue, 15 Jan 2013 22:09:40 +0000 (22:09 +0000)]
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

11 years agoFix Cast Code
David Greene [Tue, 15 Jan 2013 22:09:39 +0000 (22:09 +0000)]
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

11 years agoTypo correction; no functional change.
Aaron Ballman [Tue, 15 Jan 2013 21:59:46 +0000 (21:59 +0000)]
Typo correction; no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172555 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver/Darwin] Adjust SDKROOT handling code to not generate "-isysroot /".
Daniel Dunbar [Tue, 15 Jan 2013 20:33:56 +0000 (20:33 +0000)]
[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

11 years agoAdd a test for -Wsemicolon-before-method-body fixit
Dmitri Gribenko [Tue, 15 Jan 2013 18:29:04 +0000 (18:29 +0000)]
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

11 years agoDo not traverse the break-state when we know we cannot break anyway.
Manuel Klimek [Tue, 15 Jan 2013 16:41:02 +0000 (16:41 +0000)]
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

11 years agoFix formatting of preprocessor directives (incluces, warnings & errors).
Manuel Klimek [Tue, 15 Jan 2013 15:50:27 +0000 (15:50 +0000)]
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

11 years agoImprove operator kind detection in presence of comments.
Daniel Jasper [Tue, 15 Jan 2013 14:27:39 +0000 (14:27 +0000)]
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

11 years agoFixes various bugs around the keywords class, struct and union.
Manuel Klimek [Tue, 15 Jan 2013 13:38:33 +0000 (13:38 +0000)]
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

11 years agoResolved merge error with r172323 (llvm::X -> X)
Alexander Kornienko [Tue, 15 Jan 2013 12:20:21 +0000 (12:20 +0000)]
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

11 years agoDon't crash when binding a reference to a temporary pointer created from
Richard Smith [Tue, 15 Jan 2013 07:58:29 +0000 (07:58 +0000)]
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

11 years agoPR14950: Fix out-of-bounds function parameter access in literal operator lookup.
Richard Smith [Tue, 15 Jan 2013 07:12:59 +0000 (07:12 +0000)]
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

11 years agoPR14918: Don't confuse braced-init-lists after template variable declarations
Richard Smith [Tue, 15 Jan 2013 06:49:38 +0000 (06:49 +0000)]
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

11 years agoAdd -fopenmp -cc1 option and wire it up to define _OPENMP, from Alexey Bataev!
Douglas Gregor [Tue, 15 Jan 2013 06:45:29 +0000 (06:45 +0000)]
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

11 years agoFix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
Richard Smith [Tue, 15 Jan 2013 02:48:13 +0000 (02:48 +0000)]
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

11 years ago[driver] Warnings for warning options are handled by the frontend. The driver needs...
Chad Rosier [Tue, 15 Jan 2013 01:21:53 +0000 (01:21 +0000)]
[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

11 years agoDocument that we should recognize attributes supported by gcc with C++11
Dmitri Gribenko [Mon, 14 Jan 2013 22:44:07 +0000 (22:44 +0000)]
Document that we should recognize attributes supported by gcc with C++11
[[gnu::...]] syntax

Pointed out by Richard Smith on the mailing list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172487 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRefactor to call ActOnFinishFullExpr on every full expression. Teach
Richard Smith [Mon, 14 Jan 2013 22:39:08 +0000 (22:39 +0000)]
Refactor to call ActOnFinishFullExpr on every full expression. Teach
ActOnFinishFullExpr that some of its checks only apply to discarded-value
expressions. This adds missing checks for unexpanded variadic template
parameter packs to a handful of constructs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172485 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMultiprecision subtraction builtins.
Michael Gottesman [Mon, 14 Jan 2013 21:44:30 +0000 (21:44 +0000)]
Multiprecision subtraction builtins.

We lower these into 2x chained usub.with.overflow intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172476 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTopologically sort the link options generated for modules based on
Douglas Gregor [Mon, 14 Jan 2013 20:53:57 +0000 (20:53 +0000)]
Topologically sort the link options generated for modules based on
module-import dependencies, so we'll get the link order correct for
those silly linkers that need it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172459 91177308-0d34-0410-b5e6-96231b3b80d8