Commit Graph

65085 Commits

Author SHA1 Message Date
Vedant Kumar 957d7a00bc [clang-tblgen] Remove unused #include (NFC)
llvm-svn: 277885
2016-08-05 22:48:53 +00:00
Richard Trieu 71d74d4b25 Fix false positive in -Wunsequenced and templates.
For builtin logical operators, there is a well-defined ordering of argument
evaluation.  For overloaded operator of the same type, there is no argument
evaluation order, similar to other function calls.  When both are present,
uninstantiated templates with an operator&& is treated as an unresolved
function call.  Unresolved function calls are treated as normal function calls,
and may result in false positives when the builtin logical operator is used.
Have the unsequenced checker ignore dependent expressions to avoid this
false positive.  The check also happens in template instantiations to catch
when the overloaded operator is used.

llvm-svn: 277866
2016-08-05 21:02:34 +00:00
David Blaikie 2a58a18d67 PR26423: Assert on valid use of using declaration of a function with an undeduced auto return type
For now just disregard the using declaration in this case. Suboptimal,
but wiring up the ability to have declarations of functions that are
separate from their definition (we currently only do that for member
functions) and have differing return types (we don't have any support
for that) is more work than seems reasonable to at least fix this crash.

llvm-svn: 277852
2016-08-05 19:03:01 +00:00
David Majnemer 9d16822224 [SemaOpenMP] Some miscellaneous cleanups
Clean up some typos, follow the coding style a little more rigorously.

No functionality change is intended.

llvm-svn: 277840
2016-08-05 17:44:54 +00:00
Bruno Cardoso Lopes 9e4374daa3 Revert "[Sema] Add sizeof diagnostics for bzero"
This reverts commit r277787, which caused PR28870.

llvm-svn: 277830
2016-08-05 16:41:00 +00:00
Wei Ding 91c8450967 AMDGPU : Add Clang builtin intrinsics for compare with the full
wavefront result.

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

llvm-svn: 277824
2016-08-05 15:38:46 +00:00
Kelvin Li 0253287633 [OpenMP] Sema and parsing for 'teams distribute' pragma
This patch is to implement sema and parsing for 'teams distribute' pragma.

Differential Revision: https://reviews.llvm.org/D23189

llvm-svn: 277818
2016-08-05 14:37:37 +00:00
John Brawn 4d79ec7fe8 Reapply r276973 "Adjust Registry interface to not require plugins to export a registry"
This differs from the previous version by being more careful about template
instantiation/specialization in order to prevent errors when building with
clang -Werror. Specifically:
 * begin is not defined in the template and is instead instantiated when Head
   is. I think the warning when we don't do that is wrong (PR28815) but for now
   at least do it this way to avoid the warning.
 * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY
   instead provide a template definition then do explicit instantiation. No
   compiler I've tried has problems with doing it the other way, but strictly
   speaking it's not permitted by the C++ standard so better safe than sorry.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

llvm-svn: 277806
2016-08-05 11:01:08 +00:00
Richard Trieu e1a6a7d6d3 Fix crash in template type diffing.
When the type being diffed is a type alias, and the orginal type is not a
templated type, then there will be no unsugared TemplateSpecializationType.
When this happens, exit early from the constructor.  Also add assertions to
the other iterator accessor to prevent the iterator from being used.

llvm-svn: 277797
2016-08-05 03:16:36 +00:00
Richard Trieu 7561ed01cb Allow -1 to assign max value to unsigned bitfields.
Silence the -Wbitfield-constant-conversion warning for when -1 or other
negative values are assigned to unsigned bitfields, provided that the bitfield
is wider than the minimum number of bits needed to encode the negative value.

llvm-svn: 277796
2016-08-05 02:39:30 +00:00
Bruno Cardoso Lopes edf3d81cbf [Sema] Add sizeof diagnostics for bzero
For memset (and others) we can get diagnostics like:

  struct stat { int x; };
  void foo(struct stat *stamps) {
    bzero(stamps, sizeof(stamps));
    memset(stamps, 0, sizeof(stamps));
  }

  t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
    memset(stamps, 0, sizeof(stamps));
           ~~~~~~            ^~~~~~
  t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(stamps, 0, sizeof(stamps));
                             ^~~~~~

This patch implements the same class of warnings for bzero.

Differential Revision: https://reviews.llvm.org/D22525

rdar://problem/18963514

llvm-svn: 277787
2016-08-04 23:55:22 +00:00
Tim Shen 68de2e98a6 [ADT] Migrate DepthFirstIterator to use NodeRef
Summary: The corresponding LLVM change is D23146.

Reviewers: dblaikie, chandlerc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23147

llvm-svn: 277783
2016-08-04 23:03:44 +00:00
Artem Dergachev 7a0088bbae [analyzer] Make CloneDetector recognize different variable patterns.
CloneDetector should be able to detect clones with renamed variables.
However, if variables are referenced multiple times around the code sample,
the usage patterns need to be recognized.

For example, (x < y ? y : x) and (y < x ? y : x) are no longer clones,
however (a < b ? b : a) is still a clone of the former.

Variable patterns are computed and compared during a separate filtering pass.

Patch by Raphael Isemann!

Differential Revision: https://reviews.llvm.org/D22982

llvm-svn: 277757
2016-08-04 19:37:00 +00:00
Yaxun Liu c8acb4f37b [OpenCL] Add the lit test for image size which was omitted by r277647.
llvm-svn: 277756
2016-08-04 19:35:17 +00:00
Yaxun Liu c489e39eca [OpenCL] Remove extra native_ functions from opencl-c.h
There should be no native_ builtin functions with double type arguments.

Patch by Aaron En Ye Shi.

Differential Revision : https://reviews.llvm.org/D23071

