]> granicus.if.org Git - clang/log
clang
11 years agoclang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown...
NAKAMURA Takumi [Mon, 14 Jan 2013 13:16:02 +0000 (13:16 +0000)]
clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.

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

11 years agoRefactor datastructure used in clang-format.
Daniel Jasper [Mon, 14 Jan 2013 13:08:07 +0000 (13:08 +0000)]
Refactor datastructure used in clang-format.

Main difference, add an AnnotatedLine class to hold information about a
line while formatting. At the same time degrade the UnwrappedLine class
to a class solely used for communicating between the UnwrappedLineParser
and the Formatter.

No functional changes intended.

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

11 years agoImprove understanding post increment and decrement.
Daniel Jasper [Mon, 14 Jan 2013 12:18:19 +0000 (12:18 +0000)]
Improve understanding post increment and decrement.

Before: (a->f()) ++;
        a[42] ++;
After:  (a->f())++;
        a[42]++;

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

11 years agoCustom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Alexander Kornienko [Mon, 14 Jan 2013 11:34:14 +0000 (11:34 +0000)]
Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.

Summary:
Added tests for clang-format diagnostics. Added DiagnosticConsumer
argument to clang::format::reformat().

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, thakis, rafael.espindola
Differential Revision: http://llvm-reviews.chandlerc.com/D290

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

11 years agoAdds some more tests for * and &.
Manuel Klimek [Mon, 14 Jan 2013 10:58:01 +0000 (10:58 +0000)]
Adds some more tests for * and &.

While reviewing r172303 I noticed that I wasn't sure whether we still
format those correctly and didn't see any tests.

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

11 years agoAdd extra tests for [[gnu::...]] attributes, missed from r172382.
Richard Smith [Mon, 14 Jan 2013 08:57:42 +0000 (08:57 +0000)]
Add extra tests for [[gnu::...]] attributes, missed from r172382.

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

11 years agoFix regression in r172376. Don't try to detect missing 'constexpr' specifiers
Richard Smith [Mon, 14 Jan 2013 08:00:39 +0000 (08:00 +0000)]
Fix regression in r172376. Don't try to detect missing 'constexpr' specifiers
on redeclarations, since that makes us pick wrong prior declarations under
some circumstances.

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

11 years agoAccept [[gnu::*]] for all __attribute__((*))s which are:
Richard Smith [Mon, 14 Jan 2013 07:53:01 +0000 (07:53 +0000)]
Accept [[gnu::*]] for all __attribute__((*))s which are:
 1) Supported by Clang, and
 2) Supported by GCC, and
 3) Documented in GCC's manual.

g++ allows its C++11-style attributes to appertain only to the entity being
declared, and never to a type (even for a type attribute), so we do the same.

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

11 years agoFormatter: Add a test for bitfields.
Nico Weber [Mon, 14 Jan 2013 05:49:49 +0000 (05:49 +0000)]
Formatter: Add a test for bitfields.

They work fine, but this fifth use of colons (after labels, in ?:,
in initalizer lists in constructors, in objc method expressions, and in
bitfields) wasn't covered by tests yet.

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

11 years agoPR12008: defer adding the implicit 'const' to a constexpr member function until
Richard Smith [Mon, 14 Jan 2013 05:37:29 +0000 (05:37 +0000)]
PR12008: defer adding the implicit 'const' to a constexpr member function until
we know whether it is static.

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

11 years ago*this is const in a trailing-return-type for a constexpr member function.
Richard Smith [Mon, 14 Jan 2013 01:55:13 +0000 (01:55 +0000)]
*this is const in a trailing-return-type for a constexpr member function.

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

11 years agolibclang: remove a few const_casts
Dmitri Gribenko [Mon, 14 Jan 2013 00:46:27 +0000 (00:46 +0000)]
libclang: remove a few const_casts

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

