Commit Graph

42790 Commits

Author SHA1 Message Date
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