llvm-svn: 277754
2016-08-04 19:30:54 +00:00
Alexey Bader d81623261a [OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.
Summary:
In order to re-define OpenCL built-in functions
'to_{private,local,global}' in OpenCL run-time library LLVM names must
be different from the clang built-in function names.

Reviewers: yaxunl, Anastasia

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23120

llvm-svn: 277743
2016-08-04 18:06:27 +00:00
Benjamin Kramer 87e6d99487 Make isExternC work on VarDecls too.
llvm-svn: 277712
2016-08-04 10:02:03 +00:00
Eric Christopher abb2b54ad3 After PR28761 use -Wall with -Werror in builtins tests to identify
possible problems in headers.

llvm-svn: 277696
2016-08-04 06:02:50 +00:00
Hubert Tong 129e709a03 [Concepts] remove default argument for RequiresClause; NFC
llvm-svn: 277658
2016-08-03 22:07:50 +00:00
Yaxun Liu 99444cb860 [OpenCL] Fix size of image type
The size of image type is reported incorrectly as size of a pointer to address space 0, which causes error when casting image type to pointers by __builtin_astype.

The fix is to get image address space from TargetInfo then report the size accordingly.

Differential Revision: https://reviews.llvm.org/D22927

llvm-svn: 277647
2016-08-03 20:38:06 +00:00
Manuel Klimek 16c6d0ac37 Fix bug in conflict check for Replacements::add().
We would not detect conflicts when inserting insertions at the same
offset as previously contained replacements.

llvm-svn: 277603
2016-08-03 15:12:00 +00:00
Manuel Klimek dcb910b1cf Fix quadratic runtime when adding items to tooling::Replacements.
Previously, we would search through all replacements when inserting a
new one to check for overlaps. Instead, make use of the fact that we
already have a set of replacments without overlaps to find the potential
overlap with lower_bound.

Differential Revision: https://reviews.llvm.org/D23119

llvm-svn: 277597
2016-08-03 14:12:17 +00:00
Etienne Bergeron 74dc9b8388 [clang/test] Fix a flaky unittest on windows
Summary:
The append operator on a shell command for quick command-line is
causing trouble on windows. [NFC]
The easiest way to fix them is to avoid using them.

This patch is an attempt to fix this broken build bot:
  clang-x86-win2008-selfhost

http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/9523

Reviewers: rnk

Subscribers: cfe-commits, chrisha

Differential Revision: https://reviews.llvm.org/D23105

llvm-svn: 277576
2016-08-03 06:10:15 +00:00
Argyrios Kyrtzidis f60c395e84 [index] Fix crash with indexing designated init expressions inside templates.
rdar://27452869

llvm-svn: 277570
2016-08-03 05:38:53 +00:00
Artem Belevich c3ded37ccf [CUDA] Updated CUDA tests that must run w/o CUDA installation.
Fixes test failures after r277542 on systems that don't have
CUDA installed.

llvm-svn: 277552
2016-08-02 23:43:04 +00:00
Devin Coughlin 1bb47ac0c8 [analyzer] Update two comments in MPI-Checker. NFC.
Correct two comments that do not match the current behavior of the checker.

A patch by Alexander Droste!

Differential Revision: https://reviews.llvm.org/D22670

llvm-svn: 277547
2016-08-02 23:24:40 +00:00
Artem Belevich 02a1e973a8 [CUDA] Fix libdevice selection.
This makes clang's libdevice selection match that of NVCC as described in
http://docs.nvidia.com/cuda/libdevice-users-guide/basic-usage.html#version-selection

If required libdevice variant is not found, driver now fails with an error.

Differential Revision: https://reviews.llvm.org/D23037

llvm-svn: 277542
2016-08-02 23:12:51 +00:00
Artem Belevich f981e30b45 [CUDA] Do not allow using NVPTX target for host compilation.
Differential Revision: https://reviews.llvm.org/D23042

llvm-svn: 277537
2016-08-02 22:37:47 +00:00
Devin Coughlin 6eb1ca7416 [CFG] Fix crash finding destructor of lifetime-extended temporary.
Fix a crash under -Wthread-safety when finding the destructor for a
lifetime-extending reference.

A patch by Nandor Licker!

Differential Revision: https://reviews.llvm.org/D22419

llvm-svn: 277522
2016-08-02 21:07:23 +00:00
Chris Bieneman 54e044736f Revert "[Order Files] Remove dtrace predicate"
This reverts commit r277487.

Removing the probe predicate was a red herring. It results in more symbols being placed in the final order file, but they are symbols from outside the clang image.

llvm-svn: 277492
2016-08-02 18:23:56 +00:00
Nirav Dave 0e31955c86 Update Clang Parser test error message to match new parser errors
Update clang tests in light of r277489.

llvm-svn: 277490
2016-08-02 17:58:14 +00:00
Vitaly Buka ca2f9d1cb2 Updated documentation
Reviewers: kcc, eugenis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22992

llvm-svn: 277488
2016-08-02 17:51:48 +00:00
Chris Bieneman f7a024b886 [Order Files] Remove dtrace predicate
Having the dtrace predicate setup to only show probes in clang filters out static initializers executed by dyld, which we do want included in the order files.

llvm-svn: 277487
2016-08-02 17:50:53 +00:00
Artem Dergachev 7a7004a999 [analyzer] Hotfix for buildbot failure due to unspecified triple in r277449
If a target triple is not specified, the default host triple is used,
which is not good for compiling inline assembler code.

Patch by Raphael Isemann!

llvm-svn: 277473
2016-08-02 15:16:06 +00:00
Diana Picus 7ef9a07f96 [clang-cl] Fix PCH tests to use x86_64 as target
These tests require x86-registered-target, but they don't force the target as
x86 on the command line, which means they will be run and they might fail when
building the x86 backend on another platform (such as AArch64).

Fixes https://llvm.org/bugs/show_bug.cgi?id=28797

Differential Revision: https://reviews.llvm.org/D23054

llvm-svn: 277457
2016-08-02 13:53:00 +00:00
Artem Dergachev 78692ea590 [analyzer] Respect statement-specific data in CloneDetection.
So far the CloneDetector only respected the kind of each statement when
searching for clones. This patch refines the way the CloneDetector collects data
from each statement by providing methods for each statement kind,
that will read the kind-specific attributes.

For example, statements 'a < b' and 'a > b' are no longer considered to be
clones, because they are different in operation code, which is an attribute
specific to the BinaryOperator statement kind.

Patch by Raphael Isemann!

Differential Revision: https://reviews.llvm.org/D22514

llvm-svn: 277449
2016-08-02 12:21:09 +00:00
Hans Wennborg 622adc524f Revert r276896 "Update Clang Parser test error message to match new parser errors"
This depended on r276895, which was reverted in r277402.

llvm-svn: 277405
2016-08-01 23:34:42 +00:00
Chris Bieneman 973781bbb4 [Order Files] Fixing an error in the perf-helper script
Dtrace probemod needs to be based on the first argument of the command, not the first argument of the args. This error was introduced a while back when I added support for skipping the driver and invoking cc1 directly.

llvm-svn: 277401
2016-08-01 22:54:00 +00:00
Paul Robinson 78fb132af0 Add FIXMEs for MSVC 2013 hacks in r277211. NFC.
llvm-svn: 277396
2016-08-01 22:12:46 +00:00
Saleem Abdulrasool 4a7130a8fb CodeGen: simplify the CC handling for TLS wrappers
Use the calling convention of the wrapper directly to set the calling convention
to ensure that the calling convention matches.  Incorrectly setting the calling
convention results in the code path being entirely nullified as InstCombine +
SimplifyCFG will prune the mismatched CC calls.

llvm-svn: 277390
2016-08-01 21:31:24 +00:00
Erik Pilkington 3f3fbf6b6c [ObjC Availability] Fix partial-availability false positive introduced in r277058
Thanks to Nico Weber for pointing this out!

Differential revision: https://reviews.llvm.org/D23024

llvm-svn: 277378
2016-08-01 20:19:49 +00:00
Reid Kleckner 755220bcef [codeview] Skip injected class names in nested record emission
We were already trying to do this, but our check wasn't quite right.

Fixes PR28790

llvm-svn: 277367
2016-08-01 18:56:13 +00:00
Evandro Menezes ec133b3d20 [AArch64] Add support for Samsung Exynos M2 (NFC).
llvm-svn: 277365
2016-08-01 18:39:55 +00:00
David Majnemer 6ac7dd19f7 [Parse] Let declarations follow labels in -fms-extensions mode
MSVC permits declarations in these places as conforming extension (it is
a constraint violation otherwise).

This fixes PR28782.

llvm-svn: 277352
2016-08-01 16:39:29 +00:00
Martin Bohme 78bac52e14 Make RecursiveASTVisitor visit lambda capture initialization expressions
Summary:
Lambda capture initializations are part of the explicit source code and
therefore should be visited by default but, so far, RecursiveASTVisitor does not
visit them.

This appears to be an oversight. Because the lambda body needs custom handling
(calling TraverseLambdaBody()), the DEF_TRAVERSE_STMT for LambdaExpr sets
ShouldVisitChildren to false but then neglects to visit the lambda capture
initializations. This patch adds code to visit the expressions associated with
lambda capture initializations.

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22566

llvm-svn: 277342
2016-08-01 12:15:46 +00:00
Artem Dergachev 0b9b81412f [analyzer] Fix execution permissions for the scan-build-py scripts.
Differential Revision: https://reviews.llvm.org/D22969

llvm-svn: 277338
2016-08-01 10:55:59 +00:00
Eric Liu 40ef2fb363 Implement tooling::Replacements as a class.
Summary:
- Implement clang::tooling::Replacements as a class to provide interfaces to
  control how replacements for a single file are combined and provide guarantee
  on the order of replacements being applied.
- tooling::Replacements only contains replacements for the same file now.
  Use std::map<std::string, tooling::Replacements> to represent multi-file
  replacements.
- Error handling for the interface change will be improved in followup patches.

Reviewers: djasper, klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D21748

llvm-svn: 277335
2016-08-01 10:16:37 +00:00
Yaron Keren 5c9583981b Allow .exe extension to ld to fix test with mingw.
llvm-svn: 277334
2016-08-01 10:14:54 +00:00
Sylvestre Ledru 522c0ec295 scan-build: Add an option to show the description in the list of defect
Summary:
This patch adds an option //--show-description// to add the defect description to the list of defect. This helps to get a better understanding of the defect without opening the page.

For example, this is used for Firefox:
https://people.mozilla.org/~sledru/reports/fx-scan-build/

Reviewers: rizsotto.mailinglist, zaks.anna

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22810

llvm-svn: 277328
2016-08-01 08:04:45 +00:00
Dimitry Andric f8099f256d Add more gcc compatibility names to clang's cpuid.h
Summary:
Some cpuid bit defines are named slightly different from how gcc's
cpuid.h calls them.

Define a few more compatibility names to appease software built for gcc:

* `bit_PCLMUL`      alias of `bit_PCLMULQDQ`
* `bit_SSE4_1`      alias of `bit_SSE41`
* `bit_SSE4_2`      alias of `bit_SSE42`
* `bit_AES`         alias of `bit_AESNI`
* `bit_CMPXCHG8B`   alias of `bit_CX8`

While here, add the misssing 29th bit, `bit_F16C` (which is how gcc
calls this bit).

Reviewers: joerg, rsmith

Subscribers: bruno, cfe-commits

Differential Revision: https://reviews.llvm.org/D22010

llvm-svn: 277307
2016-07-31 20:23:23 +00:00
Faisal Vali 5e5501861a [NFC] Rearrange an example-file so the c++14 specific example is on top.
This makes it easier to add C++1z examples to the bottom, just before the #endif.

llvm-svn: 277287
2016-07-31 01:19:17 +00:00
Hubert Tong e4a0c0ec78 Reapply r276069 with workaround for MSVC 2013
llvm-svn: 277286
2016-07-30 22:33:34 +00:00
Aaron Ballman b85f5b6a28 Correcting some sphinx formatting issues so that the attribute documentation builds again.
llvm-svn: 277277
2016-07-30 20:20:03 +00:00
Devin Coughlin 1502511ca8 [analyzer] Update APIs taking user-facing strings.
Add new APIs that require localized strings and remove two APIs that were
incorrectly marked as requiring a user-facing string.

A patch by Kulpreet Chilana!

Differential Revision: https://reviews.llvm.org/D22926

llvm-svn: 277273
2016-07-30 16:16:51 +00:00
Argyrios Kyrtzidis fcfec5fdef [c-index-test] Make sure to check that clang_Cursor_getNumTemplateArguments did not return -1.
llvm-svn: 277261
2016-07-30 02:20:21 +00:00
Hans Wennborg bc1b58d086 Fix VS2013 build of CGOpenMPRuntime.cpp
It seems the compiler was getting confused by the in-class initializers
in local struct MapInfo, so moving those to a default constructor
instead.

llvm-svn: 277256
2016-07-30 00:41:37 +00:00
Chris Bieneman 7256f51b18 [Perf-Helper] Add logging for dtrace commands
Logging the dtrace command into the top of the dtrace log is useful when debugging why the order file generation is flaky.

llvm-svn: 277234
2016-07-29 22:48:17 +00:00
Eric Christopher b638558e12 Remove unused variable.
Fixes PR28761.

llvm-svn: 277221
2016-07-29 22:11:11 +00:00
Paul Robinson 15c840052e Fix CGOpenMPRuntime.cpp for VS2013. NFC.
I don't know why these changes work but they do.

llvm-svn: 277211
2016-07-29 20:46:16 +00:00
David Majnemer a6b68bf0b9 Ensure Ident_GNU_final is properly initialized in the Parser Initialize function
The recent change implementing __final forgot to initialize a variable.
This was caught by the Memory Sanitizer.

Properly initialize the value to nullptr to ensure proper memory reads.

Patch by Erich Keane!

Differential Revision: https://reviews.llvm.org/D22970

llvm-svn: 277206
2016-07-29 20:01:12 +00:00
Reid Kleckner 939119dcb2 Fix naked.cpp test on 32-bit Windows
llvm-svn: 277205
2016-07-29 19:43:28 +00:00
Saleem Abdulrasool 369f4d64a2 CodeGen: try harder to make the CFString structure RW
The previous change was insufficient to mark the content as read-write as the
structure itself was marked constant.  Adjust this and add tests to ensure that
the section is marked appropriately as being read-write.

llvm-svn: 277200
2016-07-29 19:15:51 +00:00
Yunzhong Gao 1e4426e786 Improve documentation of the type safety attributes.
1. Add description of the arguments to these attributes.
2. Add missing declarations to some of the MPI code examples.
3. Made clarifications where possible.

Based on the write-up by: Craig Flores.

Differential Revision: https://reviews.llvm.org/D22717

llvm-svn: 277192
2016-07-29 18:34:21 +00:00
Yaxun Liu 3f9e91286e [OpenCL] Add extension cl_khr_mipmap_image to clang
Adding extension cl_khr_mipmap_image to clang's OpenCL Extensions and initiated inside AMDGPU Target.

Patch by Aaron En Ye Shi.

Differential Revision: https://reviews.llvm.org/D22637

llvm-svn: 277181
2016-07-29 17:52:34 +00:00
Yaxun Liu c944e65a24 [OpenCL] Added CLK_ABGR definition for get_image_channel_order return value
Added CLK_ABGR definition for get_image_channel_order return value inside opencl-c.h file.

Patch by Aaron En Ye Shi.

Differential Revision: https://reviews.llvm.org/D22767

llvm-svn: 277179
2016-07-29 17:50:10 +00:00
Erik Pilkington 48c7cc9bc0 Reapply r277058: "[ObjC] Consider availability of context when emitting availability warnings"
llvm-svn: 277175
2016-07-29 17:37:38 +00:00
Haojian Wu 99e39a7af8 Fix a typo in document.
llvm-svn: 277174
2016-07-29 17:30:13 +00:00
Matt Masten 6731dead22 Initial vectorization support for svml calls (short vector math library).
Differential Revision: https://reviews.llvm.org/D19544

llvm-svn: 277167
2016-07-29 16:44:24 +00:00
Haojian Wu b33b02e9f0 [ASTMatcher] Add templateName matcher.
Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D22963

llvm-svn: 277155
2016-07-29 15:45:11 +00:00
Haojian Wu d898b0982a [ASTMatcher] Add hasTemplateArgument/hasAnyTemplateArgument support in functionDecl.
Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D22957

llvm-svn: 277142
2016-07-29 13:57:27 +00:00
Daniel Jasper fbbd9f96fe Add missing '-no-canonical-prefixes' in test.
llvm-svn: 277141
2016-07-29 13:45:03 +00:00
Benjamin Kramer b37fb4d2ca Make test not fail on hosts where the default omp library is gomp.
This is the case on some linuxes, just force libomp so we get the
desired results.

llvm-svn: 277138
2016-07-29 13:07:09 +00:00
Andrey Bokhanko 276055bb2f [GCC] Support for __final specifier
As reported in bug 28473, GCC supports "final" functionality in pre-C++11 code using the __final keyword. Clang currently supports the "final" keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning.

This patch adds the "__final" keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior.

This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665.

Patch by Erich Keane.

Differential Revision: https://reviews.llvm.org/D22919

llvm-svn: 277134
2016-07-29 10:42:48 +00:00
Justin Lebar 41e9dad437 [Typo police] s/proccess/process/, s/auxiliary/auxilliary/.
llvm-svn: 277113
2016-07-29 05:26:58 +00:00
Erik Pilkington 4c922aba3f [Parser] Fix bug where delayed typo in conditional expression was corrected twice
Patch by David Tarditi!

Differential revision: https://reviews.llvm.org/D22930

llvm-svn: 277095
2016-07-29 00:55:40 +00:00
Wolfgang Pieb eb505f9a1c Change a test to be less prone to random failures due to
unintended matches of label numbers to debug metadata
handles in release builds.

llvm-svn: 277094
2016-07-29 00:54:13 +00:00
Vedant Kumar ae00885108 [docs] Coverage: Reference the new -output-dir option
llvm-svn: 277081
2016-07-28 23:22:42 +00:00
Vedant Kumar 3f42b13c20 [docs] Mention some new options in llvm-cov
llvm-svn: 277080
2016-07-28 23:18:48 +00:00
Erik Pilkington 376789fc73 Revert "[ObjC] Consider availability of context when emitting availability warnings"
Reverting r277058, while I fugure out why it broke internal bots.

This reverts commit e514ffa8b657416c6784bbe6da9f5de19365103d.

llvm-svn: 277070
2016-07-28 22:51:11 +00:00
Samuel Antao 102c182bca [CUDA] Unswitch enumerators in the selection of the offloading tool chain.
llvm-svn: 277064
2016-07-28 22:42:42 +00:00
Erik Pilkington 4f2dd2d4f2 [ObjC] Consider availability of context when emitting availability warnings
This means that a function marked with an availability attribute can safely
refer to a declaration that is greater than the deployment target, but less then
or equal to the context availability without -Wpartial-availability firing.

Differential revision: https://reviews.llvm.org/D22697

llvm-svn: 277058
2016-07-28 22:09:53 +00:00
Artem Dergachev d73c57c328 [analyzer] Update the web manual for checker developers.
Fix the explanation of how to run tests after migration
from autotools to cmake.

Significantly expand the "debugging" section
with more interesting stuff.

Update the table of contents accordingly.

Fix paragraphs in the overview section.

Differential Revision: https://reviews.llvm.org/D22874

llvm-svn: 277029
2016-07-28 20:13:14 +00:00
Yaxun Liu 0bc4b2d337 [OpenCL] Generate opaque type for sampler_t and function call for the initializer
Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type.

This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer.

Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions.

This patch is partially based on Alexey Sotkin's work in Khronos Clang (3d4eec6162).

Differential Revision: https://reviews.llvm.org/D21567

llvm-svn: 277024
2016-07-28 19:26:30 +00:00
Devin Coughlin 5ed2b4ba1d [analyzer] Fix misleading indentation in ObjCDeallocChecker. NFC.
llvm-svn: 277009
2016-07-28 17:18:33 +00:00
John Brawn 2853269224 Revert r276973 "Adjust Registry interface to not require plugins to export a registry"
Buildbot failures when building with clang -Werror. Reverting while I try to
figure this out.

llvm-svn: 277008
2016-07-28 17:17:22 +00:00
Zachary Turner e78a34757e [Driver] Fix Windows SDK Detection
This fixes a couple of bugs in Windows SDK Detection.

1. `readFullStringValue` returns a bool, but was being compared
   with ERROR_SUCCESS.
2. `RegQueryValueExW` might return the null terminator in the
   queried value which will result in incorrect values being
   returned from `getSystemRegistryString`.

Patch By: comicfans44@gmail.com
Reviewed By: zturner
Differential Revision: http://reviews.llvm.org/D21946

llvm-svn: 277005
2016-07-28 17:13:32 +00:00
Samuel Antao 655e0edfd7 [CUDA] Remove duplicated test that should have been removed in r276995.
llvm-svn: 276996
2016-07-28 16:18:31 +00:00
Samuel Antao c5188cc3b6 [CUDA] Rename cuda_phases.cu test to cuda-phases.cu to be consistent with the other tests.
llvm-svn: 276995
2016-07-28 16:12:30 +00:00
Samuel Antao 44bcdb3731 [OpenMP] Change name of variable in mappble expression.
This attempts to fix a failure in Windows bots pottentially related with a reserved keyword.

llvm-svn: 276988
2016-07-28 15:31:29 +00:00
Samuel Antao e735a21ece [OpenMP] Fix link command pattern in offloading interoperability test.
It was causing a few bots to fail.

llvm-svn: 276983
2016-07-28 14:56:19 +00:00
Samuel Antao cf3f83e46b [OpenMP] Do not use default argument in lambda from mappable expressions handlers.
Windows bots were complaining about that.

llvm-svn: 276981
2016-07-28 14:47:35 +00:00
Samuel Antao db5f02b1c4 [OpenMP][CUDA] Do not forward OpenMP flags for CUDA device actions.
Summary:
This patch prevents OpenMP flags from being forwarded to CUDA device commands. That was causing the CUDA frontend to attempt to emit OpenMP code which is not supported.

This fixes the bug reported in https://llvm.org/bugs/show_bug.cgi?id=28723.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, tra, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: https://reviews.llvm.org/D22895

llvm-svn: 276979
2016-07-28 14:29:18 +00:00
Samuel Antao 6890b09634 [OpenMP] Code generation for the is_device_ptr clause
Summary: This patch adds support for the is_device_ptr clause. It expands SEMA to use the mappable expression logic that can only be tested with code generation in place and check conflicts with other data sharing related clauses using the mappable expressions infrastructure.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: https://reviews.llvm.org/D22788

llvm-svn: 276978
2016-07-28 14:25:09 +00:00
Samuel Antao cc10b85789 [OpenMP] Codegen for use_device_ptr clause.
Summary: This patch adds support for the use_device_ptr clause. It includes changes in SEMA that could not be tested without codegen, namely, the use of the first private logic and mappable expressions support.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: https://reviews.llvm.org/D22691

llvm-svn: 276977
2016-07-28 14:23:26 +00:00
John Brawn 778c3c6c61 Reapply r276856 "Adjust Registry interface to not require plugins to export a registry"
This version has two fixes compared to the original:
 * In Registry.h the template static members are instantiated before they are
   used, as clang gives an error if you do it the other way around.
 * The use of the Registry template in clang-tidy is updated in the same way as
   has been done everywhere else.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

llvm-svn: 276973
2016-07-28 12:48:17 +00:00
Zijiao Ma 33e9521399 [AArch64] Using AArch64TargetParser in Clang.
This resubmit r270688 which broke some specific buildbots.That's because
there is incorrect indexing problem in the targetparser,and the problem is
fixed in r276957.

Differential Revision: https://reviews.llvm.org/D21277

llvm-svn: 276958
2016-07-28 06:24:48 +00:00
Devin Coughlin e434fc479b [analyzer] Add check::BeginFunction to CheckerDocumentation checks. NFC.
This was an oversight from when I added BeginFunction support in r261293.

llvm-svn: 276950
2016-07-28 00:52:10 +00:00
Nirav Dave 2e46f720fa Replace preserve-as-comments CodeGen test with driver test
llvm-svn: 276947
2016-07-28 00:36:34 +00:00
Vedant Kumar 18286cfb74 Retry: [Driver] Compute effective target triples once per job (NFCI)
Compute an effective triple once per job. Cache the triple in the
prevailing ToolChain for the duration of the job.

Clients which need effective triples now look them up in the ToolChain.
This eliminates wasteful re-computation of effective triples (e.g in
getARMFloatABI()).

While we're at it, delete MachO::ComputeEffectiveClangTriple. It was a
no-op override.

Differential Revision: https://reviews.llvm.org/D22596

llvm-svn: 276937
2016-07-27 23:02:20 +00:00
Vedant Kumar 5fb00e4bd7 Revert "[Driver] Compute effective target triples once per job (NFCI)"
This reverts commit r275895 in order to address some post-commit review
feedback from Eric Christopher (see: the list thread for r275895).

llvm-svn: 276936
2016-07-27 23:01:55 +00:00
Samuel Antao 03a3cec480 [OpenMP] Add support to map member expressions with references to pointers.
Summary: This patch add support to map pointers through references in class members. Although a reference does not have storage that a user can access, it still has to be mapped in order to get the deep copy right and the dereferencing code work properly.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: https://reviews.llvm.org/D22787

llvm-svn: 276934
2016-07-27 22:52:16 +00:00
Samuel Antao 403ffd409f [OpenMP] Add support for mapping array sections through pointer references.
Summary:
This patch fixes a bug in the map of array sections whose base is a reference to a pointer. The existing mapping support was not prepared to deal with it, causing the compiler to crash.

Mapping a reference to a pointer enjoys the same characteristics of a regular pointer, i.e., it is passed by value. Therefore, the reference has to be materialized in the target region.

Reviewers: hfinkel, carlo.bertolli, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

Differential Revision: https://reviews.llvm.org/D22690

llvm-svn: 276933
2016-07-27 22:49:49 +00:00
Matthias Braun 5092dc010f Basic/Targets.cpp: Reformat aarch64 CPU list.
Having 1 entry per line and an alphabetical order is clearer and reduces
the risk of invalid merges.

llvm-svn: 276931
2016-07-27 22:47:09 +00:00
Matthias Braun 939af9c226 test/Frontend: Add a test for aarch64 target CPU names.
Nothing else checked the target cpu names for aarch64 yet.
Add a test in the spirit of x86-target-cpu.c.

llvm-svn: 276930
2016-07-27 22:47:07 +00:00
Samuel Antao 6ad11704b4 Refactor how include paths are appended to the command arguments.
Summary:
This patch aims at removing redundancy in the way include paths for the regular and offloading toolchains are appended to the arguments list in the clang tool.

This was suggested by @rsmith in response to r275931.

Reviewers: rsmith, tra

Subscribers: rsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D22518

llvm-svn: 276929
2016-07-27 22:46:31 +00:00
Justin Lebar e56360a2cd [CUDA] Align kernel launch args correctly when the LLVM type's alignment is different from the clang type's alignment.
Summary:
Before this patch, we computed the offsets in memory of args passed to
GPU kernel functions by throwing all of the args into an LLVM struct.

clang emits packed llvm structs basically whenever it feels like it, and
packed structs have alignment 1.  So we cannot rely on the llvm type's
alignment matching the C++ type's alignment.

This patch fixes our codegen so we always respect the clang types'
alignments.

Reviewers: rnk

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D22879

llvm-svn: 276927
2016-07-27 22:36:21 +00:00
Justin Lebar ed4f172c00 Don't crash when generating code for __attribute__((naked)) member functions.
Summary:
Previously this crashed inside EmitThisParam().  There should be no
prelude for naked functions, so just skip the whole thing.

Reviewers: majnemer

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22715

llvm-svn: 276925
2016-07-27 22:04:24 +00:00
Nirav Dave 574a886e75 Add target triple in test
llvm-svn: 276915
2016-07-27 20:48:39 +00:00
Matt Masten 5940875a7e test commit
llvm-svn: 276912
2016-07-27 20:23:32 +00:00
Nirav Dave 993a139847 Add flags to toggle preservation of assembly comments
Summary: Add -fpreserve-as-comments and -fno-preserve-as-comments.

Reviewers: echristo, rnk

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D22883

llvm-svn: 276907
2016-07-27 19:57:40 +00:00
Pirama Arumuga Nainar bb846a32e4 Adjust coercion of aggregates on RenderScript
Summary:
In RenderScript, the size of the argument or return value emitted in the
IR is expected to be the same as the size of corresponding qualified
type.  For ARM and AArch64, the coercion performed by Clang can
change the parameter or return value to a type whose size is different
(usually larger) than the original aggregate type.  Specifically, this
can happen in the following cases:
    - Aggregate parameters of size <= 64 bytes and return values smaller
      than 4 bytes on ARM
    - Aggregate parameters and return values smaller than bytes on
      AArch64

This patch coerces the cases above to an integer array that is the same
size and alignment as the original aggregate.  A new field is added to
TargetInfo to detect a RenderScript target and limit this coercion just
to that case.

Tests added to test/CodeGen/renderscript.c

Reviewers: rsmith

Subscribers: aemerson, srhines, llvm-commits

Differential Revision: https://reviews.llvm.org/D22822

llvm-svn: 276904
2016-07-27 19:01:51 +00:00
Erik Pilkington 3cdc317342 [Sema] Teach getCurrentThisType to reconize lambda in in-class initializer
Fixes PR27994, a crash on valid.

Differential revision: https://reviews.llvm.org/D21145

llvm-svn: 276900
2016-07-27 18:25:10 +00:00
Nirav Dave ebebd6d2ff Update Clang Parser test error message to match new parser errors
llvm-svn: 276896
2016-07-27 17:39:47 +00:00
Hans Wennborg 6e70f4e171 UsersManual.rst: update clang-cl option list
llvm-svn: 276891
2016-07-27 16:56:03 +00:00
Simon Pilgrim e71a1f9013 Fix unnecessary default switch warning
llvm-svn: 276889
2016-07-27 16:41:56 +00:00
Hans Wennborg d63a6620a7 Update cxx_dr_Status after 3.9 branch
llvm-svn: 276887
2016-07-27 16:39:45 +00:00
Vassil Vassilev 644ea61d2d Implement filtering for code completion of identifiers.
Patch by Cristina Cristescu and Axel Naumann!

Agreed on post commit review (D17820).

llvm-svn: 276878
2016-07-27 14:56:59 +00:00
Renato Golin 6b5596aaec [ARM] Pass thumb as architecture to the underlying tools, when targeting windows
This makes sure that the thumb section flag gets set by the assembler.

Patch by Martin Storsjö.

llvm-svn: 276869
2016-07-27 14:12:20 +00:00
John Brawn 3839263204 Revert r276856 "Adjust Registry interface to not require plugins to export a registry"
This is causing a huge pile of buildbot failures.

llvm-svn: 276857
2016-07-27 11:41:18 +00:00
John Brawn 63aff61019 Adjust Registry interface to not require plugins to export a registry
Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

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

llvm-svn: 276856
2016-07-27 11:18:38 +00:00
Daniel Jasper 31343832e7 clang-format: Fix incorrect detection of QT-signals access specifier.
Before:
  void f() {
  label:
    signals
    .baz();
  }

After:
  void f() {
  label:
    signals.baz();
  }

llvm-svn: 276854
2016-07-27 10:13:24 +00:00
Oliver Stannard 7921e833d5 [ARM] Pass -mimplcit-it= to integrated assembler
Differential Revision: https://reviews.llvm.org/D22761

llvm-svn: 276851
2016-07-27 08:54:13 +00:00
Jonas Hahnfeld d196fa524f Support setting default value for -rtlib at build time
This patch introduces a new cmake variable: CLANG_DEFAULT_RTLIB, thru
which we can specify a default value for -rtlib (libgcc or
compiler-rt) at build time, just like how we set the default C++
stdlib thru CLANG_DEFAULT_CXX_STDLIB.

With these two options, we can configure clang to build binaries on
Linux that have no runtime dependence on any gcc libs (libstdc++ or
libgcc_s).

Patch by Lei Zhang!

Differential Revision: https://reviews.llvm.org/D22663

llvm-svn: 276848
2016-07-27 08:15:54 +00:00
Vedant Kumar ae7e39a6e4 Fix for compiling with clang <= 3.7 and g++6 headers
Make integers explicitly unsigned, so the tuple constructor will resolve
properly when but with clang 3.6, 3.7 and gcc 6.1.1 libstdc++ headers.

Patch by Frederich Munch!

Differential Revision: https://reviews.llvm.org/D22798

llvm-svn: 276831
2016-07-27 03:43:34 +00:00
Manman Ren 4482b2a420 Modules: follow up to r276769.
In r276769, I forgot to forward the driver option, add that here.

rdar://26675801

llvm-svn: 276797
2016-07-26 19:56:12 +00:00
Artem Dergachev 96034ca10e [analyzer] Hotfix for build failure due to declaration shadowing in r276782.
CloneDetector member variable is shadowing the class with the same name,
which causes build failures on some platforms.

llvm-svn: 276791
2016-07-26 19:05:22 +00:00
Artem Dergachev ba816326f3 [analyzer] Add basic capabilities to detect source code clones.
This patch adds the CloneDetector class which allows searching source code
for clones.

For every statement or group of statements within a compound statement,
CloneDetector computes a hash value, and finds clones by detecting
identical hash values.

This initial patch only provides a simple hashing mechanism
that hashes the kind of each sub-statement.

This patch also adds CloneChecker - a simple static analyzer checker
that uses CloneDetector to report copy-pasted code.

Patch by Raphael Isemann!

Differential Revision: https://reviews.llvm.org/D20795

llvm-svn: 276782
2016-07-26 18:13:12 +00:00
Manman Ren 47a4445687 Modules: add command line option fmodules-disable-diagnostic-validation
With PCH+Module, sometimes compiler gives a hard error:
Module file ‘<some-file path>.pcm' is out of date and needs to be rebuilt

This happens when we have a pch importing a module and the module gets
overwritten by another compiler instance after we build the pch (one example is
that both compiler instances hash to the same pcm file but use different
diagnostic options). When we try to load the pch later on, the compiler notices
that the imported module is out of date (modification date, size do not match)
but it can't handle this out of date pcm (i.e it does not know how to rebuild
the pch).

