Commit Graph

33040 Commits

Author SHA1 Message Date
Richard Smith 2aa81a718e PR17800: When performing pack expansion, we must always rebuild the AST nodes
to avoid breaking AST invariants by reusing Stmt nodes within the same
function.

llvm-svn: 194217
2013-11-07 20:07:17 +00:00
Daniel Jasper a98da3d236 clang-format: Improve binary operator detection in macros.
Before:
  #define M(NAME) assert(!Context.Verifying &&#NAME);

After:
  #define M(NAME) assert(!Context.Verifying && #NAME);

This fixes llvm.org/PR16156.

llvm-svn: 194216
2013-11-07 19:56:07 +00:00
Daniel Jasper f48b5abc49 clang-format: Improve ObjC variadic and binary expression parameters.
Before:
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                           aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                           aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

After:
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                        aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa |
                        aaaaaaaaaaaaaaa | aaaaaaaaaaaaaaa];
  [self aaaaaaaaaaaaaaa:aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
                        aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa,
                        aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaa];

This addresses llvm.org/PR15349 and llvm.org/PR16185.

llvm-svn: 194214
2013-11-07 19:23:49 +00:00
Richard Smith 9ff62af3aa PR17615: A delegating constructor initializer is a full-expression. Don't
forget to clean up temporaries at the end of it.

llvm-svn: 194213
2013-11-07 18:45:03 +00:00
Daniel Jasper 4fcc8b91eb clang-format: Improve formatting of constructor initializers.
Before:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa,
                                                                      aaaa)) {}
After:
  Constructor()
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
            aaaaaaaaaaaaaaaaaaaaaaaaa(aaaa, aaaa)) {}

llvm-svn: 194210
2013-11-07 17:52:51 +00:00
Daniel Jasper bc5cb4e369 clang-format: Remove old hack that mainly made incorrect tests pass.
As a side-effect, constructors definitions will correctly be recognized
and formatted as function declarations. Tests will be added in a
follow-up patch actually using the correct recognition.

llvm-svn: 194209
2013-11-07 17:43:07 +00:00
Faisal Vali 9366a48583 Remove an unnecessary condition that I added hastily: Unsigned numbers are obviously >= 0 ;)
Also - others have complained about some white space issues - sorry about that - continues to be a pain point for me - will try and see what I can do with clang-format this evening after work - as a short term fix, if anyone can email me the files that they have already identified with issues, it would help me speed up a focused fix. sorry.

llvm-svn: 194206
2013-11-07 16:57:56 +00:00
Daniel Jasper 6b6e7c37ea clang-format: Fix corner case for brace alignment.
Before:
  Constructor::Constructor()
      : some_value{ //
            aaaaaaa //
  } {}

After:
  Constructor::Constructor()
      : some_value{ //
            aaaaaaa //
        } {}

llvm-svn: 194204
2013-11-07 14:02:28 +00:00
Timur Iskhodzhanov 9e7f505515 Minor refinement of VTableBuilder.h: fix wrong indentation, rename a struct field with a more appropriate name
llvm-svn: 194202
2013-11-07 13:34:02 +00:00
Benjamin Kramer cd502b59e7 Add parens for || in && in assert. No functionality change.
llvm-svn: 194200
2013-11-07 11:03:53 +00:00
Sylvestre Ledru aaf01a7f2b Ubuntu has published its Saucy release. 'Trusty Tahr' dev has just started. Add its support in Clang
llvm-svn: 194198
2013-11-07 09:31:30 +00:00
Enea Zaffanella b1b1b8ab71 Fixed bug in return type of __builtin_va_start().
llvm-svn: 194197
2013-11-07 08:14:26 +00:00
David Blaikie f84a105c48 Unbreak the Clang -Werror build by removing some unused variables
llvm-svn: 194190
2013-11-07 05:52:35 +00:00
Faisal Vali a17d19fb41 This patch implements capturing of variables within generic lambdas.
Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks.

What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing.  

