]> granicus.if.org Git - clang/log
clang
11 years agoAdd missing include guards into headers in lib/Headers. While it may appear
Richard Smith [Sun, 14 Jul 2013 05:41:45 +0000 (05:41 +0000)]
Add missing include guards into headers in lib/Headers. While it may appear
that these headers should not be included more than once, they are in fact
included twice when building our builtins module (in order for it to generate
submodules for them), and without this, any modular build enabling AVX and
including any builtin header fails.

Testing this is tricky because including any of these headers in a modular
build is liable to fail, due to unrelated builtin headers in the same module
including headers which might not be available on the system running the tests.
Suggestion on that front are welcome (but we're getting close to being able to
run a buildbot that has modules enabled for all tests, which would nicely solve
the testing problem).

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

11 years agoIf an unimported submodule of an imported module contains a declaration of a
Richard Smith [Sun, 14 Jul 2013 02:01:48 +0000 (02:01 +0000)]
If an unimported submodule of an imported module contains a declaration of a
global allocation or deallocation function, that should not cause that global
allocation or deallocation function to become unavailable.

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

11 years agoSerialization support for TagDecl::IsCompleteDefinitionRequired
David Blaikie [Sun, 14 Jul 2013 01:07:41 +0000 (01:07 +0000)]
Serialization support for TagDecl::IsCompleteDefinitionRequired

Requested by Richard Smith in post-commit review of r186262

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

11 years agoInitialize the "IsCompleteDefinitionRequired" field in the ASTContext ctor
David Blaikie [Sat, 13 Jul 2013 22:29:32 +0000 (22:29 +0000)]
Initialize the "IsCompleteDefinitionRequired" field in the ASTContext ctor

Introduced in r186262 & found by the hexagon buildbots (but owing to
this being UB, that's random chance - so there's no additional test case
here)

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

11 years agoPR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the...
David Blaikie [Sat, 13 Jul 2013 21:08:14 +0000 (21:08 +0000)]
PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the full definition of a type in -flimit-debug-info

This simplifies the core benefit of -flimit-debug-info by taking a more
systematic approach to avoid emitting debug info definitions for types
that only require declarations. The previous ad-hoc approach (3 cases
removed in this patch) had many holes.

The general approach (adding a bit to TagDecl and callback through
ASTConsumer) has been discussed with Richard Smith - though always open
to revision.

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

11 years agoCorrectly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT
David Blaikie [Sat, 13 Jul 2013 21:08:08 +0000 (21:08 +0000)]
Correctly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT

Test coverage for non-dependent pack expansions doesn't demonstrate a
failure prior to this patch (a follow-up commit improving debug info
will cover this commit specifically) but covers a related hole in our
test coverage.

Reviewed by Richard Smith & Eli Friedman.

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

11 years agoSimplify getTypeInfoImpl handling of 'non-canonical unless dependent' types.
David Blaikie [Sat, 13 Jul 2013 21:08:03 +0000 (21:08 +0000)]
Simplify getTypeInfoImpl handling of 'non-canonical unless dependent' types.

These types are not dependent in this context, so just look through
the sugar.

Review by Richard Smith & Eli Friedman.

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

11 years agoRevert "Revert "PR16540: ASTVector::insert(Context, Iter, Element) doesn't compile""
David Blaikie [Sat, 13 Jul 2013 19:23:35 +0000 (19:23 +0000)]
Revert "Revert "PR16540: ASTVector::insert(Context, Iter, Element) doesn't compile""

This reverts commit b18b043a5a37f76803d89467e46bcac286c0ecae.

Reapply with fix for the configure+make build (missing include of
ASTContext.h).

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

11 years agoRevert "PR16540: ASTVector::insert(Context, Iter, Element) doesn't compile"
David Blaikie [Sat, 13 Jul 2013 18:54:56 +0000 (18:54 +0000)]
Revert "PR16540: ASTVector::insert(Context, Iter, Element) doesn't compile"

This reverts commit r186253.

This is failing to link under Configure+Make on the buildbots for
reasons I don't immediately understand.

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

11 years agoPR16540: ASTVector::insert(Context, Iter, Element) doesn't compile
David Blaikie [Sat, 13 Jul 2013 18:08:59 +0000 (18:08 +0000)]
PR16540: ASTVector::insert(Context, Iter, Element) doesn't compile

Fix some uninstantiable code in ASTVector::insert. I've added a
cheap-and-dirty compile test for this, because I don't have the time to
figure out a nice way to get a real ASTContext to implement executable
tests - but we probably should have them for this ADT.

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

11 years agoFixes a typo caught by Arthur O'Dwyer
Fariborz Jahanian [Sat, 13 Jul 2013 17:16:41 +0000 (17:16 +0000)]
Fixes a typo caught by Arthur O'Dwyer

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