This commit introduces a new command line option so for PCH + module, we can
turn on this option and if two compiler instances only differ in diagnostic
options, the latter instance will not invalidate the original pcm.

rdar://26675801
Differential Revision: http://reviews.llvm.org/D22773

llvm-svn: 276769
2016-07-26 17:12:17 +00:00
Martin Bohme edb25bdb07 Revert "Make RecursiveASTVisitor visit lambda capture initialization expressions"
This reverts commit r276755.

(Broke clang-tidy check modernize-loop-convert.)

llvm-svn: 276759
2016-07-26 16:01:55 +00:00
David Majnemer 3f5a4354db Update for LLVM changes
InstSimplify has gained the ability to remove needless bitcasts which
perturbed some clang codegen tests.

llvm-svn: 276756
2016-07-26 15:21:18 +00:00
Martin Bohme d9a3521552 Make RecursiveASTVisitor visit lambda capture initialization expressions
Summary:
Lambda capture initializations are part of the explicit source code and therefore should be visited by default but, so far, RecursiveASTVisitor does not visit them.

This appears to be an oversight. Because the lambda body needs custom handling (calling TraverseLambdaBody()), the DEF_TRAVERSE_STMT for LambdaExpr sets ShouldVisitChildren to false but then neglects to visit the lambda capture initializations. This patch adds code to visit the expressions associated with lambda capture initializations.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D22566