As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable.      

Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas.  What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda.

Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming. 

This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being:
  - generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ...
  - nested variadic expansions such as:
    auto K = [](auto ... OuterArgs) {
      vp([=](auto ... Is) {
          decltype(OuterArgs) OA = OuterArgs;
          return 0;
        }(5)...);
      return 0;
    };
    auto M = K('a', ' ', 1, " -- ", 3.14); 
   currently cause crashes.  I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard.

A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless!

Now let's hope this commit doesn't upset the buildbot gods ;)

Thanks!

llvm-svn: 194188
2013-11-07 05:17:06 +00:00
David Majnemer bed356a9ea [-fms-extensions] Add support for __FUNCDNAME__
Summary:
Similar to __FUNCTION__, MSVC exposes the name of the enclosing mangled
function name via __FUNCDNAME__.  This implementation is very naive and
unoptimized, it is expected that __FUNCDNAME__ would be used rarely in
practice.

Reviewers: rnk, rsmith, thakis

CC: cfe-commits, silvas

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

llvm-svn: 194181
2013-11-06 23:31:56 +00:00
Daniel Jasper 56f8b43941 clang-format: Separate line-merging logic into its own class.
No functional changes (intended).

llvm-svn: 194179
2013-11-06 23:12:09 +00:00
Peter Collingbourne c689ee76d4 Introduce ClangTool::buildASTs, and buildASTFromCode.
These allow clients to retrieve persistent AST objects (ASTUnits) which
can be used in an ad-hoc manner after parsing.

To accommodate this change, the code for processing a CompilerInvocation
using a FrontendAction has been factored out to FrontendActionFactory, and
a new base class, ToolAction, has been introduced, allowing the tool to do
arbitrary things with each CompilerInvocation.  This change was necessary
because ASTUnit does not use the FrontendAction interface directly.

This change also causes the FileManager in ClangTool to use shared ownership.
This will become necessary because ASTUnit takes shared ownership of
FileManager (ClangTool's FileManager is currently unused by ASTUnit; this
is a FIXME).  As shown in the tests, any client of ToolInvocation will
need to be modified to use shared ownership for FileManager.

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

llvm-svn: 194164
2013-11-06 20:12:45 +00:00
Richard Smith 9dbc57436b Fix diagnostic goof in r194161.
llvm-svn: 194162
2013-11-06 19:43:09 +00:00
Richard Smith 79c927bfe9 Add a limit to the length of a sequence of 'operator->' functions we will
follow when building a class member access expression. Based on a patch by
Rahul Jain!

llvm-svn: 194161
2013-11-06 19:31:51 +00:00
Rafael Espindola 5fb3a13ba7 Fix the -cxx-abi microsoft -mconstructor-aliases combination.
On the microsoft ABI clang is producing one weak_odr and one linkonce_odr
destructor, which is reasonable since only one is required.

The fix is simply to move the assert past the special case treatment of
linkonce_odr.

llvm-svn: 194158
2013-11-06 19:18:55 +00:00
DeLesley Hutchins 05b7b37021 Thread safety analysis: minor bugfix to smart pointer handling, and expanded
test case.

llvm-svn: 194157
2013-11-06 18:40:01 +00:00
Aaron Ballman f682f53012 Silencing some MSVC warnings about not all control paths returning a value when they actually do.
llvm-svn: 194156
2013-11-06 18:15:02 +00:00
Timur Iskhodzhanov 053142a90d Fix PR17738 - add support for vtordisp thunks when using -cxx-abi microsoft
llvm-svn: 194132
2013-11-06 06:24:31 +00:00
Jiangning Liu c628af66c7 Implement AArch64 Neon instruction set Perm.
llvm-svn: 194124
2013-11-06 03:35:53 +00:00
Jiangning Liu 37f5bb1b28 Implement AArch64 Neon instruction set Bitwise Extract.
llvm-svn: 194119
2013-11-06 02:26:12 +00:00
Richard Smith 4e66f1faa1 More constant evaluation cleanup, and fix an issue where we'd override an
earlier 'non-constant' diagnostic with a later one if the earlier one was from
a side-effect we thought we could evaluate past.