11 years agoC++ modules: Don't call DeclContext::lookup when half-way through deserializing
Richard Smith [Sat, 13 Jul 2013 02:00:19 +0000 (02:00 +0000)]
C++ modules: Don't call DeclContext::lookup when half-way through deserializing
decls. That can reenter deserialization and explode horribly by trying to merge
a declaration that we've not got very far through deserializing yet.

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

11 years ago[ms-cxxabi] Don't consider function templates for name backrefs
Reid Kleckner [Sat, 13 Jul 2013 00:43:39 +0000 (00:43 +0000)]
[ms-cxxabi] Don't consider function templates for name backrefs

They don't seem to be used for back references, presumably because a
function template is unlikely to reoccur, while a class template name
may reoccur as a type.

This fixes a mangling issue for llvm::hash_combine() in Hashing.h.

Reviewers: timurrrr

Differential Revision: http://llvm-reviews.chandlerc.com/D1078

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

11 years agoObjC migrator: More knobs for migrating
Fariborz Jahanian [Sat, 13 Jul 2013 00:04:20 +0000 (00:04 +0000)]
ObjC migrator: More knobs for migrating
conforming protocols to each class. wip.

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

11 years agoObjC migrator: early work for migrating implicitly conforming
Fariborz Jahanian [Fri, 12 Jul 2013 22:32:19 +0000 (22:32 +0000)]
ObjC migrator: early work for migrating implicitly conforming
protocols to classes. This is wip.

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

11 years agoChanges so that a few tests do not fail when running under guarded malloc.
Argyrios Kyrtzidis [Fri, 12 Jul 2013 22:30:03 +0000 (22:30 +0000)]
Changes so that a few tests do not fail when running under guarded malloc.

Guarded malloc emits some messages at the beginning in stderr when enabled.
These messages caused a few tests to fail.

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

11 years agoUse function attributes to pass along the stack protector buffer size instead of...
Bill Wendling [Fri, 12 Jul 2013 22:26:07 +0000 (22:26 +0000)]
Use function attributes to pass along the stack protector buffer size instead of making it a target option.

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

11 years agoCompute 'this' correctly for block in lambda.
Eli Friedman [Fri, 12 Jul 2013 22:05:26 +0000 (22:05 +0000)]
Compute 'this' correctly for block in lambda.

Using CurFuncDecl is both correct and simple compared to crawling
the DeclContexts of the block.

Fixes <rdar://problem/14415072>.

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

11 years agoProvide a better diagnostic and a fixit for a '.' or '->' before the left paren
Kaelyn Uhrain [Fri, 12 Jul 2013 21:43:02 +0000 (21:43 +0000)]
Provide a better diagnostic and a fixit for a '.' or '->' before the left paren
of a function call.

This fixes PR5898 and means we now have a better diagnostic here than GCC.

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

11 years agoUnrevert r186040, reverted in r186185, with fix for PR16597.
Richard Smith [Fri, 12 Jul 2013 20:38:49 +0000 (20:38 +0000)]
Unrevert r186040, reverted in r186185, with fix for PR16597.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

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

11 years agoRevert r186040 to fix PR16597 while Richard investigates what the best
Chandler Carruth [Fri, 12 Jul 2013 18:54:40 +0000 (18:54 +0000)]
Revert r186040 to fix PR16597 while Richard investigates what the best
fix is.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

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

11 years ago[analyzer] Treat nullPtrType as a location type.
Anna Zaks [Fri, 12 Jul 2013 17:58:33 +0000 (17:58 +0000)]
[analyzer] Treat nullPtrType as a location type.

Fixes PR16584 (radar://14415223).

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

11 years agofixes a typo caught by Jordan.
Fariborz Jahanian [Fri, 12 Jul 2013 16:41:56 +0000 (16:41 +0000)]
fixes a typo caught by Jordan.

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

11 years agoObjective-C: Produce gcc compatible encoding of
Fariborz Jahanian [Fri, 12 Jul 2013 16:19:11 +0000 (16:19 +0000)]
Objective-C: Produce gcc compatible encoding of
ivar type in meta-data while preventing recursive
encoding in a corner case. // rdar://14408244

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

11 years ago[scan-build] Add missing comma to ccc-analyzer.
Jordan Rose [Fri, 12 Jul 2013 16:07:33 +0000 (16:07 +0000)]
[scan-build] Add missing comma to ccc-analyzer.

Thanks, Dmitry!

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

11 years agoclang-format: Improve <<-formatting.
Daniel Jasper [Fri, 12 Jul 2013 15:14:05 +0000 (15:14 +0000)]
clang-format: Improve <<-formatting.

This fixes a regression caused by r186115.

Before:
  Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
       bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbb)
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

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

11 years agoclang-format: Fix string literal breaking.
Daniel Jasper [Fri, 12 Jul 2013 11:37:05 +0000 (11:37 +0000)]
clang-format: Fix string literal breaking.