llvm-svn: 276755
2016-07-26 15:19:10 +00:00
Eric Liu df5bcea088 [Tooling] skip anonymous namespaces when checking if typeLoc references a type decl from a different canonical namespace.
Summary:
[Tooling] skip anonymous namespaces when checking if typeLoc
references a type decl from a different canonical namespace.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D22808

llvm-svn: 276754
2016-07-26 14:53:05 +00:00
David Majnemer 12b9e76b62 Update for LLVM changes
InstSimplify has gained the ability to remove needless bitcasts which
perturbed some clang codegen tests.

llvm-svn: 276728
2016-07-26 05:52:37 +00:00
Kelvin Li 2b51f7284b [OpenMP] diagnose orphaned teams construct
The OpenMP spec mandates that 'a teams construct must be contained within a 
target construct'. Currently, this scenario is not diagnosed. This patch is 
to add check for orphaned teams construct and issue an error message.

Differential Revision: https://reviews.llvm.org/D22785

llvm-svn: 276726
2016-07-26 04:32:50 +00:00
Vedant Kumar efd319a2ad [Coverage] Do not write out coverage mappings with zero entries
After r275121, we stopped mapping regions from system headers. Lambdas
declared in regions belonging to system headers started producing empty
coverage mappings, since the files corresponding to their spelling locs
were being ignored.