llvm-svn: 194117
2013-11-06 02:19:10 +00:00
Warren Hunt 6b7048ddd8 Microsoft adds weird padding before virtual bases if the last field was a bitfield
This patch adds the same behavior to clang.

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

llvm-svn: 194115
2013-11-06 00:54:59 +00:00
Peter Collingbourne b23b39da21 Introduce DynTypedNode::print, dump and getSourceRange.
These functions can generally be applied to multiple kinds of AST node,
so it makes sense to add them to DynTypedNode.

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

llvm-svn: 194113
2013-11-06 00:27:12 +00:00
DeLesley Hutchins 5ede5cc9ba Thread safety analysis: check pt_guarded_by attribute when calling -> and *
on smart pointers.  -Wthread-safety-beta only.

llvm-svn: 194103
2013-11-05 23:09:56 +00:00
Fariborz Jahanian 23417073ee ObjectiveC migrator. Please annotation of properties with
NS_RETURNS_INNER_POINTER under -objcmt-returns-innerpointer-property
flag (off by default), as older compilers do not support such annotations.
// rdar://15396636

llvm-svn: 194100
2013-11-05 22:28:30 +00:00
Richard Smith e9ff770f8b Simplify: we don't care why constant evaluation might have failed when we're
checking an expression for constant overflow.

llvm-svn: 194099
2013-11-05 22:23:30 +00:00
Richard Smith 6d4c6586c9 Refactor constant expression handling and make a couple of tweaks to make it a
bit more robust against future changes. This includes a slight diagnostic
improvement: if we know we're only trying to form a constant expression, take
the first diagnostic which shows the expression is not a constant expression,
rather than preferring the first one which makes the expression unfoldable.

llvm-svn: 194098
2013-11-05 22:18:15 +00:00
Rafael Espindola 0df9e16cc7 With this patch -Wwrite-strings is still implemented with the terrible
hack of passing -fconst-strings to -cc1, but at least the driver uses
the regular warning checking code path.

Since we don't support a warning that is DefaultIgnore in one language
but not in another, this patch creates a dummy C only warning in the same
group as the existing one to get the desired effect.

llvm-svn: 194097
2013-11-05 21:43:54 +00:00
Rafael Espindola 2e2995bf50 Produce direct calls instead of alias to linkonce_odr functions.
This is a small optimization on linux, but should help more on windows
where msvc only outputs one destructor if there would be two identical ones.

llvm-svn: 194095
2013-11-05 21:37:29 +00:00
Daniel Jasper bbf5c1c965 clang-format: Allow line merging and partial formatting of nested blocks
Before, clang-format would always format entire nested blocks, which
can be unwanted e.g. for long DEBUG({...}) statements. Also
clang-format would not allow to merge lines in nested blocks (e.g. to
put "if (a) return;" on one line in Google style).

This is the first step of several refactorings mostly focussing on the
additional functionality (by reusing the "format many lines" code to
format the children of a nested block). The next steps are:
* Pull out the line merging into its own class.
* Seperate the formatting of many lines from the formatting of a single
  line (and the analysis of the solution space).

llvm-svn: 194090
2013-11-05 19:10:03 +00:00
Kaelyn Uhrain 89035721b9 Revert "Try to correct a mistyped "-" or ">" to "->" for some C++ cases."
Revert this patch until cases of rejected valid code (e.g. identifiers
that require ADL to be resolved properly) are fixed.