11 years agoConstify argument of Preprocessor::getMacroInfoHistory and propagate to
Dmitri Gribenko [Mon, 14 Jan 2013 00:36:42 +0000 (00:36 +0000)]
Constify argument of Preprocessor::getMacroInfoHistory and propagate to
callers, removing unneeded const_cast

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

11 years agoRemove an unneeded const_cast
Dmitri Gribenko [Mon, 14 Jan 2013 00:25:25 +0000 (00:25 +0000)]
Remove an unneeded const_cast

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

11 years agoArrayRef'ize Sema APIs related to format string checking
Dmitri Gribenko [Sun, 13 Jan 2013 20:46:02 +0000 (20:46 +0000)]
ArrayRef'ize Sema APIs related to format string checking

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

11 years agoDocument behavior of -Wformat-nonliteral, it is different from GCC
Dmitri Gribenko [Sun, 13 Jan 2013 16:37:18 +0000 (16:37 +0000)]
Document behavior of -Wformat-nonliteral, it is different from GCC

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

11 years agoStronger respect the input codes line breaks wrt. comments.
Daniel Jasper [Sun, 13 Jan 2013 16:10:20 +0000 (16:10 +0000)]
Stronger respect the input codes line breaks wrt. comments.

clang-format should not change whether or not there is a line break
before a line comment as this strongly influences the percieved binding.

User input: void f(int a,
                   // b is awesome
   int b);
            void g(int a, // a is awesome
   int b);
Before:     void f(int a, // b is awesome
                   int b);
            void g(int a, // a is awesome
   int b);
After:      <unchanged from input>

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

11 years agoFix LLP64 build.
Michael J. Spencer [Sun, 13 Jan 2013 16:00:51 +0000 (16:00 +0000)]
Fix LLP64 build.

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

11 years agoFormat unions like structs and classes.
Daniel Jasper [Sun, 13 Jan 2013 14:39:04 +0000 (14:39 +0000)]
Format unions like structs and classes.

Note that I don't know whether we should put {} on a single line in this
case, but it is probably a theoretical issue as in practice such
structs, classes or unions won't be empty.

Before: union A {}
        a;
After:  union A {} a;

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

11 years agoRefactor the x86 CPU name logic in the driver and pass -march and -mcpu
Chandler Carruth [Sun, 13 Jan 2013 11:46:33 +0000 (11:46 +0000)]
Refactor the x86 CPU name logic in the driver and pass -march and -mcpu
flag information down from the Clang driver into the Gold linker plugin
for LTO. This allows specifying -march on the linker commandline and
should hopefully have it pass all the way through to the LTO optimizer.

Fixes PR14697.

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

11 years agoCGBuiltin.cpp: Fix abuse of ArrayRef in EmitOverflowIntrinsic().
NAKAMURA Takumi [Sun, 13 Jan 2013 11:26:44 +0000 (11:26 +0000)]
CGBuiltin.cpp: Fix abuse of ArrayRef in EmitOverflowIntrinsic().

In ArrayRef<T>(X), X should not be temporary value. It could be rewritten more redundantly;

  llvm::Type *XTy = X->getType();
  ArrayRef<llvm::Type *> Ty(XTy);
  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, Ty);

Since it is safe if both XTy and Ty are temporary value in one statement, it could be shorten;

  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, ArrayRef<llvm::Type*>(X->getType()));

ArrayRef<T> has an implicit constructor to create uni-entry of T;

  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, X->getType());

MSVC-generated clang.exe crashed.

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

11 years agoAlways put a space after ",".
Daniel Jasper [Sun, 13 Jan 2013 08:19:51 +0000 (08:19 +0000)]
Always put a space after ",".

I am not aware of a case where that would be wrong. The specific case I
am fixing are function parameters wrapped in parenthesis (e.g. in
macros).

Before: function(a,(b));
After:  function(a, (b));

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

11 years agoDon't put spaces around hyphens in include paths.
Daniel Jasper [Sun, 13 Jan 2013 08:12:18 +0000 (08:12 +0000)]
Don't put spaces around hyphens in include paths.