The coverage reader doesn't know what to do with these empty mappings.
This commit makes sure that we don't produce them and adds a test. I'll
make the reader stricter in a follow-up commit.

llvm-svn: 276716
2016-07-26 00:24:59 +00:00
Chris Bieneman d052efc332 [CMake] Pass DYLD_LIBRARY_PATH as CMake variable instead of as envar
On OS X 10.11 System Integrity Protection prevents the DYLD environment variables from being set on system binaries. To work around this r276710 accepts DYLD_LIBRARY_PATH as a CMake variable and sets it directly on the archiver commands.

To make this work with bootstrapping we need to set DYLD_LIBRARY_PATH to the current stage's library directory and pass that into the next stage's configuration.

llvm-svn: 276711
2016-07-25 23:48:14 +00:00
Akira Hatanaka 1b07496cea [Sema][ObjC] Compute the nullability of a conditional expression based
on the nullabilities of its operands.

This commit is a follow-up to r276076 and enables
computeConditionalNullability to compute the merged nullability when
the operands are objective-c pointers.

rdar://problem/22074116

llvm-svn: 276696
2016-07-25 21:58:19 +00:00
Chris Bieneman c486541fea [CMake] Cleaning up some CMake warnings
In Bootstrap builds Clang logs some warnings. These are caused because Clang passes CLANG_STAGE and BOOTSTRAP_DEFAULT_PASSTHROUGH into the next stage's configuration.

BOOTSTRAP_DEFAULT_PASSTHROUGH shouldn't be passed, so it is renamed to _BOOTSTRAP_DEFAULT_PASSTHROUGH, to prevent passthrough.

CLANG_STAGE should be passed, so I've changed the code to log it if it is set outside the if(CLANG_ENABLE_BOOTSTRAP) block. This makes the variable always used, so the warning goes away.

llvm-svn: 276674
2016-07-25 18:54:30 +00:00
Joel Jones b89eb65b0e [cc1as] Add MCTargetOptions argument to createAsmBackend
Allow an assembler backend to get ABI options. This is to match the changes
to http://reviews.llvm.org/D16213.

Tested with "make check-clang"

Patch by: Joel Jones

Differential Revision: https://reviews.llvm.org/D16538

llvm-svn: 276655
2016-07-25 17:18:44 +00:00
Sunil Srivastava fe58327146 Support '#pragma once' in headers when using PCH
The '#pragma once' directive was erroneously ignored when encountered
in the header-file specified in generate-PCH-mode. This resulted in
compile-time errors in some cases with legal code, and also a misleading
warning being produced.

Patch by Warren Ristow!

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

llvm-svn: 276653
2016-07-25 17:17:06 +00:00
Douglas Katzman 87da5f47ac [Myriad]: better compatibility with vendor source
- Accept ma{2100,2150,2150} for -mcpu
- Define more preprocessor macros
- Don't append "le/" to little-endian lib dirs

llvm-svn: 276646
2016-07-25 16:36:02 +00:00
Alexander Kornienko c5e509316a MPI-Checker: move MPIFunctionClassifier.h
Summary:
This patch moves the MPIFunctionClassifier header to `clang/include/clang/StaticAnalyzer/Checkers`,
in order to make it accessible in other parts of the architecture.

Reviewers: dcoughlin, zaks.anna

Subscribers: alexfh, cfe-commits

Patch by Alexander Droste!

Differential Revision: https://reviews.llvm.org/D22671

llvm-svn: 276639
2016-07-25 15:27:16 +00:00
Jonas Hahnfeld ebf866213c Update description for CLANG_DEFAULT_CXX_STDLIB and add comment. NFC
We agreed to call it "platform default" instead of "architecture default".
(see D17286)

llvm-svn: 276618
2016-07-25 08:04:26 +00:00
David Majnemer 0ed275c773 Update test to account for r276604
llvm-svn: 276607
2016-07-25 04:47:45 +00:00
David Majnemer d5f7d19dc8 [MSVCToolChain] Guard hardcoded Windows paths with LLVM_ON_WIN32
Paths like C:/foo will never work on UNIX platforms, don't bother
implicitly adding them to the search path.

llvm-svn: 276606
2016-07-25 04:47:44 +00:00
George Burgess IV 21081364f8 [Sema] Replace mem_fn with lambdas. NFC.
I'm told that some optimizers like lambdas a lot more than mem_fn.
Given that the readability difference is basically nil, and we seem to
use lambdas basically everywhere else, it seems sensible to just use
lambdas.

llvm-svn: 276577
2016-07-24 23:12:40 +00:00
David Majnemer 85c25b4d50 [Driver] Switch some getenv calls to llvm::sys::Process::GetEnv
No functional change is intended.

llvm-svn: 276573
2016-07-24 17:44:03 +00:00
Craig Topper 351ed42795 [X86] Block pbroadcastq instructions on 32-bit targets instead of pbroadcastb.
Thanks to Simon Pilgrim for catching the mistake.

llvm-svn: 276564
2016-07-24 14:58:06 +00:00
Artem Dergachev 7929bf22fb [analyzer] Pring LocationContext in ExplodedGraph dumps.
Remove some FIXMEs in the surrounding code,
which have been addressed long time ago
by introducing checker-specific tags.

Differential Revision: https://reviews.llvm.org/D22622

llvm-svn: 276557
2016-07-24 08:15:58 +00:00
Xinliang David Li b65f8ae9e8 [Profile] Use a flag to enable PGO rather than the profraw filename
Patch by Jake VanAdrighem

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

llvm-svn: 276517
2016-07-23 04:28:59 +00:00
Faisal Vali c6b9be29f2 [cxx1z-constexpr-lambda] Make a lambda's closure type eligible as a literal-type in C++1z
Additionally, for pre-C++1z, instead of forbidding a lambda's closure type from being a literal type through circumlocutorily setting HasNonLiteralTypeFieldsOrBases falsely to true -- handle lambda's more directly in CXXRecordDecl::isLiteral().

One additional small step towards implementing constexpr-lambdas.

Thanks to Richard Smith for his review! 
https://reviews.llvm.org/D22662

llvm-svn: 276514
2016-07-23 04:05:19 +00:00
Richard Smith cec363527e Work around MSVC's lack of support for unrestricted unions by making this
struct a bit bigger under MSVC (this shouldn't be a big deal; we typically
allocate no more than two of these at a time, on the stack).

llvm-svn: 276509
2016-07-23 02:39:52 +00:00
Richard Smith c7bf3805a1 Add -fmodules-ts flag to cc1 for the provisional C++ modules TS, and mark
'module' and 'import' as keywords when the flag is specified.

llvm-svn: 276508
2016-07-23 02:32:21 +00:00
Ekaterina Romanova a84c24f39c Add doxygen comments to emmintrin.h's intrinsics.
Only around 50% of the intrinsics in this file are documented now. The patches for the rest of the intrisics in this file will be send out later.

The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Paul Robinson.

llvm-svn: 276499
2016-07-22 23:49:37 +00:00
Richard Smith bdb84f374c P0217R3: Parsing support and framework for AST representation of C++1z
decomposition declarations.

There are a couple of things in the wording that seem strange here:
decomposition declarations are permitted at namespace scope (which we partially
support here) and they are permitted as the declaration in a template (which we
reject).

llvm-svn: 276492
2016-07-22 23:36:59 +00:00
Xinliang David Li b7b335a2ce [Profile] Enable profile merging with -fprofile-generat[=<dir>]
This patch enables raw profile merging for this option which is the
new intended behavior.

llvm-svn: 276484
2016-07-22 22:25:01 +00:00
Vassil Vassilev 19765fb68c [modules] Teach the ASTWriter to ignore mutations coming from the ASTReader.
Processing update records (and loading a module, in general) might trigger
unexpected calls to the ASTWriter (being a mutation listener). Now we have a
mechanism to suppress those calls to the ASTWriter but notify other possible
mutation listeners.

Fixes https://llvm.org/bugs/show_bug.cgi?id=28332

Patch by Cristina Cristescu and me.

Reviewed by Richard Smith (D21800).

llvm-svn: 276473
2016-07-22 21:08:24 +00:00
Vassil Vassilev 462a5328dd Add regression test for PR27699.
llvm-svn: 276469
2016-07-22 20:49:31 +00:00
Pirama Arumuga Nainar 98eaa62e36 Add .rgba syntax extension to ext_vector_type types
Summary:
This patch enables .rgba accessors to ext_vector_type types and adds
tests for syntax validation and code generation.

'a' and 'b' can appear either in the point access mode or the numeric
access mode (for indices 10 and 11).  To disambiguate between the two
usages, the accessor type is explicitly passed to relevant methods.

Reviewers: rsmith

Subscribers: Anastasia, bader, srhines, cfe-commits

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

llvm-svn: 276455
2016-07-22 18:49:43 +00:00
Anna Thomas 142ea99832 Clang changes for overloading invariant.start and end intrinsics
This change depends on the corresponding LLVM change at:
https://reviews.llvm.org/D22519

