]> granicus.if.org Git - clang/log
clang
11 years agoFormatter: Enable @encode test.
Nico Weber [Fri, 18 Jan 2013 05:11:47 +0000 (05:11 +0000)]
Formatter: Enable @encode test.

This doesn't work right with pointers to pointers, but that's likely just a
dupe of PR14884.

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

11 years agoRevert Clang r172620 and r172629, which caused a hang when building
Douglas Gregor [Fri, 18 Jan 2013 04:34:14 +0000 (04:34 +0000)]
Revert Clang r172620 and r172629, which caused a hang when building
complicated modules (<rdar://problem/13038265>). Unfortunately, this
un-fixes <rdar://problem/13016031>.

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

11 years agoFormatter: The contents of @selector() should be formatted as a selector.
Nico Weber [Fri, 18 Jan 2013 02:43:57 +0000 (02:43 +0000)]
Formatter: The contents of @selector() should be formatted as a selector.

Before: @selector(foo: )
Now: @selector(foo:)

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

11 years agoWhen checking the parameter types of an Objective-C method, don't
Douglas Gregor [Fri, 18 Jan 2013 01:41:40 +0000 (01:41 +0000)]
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>.

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

11 years ago[ms-inline asm] Test case for r172773.
Chad Rosier [Fri, 18 Jan 2013 00:51:29 +0000 (00:51 +0000)]
[ms-inline asm] Test case for r172773.

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

11 years agoOne can override an Objective-C ARC ownership qualifier that came from
Douglas Gregor [Thu, 17 Jan 2013 23:59:28 +0000 (23:59 +0000)]
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>.

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

11 years agoSome builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
Richard Smith [Thu, 17 Jan 2013 23:46:04 +0000 (23:46 +0000)]
Some builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
to visit them.

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

11 years agoIn Objective-C ARC, completely ignore ownership qualifiers on the
Douglas Gregor [Thu, 17 Jan 2013 23:36:45 +0000 (23:36 +0000)]
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>.

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

11 years ago[analyzer] DirectIvarAssignment: allow suppression annotation on Ivars.
Anna Zaks [Thu, 17 Jan 2013 23:24:58 +0000 (23:24 +0000)]
[analyzer] DirectIvarAssignment: allow suppression annotation on Ivars.

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

11 years agoDefer checking for unsequenced operations on the RHS of && and || in order to
Richard Smith [Thu, 17 Jan 2013 23:18:09 +0000 (23:18 +0000)]
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.

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

11 years agoFormat strings: don't ever convert %+d to %lu.
Jordan Rose [Thu, 17 Jan 2013 22:34:10 +0000 (22:34 +0000)]
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.

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

11 years agoParsing support for C11's _Noreturn keyword. No semantics yet.
Richard Smith [Thu, 17 Jan 2013 22:16:11 +0000 (22:16 +0000)]
Parsing support for C11's _Noreturn keyword. No semantics yet.

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

11 years ago-Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
Richard Smith [Thu, 17 Jan 2013 22:06:26 +0000 (22:06 +0000)]
-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)'.

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

11 years agoWe want the dwarf AT_producer for assembly source files to match clang's
Kevin Enderby [Thu, 17 Jan 2013 21:38:06 +0000 (21:38 +0000)]
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

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

11 years agoDo not pass -pie flag to linker if -shared specified. This matches
Peter Collingbourne [Thu, 17 Jan 2013 20:17:16 +0000 (20:17 +0000)]
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.

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

11 years ago[ms-inline asm] Updates and test case for r172743.
Chad Rosier [Thu, 17 Jan 2013 19:22:48 +0000 (19:22 +0000)]
[ms-inline asm] Updates and test case for r172743.
Part of rdar://12576868

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

11 years ago[ms-inline asm] Extend the Sema interface to get the size and length of a
Chad Rosier [Thu, 17 Jan 2013 19:21:24 +0000 (19:21 +0000)]
[ms-inline asm] Extend the Sema interface to get the size and length of a
VarDecl.
Part of rdar://12576868

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

11 years agoFormat strings: correct signedness if already correcting width (%d,%u).
Jordan Rose [Thu, 17 Jan 2013 18:47:16 +0000 (18:47 +0000)]
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.

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

11 years agoConvert test/FixIt/format-darwin.m to use relative line numbers.
Jordan Rose [Thu, 17 Jan 2013 18:47:12 +0000 (18:47 +0000)]
Convert test/FixIt/format-darwin.m to use relative line numbers.

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

11 years agoAdd some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not...
Joey Gouly [Thu, 17 Jan 2013 17:35:00 +0000 (17:35 +0000)]
Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.

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

11 years agoFormatter: Get bit tests in ifs right.
Nico Weber [Thu, 17 Jan 2013 17:17:19 +0000 (17:17 +0000)]
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())

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

11 years agoDocumentation: formatting
Dmitri Gribenko [Thu, 17 Jan 2013 17:04:54 +0000 (17:04 +0000)]
Documentation: formatting

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

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