Commit Graph

44560 Commits

Author SHA1 Message Date
David Majnemer c2406d46b8 [Sema] Don't artificially forbid BuiltinTemplateDecls in CheckTemplateArgument
After thinking about it, we don't really need to forbid
BuiltinTemplateDecls explicitly.  The restriction doesn't really buy us
anything.

llvm-svn: 275078
2016-07-11 17:09:56 +00:00
Eric Liu 4f8d99433d Make tooling::applyAllReplacements return llvm::Expected<string> instead of empty string to indicate potential error.
Summary:
return llvm::Expected<> to carry error status and error information.
This is the first step towards introducing "Error" into tooling::Replacements.

Reviewers: djasper, klimek

Subscribers: ioeric, klimek, cfe-commits

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

llvm-svn: 275062
2016-07-11 13:53:12 +00:00
Anastasia Stulova 4d85003964 [OpenCL] Improved diagnostics of OpenCL types.
- Changes diagnostics for Blocks to be implicitly
const qualified OpenCL v2.0 s6.12.5.

 - Added and unified diagnostics of some OpenCL special types:
blocks, images, samplers, pipes. These types are intended for use
with the OpenCL builtin functions only and, therefore, most regular
uses are not allowed including assignments, arithmetic operations,
pointer dereferencing, etc.

Review: http://reviews.llvm.org/D21989
llvm-svn: 275061
2016-07-11 13:46:02 +00:00
Craig Topper 4d61a3c2d8 [AVX512] Replace masked AND/OR/XOR intrinsics with native code and remove the builtins.
llvm-svn: 275049
2016-07-11 06:14:18 +00:00
David Majnemer f580dd98cb [Sema] Disallow __make_integer_seq from showing up in __make_integer_seq
We hit over stringent asserts when trying to diagnose.  Loosen them as
appropriate.

This fixes PR28494.

llvm-svn: 275047
2016-07-11 05:59:24 +00:00
David Majnemer 60e5bdc470 [CodeGen] Treat imported static local variables as declarations
Imported variables cannot really be definitions for the purposes of
IR generation.

llvm-svn: 275040
2016-07-11 04:28:21 +00:00
Saleem Abdulrasool 37bf71828b Reapply SVN r274797.
Original Commit Message

    Driver: Stop linking to C++ when using sanitizers on Darwin

    Sanitizers on Darwin are built as dynamic libraries, not static libraries.
    Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB)
    in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static,
    linking against C++ when enabling a sanitizer becomes over linkage.

    Patch by Dave Lee!

llvm-svn: 275032
2016-07-10 23:24:36 +00:00
Jan Vesely d7e03a5bd9 AMDGPU: Export workitem builtins
Reviewers: tstellardAMD

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

llvm-svn: 275030
2016-07-10 22:38:04 +00:00
Craig Topper 8a62061e37 [AVX512] Remove masked shufps/shudpd builtins. These are all handled with __builtin_shufflevector.
llvm-svn: 275018
2016-07-10 16:35:54 +00:00
Craig Topper 6e76fb61a7 [X86] Use __butilin_shufflevector for 512-bit shufps intrinsics.
llvm-svn: 275012
2016-07-10 05:57:21 +00:00
Sean Silva 9ac6ae2a99 Delete dead code.
We were just setting DisableUnitAtATime to its default value.

llvm-svn: 275005
2016-07-10 00:57:52 +00:00
David Majnemer 58fab355e2 [clang-cl] Add support for /Zd
MASM (ML.exe and ML64.exe) and older versions of MSVC (CL.exe) support a
flag called /Zd which is more-or-less -gline-tables-only.

It seems nicer to support this flag instead of exposing
-gline-tables-only.

llvm-svn: 274991
2016-07-09 21:49:16 +00:00
David Majnemer 177553511d [MS ABI] Some code cleanups
Don't create unnecessary truncations if the result will not be used.
Also prefer preforming math before the truncation, it makes it a little
easier to reason about.

llvm-svn: 274984
2016-07-09 19:26:25 +00:00
Martin Probst 2a19454a86 clang-format: [JS] Sort imports case insensitive.
Summary: ASCII case sorting does not help finding imported symbols quickly, and it is common to have e.g. class Foo and function fooFactory exported/imported from the same file.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 274977
2016-07-09 15:11:18 +00:00
Martin Probst a8c9d154b8 clang-format: [JS] support trailing commas in imports.
Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 274976
2016-07-09 15:09:22 +00:00
Benjamin Kramer 6ec90ec2ab [analyzer] Older version of GCC 4.7 crash on lambdas in default arguments.
llvm-svn: 274975
2016-07-09 12:16:58 +00:00
Benjamin Kramer 951a6287c7 [analyzer] Rewrite manual erase loop using remove_if.
No functionality change intended.

llvm-svn: 274974
2016-07-09 11:16:56 +00:00
Craig Topper 95b61b0544 [X86] Use __builtin_ia32_vec_ext_v4hi and __builtin_ia32_vec_set_v4hi to implement pextrw/pinsertw MMX intrinsics instead of trying to use native IR.
Without this we end up generating code that doesn't use mmx registers and probably doesn't work well with other mmx intrinsics.