The llvm.invariant.start and llvm.invariant.end intrinsics currently
support specifying invariant memory objects only in the default address
space.

With this LLVM change, these intrinsics are overloaded for any adddress space
for memory objects and we can use these llvm invariant intrinsics in
non-default address spaces.

Example: llvm.invariant.start.p1i8(i64 4, i8 addrspace(1)* %ptr)

This overloaded intrinsic is needed for representing final or invariant
memory in managed languages.

llvm-svn: 276448
2016-07-22 17:50:08 +00:00
Anna Thomas b772151a17 test commit. update comment grammatically. NFC
llvm-svn: 276425
2016-07-22 15:37:56 +00:00
Simon Pilgrim 2d8517303c [X86][AVX] Added support for lowering to VBROADCASTF128/VBROADCASTI128 with generic IR
As discussed on D22460, I've updated the vbroadcastf128 pd256/ps256 builtins to map directly to generic IR - load+splat a 128-bit vector to both lanes of a 256-bit vector.

Fix for PR28657.

llvm-svn: 276417
2016-07-22 13:58:56 +00:00
Vedant Kumar 9fc15de174 [Coverage] Attempt to appease a Windows builder
The builder prints out the following IR:

  \5CCoverageMapping\5COutput\5Ctest\5Cf1.c

The updated test in r276367 expects path separators to be either '/' or
'\\', so it chokes on the unexpected "5C" stuff. I'm not sure what that
is, but I included a kludge that should work around it.

Failing bot:

  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/8718

llvm-svn: 276370
2016-07-22 00:25:09 +00:00
Vedant Kumar fe28a0fdd5 [Coverage] Strengthen a test case
We should be able to use `mkdir` without turning on `REQUIRES: shell`.
Moreover, this test should check for a path separator which precedes the
relative filename to make sure that absolute paths are being used.

llvm-svn: 276367
2016-07-22 00:00:02 +00:00
Devin Coughlin f57f90dfd1 [analyzer] Add checker modeling potential C++ self-assignment
This checker checks copy and move assignment operators whether they are
protected against self-assignment. Since C++ core guidelines discourages
explicit checking for `&rhs==this` in general we take a different approach: in
top-frame analysis we branch the exploded graph for two cases, where &rhs==this
and &rhs!=this and let existing checkers (e.g. unix.Malloc) do the rest of the
work. It is important that we check all copy and move assignment operator in top
frame even if we checked them already since self-assignments may happen
undetected even in the same translation unit (e.g. using random indices for an
array what may or may not be the same).

This reapplies r275820 after fixing a string-lifetime issue discovered by the
bots.

A patch by Ádám Balogh!

Differential Revision: https://reviews.llvm.org/D19311

llvm-svn: 276365
2016-07-21 23:42:31 +00:00
Wolfgang Pieb 24e03341af Reverting r275115 which caused PR28634.
When empty (forwarding) basic blocks that are referenced by user labels
are removed, incorrect code may be generated.

llvm-svn: 276361
2016-07-21 23:28:18 +00:00
Xinliang David Li 9081de2e32 [profile] update test case with interface change.
See http://reviews.llvm.org/D22613, http://reviews.llvm.org/D22614

llvm-svn: 276356
2016-07-21 23:19:39 +00:00
David Majnemer e7287717cb [Sema] Handle errors during rewriteBuiltinFunctionDecl
rewriteBuiltinFunctionDecl can encounter errors when performing
DefaultFunctionArrayLvalueConversion.  These errors were not handled
which led to a null pointer dereference.

This fixes PR28651.

llvm-svn: 276352
2016-07-21 23:03:43 +00:00
Erik Pilkington 1ac8adfcab [CodeGen] Fix a crash when constant folding switch statement
Differential revision: https://reviews.llvm.org/D22542

llvm-svn: 276350
2016-07-21 22:31:40 +00:00
Reid Kleckner 07915f6cb0 Disable a flaky test on Windows that uses "echo >>"
llvm-svn: 276335
2016-07-21 21:07:47 +00:00
Adrian McCarthy ab1e786503 Reroll "Include unreferenced nested types in member list only for CodeView"
Another attempt at r276271, hopefully without breaking ModuleDebugInfo test.

llvm-svn: 276317
2016-07-21 18:43:20 +00:00
Benjamin Kramer 018b6d4ee4 Move some IntrusiveRefCntPtrs instead of copying.
No functionality change intended.

llvm-svn: 276292
2016-07-21 15:06:51 +00:00
Adrian McCarthy a9a89ae77f Revert "Include unreferenced nested types in member list only for CodeView"
Patch broke ModuleDebugInfo test on the build bots (but not locally).  Again.

svn revision:  r276271

This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d.

llvm-svn: 276279
2016-07-21 13:41:25 +00:00
Adrian McCarthy e89c62a102 Include unreferenced nested types in member list only for CodeView
Unreferenced nested structs and classes were omitted from the debug info.  In DWARF, this was intentional, to avoid bloat.  But for CodeView, we want this information to be consistent with what Microsoft tools would produce and expect.

llvm-svn: 276271
2016-07-21 13:16:14 +00:00
Yaron Keren 7996340d9f Provide __GLIBCXX_TYPE_INT_N_0 and __GLIBCXX_BITSIZE_INT_N_0 when in C++ gnu language extensions.
These are used by libstdc++ <type_traits> for is_integral<__int128>. 
Addresses http://llvm.org/pr23156.

llvm-svn: 276252
2016-07-21 07:44:41 +00:00
Craig Topper fe22d59a84 [Sema,X86] Add explicit check to ensure that builtins that require x86-64 target throw an error if used on 32-bit target.
If these builtins are allowed to go through on a 32-bit target they will fire assertions in the backend.

Fixes PR28635.

llvm-svn: 276250
2016-07-21 07:38:43 +00:00
Craig Topper 45db56c375 [X86] Add missing __x86_64__ qualifiers on a bunch of intrinsics that assume 64-bit GPRs are available.
Usages of these intrinsics in a 32-bit build results in assertions in the backend.

llvm-svn: 276249
2016-07-21 07:38:39 +00:00
Davide Italiano b99fabd4ec [CodeGen] Handle recursion in LLVMIRGeneration Timer.
This can happen when emitting a local decl, which triggers
loading a decl imported from an AST file, which we then
hand to the AST consumer. Timer is not allowed to recurse
so an assertion fire. Keep a reference counter to avoid this
problem. LGTM'd by Richard Smith on IRC.

Differential Revision:  https://reviews.llvm.org/D20748

llvm-svn: 276242
2016-07-21 06:28:48 +00:00
George Burgess IV 92b43a462e [Sema] Fix PR28623.
In atomic builtins, we assumed that the LValue conversion on the first
argument would succeed. So, we would crash given code like:

```
void ovl(char);
void ovl(int);
__atomic_store_n(ovl, 0, 0);
```

This patch makes us not assume that said conversion is successful. :)

llvm-svn: 276232
2016-07-21 03:28:13 +00:00
Xinliang David Li 7cd5e38d75 [Profile] Document new profile file name modifiers
Differential Revision: http://reviews.llvm.org/D22593

llvm-svn: 276207
2016-07-20 23:32:50 +00:00
Kelvin Li 986330c190 [OpenMP] Sema and parsing for 'target simd' pragma
This patch is to implement sema and parsing for 'target simd' pragma.

Differential Revision: https://reviews.llvm.org/D22479

llvm-svn: 276203
2016-07-20 22:57:10 +00:00
Richard Smith 423f46f2d8 Fix memory leak introduced in r276159.
llvm-svn: 276188
2016-07-20 21:38:26 +00:00
John McCall 4c7718d51b When copying an array into a lambda, destroy temporaries from
the copy-constructor immediately and enter a partial array
cleanup for previously-copied elements.

Fixes PR28595.

llvm-svn: 276180
2016-07-20 21:02:43 +00:00
Kelvin Li ad9ecbab42 [OpenMP] Allow negative lower bound in array sections based on pointers
OpenMP 4.5 removed the restriction that array section lower bound must be non negative.
This change is to allow negative values for array section based on pointers.
For array section based on array type there is still a restriction: "The array section must be a subset of the original array."

Patch by David S.

Differential Revision: https://reviews.llvm.org/D22481

llvm-svn: 276177
2016-07-20 20:45:29 +00:00
Kelvin Li 4f161cf1c2 [OpenMP] Ignore parens in atomic capture
Clang misdiagnoses atomic captures cases that contains parens.
i.e.

  int v, int *p;
#pragma omp atomic capture
{ v = (*p); (*p)++; }

Patch by David S.

Differential Revision: https://reviews.llvm.org/D22487

llvm-svn: 276167
2016-07-20 19:41:17 +00:00
Yaxun Liu 37ceedeabd [OpenCL] AMDGCN target will generate images in constant address space
Allows AMDGCN target to generate images (such as %opencl.image2d_t) in constant address space.
Images will still be generated in global address space by default.

Added tests to existing opencl-types.cl in test\CodeGenOpenCL.

Patch by Aaron En Ye Shi.

Differential Revision: https://reviews.llvm.org/D22523

llvm-svn: 276161
2016-07-20 19:21:11 +00:00
Richard Smith dc1f042171 [modules] Don't emit initializers for VarDecls within a module eagerly whenever
we first touch any part of that module. Instead, defer them until the first
time that module is (transitively) imported. The initializer step for a module
then recursively initializes modules that its own headers imported.

For example, this avoids running the <iostream> global initializer in programs
that don't actually use iostreams, but do use other parts of the standard
library.

llvm-svn: 276159
2016-07-20 19:10:16 +00:00
Richard Smith 3b24b808a7 Fix modules self-host: add missing include and forward-decl.
llvm-svn: 276152
2016-07-20 18:28:19 +00:00
Reid Kleckner 8ad06d6546 [MS] Improve VPtrInfo field names and doc comments
'ReusingBase' was a terrible name. It might actually refer to the most
derived class, which is not a base. 'BaseWithVPtr' was also bad, since
again, it could refer to the most derived class. It was actually the
first base to introduce the vptr, so now it is 'IntroducingObject'.

llvm-svn: 276120
2016-07-20 14:40:25 +00:00
Simon Pilgrim e3b9ee0645 [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR
D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead.

It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match).

This patch changes both scalar and packed versions back to using x86-specific builtins.

It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding.

Differential Revision: https://reviews.llvm.org/D22105