llvm-svn: 194088
2013-11-05 18:28:21 +00:00
Jiangning Liu 34a7109b47 Implement AArch64 Neon Crypto instruction classes AES, SHA, and 3 SHA.
llvm-svn: 194086
2013-11-05 17:42:24 +00:00
Timur Iskhodzhanov 5877663622 Fix vbtable indices when a class shares the vbptr with a non-virtual base
llvm-svn: 194082
2013-11-05 15:54:58 +00:00
Joey Gouly a7310a8cfa Do not allow functions or kernels called 'main' in OpenCL.
llvm-svn: 194068
2013-11-05 12:30:39 +00:00
David Majnemer 76faf1f525 Lex: Require that '#' be followed by a macro parameter name when preceded by '##'
After lexing a '##', we would look ahead and check to see if it was
followed by '__VA_ARGS__'.  After doing so, we would then go ahead and
lex the token.

However we would fail in the case where the '##' was followed by a '#'
followed by an identifier because we would have lexed the '#' separately
from the identifier, bypassing our parameter validation logic.

Instead, lex the tokens coming after the '##' later.

This fixes PR17804.

llvm-svn: 194059
2013-11-05 09:30:17 +00:00
Richard Smith b47c36f8e1 C++1y sized deallocation: if we have a use, but not a definition, of a sized
deallocation function (and the corresponding unsized deallocation function has
been declared), emit a weak discardable definition of the function that
forwards to the corresponding unsized deallocation.

This allows a C++ standard library implementation to provide both a sized and
an unsized deallocation function, where the unsized one does not just call the
sized one, for instance by putting both in the same object file within an
archive.

llvm-svn: 194055
2013-11-05 09:12:18 +00:00
David Majnemer 2748da9be4 Sema: Improve comment introduced in r193397
llvm-svn: 194052
2013-11-05 08:01:18 +00:00
Rafael Espindola b5ac86865a Revert "Produce direct calls instead of alias to linkonce_odr functions."
This reverts commit r194046.
Debugging a bootstrap issue.

llvm-svn: 194047
2013-11-05 05:29:54 +00:00
Rafael Espindola 5d79a51a45 Produce direct calls instead of alias to linkonce_odr functions.
This is a small optimization on linux, but should help more on windows
where msvc only outputs one destructor if there would be two identical ones.

llvm-svn: 194046
2013-11-05 05:22:36 +00:00
Kevin Qin 9eece7b5e0 Implemented aarch64 neon intrinsic vcopy_lane with float type.
llvm-svn: 194042
2013-11-05 02:05:44 +00:00
Fariborz Jahanian ce4bbb2532 ObjectiveC. Method implementations should only check for
"Missing call to Super" in the overriding method and
not in the method itself. // rdar://15385981.

llvm-svn: 194031
2013-11-05 00:28:21 +00:00
Dmitri Gribenko e9bcf5b7b1 Include non-explicit submodules in exported module list
This change fixes Richard's testcase for r193815.  Now we include non-explicit
submodules into the list of exports.

The test failed previously because:
- recursive_visibility_a1.inner is not imported (only recursive_visibility_a1 is),
- thus the 'inner' submodule is not showing up in any of the import lists,
- and because of this getExportedModules() is not returning the
  correct module set -- it only considers modules that are imported.

The fix is to make Module::getExportedModules() include non-explicit submodules
into the list of exports.

llvm-svn: 194018
2013-11-04 21:51:33 +00:00
Anna Zaks 3d46ac66d8 [analyzer] Track the count of NSOrderedSet similarly to other fast enumerations.
llvm-svn: 194005
2013-11-04 19:13:08 +00:00
Anna Zaks 830d2f7701 [analyzer] Suppress warnings coming out of std::basic_string.
The analyzer cannot reason about the internal invariances of the data structure (radar://15194597).

llvm-svn: 194004
2013-11-04 19:13:03 +00:00
Kaelyn Uhrain 3fb1710910 Try to correct a mistyped "-" or ">" to "->" for some C++ cases.
Similar C code isn't caught as it seems to hit a different code path.
Also, as the check is only done for record pointers, cases involving
an overloaded operator-> are not handled either. Note that the reason
this check is done in the parser instead of Sema is not related to
having enough knowledge about the current state as it is about being
able to fix up the parser's state to be able to recover and traverse the
correct code paths.

llvm-svn: 194002
2013-11-04 18:59:34 +00:00