Commit Graph

52565 Commits

Author SHA1 Message Date
Sam McCall 3e4f5eb33c [CodeComplete] #include completion treats -I as non-system (require header-like extension).
llvm-svn: 343457
2018-10-01 11:56:42 +00:00
Fangrui Song 1d38c13f6e Use the container form llvm::sort(C, ...)
There are a few leftovers of rC343147 that are not (\w+)\.begin but in
the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them
to use the container form in this commit. The 12 occurrences have been
inspected manually for safety.

llvm-svn: 343425
2018-09-30 21:41:11 +00:00
Eric Fiselier 407584c433 Fix linkage error on ProgramPoint's dump method.
Currently, ProgramPoint::dump calls the out-of-line function ProgramPoint::print. This causes
libraries which include ProgramPoint.h to become dependent on libclangAnalysis, which in turn
causes missing symbol link error when building with -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_MODULES=ON.

The breakage was introduced in r343160.

This patch fixes the issues by moving ProgramPoint::dump's declaration out of line.

llvm-svn: 343420
2018-09-30 18:05:39 +00:00
Craig Topper 716e8e6858 [X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics
Summary:
This patch adds
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

We already had _mm_load_si64.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 343388
2018-09-29 17:49:42 +00:00
Erik Pilkington 6f11db1370 Support enums with a fixed underlying type in all language modes.
Previously we supported these in C++, ObjC, and C with -fms-extensions.

rdar://43831380

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

llvm-svn: 343360
2018-09-28 20:24:58 +00:00
Alexey Bataev bc52967835 [OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.
According to OpenMP, the reduction item must be shared in parent region.
But the item can be an array section or array subscript. In this case,
we should not check for the datasharing of the base declaration.

llvm-svn: 343356
2018-09-28 19:33:14 +00:00
George Karpenkov c82d457db5 [analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter
Differential Revision: https://reviews.llvm.org/D52640

llvm-svn: 343353
2018-09-28 18:49:41 +00:00
George Karpenkov c704f4fbd0 [analyzer] Provide an option to dump generated exploded graphs to a given file.
Dumping graphs instead of opening them is often very useful,
e.g. for transfer or converting to SVG.

Basic sanity check for generated exploded graphs.

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

llvm-svn: 343352
2018-09-28 18:49:21 +00:00
Richard Smith 8baa50013c [cxx2a] P0614R1: Support init-statements in range-based for loops.
We don't yet support this for the case where a range-based for loop is
implicitly rewritten to an ObjC for..in statement.

llvm-svn: 343350
2018-09-28 18:44:09 +00:00
Craig Topper 6ad9220067 [X86] Add the movbe instruction intrinsics from icc.
These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide website.

All the backend support is in place to pattern match a load+bswap or a bswap+store pattern to the MOVBE instructions. So we just need to get the frontend to emit the correct IR. The pointer arguments in icc are declared as void so I had to jump through a packed struct to forcing a specific alignment on the load/store. Same trick we use in the unaligned vector load/store intrinsics

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

llvm-svn: 343343
2018-09-28 17:09:51 +00:00
Saleem Abdulrasool f3a981e801 AST: add missing ObjC extensions to MS style name decoration
Add support for encoding type arguments for lightweight generics in
Objective-C++ mode.  Additionally, add support for the `__kindof` modifier.
This should complete the coverage of the ObjC extensions that clang currently
supports under the MS style name decoration scheme.

This is implemented similar to the Objective-C lifetime qualifiers decoration:
a template specialization in the `__ObjC` namespace so that we can interoperate
with Microsoft's tools as well as ensure that we do not accidentally collide
with new features in the Microsoft implementation.

Since the `__kindof` appertains to the type and not the pointer, we apply the
template specialization to the underlying type instead of the pointer type.

Unfortunately, until D52581 is resolved, the generated name is not really
compatible with the MS tools as well as breaks interoperability with
Objective-C++ and C++.

This resolves PR37754!

llvm-svn: 343338
2018-09-28 16:47:53 +00:00
Alexey Bataev a5178f5369 [DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

llvm-svn: 343335
2018-09-28 16:17:59 +00:00
Sam Parker d476cd304b [ARM] Prevent DSP and SIM32 being set for v6m
My previous change (rL340911) set the two features for architectures
>= 6, which wrongly includes v6m. Now set to >= 6 and not Cortex-M.

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

llvm-svn: 343309
2018-09-28 10:18:02 +00:00
Owen Pan cb5ffbed71 [ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping
It should respond to AfterFunction, not AfterControlStatement.

Fixes PR39067

llvm-svn: 343305
2018-09-28 09:17:00 +00:00
Richard Smith cff420120f Handle dependent class template names in class template argument
deduction for new-expressions.

llvm-svn: 343293
2018-09-28 03:18:53 +00:00
Richard Smith 9b2c5e7c44 [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
render the function deleted instead of rendering the program ill-formed.

This change also adds an enabled-by-default warning for the case where
an explicitly-defaulted special member function of a non-template class
is implicitly deleted by the type checking rules. (This fires either due
to this language change or due to pre-C++20 reasons for the member being
implicitly deleted). I've tested this on a large codebase and found only
bugs (where the program means something that's clearly different from
what the programmer intended), so this is enabled by default, but we
should revisit this if there are problems with this being enabled by
default.

llvm-svn: 343285
2018-09-28 01:16:43 +00:00
Richard Smith 864949bda1 [cxx2a] P0624R2: Lambdas with no capture-default are
default-constructible and assignable.

llvm-svn: 343279
2018-09-27 22:47:04 +00:00
George Karpenkov 6d229be5ec [analyzer] Hotfix for the bug in exploded graph printing
llvm-svn: 343276
2018-09-27 22:31:13 +00:00
Erik Pilkington 46420b6fee NFC: Fix some darwin linker warnings introduced in r338385
The darwin linker was complaining about Toolchains/RISCV.cpp and
Toolchains/Arch/RISCV.cpp had the same name. Fix is to just rename
Toolchains/RISCV.cpp to Toolchains/RISCVToolchain.cpp.

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

llvm-svn: 343263
2018-09-27 20:36:28 +00:00
Gheorghe-Teodor Bercea 8233af90e1 [OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode achieve coalescing
Summary: Set default schedule for parallel for loops to schedule(static, 1) when using SPMD mode on the NVPTX device offloading toolchain to ensure coalescing.

Reviewers: ABataev, Hahnfeld, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 343260
2018-09-27 20:29:00 +00:00
Patrick Lyster e653b63d83 Test commit. NFC
llvm-svn: 343258
2018-09-27 19:30:32 +00:00
Gheorghe-Teodor Bercea 02650d4c2c [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing
Summary: For the OpenMP NVPTX toolchain choose a default distribute schedule that ensures coalescing on the GPU when in SPMD mode. This significantly increases the performance of offloaded target code and reduces the number of registers used on the GPU side.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev, Hahnfeld

Subscribers: Hahnfeld, jholewinski, guansong, cfe-commits

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

llvm-svn: 343253
2018-09-27 19:22:56 +00:00
George Karpenkov 2b7682d1b4 [analyzer] Highlight nodes which have error reports in them in red in exploded graph
Differential Revision: https://reviews.llvm.org/D52584

llvm-svn: 343239
2018-09-27 17:26:41 +00:00
Jonas Hahnfeld a981f67bcd [OpenMP] Improve search for libomptarget-nvptx
When looking for the bclib Clang considered the default library
path first while it preferred directories in LIBRARY_PATH when
constructing the invocation of nvlink. The latter actually makes
more sense because during development it allows using a non-default
runtime library. So change the search for the bclib to start
looking in directories given by LIBRARY_PATH.
Additionally add a new option --libomptarget-nvptx-path= which
will be searched first. This will be handy for testing purposes.

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

llvm-svn: 343230
2018-09-27 16:12:32 +00:00
Eric Liu bb898704e9 [Tooling] Get rid of uses of llvm::Twine::str which is slow. NFC
llvm-svn: 343224
2018-09-27 14:50:24 +00:00
Kristof Umann e4f81ec366 Revert untintentionally commited changes
llvm-svn: 343205
2018-09-27 12:46:37 +00:00
Kristof Umann b416dbfb04 [Lex] TokenConcatenation now takes const Preprocessor
Differential Revision: https://reviews.llvm.org/D52502

llvm-svn: 343204
2018-09-27 12:40:16 +00:00
Martin Storsjo 0b339e4d80 [Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM
This fixes PR39090.

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

llvm-svn: 343184
2018-09-27 08:24:15 +00:00
Vitaly Buka 84ffd06f8b Revert "[DebugInfo] Generate debug information for labels."
This reverts commit r343148.

It crashes on sanitizer-x86_64-linux-autoconf.

llvm-svn: 343183
2018-09-27 08:15:24 +00:00
Martin Probst 3315aed44a clang-format: [JS] conditional types.
Summary:
This change adds some rudimentary support for conditional types.
Specifically it avoids breaking before `extends` and `infer` keywords,
which are subject to Automatic Semicolon Insertion, so breaking before
them creates incorrect syntax.

The actual formatting of the type expression is odd, but there is as of
yet no clear idea on how to format these.

See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#conditional-types.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 343179
2018-09-27 06:48:13 +00:00
Simon Atanasyan 0c0fb4b765 [driver][mips] Adjust target triple accordingly to provided ABI name
Explicitly selected MIPS ABI using the `-mabi` option implies
corresponding target triple. For 'O32' ABI it's a 32-bit target triple
like `mips-linux-gnu`. For 'N32' and 'N64' ABIs it's a 64-bit target
triple like `mips64-linux-gnu`. This patch adjusts target triple
accordingly these rules like we do for pseudo-target flags '-m64',
'-m32' etc already.

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

llvm-svn: 343169
2018-09-27 05:04:50 +00:00
George Karpenkov 27ec210fbd [analyzer] [NFC] Move the code for dumping the program point to ProgramPoint
So we can dump them outside of viewing the exploded grpah.

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

llvm-svn: 343160
2018-09-27 01:46:18 +00:00
George Karpenkov 4b9bb7cebb [analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue
Differential Revision: https://reviews.llvm.org/D52519

llvm-svn: 343159
2018-09-27 01:45:57 +00:00
Hsiangkai Wang 705121aaae [DebugInfo] Generate debug information for labels.
Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.

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

llvm-svn: 343148
2018-09-26 22:18:45 +00:00
Fangrui Song 55fab260ca llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: rsmith, #clang, dblaikie

Reviewed By: rsmith, #clang

Subscribers: mgrang, arphaman, kadircet, cfe-commits

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

llvm-svn: 343147
2018-09-26 22:16:28 +00:00
Richard Smith 79c88c3105 P1008R1 Classes with user-declared constructors are never aggregates in
C++20.

llvm-svn: 343131
2018-09-26 19:00:16 +00:00
Craig Topper fb5d9f2849 [X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set to false.
Previously we used a select and the zero_undef=true intrinsic. In -O2 this pattern will get optimized to zero_undef=false. But in -O0 this optimization won't happen. This results in a compare and cmov being wrapped around a tzcnt/lzcnt instruction.

By using the zero_undef=false intrinsic directly without the select, we can improve the -O0 codegen to just an lzcnt/tzcnt instruction.

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

llvm-svn: 343126
2018-09-26 17:01:44 +00:00
Oliver Stannard a30b48d020 [ARM/AArch64][v8.5A] Add Armv8.5-A target
This patch allows targetting Armv8.5-A from Clang. Most of the
implementation is in TargetParser, so this is mostly just adding tests.

Patch by Pablo Barrio!

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

llvm-svn: 343111
2018-09-26 14:20:29 +00:00
Simon Pilgrim 8d5f101e94 Removed extra semicolon to fix Wpedantic. (NFCI).
llvm-svn: 343085
2018-09-26 09:12:55 +00:00
Martin Probst cc525e7b8d clang-format: [JS] space after parameter naming.
Summary:
Previously:
    foo(/*bar=*/baz);

Now:
    foo(/*bar=*/ baz);

The run-in parameter naming comment is not intended in JS.

Reviewers: mboehme

Subscribers: cfe-commits

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

llvm-svn: 343080
2018-09-26 08:28:33 +00:00
Fangrui Song 47db633239 [Frontend] Tidy up -print-decl-contexts conditions
The existing conditions are not consistent. Some have braces and define a temporary Decl while others simply call `<< *cast<XXXDecl>(I)` (mostly the NamedDecl overload of operator<<).
Just use the latter for consistency and brevity.

llvm-svn: 343072
2018-09-26 06:28:14 +00:00
Richard Smith 12938cf899 P0859R0: List-initialization is potentially-constant-evaluated and
triggers instantiation of constexpr functions.

We mostly implemented this since Clang 6, but missed the template
instantiation case.

We do not implement the '&cast-expression' special case. It appears to
be a mistake / oversight. I've mailed CWG to see if we can remove it.

llvm-svn: 343064
2018-09-26 04:36:55 +00:00
Kelvin Li 1408f91a25 [OPENMP] Add support for OMP5 requires directive + unified_address clause
Add support for OMP5.0 requires directive and unified_address clause.
Patches to follow will include support for additional clauses.

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

llvm-svn: 343063
2018-09-26 04:28:39 +00:00
Artem Dergachev 69ece336b8 [analyzer] Fix a crash on casting symbolic pointers to derived classes.
Commit r340984 causes a crash when a pointer to a completely unrelated type
UnrelatedT (eg., opaque struct pattern) is being casted from base class BaseT to
derived class DerivedT, which results in an ill-formed region
Derived{SymRegion{$<UnrelatedT x>}, DerivedT}.

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

llvm-svn: 343051
2018-09-26 00:17:14 +00:00
Artem Dergachev e527df03c4 [analyzer] Add a testing facility for testing relationships between symbols.
Tests introduced in r329780 was disabled in r342317 because these tests
were accidentally testing dump infrastructure, when all they cared about was
how symbols relate to each other. So when dump infrastructure changed,
tests became annoying to maintain.

Add a new feature to ExprInspection: clang_analyzer_denote() and
clang_analyzer_explain(). The former adds a notation to a symbol, the latter
expresses another symbol in terms of previously denoted symbols.

It's currently a bit wonky - doesn't print parentheses and only supports
denoting atomic symbols. But it's even more readable that way.

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

llvm-svn: 343048
2018-09-25 23:50:53 +00:00
Erik Pilkington b794aec290 [Sema] Use a more civilized hash map to implement -Wduplicate-enum.
DenseMap<long, SOMETHING> used LONG_MAX as a tombstone, so it asserts
when you try to insert it!

rdar://44774672

llvm-svn: 343042
2018-09-25 22:53:06 +00:00
Richard Smith 4e966e8135 Don't emit "will be treated as an identifier character" warning for
UTF-8 characters that aren't identifier characters in the current
language mode.

llvm-svn: 343040
2018-09-25 22:34:45 +00:00
Kristina Brooks 34e24d5b6a Reland "[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`"
Relanding rL342883 with more fragmented tests to test ELF-specific
section emission separately from broad-scope CFString tests. Now this
tests the following separately

1). CoreFoundation builds and linkage for ELF while building it.
2). CFString ELF section emission outside CF in assembly output.
3). Broad scope `cfstring3.c` tests which cover all object formats at
    bitcode level and assembly level (including ELF). 

This fixes non-bridged CoreFoundation builds on ELF targets
that use -fconstant-cfstrings. The original changes from differential 
for a similar patch to PE/COFF (https://reviews.llvm.org/D44491) did not
check for an edge case where the global could be a constant which surfaced
as an issue when building for ELF because of different linkage semantics.

This patch addresses several issues with crashes related to CF builds on ELF
as well as improves data layout by ensuring string literals that back
the actual CFConstStrings end up in .rodata in line with Mach-O.

Change itself tested with CoreFoundation on Linux x86_64 but should be valid
for BSD-like systems as well that use ELF as the native object format.

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

llvm-svn: 343038
2018-09-25 22:27:40 +00:00
Artem Dergachev 0b7fdca640 [analyzer] NFC: CallDescription: Improve array management.
Combine the two constructor overrides into a single ArrayRef constructor
to allow easier brace initializations and simplify how the respective field
is used internally.

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

llvm-svn: 343037
2018-09-25 22:13:31 +00:00
Richard Smith 5c9b3b7576 P0969R0: allow structured binding of accessible members, not only public members.
llvm-svn: 343036
2018-09-25 22:12:44 +00:00