Before: #include <a - a>
After:  #include <a-a>

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

11 years agoImprove identification of c-style casts.
Daniel Jasper [Sun, 13 Jan 2013 08:01:36 +0000 (08:01 +0000)]
Improve identification of c-style casts.

A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues
with the formatting of unnamed parameters.

Before: void f(int *){}
After:  void f(int *) {}

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

11 years agoUpdated documentation to reflect new multiprecision builtin functions.
Michael Gottesman [Sun, 13 Jan 2013 04:35:31 +0000 (04:35 +0000)]
Updated documentation to reflect new multiprecision builtin functions.

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

11 years agoclang/test/CodeGen/builtins-multiprecision.c: Enhance for each test to run on theree...
NAKAMURA Takumi [Sun, 13 Jan 2013 03:55:21 +0000 (03:55 +0000)]
clang/test/CodeGen/builtins-multiprecision.c: Enhance for each test to run on theree targets, i686, amd64, win64.

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

11 years agoFixed spelling of test name: builtins-multipercision.c => builtins-multiprecision.c.
Michael Gottesman [Sun, 13 Jan 2013 03:44:31 +0000 (03:44 +0000)]
Fixed spelling of test name: builtins-multipercision.c => builtins-multiprecision.c.

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

11 years agoAdded a triple to the test builtins-multiprecision.c.
Michael Gottesman [Sun, 13 Jan 2013 03:40:23 +0000 (03:40 +0000)]
Added a triple to the test builtins-multiprecision.c.

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

11 years agoAdded builtins for multiprecision adds.
Michael Gottesman [Sun, 13 Jan 2013 02:22:39 +0000 (02:22 +0000)]
Added builtins for multiprecision adds.

We lower all of these intrinsics into a 2x chained usage of
uadd.with.overflow.

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

11 years agoRemove some duplication in the handling of __attribute__((ext_vector_size(N))).
Richard Smith [Sun, 13 Jan 2013 02:11:23 +0000 (02:11 +0000)]
Remove some duplication in the handling of __attribute__((ext_vector_size(N))).

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

11 years agoFormatter: Don't insert a space before unary operators after selector names.
Nico Weber [Sat, 12 Jan 2013 23:48:49 +0000 (23:48 +0000)]
Formatter: Don't insert a space before unary operators after selector names.

Before:
  [color getRed: &r green: &g blue: &b alpha: &a];

Now:
  [color getRed:&r green:&g blue:&b alpha:&a];

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

11 years agoFormatter: Add a test for @selector in an ObjC method expression, which happens to...
Nico Weber [Sat, 12 Jan 2013 23:41:33 +0000 (23:41 +0000)]
Formatter: Add a test for @selector in an ObjC method expression, which happens to work already.

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

11 years agoFormatter: Remove debugging junk I accidentally landed in r172333.
Nico Weber [Sat, 12 Jan 2013 22:51:13 +0000 (22:51 +0000)]
Formatter: Remove debugging junk I accidentally landed in r172333.

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

11 years agoFormatter: Prefer breaking before ObjC selector names over breaking at their ':'
Nico Weber [Sat, 12 Jan 2013 22:48:47 +0000 (22:48 +0000)]
Formatter: Prefer breaking before ObjC selector names over breaking at their ':'