Before this patch, it did not cooperate with
Style::AlwaysBreakBeforeMultilineStrings. Thus, it would turn

  aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

into:

  aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
                              "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

and only a second format step would lead to the desired (with that
option):

  aaaaaaaaaaaa(aaaaaaaaaaaaa,
               "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
               "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");

This could even lead to clang-format breaking the string at a different
character and thus leading to a completely different end result.

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

11 years agoclang-format: Break before/between array subscript expressions.
Daniel Jasper [Fri, 12 Jul 2013 11:19:37 +0000 (11:19 +0000)]
clang-format: Break before/between array subscript expressions.

clang-format used to treat array subscript expressions much like
function call (just replacing () with []). However, this is not really
appropriate especially for expressions with multiple subscripts.

Although it might seem counter-intuitive, the most consistent solution
seems to be to always (if necessary) break before a square bracket,
never after it. Also, multiple subscripts of the same expression should
be aligned if they are on subsequent lines.

Before:
  aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa][
      bbbbbbbbbbbbbbbbbbbbbbbbb] = c;
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa][
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc;

After:
  aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa]
                           [bbbbbbbbbbbbbbbbbbbbbbbbb] = c;
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]
      [bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc;

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

11 years ago[analyzer] Add support for __builtin_addressof.
Jordan Rose [Fri, 12 Jul 2013 00:26:14 +0000 (00:26 +0000)]
[analyzer] Add support for __builtin_addressof.

...so we don't regress on std::addressof.

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

11 years ago[scan-build] Pass through all -f and -O flags, along with -Wwrite-strings.
Jordan Rose [Thu, 11 Jul 2013 23:56:12 +0000 (23:56 +0000)]
[scan-build] Pass through all -f and -O flags, along with -Wwrite-strings.

These flags control language options and user-visible macros, so it's
important to preserve them when analyzing. Rather than try to keep up
with all the -f flags, we'll pass them all through and then ban the ones
we don't want (like -fsyntax-only).

-Wwrite-strings is really an f-flag in disguise: it implies -fconst-strings.

Patch by Keaton Mowry, modified by me.

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

11 years agoFix crash on zero-argument assignment operator.
Eli Friedman [Thu, 11 Jul 2013 23:55:07 +0000 (23:55 +0000)]
Fix crash on zero-argument assignment operator.

Make sure we don't crash when checking whether an assignment operator
without any arguments is a special member.  <rdar://problem/14397774>.

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

11 years agoAdd the ability to use guarded malloc when running clang's lit tests.
David Dean [Thu, 11 Jul 2013 23:37:50 +0000 (23:37 +0000)]
Add the ability to use guarded malloc when running clang's lit tests.

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

11 years agoProvide a fixit hint for changing '->' to '.' if there is no operator->
Kaelyn Uhrain [Thu, 11 Jul 2013 22:38:30 +0000 (22:38 +0000)]
Provide a fixit hint for changing '->' to '.' if there is no operator->
defined for a class.

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

11 years agoMake CXXBaseSpecifier::getType return unqual type.
Eli Friedman [Thu, 11 Jul 2013 22:22:22 +0000 (22:22 +0000)]
Make CXXBaseSpecifier::getType return unqual type.

Various pieces of code, like base initialization in Sema and RTTI IRGen,
don't properly ignore qualifiers on base classes.  Instead of auditing the
whole codebase, just strip them off in the getter.  (The type as written is
still available in the TypeSourceInfo for code that cares.)

Fixes PR16596.

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

11 years agoclang-format: Fix bug concerning the alignment of "}".
Daniel Jasper [Thu, 11 Jul 2013 21:27:40 +0000 (21:27 +0000)]
clang-format: Fix bug concerning the alignment of "}".

Before:
    int i;  // indented 2 space more than clang-format would use.
    SomeReturnType  // clang-format invoked on this line.
    SomeFunctionMakingLBraceEndInColumn80() {
  }  // This is the indent clang-format would prefer.

After:
    int i;  // indented 2 space more than clang-format would use.
    SomeReturnType  // clang-format invoked on this line.
    SomeFunctionMakingLBraceEndInColumn80() {
    }

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

11 years agoclang-format: Break before trailing annotations.
Daniel Jasper [Thu, 11 Jul 2013 21:02:56 +0000 (21:02 +0000)]
clang-format: Break before trailing annotations.

(if they are not function-like).

Before:
  SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      OVERRIDE;

After:
  SomeFunction(aaaaaaaaaaaaaaaaaaaaaa,
               aaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE;

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

11 years agoclang-format: Avoid line breaks before the first <<.
Daniel Jasper [Thu, 11 Jul 2013 20:41:21 +0000 (20:41 +0000)]
clang-format: Avoid line breaks before the first <<.

This puts a slight penalty on the linebreak before the first "<<", so
that clang-format generally tries to keep things on the first line.

User feedback has shown that this is generally desirable.

Before:
  llvm::outs()
      << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =" << aaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  llvm::outs() << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ="
               << aaaaaaaaaaaaaaaaaaaaaaaaaaa;

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

11 years agoRestore warning to its original text when
Fariborz Jahanian [Thu, 11 Jul 2013 19:13:34 +0000 (19:13 +0000)]
Restore warning to its original text when
certain familiy of methods have the wrong type.
// rdar://14408244

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

11 years agoSimplify GetBuiltinNames by hoising the NoBuiltins argument out of it.
Eli Bendersky [Thu, 11 Jul 2013 16:53:04 +0000 (16:53 +0000)]
Simplify GetBuiltinNames by hoising the NoBuiltins argument out of it.

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

11 years agoObjectiveC arc[qoi]: When due to change of certain methods'
Fariborz Jahanian [Thu, 11 Jul 2013 16:48:06 +0000 (16:48 +0000)]
ObjectiveC arc[qoi]: When due to change of certain methods'
result type, a diagnostic being issued, issue a 'note'
mentioning reason behind the unexpected warning.
// rdar://14121570.

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

11 years agoImprove detection of trailing return types.
Daniel Jasper [Thu, 11 Jul 2013 14:33:06 +0000 (14:33 +0000)]
Improve detection of trailing return types.

Trailing return types can only occur in declaration contexts.

Before:
  void f() { auto a = b -> c(); }

After:
  void f() { auto a = b->c(); }

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

11 years agoFix indentation problem for comments in call chains
Daniel Jasper [Thu, 11 Jul 2013 13:48:16 +0000 (13:48 +0000)]
Fix indentation problem for comments in call chains

Before:
SomeObject
    // Calling someFunction on SomeObject
        .someFunction();

After:
SomeObject
    // Calling someFunction on SomeObject
    .someFunction();

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

11 years agoKeep trailing annotations close to their argument.
Daniel Jasper [Thu, 11 Jul 2013 12:34:23 +0000 (12:34 +0000)]
Keep trailing annotations close to their argument.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(
    aaaaaaaaaaaa);

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    GUARDED_BY(aaaaaaaaaaaa);

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

11 years agoPR5066: If a declarator cannot have an identifier, and cannot possibly be
Richard Smith [Thu, 11 Jul 2013 05:10:21 +0000 (05:10 +0000)]
PR5066: If a declarator cannot have an identifier, and cannot possibly be
followed by an identifier, then diagnose an identifier as being a bogus part of
the declarator instead of tripping over it. Improves diagnostics for cases like

  std::vector<const int *p> my_vec;

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

11 years agoDocumentation fixes - the rest of DeclCXX.h:
James Dennett [Thu, 11 Jul 2013 05:01:16 +0000 (05:01 +0000)]
Documentation fixes - the rest of DeclCXX.h:
* More \brief additions/fixes;
* Fix some misleading comments about C++11's explicit conversion operators;
* Mark up some \code examples;
* Add \file documentation.

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

11 years agoDocumentation cleanup for DeclCXX.h:
James Dennett [Thu, 11 Jul 2013 03:51:36 +0000 (03:51 +0000)]
Documentation cleanup for DeclCXX.h:
* Fixing up \brief summaries (adding some, making some briefer);
* Standardizing on \commands, not @commands;
* Update C++0x references to C++11;
* Fix typos and Doxygen warnings.

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

11 years agoclang/test/CodeGen/c11atomics.c: Fix testcase for -Asserts since r186054.
NAKAMURA Takumi [Thu, 11 Jul 2013 03:45:54 +0000 (03:45 +0000)]
clang/test/CodeGen/c11atomics.c: Fix testcase for -Asserts since r186054.

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

11 years agoFix build.
Eli Friedman [Thu, 11 Jul 2013 02:28:36 +0000 (02:28 +0000)]
Fix build.

Sorry about that.

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

11 years agoAdd a __builtin_addressof that performs the same functionality as the built-in
Richard Smith [Thu, 11 Jul 2013 02:27:57 +0000 (02:27 +0000)]
Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.

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

11 years agoMake CheckAddressOfOperand a member of Sema so it can be reused by
Richard Smith [Thu, 11 Jul 2013 02:26:56 +0000 (02:26 +0000)]
Make CheckAddressOfOperand a member of Sema so it can be reused by
__builtin_addressof.

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

11 years agoSimplify atomic load/store IRGen.
Eli Friedman [Thu, 11 Jul 2013 01:32:21 +0000 (01:32 +0000)]
Simplify atomic load/store IRGen.

Also fixes a couple minor bugs along the way; see testcases.

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

11 years agoFix some grammar errors.
Richard Smith [Thu, 11 Jul 2013 00:34:42 +0000 (00:34 +0000)]
Fix some grammar errors.

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

11 years agoFix documentation:
Richard Smith [Thu, 11 Jul 2013 00:27:05 +0000 (00:27 +0000)]
Fix documentation:

  #if defined(__has_foo("X")) && __has_foo("X")

is not a correct way to portably use __has_foo, because it is expanded to

  #if 0 && 0("X")

... which is ill-formed.

Also add a missing ')'.

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

11 years agoIf we friend a declaration twice, that should not make it visible to name
Richard Smith [Wed, 10 Jul 2013 22:04:13 +0000 (22:04 +0000)]
If we friend a declaration twice, that should not make it visible to name
lookup in the surrounding context. Slightly rework how we handle friend
declarations to inherit the visibility of the prior declaration, rather
than setting a friend declaration to be visible whenever there was a prior
declaration.

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

11 years agoObjC migrator: Improve on hueristics.
Fariborz Jahanian [Wed, 10 Jul 2013 21:30:22 +0000 (21:30 +0000)]
ObjC migrator: Improve on hueristics.
migrate to 'copy attribute if Object
class implements NSCopying otherwise
assume implied 'strong'. Remove
lifetime qualifier on property as it has
moved to property's attribute. Added TODO
comment for future work by poking into
setter implementation.

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

11 years agoUse a LexicalScope here since it is one and it will encapsulate
Eric Christopher [Wed, 10 Jul 2013 20:14:36 +0000 (20:14 +0000)]
Use a LexicalScope here since it is one and it will encapsulate
the two sets of debug scope and cleanup scope.

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

11 years ago[analyzer] Remove bogus assert: in C++11, 'new' can do list-initialization.
Jordan Rose [Wed, 10 Jul 2013 19:14:10 +0000 (19:14 +0000)]
[analyzer] Remove bogus assert: in C++11, 'new' can do list-initialization.

Previously, we asserted that whenever 'new' did not include a constructor
call, the type must be a non-record type. In C++11, however, uniform
initialization syntax (braces) allow 'new' to construct records with
list-initialization: "new Point{1, 2}".

Removing this assertion should be perfectly safe; the code here matches
what VisitDeclStmt does for regions allocated on the stack.

<rdar://problem/14403437>

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

11 years agoAdd a hook RecursiveASTVisitor::TraverseLambdaBody, to enable visitors to
James Dennett [Wed, 10 Jul 2013 18:29:15 +0000 (18:29 +0000)]
Add a hook RecursiveASTVisitor::TraverseLambdaBody, to enable visitors to
use/maintain additional state from the LambdaExpr while visiting the body
of a LambdaExpr.

One use for this arises because Clang's AST currently holds lambda bodies
in a form prior to their adjustment to refer to captured copies of local
variables, and so some clients will need access to the lambda's closure
type in order to query how to map VarDecl*s to the FieldDecls of their
by-copy captures. This hook is sufficient for at least one such client;
to do this without such a hook would require the client to re-implement
the whole of TraverseLambdaExpr, which is non-trivial and would likely be
more brittle.

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

11 years agoOffer typo suggestions for 'using' declarations.
Kaelyn Uhrain [Wed, 10 Jul 2013 17:34:22 +0000 (17:34 +0000)]
Offer typo suggestions for 'using' declarations.

Patch courtesy of Luke Zarko <zarko@google.com>

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

11 years agoAdd experimental flag for adaptive parameter bin-packing.
Daniel Jasper [Wed, 10 Jul 2013 14:02:49 +0000 (14:02 +0000)]
Add experimental flag for adaptive parameter bin-packing.

This is not activated for any style, might change or go away
completely.

For those that want to play around with it, set
ExperimentalAutoDetectBinPacking to true.

clang-format will then:
Look at whether function calls/declarations/definitions are currently
formatted with one parameter per line (on a case-by-case basis). If so,
clang-format will avoid bin-packing the parameters. If all parameters
are on one line (thus that line is "inconclusive"), clang-format will
make the choice dependent on whether there are other bin-packed
calls/declarations in the same file.

The reason for this change is that bin-packing in some situations can be
really bad and an author might opt to put one parameter on each line. If
the author does that, he might want clang-format not to mess with that.
If the author is unhappy with the one-per-line formatting, clang-format
can easily be convinced to bin-pack by putting any two parameters on the
same line.

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

11 years agoFixed comment of Sema::FindInstantiatedDecl.
Serge Pavlov [Wed, 10 Jul 2013 04:59:14 +0000 (04:59 +0000)]
Fixed comment of Sema::FindInstantiatedDecl.

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

11 years agoFinish off mangling locals in block literals.
Eli Friedman [Wed, 10 Jul 2013 01:33:19 +0000 (01:33 +0000)]
Finish off mangling locals in block literals.

Specifically, handle the case where the block is in a default argument
in a class method.  The mangling here follows what we do for lambdas.

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

11 years agoGet rid of dead/useless code for block mangling.
Eli Friedman [Wed, 10 Jul 2013 01:13:27 +0000 (01:13 +0000)]
Get rid of dead/useless code for block mangling.

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

11 years agoMore local mangling fixes.
Eli Friedman [Wed, 10 Jul 2013 00:30:46 +0000 (00:30 +0000)]
More local mangling fixes.

Compute mangling numbers for externally visible local variables and tags.
Change the mangler to consistently use discriminators where necessary.
Tweak the scheme we use to number decls which are not externally visible
to avoid unnecessary discriminators in common cases now that we request
them more consistently.

Fixes <rdar://problem/14204721>.

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

11 years agoobjc migrator: More refinment of property
Fariborz Jahanian [Wed, 10 Jul 2013 00:20:11 +0000 (00:20 +0000)]
objc migrator: More refinment of property
attributes in migration. Specialli use of
'copy' attribute for retainable object types.

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

11 years agoApply BlackList -> SpecialCaseList rename in Clang.
Peter Collingbourne [Tue, 9 Jul 2013 22:03:30 +0000 (22:03 +0000)]
Apply BlackList -> SpecialCaseList rename in Clang.

Differential Revision: http://llvm-reviews.chandlerc.com/D1095

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

11 years agoObjective-C: merge objc_requires_super attribute of
Fariborz Jahanian [Tue, 9 Jul 2013 22:02:20 +0000 (22:02 +0000)]
Objective-C: merge objc_requires_super attribute of
method declaration into its implementation to
prevent a bogus warning about mismatched attributes.
then make sure the warning about missing call to super comes out
of the method implementation. // rdar://14251387

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

11 years agoReapply an improved version of r180816/180817.
Adrian Prantl [Tue, 9 Jul 2013 20:29:03 +0000 (20:29 +0000)]
Reapply an improved version of r180816/180817.

Do not generate VLAs as complex variables any more, as they are now
correctly represented as breg+0 locations in the backend.

(Paired commit with LLVM: r185966)

rdar://problem/13658587

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

11 years agoObjC migrator: Add -objcmt-migrate-property to do property
Fariborz Jahanian [Tue, 9 Jul 2013 16:59:14 +0000 (16:59 +0000)]
ObjC migrator: Add -objcmt-migrate-property to do property
migration. Also, fixes an old bug where older migration
flags were not being checked for properly.

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

11 years agoInitial support for formatting trailing return types.
Daniel Jasper [Tue, 9 Jul 2013 14:36:48 +0000 (14:36 +0000)]
Initial support for formatting trailing return types.

This fixes llvm.org/PR15170.

For now, the basic formatting rules are (based on the C++11 standard):
* Surround the "->" with spaces.
* Break before "->".

Also fix typo.

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

11 years agoArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup and
Rafael Espindola [Tue, 9 Jul 2013 12:05:01 +0000 (12:05 +0000)]
ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup and
Sema::ActOnDocumentableDecls.

Patch by Robert Wilhelm.

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

11 years agoAvoid confusing indentations for chained function calls.
Daniel Jasper [Tue, 9 Jul 2013 11:57:27 +0000 (11:57 +0000)]
Avoid confusing indentations for chained function calls.

Basically treat a function with a trailing call similar to a function
with multiple parameters.

Before:
  aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa))
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                           aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa))
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();