llvm-svn: 276102
2016-07-20 10:18:01 +00:00
Akira Hatanaka 73118fd10e [Sema] Compute the nullability of a conditional expression based on the
nullabilities of its operands.

This patch defines a function to compute the nullability of conditional
expressions, which enables Sema to precisely detect implicit conversions
of nullable conditional expressions to nonnull pointers.

rdar://problem/25166556

Differential Revision: https://reviews.llvm.org/D22392

llvm-svn: 276076
2016-07-20 01:48:11 +00:00
Hubert Tong 286547a337 Revert r276069: MSVC bots not happy
llvm-svn: 276074
2016-07-20 01:05:31 +00:00
Hubert Tong 9aa955b3ae Fix r276069: add default argument for new parameter
llvm-svn: 276073
2016-07-20 00:57:56 +00:00
Hubert Tong 58dda5a716 Fix r276069: use LLVM_CONSTEXPR
llvm-svn: 276071
2016-07-20 00:41:30 +00:00
Hubert Tong 24ee98e4a5 Concepts: Create space for requires-clause in TemplateParameterList; NFC
Summary:
Space for storing the //constraint-expression// of the
//requires-clause// associated with a `TemplateParameterList` is
arranged by taking a bit out of the `NumParams` field for the purpose
of determining whether there is a //requires-clause// or not, and by
adding to the trailing objects tied to the `TemplateParameterList`. An
accessor is provided.

An appropriate argument is supplied to `TemplateParameterList::Create`
at the various call sites.

Serialization changes will addressed as the Concepts implementation
becomes more solid.

Drive-by fix:
This change also replaces the custom
`FixedSizeTemplateParameterListStorage` implementation with one that
follows the interface provided by `llvm::TrailingObjects`.

Reviewers: aaron.ballman, faisalv, rsmith

Subscribers: cfe-commits, nwilson

Differential Revision: https://reviews.llvm.org/D19322

llvm-svn: 276069
2016-07-20 00:30:15 +00:00
Bruno Cardoso Lopes 1383ddc40b [SemaObjC] Improve ObjCDictionaryLiteral and ObjCArryLiteral diagnostics
Sema actions on ObjCDictionaryLiteral and ObjCArryLiteral are currently
done as a side-effect of Sema upon parent expressions, which incurs of
delayed typo corrections for such literals to be performed by TypoTransforms
upon the ObjCDictionaryLiteral and ObjCArryLiteral themselves instead of
its elements individually.

This is specially bad because it was not designed to act on several
elements; searching through all possible combinations of corrections for
several elements is very expensive. Additionally, when one of the
elements has no correction candidate, we still explore all options and
at the end emit no typo corrections whatsoever.

Do the proper sema actions by acting on each element alone during appropriate
literal parsing time to get proper diagonistics and decent compile time
behavior.

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

rdar://problem/21046678

llvm-svn: 276020
2016-07-19 20:21:18 +00:00
David Majnemer 24547108d6 Let FuncAttrs infer the 'returned' argument attribute
This reverts commit r275756.

llvm-svn: 276014
2016-07-19 19:59:24 +00:00
Yaxun Liu f2e8ab2566 [OpenCL] Fixes bug of missing OCL version metadata on the AMDGCN target
Added the opencl.ocl.version metadata to be emitted with amdgcn. Created a static function emitOCLVerMD which is shared between triple spir and target amdgcn.

Also added new testcases to existing test file, spir_version.cl inside test/CodeGenOpenCL.

Patch by Aaron En Ye Shi.

Differential Revision: https://reviews.llvm.org/D22424

llvm-svn: 276010
2016-07-19 19:39:45 +00:00
Sylvestre Ledru d3078e7d06 Add support of the latest Ubuntu (Yakkety Yak - 16.10)
llvm-svn: 275975
2016-07-19 14:00:57 +00:00
Dmitry Polukhin 4a29007748 Fix for failing bot sanitizer-x86_64-linux-fast after r275970
More info http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/14774/steps/check-clang%20msan/logs/stdio

llvm-svn: 275974
2016-07-19 13:35:15 +00:00
Dmitry Polukhin ba57f02720 Deprecated (legacy) string literal conversion to 'char *' causes strange overloading resolution
It's a patch for PR28050. Seems like overloading resolution wipes out
the first standard conversion sequence (before user-defined conversion)
in case of deprecated string literal conversion.

Differential revision: https://reviews.llvm.org/D21228

Patch by Alexander Makarov

llvm-svn: 275970
2016-07-19 11:29:16 +00:00
Daniel Sanders 6a73883c48 [mips] Correct label prefixes for N32 and N64.
Summary:
N32 and N64 follow the standard ELF conventions (.L) whereas O32 uses its own
($).

This fixes the majority of object differences between -fintegrated-as and
-fno-integrated-as.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

Differential Revision: https://reviews.llvm.org/D22412

llvm-svn: 275967
2016-07-19 10:49:03 +00:00
Simon Atanasyan 603018af40 [driver][mips] Support MIPS targets in modern Android NDK
Initial patch provided by Duane Sand.

llvm-svn: 275949
2016-07-19 07:09:48 +00:00
Alexey Bataev e397812dcb [OPENMP] Removed loop statement as its body executes at most once, NFC.
Removed not required loop statement, addressing comments from Richard
Smith.

llvm-svn: 275947
2016-07-19 05:06:39 +00:00
Alexey Bataev 5140e748b5 [OPENMP] Improved processing of 'priority' clause, NFC.
Removed some old comments + improved handling of 'priority' clause value
during codegen after comments from Richard Smith.

llvm-svn: 275945
2016-07-19 04:21:09 +00:00
Samuel Antao b101838244 Append clang system include path for offloading tool chains.
Summary:
This patch adds clang system include path when offloading tool chains, e.g. CUDA, are used in the current compilation.

This fixes an issue detected by @rsmith in response to r275645.

Reviewers: rsmith, tra

Subscribers: rsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D22490

llvm-svn: 275931
2016-07-19 00:01:12 +00:00
Samuel Antao dab51bbd48 [OpenMP] Remove dead code in conditional of mappable expressions SEMA.
llvm-svn: 275930
2016-07-18 23:22:11 +00:00
Kelvin Li 9f645ae63b [OpenMP] Fix incorrect diagnostics in map clause
Having the following code pattern will result in incorrect diagnostic

int main() {
  int arr[10];
#pragma omp target data map(arr[:])
#pragma omp target map(arr)
  {}
}

t.cpp:4:24: error: original storage of expression in data environment is shared
      but data environment do not fully contain mapped expression storage
#pragma omp target map(arr)
                       ^~~
t.cpp:3:29: note: used here
#pragma omp target data map(arr[:])
                            ^~~~~~
1 error generated.


Patch by David S.

Differential Revision: https://reviews.llvm.org/D22075

llvm-svn: 275926
2016-07-18 22:49:16 +00:00
Richard Smith cb2ba5a5a7 Fix some minor issues found by Coverity.
llvm-svn: 275925
2016-07-18 22:37:35 +00:00
Vedant Kumar d04929d875 [Coverage] Remove '..' from filenames *after* getting an absolute path
Failure to do this breaks relative paths which begin with '..'.

This issue was caught by the (still nascent) coverage bot.

llvm-svn: 275924
2016-07-18 22:32:02 +00:00
Vedant Kumar 14f8fb6864 [Coverage] Normalize '..' out of filename strings
This fixes the issue of having duplicate entries for the same file in a
coverage report s.t none of the entries actually displayed the correct
coverage information.

llvm-svn: 275913
2016-07-18 21:01:27 +00:00
Bruno Cardoso Lopes d9b7dfe4a4 [Sema] Create a separate group for incompatible function pointer warning
Give incompatible function pointer warning its own diagnostic group
but still leave it as a subgroup of incompatible-pointer-types. This is in
preparation to promote -Wincompatible-function-pointer-types to error on
darwin.

Differential Revision: https://reviews.llvm.org/D22248

rdar://problem/12907612

llvm-svn: 275907
2016-07-18 20:37:06 +00:00
Mehdi Amini 320a5a615b Add missing header in ClangFuzzer (after r275882 cleanup)
llvm-svn: 275906
2016-07-18 20:33:09 +00:00
Bob Wilson 4cf27c4d6f Allow iOS and tvOS version numbers with 2-digit major version numbers.
rdar://problem/26921601

llvm-svn: 275905
2016-07-18 20:29:14 +00:00
Vedant Kumar bf51e703cf [Driver] Compute effective target triples once per job (NFCI)
Compute an effective target triple exactly once in ConstructJob(), and
then simply pass around references to it. This eliminates wasteful
re-computation of effective triples (e.g in getARMFloatABI()).

Differential Revision: https://reviews.llvm.org/D22290

llvm-svn: 275895
2016-07-18 19:56:38 +00:00
Vedant Kumar f2030b931c [Driver] Make Driver::DefaultTargetTriple private (NFCI)
No in-tree targets access this `DefaultTargetTriple` directly, and usage
of default triples is generally discouraged. Make the field private.

This is part of en effort to make the clang driver use effective triples
more pervasively.

Differential Revision: https://reviews.llvm.org/D22289

llvm-svn: 275894
2016-07-18 19:56:33 +00:00
Mehdi Amini 9670f847b8 [NFC] Header cleanup
Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

Differential Revision: https://reviews.llvm.org/D20100

llvm-svn: 275882
2016-07-18 19:02:11 +00:00
Devin Coughlin d2387432bb Revert "[analyzer] Add checker modeling potential C++ self-assignment"
This reverts commit r275820. It is failing on the bots.

llvm-svn: 275880
2016-07-18 18:57:50 +00:00
Yunzhong Gao fc611138eb Support -masm= flag for x86 assembly targets.
For assembly files without .intel_syntax or .att_syntax directives, allow the
-masm= flag to supply a default assembly dialect. For example,

C:\TMP> type intel.s
.text
mov al,0

C:\TMP> clang -masm=intel -c intel.s

Without this patch, one would need to pass an "-mllvm -x86-asm-syntax=" flag
directly to the backend.
C:\TMP> clang -mllvm --x86-asm-syntax=intel -c intel.s

Differentials Review: http://reviews.llvm.org/D22285

llvm-svn: 275877
2016-07-18 18:44:51 +00:00
Hans Wennborg 7e8f01adff docs/conf.py: update version to 4.0
llvm-svn: 275848
2016-07-18 18:13:08 +00:00
Hans Wennborg 60d06bfc4f Trunk release notes are now for 4.0.0
The 3.9 release are on the 3.9 branch.