Before:
  if ((self = [super initWithContentRect:contentRect styleMask:
                  styleMask backing:NSBackingStoreBuffered defer:YES])) {

Now:
  if ((self = [super initWithContentRect:contentRect styleMask:styleMask
                  backing:NSBackingStoreBuffered defer:YES])) {

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

11 years agoAdd a comment to test to clarify the intention here
Dmitri Gribenko [Sat, 12 Jan 2013 22:39:30 +0000 (22:39 +0000)]
Add a comment to test to clarify the intention here

Comment is taken from the commit message of r151080, by Jean-Daniel Dupas

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

11 years agoPrune an unused diagnostic, detected after improving the script in r172330
Dmitri Gribenko [Sat, 12 Jan 2013 21:58:21 +0000 (21:58 +0000)]
Prune an unused diagnostic, detected after improving the script in r172330

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

11 years agoSpeed up find-unused-diagnostics. Now runs in less than a second instead of more...
Benjamin Kramer [Sat, 12 Jan 2013 21:39:06 +0000 (21:39 +0000)]
Speed up find-unused-diagnostics. Now runs in less than a second instead of more than a minute.

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

11 years agoRemove unused diagnostics
Dmitri Gribenko [Sat, 12 Jan 2013 20:32:43 +0000 (20:32 +0000)]
Remove unused diagnostics

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

11 years agoRemove useless 'llvm::' qualifier from names like StringRef and others that are
Dmitri Gribenko [Sat, 12 Jan 2013 19:30:44 +0000 (19:30 +0000)]
Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

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

11 years agoFix spurious output in JSONCompilationDatabase
Arnaud A. de Grandmaison [Sat, 12 Jan 2013 18:37:52 +0000 (18:37 +0000)]
Fix spurious output in JSONCompilationDatabase

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

11 years agoAdd missing includes and forward declarations so that headers don't depend on
Dmitri Gribenko [Sat, 12 Jan 2013 16:54:37 +0000 (16:54 +0000)]
Add missing includes and forward declarations so that headers don't depend on
other headers included before them.

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

11 years agocomment
Rafael Espindola [Sat, 12 Jan 2013 15:27:44 +0000 (15:27 +0000)]
comment

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

11 years agobar
Rafael Espindola [Sat, 12 Jan 2013 15:27:43 +0000 (15:27 +0000)]
bar

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

11 years agoRemove unused private field.
Rafael Espindola [Sat, 12 Jan 2013 14:22:42 +0000 (14:22 +0000)]
Remove unused private field.

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

11 years agoFix incorrect comparison operator causing loooong formatting times.
Daniel Jasper [Sat, 12 Jan 2013 07:36:22 +0000 (07:36 +0000)]
Fix incorrect comparison operator causing loooong formatting times.

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

11 years agoFormatter: Remove an always-false condition.
Nico Weber [Sat, 12 Jan 2013 07:05:25 +0000 (07:05 +0000)]
Formatter: Remove an always-false condition.

canBreakBefore() does not allow breaking after ':' for LT_ObjCMethodDecl lines,
so if Newline is true in addTokenToState() for ':' then LT_ObjCMethodDecl
cannot be set. No functionality change.

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

11 years agoFormatter: Remove a redundant CurrentLineType check.
Nico Weber [Sat, 12 Jan 2013 07:00:16 +0000 (07:00 +0000)]
Formatter: Remove a redundant CurrentLineType check.

The containing if checks for this already. No functionality change.

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

11 years agoDisable caching of visibility.
Rafael Espindola [Sat, 12 Jan 2013 06:42:30 +0000 (06:42 +0000)]
Disable caching of visibility.

The testcase in pr14929 shows that this is extremely hard to do. If we choose
to apply the attribute, that causes the visibility of some decls to change and
that can happen really late (during codegen).

Current gcc warns and ignores the attribute in this testcase with a warning.
This suggest that the correct solution is to find a point in the compilation
where we can compute the visibility and
* assert it was never computed before
* reject any attempts to compute it again in the future (with warnings).

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

11 years agoFormatter: Initial support for formatting Objective-C method expressions.
Nico Weber [Sat, 12 Jan 2013 06:18:40 +0000 (06:18 +0000)]
Formatter: Initial support for formatting Objective-C method expressions.

This follows the approach suggested by djasper in PR14911: When a '[' is
seen that's at the start of a line, follows a binary operator, or follows one
of : [ ( return throw, that '[' and its closing ']' are marked as
TT_ObjCMethodExpr and every ':' in that range that isn't part of a ternary
?: is marked as TT_ObjCMethodExpr as well.

Update the layout routines to not output spaces around ':' tokens that are
marked TT_ObjCMethodExpr, and only allow breaking after such tokens, not
before.

Before:
    [self adjustButton : closeButton_ ofKind : NSWindowCloseButton];

Now:
    [self adjustButton:closeButton_ ofKind:NSWindowCloseButton];

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

11 years agoFormatter: * and & are binary operators before ( and [.
Nico Weber [Sat, 12 Jan 2013 05:50:48 +0000 (05:50 +0000)]
Formatter: * and & are binary operators before ( and [.

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

11 years agoFormatter: * and & are binary operators after ) and ].
Nico Weber [Sat, 12 Jan 2013 05:47:16 +0000 (05:47 +0000)]
Formatter: * and & are binary operators after ) and ].

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

11 years agoFormatter: + and - after { are unary operators.
Nico Weber [Sat, 12 Jan 2013 05:41:23 +0000 (05:41 +0000)]
Formatter: + and - after { are unary operators.

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

11 years agoclang/unittests: Fixup corresponding to r172290.
NAKAMURA Takumi [Sat, 12 Jan 2013 02:16:29 +0000 (02:16 +0000)]
clang/unittests: Fixup corresponding to r172290.

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

11 years agoFix a regression from 171193: main cannot be overloaded.
Rafael Espindola [Sat, 12 Jan 2013 01:47:40 +0000 (01:47 +0000)]
Fix a regression from 171193: main cannot be overloaded.
Thanks Eli Friedman for noticing it.

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

11 years agoProvide Decl::getOwningModule(), which determines the (sub)module in
Douglas Gregor [Sat, 12 Jan 2013 01:29:50 +0000 (01:29 +0000)]
Provide Decl::getOwningModule(), which determines the (sub)module in
which a particular declaration resides. Use this information to
customize the "definition of 'blah' must be imported from another
module" diagnostic with the module the user actually has to
import. Additionally, recover by importing that module, so we don't
complain about other names in that module.

Still TODO: coming up with decent Fix-Its for these cases, and expand
this recovery approach for other name lookup failures.

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

11 years agoFormatter: add a test for :? in []
Nico Weber [Sat, 12 Jan 2013 01:28:06 +0000 (01:28 +0000)]
Formatter: add a test for :? in []

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

11 years agoOnly produce one -Wc++98-compat warning when initializing a reference from an init...
Richard Smith [Sat, 12 Jan 2013 01:05:20 +0000 (01:05 +0000)]
Only produce one -Wc++98-compat warning when initializing a reference from an init list with multiple elements.

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

11 years agoAdd a test from pr14898.
Rafael Espindola [Sat, 12 Jan 2013 01:01:06 +0000 (01:01 +0000)]
Add a test from pr14898.

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

11 years agoFix -Wunused-comparison for comparisons in arguments to function-like macros.
Matt Beaumont-Gay [Sat, 12 Jan 2013 00:54:16 +0000 (00:54 +0000)]
Fix -Wunused-comparison for comparisons in arguments to function-like macros.

Previously, -Wunused-comparison ignored comparisons in both macro bodies and
macro arguments, but we would still emit a -Wunused-value warning for either.
Now we correctly emit -Wunused-comparison for expressions in macro arguments.

Also, add isMacroBodyExpansion to SourceManager, to go along with
isMacroArgExpansion.

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

11 years agocomment parsing: when property accessors don't have comment
Fariborz Jahanian [Sat, 12 Jan 2013 00:28:34 +0000 (00:28 +0000)]
comment parsing: when property accessors don't have comment
of their own (or are syntheszed), use prperty's comment.
for them. // rdar://12791315

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

11 years agoRefine analyzer's handling of unary '!' and floating types to not assert.
Ted Kremenek [Fri, 11 Jan 2013 23:36:25 +0000 (23:36 +0000)]
Refine analyzer's handling of unary '!' and floating types to not assert.

Fixes PR 14634 and <rdar://problem/12903080>.

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

11 years agoFixed a bug that caused the AST importer to erroneously
Sean Callanan [Fri, 11 Jan 2013 23:17:47 +0000 (23:17 +0000)]
Fixed a bug that caused the AST importer to erroneously
import incomplete definitions for RecordDecls and then
mark the resulting definition as complete.

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

11 years agolibclang: use C++ casts in CXString.cpp
Dmitri Gribenko [Fri, 11 Jan 2013 23:13:36 +0000 (23:13 +0000)]
libclang: use C++ casts in CXString.cpp

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

11 years agolibclang: constness for CXString
Dmitri Gribenko [Fri, 11 Jan 2013 23:08:18 +0000 (23:08 +0000)]
libclang: constness for CXString

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

11 years agoCorrectly propagate uninitialized values within logical expressions.
Ted Kremenek [Fri, 11 Jan 2013 22:35:39 +0000 (22:35 +0000)]
Correctly propagate uninitialized values within logical expressions.

Fixes assertion failure reported in PR 14635 and
<rdar://problem/12902945> respectively.

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

11 years ago[PCH] Make the const_cast explicit to silence a compiler warning.
Argyrios Kyrtzidis [Fri, 11 Jan 2013 22:29:49 +0000 (22:29 +0000)]
[PCH] Make the const_cast explicit to silence a compiler warning.

Patch by David Greene.

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

11 years ago[libclang] Add some constness in CXSourceLocation and CXSourceRange.
Argyrios Kyrtzidis [Fri, 11 Jan 2013 22:29:47 +0000 (22:29 +0000)]
[libclang] Add some constness in CXSourceLocation and CXSourceRange.

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

11 years ago[libclang] In ASTUnit::getMainFileName() Invocation may be null because the ASTUnit
Argyrios Kyrtzidis [Fri, 11 Jan 2013 22:11:14 +0000 (22:11 +0000)]
[libclang] In ASTUnit::getMainFileName() Invocation may be null because the ASTUnit
came from loading a PCH/module.

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

11 years agoSet process return code of 1 in set-xcode-analyzer when Xcode needs to be quit. ...
Ted Kremenek [Fri, 11 Jan 2013 21:49:36 +0000 (21:49 +0000)]
Set process return code of 1 in set-xcode-analyzer when Xcode needs to be quit.  Fixes <rdar://problem/12983031>.

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

11 years agoFormatter: Format ObjC static and instance methods consistently, add a test for that.
Nico Weber [Fri, 11 Jan 2013 21:14:08 +0000 (21:14 +0000)]
Formatter: Format ObjC static and instance methods consistently, add a test for that.

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

11 years agolibclang: remove unneeded casts
Dmitri Gribenko [Fri, 11 Jan 2013 21:06:06 +0000 (21:06 +0000)]
libclang: remove unneeded casts

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

11 years agolibclang: change CXCursor to store 'const void *' pointers for
Dmitri Gribenko [Fri, 11 Jan 2013 21:01:49 +0000 (21:01 +0000)]
libclang: change CXCursor to store 'const void *' pointers for
const-correctness, and update all users

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

11 years agoConstify parameter of clang::getCursorKindForDecl
Dmitri Gribenko [Fri, 11 Jan 2013 20:32:41 +0000 (20:32 +0000)]
Constify parameter of clang::getCursorKindForDecl

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

11 years agoReject incompatible redeclarations of extern C symbols.
Rafael Espindola [Fri, 11 Jan 2013 19:34:23 +0000 (19:34 +0000)]
Reject incompatible redeclarations of extern C symbols.

Before we were only checking if the new declaration itself was marked extern
C. Fixes prpr14766.

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

11 years agoImprove diagnostic per Richard's suggestion
Fariborz Jahanian [Fri, 11 Jan 2013 19:33:54 +0000 (19:33 +0000)]
Improve diagnostic per Richard's suggestion
(which may yet change if we move the diagnostic
 outside case value).

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

11 years agolibclang: use getCursorTU and getCursorASTUnit instead of explicit casts
Dmitri Gribenko [Fri, 11 Jan 2013 19:28:44 +0000 (19:28 +0000)]
libclang: use getCursorTU and getCursorASTUnit instead of explicit casts

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

11 years agoFix crashes in UnwrappedLineParser on missing parens.
Manuel Klimek [Fri, 11 Jan 2013 19:23:05 +0000 (19:23 +0000)]
Fix crashes in UnwrappedLineParser on missing parens.

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

11 years agoFix single-line optimization for ObjC.
Manuel Klimek [Fri, 11 Jan 2013 19:17:44 +0000 (19:17 +0000)]
Fix single-line optimization for ObjC.

Puts blocks always into multiple lines when they start with an ObjC
keyword or minus.

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

11 years agoFix crash on invalid.
Manuel Klimek [Fri, 11 Jan 2013 18:28:36 +0000 (18:28 +0000)]
Fix crash on invalid.

if { foo; }
would previously crash clang-format.

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

11 years agoFix parsing of initializer lists with elaborated type specifier.
Manuel Klimek [Fri, 11 Jan 2013 18:13:04 +0000 (18:13 +0000)]
Fix parsing of initializer lists with elaborated type specifier.

Now we correctly parse and format:
verifyFormat("struct foo a = { bar };
int n;

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

11 years agoImplements pulling simple blocks into a single line.
Manuel Klimek [Fri, 11 Jan 2013 17:54:10 +0000 (17:54 +0000)]
Implements pulling simple blocks into a single line.

void f() { return 42; }

The final change that implements the feature.

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

11 years agoAdd -std=c++98 to the test and minor improvment in addition.
Fariborz Jahanian [Fri, 11 Jan 2013 17:33:57 +0000 (17:33 +0000)]
Add -std=c++98 to the test and minor improvment in addition.

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

11 years agoAllow RefactoringTool to write to memory instead of always to disk
Edwin Vane [Fri, 11 Jan 2013 17:04:55 +0000 (17:04 +0000)]
Allow RefactoringTool to write to memory instead of always to disk

RefactoringTool::run() always writes the result of rewrites to disk.
Instead, make this optional and provide a method for getting the
refactoring results in a memory buffer instead.

Also made ClangTool polymorphic so RefactoringTool could inherit from it
to properly express the IS-A relationship. This change also provides
access to ClangTool's public interface, e.g. mapVirtualFile() which is
important once refactored buffers start living in memory instead of on
disk.

Reviewers: klimek

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

11 years agoCorrect spacing around new and delete.
Daniel Jasper [Fri, 11 Jan 2013 16:09:04 +0000 (16:09 +0000)]
Correct spacing around new and delete.

This fixes llvm.org/PR14913.

Before:  A *a = new(placement) A;
After:   A *a = new (placement) A;

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

11 years agoclang-format: a bit nicer error message.
Alexander Kornienko [Fri, 11 Jan 2013 16:03:45 +0000 (16:03 +0000)]
clang-format: a bit nicer error message.

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

11 years agoEnable the new (more C++-like, less broken) EH model when targeting the GNUstep
David Chisnall [Fri, 11 Jan 2013 15:33:01 +0000 (15:33 +0000)]
Enable the new (more C++-like, less broken) EH model when targeting the GNUstep
Objective-C runtime 1.7 or greater.

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

11 years agoFixed an assertion failure triggered by invalid code.
Enea Zaffanella [Fri, 11 Jan 2013 14:34:39 +0000 (14:34 +0000)]
Fixed an assertion failure triggered by invalid code.

Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.

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

11 years agoImprove handling of trailing declaration annotations.
Daniel Jasper [Fri, 11 Jan 2013 14:23:32 +0000 (14:23 +0000)]
Improve handling of trailing declaration annotations.

Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(
    aaaaaaaaaaaaa);

After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
    GUARDED_BY(aaaaaaaaaaaaa);

Also did some formatting cleanups with clang-format on the way.

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

11 years agoImproved formatting of constructor initializers
Daniel Jasper [Fri, 11 Jan 2013 11:37:55 +0000 (11:37 +0000)]
Improved formatting of constructor initializers

Added option to put each constructor initializer on its own line
if not all initializers fit on a single line. Enabling this for
Google style now as the style guide (arguable) suggests it. Not
sure whether we also want it for LLVM.

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

11 years agoTest commit.
Enea Zaffanella [Fri, 11 Jan 2013 11:37:08 +0000 (11:37 +0000)]
Test commit.

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

11 years agoRefactor IndentState into two classes.
Daniel Jasper [Fri, 11 Jan 2013 10:22:12 +0000 (10:22 +0000)]
Refactor IndentState into two classes.

As we keep adding more stuff to it, this structure is easier to
maintain. At one point we might think about making it an actual
class with specific accessors, etc.

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

11 years agoPass false instead of 0 since isStar parameter of getArray has type bool. No function...
Nikola Smiljanic [Fri, 11 Jan 2013 08:33:05 +0000 (08:33 +0000)]
Pass false instead of 0 since isStar parameter of getArray has type bool. No functionality change.

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

11 years agoFix spelling error and remove the part about CMake having experimental Ninja support...
Nikola Smiljanic [Fri, 11 Jan 2013 07:23:53 +0000 (07:23 +0000)]
Fix spelling error and remove the part about CMake having experimental Ninja support since 2.8.9 has been released some time ago.

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

11 years agoRevert the line ending mess I made.
Nikola Smiljanic [Fri, 11 Jan 2013 07:14:58 +0000 (07:14 +0000)]
Revert the line ending mess I made.

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

11 years agoFix spelling error and remove the part about CMake having experimental Ninja support...
Nikola Smiljanic [Fri, 11 Jan 2013 07:09:00 +0000 (07:09 +0000)]
Fix spelling error and remove the part about CMake having experimental Ninja support since 2.8.9 has been released some time ago.

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

11 years ago[analyzer] Rename the warning: state the issue before the hint of how it
Anna Zaks [Fri, 11 Jan 2013 03:52:44 +0000 (03:52 +0000)]
[analyzer] Rename the warning: state the issue before the hint of how it
can be fixed

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

11 years ago[analyzer]Recognize ivar invalidation protocol even if it was redeclared
Anna Zaks [Fri, 11 Jan 2013 03:52:40 +0000 (03:52 +0000)]
[analyzer]Recognize ivar invalidation protocol even if it was redeclared

This will get rid of some false positives as well as false negatives.

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

11 years ago[analyzer] Ivar invalidation: track ivars declared in categories.
Anna Zaks [Fri, 11 Jan 2013 03:52:37 +0000 (03:52 +0000)]
[analyzer] Ivar invalidation: track ivars declared in categories.

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

11 years agoRevert "tg-fixits.td: fixup for Linux"
Jordan Rose [Fri, 11 Jan 2013 02:37:47 +0000 (02:37 +0000)]
Revert "tg-fixits.td: fixup for Linux"

It's better to show no caret/ranges/fixits than to show them misaligned.
(It scares me a bit that Clang is going to show them misaligned on
systems without a proper llvm::sys::locale::columnWidth.) See PR14910.

This reverts commit a03cc72bedd015b7eb76e9ac650992f58a48549d.

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

11 years agoReplace more usages of __func__ with LLVM_FUNCTION_NAME
Dmitri Gribenko [Fri, 11 Jan 2013 02:23:13 +0000 (02:23 +0000)]
Replace more usages of __func__ with LLVM_FUNCTION_NAME

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