Also fix typo.

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

11 years agoc-index-test/CMakeLists.txt: Suggest -isystem to include libxml2 with include_directo...
NAKAMURA Takumi [Tue, 9 Jul 2013 11:14:30 +0000 (11:14 +0000)]
c-index-test/CMakeLists.txt: Suggest -isystem to include libxml2 with include_directories(SYSTEM).

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

11 years agoc-index-test/Makefile: Use -isystem instead of -I on $(LIBXML2_INC) with -Wdocumentation.
NAKAMURA Takumi [Tue, 9 Jul 2013 11:14:24 +0000 (11:14 +0000)]
c-index-test/Makefile: Use -isystem instead of -I on $(LIBXML2_INC) with -Wdocumentation.

-Wdocumentation won't seek -isystem. LIBXML2's headers in a certain distro might be incompatible to -Wdocumentation.

FIXME: Could autoconf detect clang or availability of -isystem?

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

11 years agoFix alignment of closing brace in braced initializers.
Daniel Jasper [Tue, 9 Jul 2013 09:06:29 +0000 (09:06 +0000)]
Fix alignment of closing brace in braced initializers.

Before:
someFunction(OtherParam, BracedList{
                           // comment 1 (Forcing intersting break)
                           param1, param2,
                           // comment 2
                           param3, param4
             });