llvm-svn: 275844
2016-07-18 18:05:19 +00:00
Reid Kleckner 0b6773e189 [clang-cl] Reinstate -gline-tables-only as a CoreOption while we sort out the fate of /Zd
llvm-svn: 275826
2016-07-18 17:49:40 +00:00
Devin Coughlin eea0737a34 [analyzer] Add checker modeling potential C++ self-assignment
This checker checks copy and move assignment operators whether they are
protected against self-assignment. Since C++ core guidelines discourages
explicit checking for `&rhs==this` in general we take a different approach: in
top-frame analysis we branch the exploded graph for two cases, where &rhs==this
and &rhs!=this and let existing checkers (e.g. unix.Malloc) do the rest of the
work. It is important that we check all copy and move assignment operator in top
frame even if we checked them already since self-assignments may happen
undetected even in the same translation unit (e.g. using random indices for an
array what may or may not be the same).

A patch by Ádám Balogh!

Differential Revision: https://reviews.llvm.org/D19311

llvm-svn: 275820
2016-07-18 17:23:30 +00:00
Paul Robinson f9ede1c2fa Release note for 'nodebug' on variables
llvm-svn: 275817
2016-07-18 17:19:12 +00:00
Kelvin Li 2cf4845a5f [OpenMP] update test cases for -std=c++11 compile
target_parallel_for_simd_collapse_messages.cpp and target_parallel_for_simd_ordered_messages.cpp give different diagnostic messages in compiling with -std=c++11. The test cases are updated to make it compatible.

Differential Revision: https://reviews.llvm.org/D22417

llvm-svn: 275805
2016-07-18 16:09:53 +00:00
NAKAMURA Takumi 966bde50c3 Revert r275678, "Revert "Revert r275027 - Let FuncAttrs infer the 'returned' argument attribute""
This reverts also r275029, "Update Clang tests after adding inference for the returned argument attribute"

It broke LTO build. Seems miscompilation.

llvm-svn: 275756
2016-07-18 03:23:25 +00:00
Saleem Abdulrasool f7e0e26d99 test: add missing triple to test
The test was relying on the default triple which may not be correct.  Explicitly
provide it a triple.  Should repair the windows on Linux builder.

llvm-svn: 275738
2016-07-17 22:54:42 +00:00
Saleem Abdulrasool 7093e21ea5 CodeGen: honour dllstorage on ObjC types
Add support for ObjC types to respect the DLLImport/DLLExport storage
annotations.  This only effects COFF output.  This would allow usage with
clang/C2, but not with clang/LLVM due to hard coded section names.

llvm-svn: 275737
2016-07-17 22:27:44 +00:00
Saleem Abdulrasool a088ad9721 CodeGen: whitespace, formatting cleanups, NFC
Format some code which was oddly formatted.  Use a bit of auto to make the code
more legible.  NFC.

llvm-svn: 275736
2016-07-17 22:27:41 +00:00
Saleem Abdulrasool e5f3eae854 CodeGen: whitespace cleanup, StringRef usage in ObjC EH type construction
Clean up some formatting issues and use a bit more StringRef based operations
instead of SmallStrings.  NFC.

llvm-svn: 275735
2016-07-17 22:27:38 +00:00
Richard Smith 5eb7e1bf18 Attempt to work around MSVC rejects-valid, round 2.
llvm-svn: 275730
2016-07-17 20:00:59 +00:00
Richard Smith a662e0f738 PR28589: attempt to work around MSVC rejects-valid.
llvm-svn: 275727
2016-07-17 19:24:51 +00:00
David Majnemer 58ed0f3a5c [CodeGen] Some assorted cleanups
No functional change, just some cleanups:
- Use auto when it is appropriate.
- There were some strange static_casts which were superfluous.
- Use range-based for loops when appropriate.
- The dyn_cast_or_null construct was used when null was impossible.

llvm-svn: 275699
2016-07-17 00:39:12 +00:00
Saleem Abdulrasool 10fd1ff56a CodeGen: use StringRefs more in ObjC class generation, NFC
Rather than building up a number of SmallString-s in order to construct a
std::string, use more StringRefs and construct the string once before use.  This
avoids unnecessary string constructions.  NFC.

llvm-svn: 275697
2016-07-16 22:42:06 +00:00
Saleem Abdulrasool bc2d9998ea CodeGen: simplify using a local variable, NFC
Add a couple of local variables for the class interface and the super class
interface.  This allows for the repeated access of the information to be cached
and makes the code simpler to understand.  NFC.

llvm-svn: 275696
2016-07-16 22:42:04 +00:00
Hal Finkel 81cdef31e6 Revert "Revert r275029 - Update Clang tests after adding inference for the returned argument attribute"
This reverts commit r275043 after reapplying the underlying LLVM commit.

llvm-svn: 275679
2016-07-16 07:22:09 +00:00
Sean Silva a834ff260a [Driver] Add flags for enabling both types of PGO Instrumentation
The flags:
Enable IR-level instrumentation -fprofile-generate or -fprofile-generate=
When applying profile data: -fprofile-use=/path/to/profdata

Patch by Jake VanAdrighem!

Differential Revision: https://reviews.llvm.org/D21823

llvm-svn: 275668
2016-07-16 02:54:58 +00:00
Eric Christopher 2a7248f06b Remove extra semi-colon. Fixes warning and Werror bots.
llvm-svn: 275655
2016-07-16 00:58:34 +00:00
Erik Pilkington 29099ded0c [ObjC] Implement @available in the Parser and AST
This patch adds a new AST node: ObjCAvailabilityCheckExpr, and teaches the
Parser and Sema to generate it. This node represents an availability check of
the form:

  @available(macos 10.10, *);

Which will eventually compile to a runtime check of the host's OS version. This
is the first patch of the feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

Differential Revision: https://reviews.llvm.org/D22171

llvm-svn: 275654
2016-07-16 00:35:23 +00:00
Richard Smith 21b3a032af Reimplement ExternalSemaSource delegation in terms of
MultiplexExternalSemaSource to remove one of the places that needs updating
every time the ExternalSemaSource interface changes.

llvm-svn: 275653
2016-07-16 00:35:14 +00:00
Samuel Antao 2f7b339731 Use std::string instead of StringRef when generating the auxiliar triple in the frontend tool.
llvm-svn: 275651
2016-07-16 00:15:56 +00:00
Samuel Antao 2fd32138ef Attempt to fix breakage caused by r275645 for Windows bots.
llvm-svn: 275650
2016-07-15 23:51:21 +00:00
Samuel Antao d06239d359 [CUDA][OpenMP] Create generic offload action
Summary:
This patch replaces the CUDA specific action by a generic offload action. The offload action may have multiple dependences classier in “host” and “device”. The way this generic offloading action is used is very similar to what is done today by the CUDA implementation: it is used to set a specific toolchain and architecture to its dependences during the generation of jobs.

This patch also proposes propagating the offloading information through the action graph so that that information can be easily retrieved at any time during the generation of commands. This allows e.g. the "clang tool” to evaluate whether CUDA should be supported for the device or host and ptas to easily retrieve the target architecture.

This is an example of how the action graphs would look like (compilation of a single CUDA file with two GPU architectures)
```
0: input, "cudatests.cu", cuda, (host-cuda)
1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
2: compiler, {1}, ir, (host-cuda)
3: input, "cudatests.cu", cuda, (device-cuda, sm_35)
4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_35)
5: compiler, {4}, ir, (device-cuda, sm_35)
6: backend, {5}, assembler, (device-cuda, sm_35)
7: assembler, {6}, object, (device-cuda, sm_35)
8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {7}, object
9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {6}, assembler
10: input, "cudatests.cu", cuda, (device-cuda, sm_37)
11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_37)
12: compiler, {11}, ir, (device-cuda, sm_37)
13: backend, {12}, assembler, (device-cuda, sm_37)
14: assembler, {13}, object, (device-cuda, sm_37)
15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {14}, object
16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {13}, assembler
17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda)
18: offload, "host-cuda (powerpc64le-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir
19: backend, {18}, assembler
20: assembler, {19}, object
21: input, "cuda", object
22: input, "cudart", object
23: linker, {20, 21, 22}, image
```
The changes in this patch pass the existent regression tests (keeps the existent functionality) and resulting binaries execute correctly in a Power8+K40 machine.

Reviewers: echristo, hfinkel, jlebar, ABataev, tra

Subscribers: guansong, andreybokhanko, tcramer, mkuron, cfe-commits, arpith-jacob, carlo.bertolli, caomhin

Differential Revision: https://reviews.llvm.org/D18171

llvm-svn: 275645
2016-07-15 23:13:27 +00:00
Argyrios Kyrtzidis d9849a972b [index] Create different USR if a property is a class property.
Avoids USR conflicts between class & instance properties of the same name.

llvm-svn: 275630
2016-07-15 22:18:19 +00:00
Richard Smith 13fb860c78 Revert r275481, r275490. This broke modules bootstrap.
llvm-svn: 275624
2016-07-15 21:33:46 +00:00
Matt Arsenault c7536a5d60 AMDGPU: Remove legacy ldexp builtin
llvm-svn: 275623
2016-07-15 21:33:06 +00:00
Matt Arsenault c86671da09 AMDGPU: Update for rsq intrinsic changes
llvm-svn: 275622
2016-07-15 21:33:02 +00:00
Richard Smith 3cbf3f1f59 Push alias-declarations and alias-template declarations into scope even if
they're redeclarations. This is necessary in order for name lookup to correctly
find the most recent declaration of the name (which affects default template
argument lookup and cross-module merging, among other things).

llvm-svn: 275612
2016-07-15 20:53:25 +00:00
Saleem Abdulrasool 511f2e5a89 Sema: support __declspec(dll*) on ObjC interfaces
Extend the __declspec(dll*) attribute to cover ObjC interfaces.  This was
requested by Microsoft for their ObjC support.  Cover both import and export.
This only adds the semantic analysis portion of the support, code-generation
still remains outstanding.  Add some basic initial documentation on the
attributes that were previously empty.  Tweak the previous tests to use the
relative expected-warnings to make the tests easier to read.

llvm-svn: 275610
2016-07-15 20:41:10 +00:00
Argyrios Kyrtzidis 4278047f64 [test/objcmt] Add a follow-up test case for r275600.
llvm-svn: 275609
2016-07-15 20:40:24 +00:00