llvm-svn: 274968
2016-07-09 05:30:41 +00:00
Saleem Abdulrasool 0295f8ce39 CodeGen: tweak CFString section for COFF, ELF
Place the structure data into `cfstring`.  This both isolates the structures to
permit coalescing in the future (by the linker) as well as ensures that it
doesnt get marked as read-only data.  The structures themselves are not
read-only, only the string contents.

llvm-svn: 274956
2016-07-09 01:59:51 +00:00
Vassil Vassilev 1002373946 Teach -ast-print to print constexpr variables.
Patch reviewed by Richard Smith (D22168).

llvm-svn: 274930
2016-07-08 21:09:08 +00:00
Yaxun Liu 79c99fb7eb [OpenCL] Add missing -cl-no-signed-zeros option into driver
Add OCL option -cl-no-signed-zeros to driver options.

Also added to opencl.cl testcases.

Patch by Aaron En Ye Shi.

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

llvm-svn: 274923
2016-07-08 20:28:29 +00:00
Vassil Vassilev cdaa31fe84 Don't crash when printing auto variables.
Patch by Axel Naumann!

llvm-svn: 274859
2016-07-08 16:04:22 +00:00
Alexey Bader c813c8113d [OpenCL] Fix access qualifiers handling for typedefs
OpenCL s6.6: "Access qualifier must be used with image object arguments
of kernels and of user-defined functions [...] If no qualifier is
provided, read_only is assumed".

This does not define the behavior for image types used in typedef
declaration, but following the spec logic, we should allow access
qualifiers specification in typedefs, e.g.:

  typedef write_only image1d_t img1d_wo;

Unlike cv-qualifiers, user cannot add access qualifier to a typedef
type, i.e. this is not allowed:

  typedef image1d_t img1d; // note: previously declared 'read_only' here
  void foo(write_only img1d im) {} // error: multiple access qualifier

Patch by Andrew Savonichev.
Reviewers: Anastasia Stulova.

Differential revision: http://reviews.llvm.org/D20948

llvm-svn: 274858
2016-07-08 15:34:59 +00:00
Alexander Kornienko ff2046a93e CFGBuilder: Fix crash when visiting a range-based for over a dependent type
Summary:
CFG generation is expected to fail in this case, but it should not crash.

Also added a test that reproduces the crash.

Reviewers: klimek

Subscribers: cfe-commits

Patch by Martin Boehme!

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

llvm-svn: 274834
2016-07-08 10:50:51 +00:00
Craig Topper a1bee4398c [X86] Remove dead builtins that don't exist in the backend intrinsic file and don't have custom handling in CGBuiltins.cpp either.
llvm-svn: 274825
2016-07-08 05:11:47 +00:00
Craig Topper f2f1a099a7 [CodeGen] Use llvm::Type::getVectorNumElements instead of casting to llvm::VectorType and calling getNumElements. This is equivalent and shorter.
llvm-svn: 274823
2016-07-08 02:17:35 +00:00
Craig Topper 0160063aeb [X86] Reuse existing lambda and remove unnecessary argument from vector cmp builtin handling. NFC
llvm-svn: 274821
2016-07-08 01:57:24 +00:00
Craig Topper 925ef0a135 [X86] Remove a couple calls to create V2F64 and V4F32 types for builtin handling. Just get the type from the operand of the builtin instead. NFC
llvm-svn: 274820
2016-07-08 01:48:44 +00:00
Devin Coughlin cad622742e [analyzer] Add rudimentary handling of AtomicExpr.
This proposed patch adds crude handling of atomics to the static analyzer.
Rather than ignore AtomicExprs, as we now do, this patch causes the analyzer
to escape the arguments. This is imprecise -- and we should model the
expressions fully in the future -- but it is less wrong than ignoring their
effects altogether.

This is rdar://problem/25353187

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

llvm-svn: 274816
2016-07-08 00:53:18 +00:00
Saleem Abdulrasool c61723f73e Revert "Driver: Stop linking to C++ when using sanitizers on Darwin"
This reverts SVN r274797.  It broke the Green Dragon bot.  Revert it until the
failure can be addressed.

llvm-svn: 274814
2016-07-08 00:37:31 +00:00
Vedant Kumar 3339c568c4 [Lex] Speed up updateConsecutiveMacroArgTokens (NFC)
SM.isWrittenInSameFile() calls getFileID(), which can be expensive.
Move this check behind some cheaper filters.

llvm-svn: 274800
2016-07-07 22:38:29 +00:00
Simon Pilgrim 13dff57849 Update switch statement to match coding standards.
llvm-svn: 274799
2016-07-07 22:32:26 +00:00
Saleem Abdulrasool a1a36c85df Driver: Stop linking to C++ when using sanitizers on Darwin
Sanitizers on Darwin are built as dynamic libraries, not static libraries.
Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB)
in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static,
linking against C++ when enabling a sanitizer becomes over linkage.

Patch by Dave Lee!

llvm-svn: 274797
2016-07-07 21:42:29 +00:00
Chad Rosier 4c077aaabb [AArch64] Change the preferred alignment for char and short.
This reinstates commits r273280 and r273289.