After:
someFunction(OtherParam, BracedList{
                           // comment 1 (Forcing intersting break)
                           param1, param2,
                           // comment 2
                           param3, param4
                         });

To do so, the UnwrappedLineParser now stores the information about the
kind of brace in the FormatToken.

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

11 years agoFormat overloaded operators like other functions.
Daniel Jasper [Tue, 9 Jul 2013 07:43:55 +0000 (07:43 +0000)]
Format overloaded operators like other functions.

This fixes llvm.org/PR16328 (at least partially).

Before:
SomeLoooooooooooooooooooooooooooooogType operator<<(
    const SomeLooooooooogType &a, const SomeLooooooooogType &b);

After:
SomeLoooooooooooooooooooooooooooooogType
operator<<(const SomeLooooooooogType &a, const SomeLooooooooogType &b);

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

11 years ago[analyzer] Fixup for r185609: actually do suppress warnings coming out of std::list.
Anna Zaks [Tue, 9 Jul 2013 01:55:00 +0000 (01:55 +0000)]
[analyzer] Fixup for r185609: actually do suppress warnings coming out of std::list.

list is the name of a class, not a namespace. Change the test as well - the previous
version did not test properly.

Fixes radar://14317928.

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

11 years agoFix recovery for missing * in objc property.
Eli Friedman [Tue, 9 Jul 2013 01:38:07 +0000 (01:38 +0000)]
Fix recovery for missing * in objc property.

