Commit Graph

55786 Commits

Author SHA1 Message Date
Samuel Benzaquen b6f0a83f41 Skip some unnecessary type checks.
Summary:
Skip some unnecessary type checks wrt DynTypedNodes.
Add DynTypedNode::getUnchecked() to skip the runtime check when the type
is known.
Speed up DynTypedNode::operator== by using isSame() instead of
isBaseOf().
Skip the type check in MatcherInterface<T>::matches(). All calls come
from DynTypedMatcher::matches(), which already did the type check.
This change speeds up our clang-tidy benchmark by ~4%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6468

llvm-svn: 223134
2014-12-02 18:29:00 +00:00
Anton Korobeynikov d90dd7977e Fix invalid calling convention used for libcalls on ARM.
ARM ABI specifies that all the libcalls use soft FP ABI 
(even hard FP binaries). These days clang emits _mulsc3 / _muldc3
calls with default (C) calling convention which would be translated
into AAPCS_VFP LLVM calling and thus the result of complex
multiplication will be bogus.

Introduce a way for a target to specify explicitly calling
convention for libcalls. Right now this is temporary correctness
fix. Ultimately, we'll end with intrinsic for complex 
multiplication and all calling convention decisions for libcalls
will be put into backend.

llvm-svn: 223123
2014-12-02 16:04:58 +00:00
Serge Pavlov 376aee9ae7 Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.
llvm-svn: 223120
2014-12-02 14:52:20 +00:00
Daniel Jasper 7f43266778 clang-format: Escape '*' in generated flag documentation.
llvm-svn: 223118
2014-12-02 14:21:16 +00:00
Daniel Jasper 3219e43c94 clang-format: Add option to suppress operator alignment.
With alignment:
  int aaaaaa = aa
               + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                     * cccccccccccccccccccccccccccccccc;

Without alignment:
  int aaaaaa = aa
      + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
          * cccccccccccccccccccccccccccccccc;

This fixes llvm.org/PR21666.

llvm-svn: 223117
2014-12-02 13:24:51 +00:00
Justin Holewinski 6e9bfa344c [NVPTX] Fix type error for some builtins in BuiltinsNVPTX.def
llvm-svn: 223116
2014-12-02 12:58:24 +00:00
Serge Pavlov 1ecb41c09b Emit warning if define or undef reserved identifier or keyword.
Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

Differential Revision: http://reviews.llvm.org/D6194

llvm-svn: 223114
2014-12-02 11:06:09 +00:00
Daniel Jasper 8c6e9ef676 clang-format: precedence-based indentation when breaking before operators.
Before:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                  + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  > ccccccccccccccccccccccccccccccccccccccccc;

After:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                   == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                              * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                          + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                          * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      > ccccccccccccccccccccccccccccccccccccccccc;

Not particularly pretty, but can probably help to uncover bugs. And if this
bugs somebody, parentheses can help.

llvm-svn: 223111
2014-12-02 09:46:56 +00:00
Bob Wilson ec2580dec0 Re-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a while."
This reverts commit r176892.

I had reverted this a while back to give Chromium more time to update, and
Nico says it should be OK now.

llvm-svn: 223108
2014-12-02 05:17:21 +00:00
NAKAMURA Takumi 8ca1b5a294 clang/test/Modules/malformed.cpp REQUIRES shell due to "cd".
llvm-svn: 223107
2014-12-02 03:55:16 +00:00
Hans Wennborg 76abe8ef98 CMake: make the regexes used for setting HOST_LINK_VERSION more forgiving (PR21268)
If the output of 'ld -v' didn't match the regexes, CMake would previously error
with a message like:

  CMake Error at tools/clang/CMakeLists.txt:269 (string):
    string sub-command REGEX, mode REPLACE regex "[^0-9]*([0-9.]*).*" matched
    an empty string.

llvm-svn: 223106
2014-12-02 03:08:38 +00:00
Hans Wennborg 0101b540db Try to fix the MSVC build.
llvm-svn: 223105
2014-12-02 02:13:09 +00:00
Chandler Carruth bdf7e1dd4b Rely on fewer features of the 'env' command. Darwin only supports '-i'.
I'm explicitly setting LC_ALL=C somewhat for documentation, but
hopefully this also removes some host variation from the test results.

llvm-svn: 223102
2014-12-02 01:24:52 +00:00
Chandler Carruth c2f9ea7847 Add a test that ensures the Clang driver behaves itself when the PATH
environment variable is changed to strange things out from under it.
Prior to r223099 in LLVM, these test cases would crash in various ways
(assert fails, stack exhaustion, etc.).

llvm-svn: 223100
2014-12-02 00:53:20 +00:00
Bob Wilson 5f4346d538 Remove special case for aarch64 static vs. PIC code in iOS kernel code.
I added this check a while back but then made a note to myself that it
should be completely unnecessary since iOS always uses PIC code-gen for
aarch64. Since I could never come up with any reason why it would be
necessary, I'm just going to remove it and we'll see if anything breaks.
rdar://problem/13627985