Original Review: http://reviews.llvm.org/D21414.

llvm-svn: 274791
2016-07-07 20:02:25 +00:00
Justin Lebar f39977112a [CUDA] s/OPT_nocuda_version_chec/OPT_no_cuda_version_check/.
Fix build breakage.

llvm-svn: 274782
2016-07-07 18:24:28 +00:00
Justin Lebar c43ad9ee5a [CUDA] Check that our CUDA install supports the requested architectures.
Summary:
Raise an error if you're using a CUDA installation that's too old for
the requested architectures.  In practice, this means that you need a
CUDA 8 install to compile for sm_6*.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274781
2016-07-07 18:17:52 +00:00
Justin Bogner 2d5de7e568 NVPTX: Use the nvvm builtins to read SRegs rather than the legacy ptx ones
The ptx spellings were removed from LLVM in r274769.

llvm-svn: 274770
2016-07-07 16:41:08 +00:00
Chad Rosier 3e68af8f3d Revert "[AArch64] Change the preferred alignment for char and short to word alignment"
This reverts commit r273280 as the change was not properly approved.

llvm-svn: 274766
2016-07-07 16:37:19 +00:00
Simon Pilgrim 474c642172 Fix "not all control paths return a value" warning on MSVC
This time without causing a 'all enums handled' warning on other compilers.

llvm-svn: 274748
2016-07-07 11:24:38 +00:00
Simon Pilgrim c6db895ece Fix "not all control paths return a value" warning on MSVC
llvm-svn: 274746
2016-07-07 11:12:02 +00:00
Alexey Bataev be8b8b5bca [OPENMP] Do not create helper expressions in dependent contexts, NFC.
OpenMP relies on some helper expressions generated during semantic
analysis. But they are required only for codegen and not required in
dependent contexts. Patch removes generation of some of helper
expressions.

llvm-svn: 274745
2016-07-07 11:04:06 +00:00
David Majnemer 6fbeee307e [AST] Use ArrayRef in more interfaces
ArrayRef is a little better than passing around a pointer/length
pair.

No functional change is intended.

llvm-svn: 274732
2016-07-07 04:43:07 +00:00
Justin Lebar d9bc485cfe [CUDA] Fix "control reaches end of non-void function" warnings in Cuda.cpp.
Some compilers are too dumb to realize that the switch statement covers
all cases.

(Don't use a "default" label, because we explicitly want to get a warning
if our switch doesn't cover all the cases.)

llvm-svn: 274713
2016-07-07 01:06:59 +00:00
Adrian McCarthy 20128d94e5 Revert "Retry "Include debug info for nested structs and classes""
Reverting because it causes a test failure on build bots (Modules/ModuleDebugInfo.cpp).  Failure does not reproduce locally.

svn revision: rL274698

This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6.

llvm-svn: 274706
2016-07-06 23:28:34 +00:00
Adrian McCarthy 0a8cb648c9 Retry "Include debug info for nested structs and classes"
This should work now that the LLVM-side of the change has landed successfully.

Original Differential Revision: http://reviews.llvm.org/D21705

This reverts commit a30322e861c387e1088f47065d0438c6bb019879.

llvm-svn: 274698
2016-07-06 22:39:15 +00:00
Devin Coughlin 0a53fdf00c [analyzer] Suppress false positives in std::shared_ptr
The analyzer does not model C++ temporary destructors completely and so
reports false alarms about leaks of memory allocated by the internals of
shared_ptr:

  std::shared_ptr<int> p(new int(1));
  p = nullptr; // 'Potential leak of memory pointed to by field __cntrl_'

This patch suppresses all diagnostics where the end of the path is inside
a method in std::shared_ptr.

It also reorganizes the tests for suppressions in the C++ standard library
to use a separate simulated header for library functions with bugs
that were deliberately inserted to test suppression. This will prevent
other tests from using these as models.

rdar://problem/23652766

llvm-svn: 274691
2016-07-06 21:52:55 +00:00
Justin Lebar 4b926a29fd [CUDA] Add missing namespace qualification on CudaArch in Action.cpp.
Fix build breakage with MSVC.

llvm-svn: 274689
2016-07-06 21:45:44 +00:00
Justin Lebar 710c13167f [CUDA] Rename member variables in CudaInstallationDetector.
Summary:
Remove the "Cuda" prefix from these variables -- it's clear that they
related to CUDA given their containing type.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274682
2016-07-06 21:21:43 +00:00
Justin Lebar 629076178a [CUDA] Add utility functions for dealing with CUDA versions / architectures.
Summary:
Currently our handling of CUDA architectures is scattered all around
clang.  This patch centralizes it.

A key advantage of this centralization is that you can now write a C++
switch on e.g. CudaArch and get a compile error if you don't handle one
of the enum values.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274681
2016-07-06 21:21:39 +00:00
Justin Lebar ef1aaac3cc [CUDA] Add support for CUDA 8 and sm_60-62.
Summary: Also add sm_32, which was missing.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 274680
2016-07-06 21:21:14 +00:00