<rdar://problem/14354144>

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

11 years agoDon't give # and ## special treatment when in -traditional-cpp mode. Patch by
Richard Smith [Tue, 9 Jul 2013 01:00:29 +0000 (01:00 +0000)]
Don't give # and ## special treatment when in -traditional-cpp mode. Patch by
Austin Seipp!

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

11 years agoGeneralize hack allowing 'const' in __has_attribute (etc) to allow any token
Richard Smith [Tue, 9 Jul 2013 00:57:56 +0000 (00:57 +0000)]
Generalize hack allowing 'const' in __has_attribute (etc) to allow any token
with identifier info. This covers most identifier-like entities (other than
the ISO646 keywords).

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

11 years agoFix crash typo-correcting dependent member func.
Eli Friedman [Mon, 8 Jul 2013 23:35:04 +0000 (23:35 +0000)]
Fix crash typo-correcting dependent member func.

PR16561.

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

11 years agoObjC migration: more test for migration to
Fariborz Jahanian [Mon, 8 Jul 2013 23:29:51 +0000 (23:29 +0000)]
ObjC migration: more test for migration to
properties.

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

11 years agoAttempt typo correction for function calls with the wrong number of arguments.
Kaelyn Uhrain [Mon, 8 Jul 2013 23:13:44 +0000 (23:13 +0000)]
Attempt typo correction for function calls with the wrong number of arguments.