llvm-svn: 223097
2014-12-02 00:27:35 +00:00
Richard Smith 3c1a41ad99 [modules] Track how 'header' directives were written in module map files,
rather than trying to extract this information from the FileEntry after the
fact.

This has a number of beneficial effects. For instance, diagnostic messages for
failed module builds give a path relative to the "module root" rather than an
absolute file path, and the contents of the module includes file is no longer
dependent on what files the including TU happened to inspect prior to
triggering the module build.

llvm-svn: 223095
2014-12-02 00:08:08 +00:00
Nikola Smiljanic fce370eb52 Perform correct lookup when '__super' is used in class with dependent base.
llvm-svn: 223090
2014-12-01 23:15:01 +00:00
Zachary Turner 719f58c228 Make -fuse-ld=lld work properly on Windows.
Using lld on Windows requires calling link-lld.exe instead of
lld.exe.  This patch puts this knowledge into clang so that when
using the GCC style clang driver, it can properly delegate to
lld.

Differential Revision: http://reviews.llvm.org/D6428
Reviewed by: Reid Kleckner, Rui Ueyama

llvm-svn: 223086
2014-12-01 23:06:47 +00:00
Reid Kleckner ee7cf84c8f Use nullptr to silence -Wsentinel when self-hosting on Windows
Richard rejected my Sema change to interpret an integer literal zero in
a varargs context as a null pointer, so -Wsentinel sees an integer
literal zero and fires off a warning. Only CodeGen currently knows that
it promotes integer literal zeroes in this context to pointer size on
Windows.  I didn't want to teach -Wsentinel about that compatibility
hack. Therefore, I'm migrating to C++11 nullptr.

llvm-svn: 223079
2014-12-01 22:02:27 +00:00
Richard Smith a634ff2194 Add missing 'break's, found by inspection. No functionality change; the
fallthrough happened to do the right thing in both cases.

llvm-svn: 223064
2014-12-01 18:59:10 +00:00
Nico Weber 4af55faa19 Add a test for devirtualization of virtual operator calls.
There was no test coverage for this before: Modifiying
EmitCXXOperatorMemberCallee() to not call CanDevirtualizeMemberFunctionCall()
didn't make any test fail.

llvm-svn: 223056
2014-12-01 17:48:04 +00:00
Matt Arsenault bfe25b268e Update R600 address space map to include generic
llvm-svn: 223046
2014-12-01 16:46:03 +00:00
Samuel Benzaquen 95636e565a Make the function pointer a template argument instead of a runtime value.
Summary:
Speed up the variadic matchers by removing one indirect call.
Making the function pointer a template arguments allows the compiler to
inline the call instead of doing an runtime call by pointer.
Also, optimize the allOf() case to avoid redundant kind checks.
This speeds up our clang-tidy benchmark by ~2%

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6424

llvm-svn: 223029
2014-12-01 14:46:14 +00:00
Alexey Bataev 75ddfabed7 [OPENMP] Formating and code improvement for codegen of 'omp critical' directive.
No functional changes, only code improvements.

llvm-svn: 223010
2014-12-01 11:32:38 +00:00
Arnaud A. de Grandmaison f3470cc979 Revert "Remove threshold for lifetime marker insertion of named temporaries"
Revert r222993 while I investigate some MemorySanitizer failures.

llvm-svn: 222995
2014-12-01 09:30:16 +00:00
Arnaud A. de Grandmaison f2730e2d22 Remove threshold for lifetime marker insertion of named temporaries
Now that TailRecursionElimination has been fixed with r222354, the
threshold on size for lifetime marker insertion can be removed. This
only affects named temporary though, as the patch for unnamed temporaries
is still in progress.

llvm-svn: 222993
2014-12-01 09:13:54 +00:00
NAKAMURA Takumi ddd125a3f9 clang/test/CodeGenOpenCL/opencl_types.cl: Appease i686-msvc.
llvm-svn: 222969
2014-11-30 00:32:02 +00:00
Nico Weber cda5c7c764 Fix typo.
llvm-svn: 222964
2014-11-29 23:57:35 +00:00
Nathan Sidwell 81475c8b7d Fix grammar error in err_bad_reinterpret_cast_reference error message.
llvm-svn: 222963
2014-11-29 22:51:47 +00:00
NAKAMURA Takumi c3ee2c5a77 Tweak clang/test/CodeGenOpenCL/opencl_types.cl to appease msvc since r222941.
llvm-svn: 222956
2014-11-29 17:27:07 +00:00
David Majnemer eea02eefe7 AST: Consider pseudo-struct builtin types as substitutable
We didn't consider types like ObjCSel as a substitution candidate.

This fixes PR21688.