Combined with typo correction's new ability to apply global/absolute nested
name specifiers to possible corrections, cases such as in PR12287 where the
desired function is being shadowed by a lexically closer function with the
same name but a different number of parameters will now include a FixIt.

On a side note, since the test for this change caused
test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for
a single file, I've included a test case for exceeding the limit and added
some comments to both the original and part two of typo-correction.cpp
warning future editors of the files about the limit.

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

11 years agoMake a couple of useful typo correction callbacks more widely available.
Kaelyn Uhrain [Mon, 8 Jul 2013 23:13:39 +0000 (23:13 +0000)]
Make a couple of useful typo correction callbacks more widely available.

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

11 years agoObjC migration: Skip over setter/getter with attributes
Fariborz Jahanian [Mon, 8 Jul 2013 22:49:25 +0000 (22:49 +0000)]
ObjC migration: Skip over setter/getter with attributes
for now.

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

11 years ago[Objective-C migrator] replace candidate user setter/getter with
Fariborz Jahanian [Mon, 8 Jul 2013 21:42:08 +0000 (21:42 +0000)]
[Objective-C migrator] replace candidate user setter/getter with
their equivalent property declaration. wip.

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

11 years agoFix Sema for compares with _Atomic vars.
Eli Friedman [Mon, 8 Jul 2013 20:20:06 +0000 (20:20 +0000)]
Fix Sema for compares with _Atomic vars.

Use UsualArithmeticConversions unconditionally in analysis of
comparisons and conditional operators: the method performs
the usual arithmetic conversions if both sides are arithmetic, and
usual unary conversions if they are not.  This is just a cleanup
for conditional operators; for comparisons, it fixes the issue that
we would try to check isArithmetic() on an atomic type.

Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables
of atomic type correctly.

Fixes PR15537.

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

11 years agoFix incorrect incorrect cast identification in clang-format.
Daniel Jasper [Mon, 8 Jul 2013 14:58:01 +0000 (14:58 +0000)]
Fix incorrect incorrect cast identification in clang-format.

This fixes llvm.org/PR16534.

Before:
aaaaa& operator+(const aaaaa&)LLVM_DELETED_FUNCTION;
After:
aaaaa& operator+(const aaaaa&) LLVM_DELETED_FUNCTION;

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

11 years agoFixed testcase failing under MS by adding "-fno-delayed-template-parsing",
Enea Zaffanella [Mon, 8 Jul 2013 14:50:30 +0000 (14:50 +0000)]
Fixed testcase failing under MS by adding "-fno-delayed-template-parsing",
as suggested by Takumi. To this end, added a MatchVerifier::match()
overload accepting a vector of invocation arguments.

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

11 years agoReformat clang-format's source files after r185822 and others.
Daniel Jasper [Mon, 8 Jul 2013 14:34:09 +0000 (14:34 +0000)]
Reformat clang-format's source files after r185822 and others.

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

11 years agoPrefer similar line breaks.
Daniel Jasper [Mon, 8 Jul 2013 14:25:23 +0000 (14:25 +0000)]
Prefer similar line breaks.

This adds a penalty for clang-format for each break that occurs in
a set of parentheses (including fake parenthesis that determine
the range of certain operator precendences) that have not yet been
broken. Thereby, clang-format prefers similar line breaks.

This fixes llvm.org/PR15506.

Before:
const int kTrackingOptions =
    NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited |
    NSTrackingActiveAlways;

After:
const int kTrackingOptions = NSTrackingMouseMoved |
                             NSTrackingMouseEnteredAndExited |
                             NSTrackingActiveAlways;

Also removed ParenState::ForFakeParenthesis which has become unused.

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

11 years agoFix use of invalidated iterator bug in AST match finder.
Manuel Klimek [Mon, 8 Jul 2013 14:16:30 +0000 (14:16 +0000)]
Fix use of invalidated iterator bug in AST match finder.

Pulled out the cache clearing in the case of descendant matching, too,
for consistency, also it is not technically needed there.

FIXME: Make cache size configurable and add unit test.

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

11 years agoFix for corner cases in code handling leading "* " decorations in block comments
Alexander Kornienko [Mon, 8 Jul 2013 14:12:07 +0000 (14:12 +0000)]
Fix for corner cases in code handling leading "* " decorations in block comments

Summary:
Fixes problems that lead to incorrect formatting of these and similar snippets:
/*
 **
 */

/*
 **/

/*
 * */

/*
 *test
 */

Clang-format used to think that all the cases above use "* " decoration, and
failed to calculate insertion position properly. It also used to remove leading
"* " in the last line.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1113

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

11 years agoclang/include/clang/AST/ExprCXX.h:260:5: Fix a warning -- unknown command tag name...
NAKAMURA Takumi [Mon, 8 Jul 2013 12:00:36 +0000 (12:00 +0000)]
clang/include/clang/AST/ExprCXX.h:260:5: Fix a warning -- unknown command tag name 'cc'; did you mean 'c'? [-Wdocumentation]

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

11 years agoclang/test/Index/comment-custom-block-command.cpp: This has not been failing since...
NAKAMURA Takumi [Mon, 8 Jul 2013 12:00:29 +0000 (12:00 +0000)]
clang/test/Index/comment-custom-block-command.cpp: This has not been failing since r175892 on valgrind.
That said, it fails with --vg-leak. Mark it as XFAIL: vg_leak instead.

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

11 years agoDocumentation cleanup for include/clang/AST/ExprCXX.h.
James Dennett [Mon, 8 Jul 2013 07:29:35 +0000 (07:29 +0000)]
Documentation cleanup for include/clang/AST/ExprCXX.h.

This is mostly Doxygen formatting, but also updates some C++0x references
to C++11 and clarifies some wording.

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

11 years agoclang/test/Misc/permissions.cpp: Suppress this on MSYS with the feature 'shell-preser...
NAKAMURA Takumi [Mon, 8 Jul 2013 06:45:16 +0000 (06:45 +0000)]
clang/test/Misc/permissions.cpp: Suppress this on MSYS with the feature 'shell-preserves-root'.

FIXME: Could we introduce another feature for it?

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

11 years agoclang/test/CodeGen/2008-01-25-ByValReadNone.c: Add explicit -triple x86_64-unknown...
NAKAMURA Takumi [Mon, 8 Jul 2013 06:38:51 +0000 (06:38 +0000)]
clang/test/CodeGen/2008-01-25-ByValReadNone.c: Add explicit -triple x86_64-unknown-unknown.

It would emit @llvm.memcpy with "-triple x86_64-(mingw32|win32)" and had been failing since Nick's r185735.

  ; Function Attrs: nounwind
  declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1

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

11 years agoAST/SourceLocationTest.cpp: Appease MS hosts to suppress CXXUnresolvedConstructExpr...
NAKAMURA Takumi [Mon, 8 Jul 2013 06:38:46 +0000 (06:38 +0000)]
AST/SourceLocationTest.cpp: Appease MS hosts to suppress CXXUnresolvedConstructExpr.SourceRange, for now.

FIXME: It could pass if MS-compatible mode were disabled with Args.push_back("-fno-delayed-template-parsing").

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

11 years agoSimplify code. No functional change.
Craig Topper [Mon, 8 Jul 2013 04:47:18 +0000 (04:47 +0000)]
Simplify code. No functional change.

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