llvm-svn: 222941
2014-11-28 22:22:46 +00:00
Richard Barton 3b0dcc160a Add additional arguments for -mfpu options
Add neon-vfpv3 to allow specifying both at the same time. This is not an
option that GCC supports, but follows the same track and should be
non-controversial.

Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658
llvm-svn: 222933
2014-11-28 20:39:59 +00:00
Richard Barton 09b60b2a63 Add -mfpu=neon-vfpv4
This enables user to architecturally specify ARMv7A + VFPv4 + NEON.

Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f
llvm-svn: 222932
2014-11-28 20:39:54 +00:00
Alexey Bataev f33eba6573 [OPENMP] Additional processing of 'omp atomic write' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic write' is allowed to be used only for expression statements of form 'x = expr;', where x is a lvalue expression and expr is an expression with scalar type. Patch adds checks for it.

llvm-svn: 222913
2014-11-28 07:21:40 +00:00
Alexis Hunt 724f14e75c Create a new 'flag_enum' attribute.
This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.

Reviewed by Aaron Ballman.

llvm-svn: 222906
2014-11-28 00:53:20 +00:00
Tim Northover b047bfae32 AArch64: simplify PCS mapping.
Now that LLVM can count the registers needed to implement AAPCS rules, we don't
need to duplicate that logic here. This means we can drop the explicit padding
and also use more natural types in many cases (e.g. "struct { float arr[3]; }"
used to end up as "[2 x double]" to avoid holes on the stack.

The one wrinkle is that AAPCS va_arg was also using the register counting
machinery. But the local replacement isn't too bad.

llvm-svn: 222904
2014-11-27 21:02:49 +00:00
Aaron Ballman c7d4b8dcec Sphinx does not have a lexer for OpenCL, so falling back to C for the language on the code block. Also fixing an indentation warning. NFC to the content of the documentation itself.
llvm-svn: 222894
2014-11-27 15:45:59 +00:00
Daniel Jasper 41368e9e07 clang-format: [JS] Contract fewer functions to a single line.
Before:
  var someVariable =
      function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); };

After:
  var someVariable = function(x) {
    return x.zIsTooLongForOneLineWithTheDeclarationLine();
  };

llvm-svn: 222893
2014-11-27 15:37:42 +00:00
Daniel Jasper 4087432f8b clang-format: [JS] Try not to break in container literals.
Before:
  var obj = {
    fooooooooo:
        function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }
  };

After:
  var obj = {
    fooooooooo: function(x) {
      return x.zIsTooLongForOneLineWithTheDeclarationLine();
    }
  };

llvm-svn: 222892
2014-11-27 15:24:48 +00:00
Daniel Jasper 7912123893 clang-format: [JS] new and delete are valid function names.
Before:
  someObject.new ();
  someObject.delete ();

After:
  someObject.new();
  someObject.delete();

llvm-svn: 222890
2014-11-27 14:55:17 +00:00
Daniel Jasper 53c38f4e79 clang-format: [JS] Make Closure module detection more narrow.
Before:
  var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName');

After:
  var MyLongClassName =
      goog.module.get('my.long.module.name.followedBy.MyLongClassName');

llvm-svn: 222888
2014-11-27 14:46:03 +00:00
Daniel Jasper 13404dad0d clang-format: Don't use column layout with AlignAfterOpenBrackets.
This fixes llvm.org/PR21676.

llvm-svn: 222886
2014-11-27 14:40:48 +00:00
Richard Smith 83d3f150c8 [c++1z] Remove terse range-based for loops; they've been removed from
consideration for C++17 for now. Update C++ status page to match.

llvm-svn: 222865
2014-11-27 01:54:27 +00:00
Richard Trieu c321b931c0 When checking for uninitialized values, do not confuse "std::move" with every
other function named "move".

llvm-svn: 222863
2014-11-27 01:29:32 +00:00
Tim Northover 8603941057 OpenCL: fix test for lack of names in release builds
llvm-svn: 222853
2014-11-26 22:33:04 +00:00
Anton Yartsev 0a18fca007 [analyzer] Indented code within the DisplayHelp sub.
llvm-svn: 222851
2014-11-26 21:53:39 +00:00
Richard Smith 42ea81f655 Fix buildbot failure on LLP64 platforms like MSVC x86_64.
llvm-svn: 222848
2014-11-26 19:37:39 +00:00
Daniel Jasper 9b9e07608d clang-format: [Java] Don't line-wrap package declarations.
This fixes llvm.org/PR21677.

llvm-svn: 222843
2014-11-26 18:03:42 +00:00
Nico Weber 450425c980 clang-format: Tweak -style=Chromium for Java files.
For Java, don't do any of the deviations from Google Style that Chromium style
does for C++.

Chromium's Java follows Android Java style [1], which is roughly Google Java
style with an indent of 4 and a continuation indent of 8.

1: https://source.android.com/source/code-style.html
llvm-svn: 222839
2014-11-26 16:43:18 +00:00
Aaron Ballman eda0373900 Adding an explicit triple to this test to get it to pass all build bots.
llvm-svn: 222837
2014-11-26 16:17:20 +00:00