Commit Graph

75374 Commits

Author SHA1 Message Date
Bruno Cardoso Lopes 6fc8a564cf [Modules] Add imported modules to the output of -module-file-info
Fix a bug in the deserialization of IMPORTS section and allow for
imported modules to also be printed with -module-file-info.

rdar://problem/43867753

llvm-svn: 341902
2018-09-11 05:17:13 +00:00
Saleem Abdulrasool b69ce1fcd0 clang-check: rename the local FixItAction
Resolve the ambiguity in the FixItAction definition by renaming the type.  With
Xcode 9.2, you would fail to build this with:

  llvm/tools/clang/tools/clang-check/ClangCheck.cpp:183:48: error: reference to 'FixItAction' is ambiguous
      FrontendFactory = newFrontendActionFactory<FixItAction>();
                                                 ^

llvm-svn: 341877
2018-09-10 22:57:26 +00:00
Erik Pilkington 4257857bf8 [Sema][ObjC] Infer availability of +new from availability of -init.
When defined in NSObject, +new will call -init. If -init has been marked
unavailable, diagnose uses of +new.

rdar://18335828

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

llvm-svn: 341874
2018-09-10 22:20:09 +00:00
Erich Keane 33428d98f7 Fix test regression in r341862
The commit updates when AES is enabled, but failed to update the tests.
This patch fixes them.

llvm-svn: 341871
2018-09-10 21:57:53 +00:00
Erik Pilkington c587164422 [AST] Fix a crash on invalid.
Problem was that we were appending to the source location info buffer in the
copy assignment operator (instead of overwriting).

rdar://42746401

llvm-svn: 341869
2018-09-10 21:54:04 +00:00
Erich Keane 7582222691 Move AESNI generation to Skylake and Goldmont
The instruction set first appeared with Westmere, but not all processors
in that and the next few generations have the instructions. According to
Wikipedia[1], the first generation in which all SKUs have AES
instructions are Skylake and Goldmont. I can't find any Skylake,
Kabylake, Kabylake-R or Cannon Lake currently listed at
https://ark.intel.com that says "Intel® AES New Instructions" "No".

This matches GCC commit
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01940.html

[1] https://en.wikipedia.org/wiki/AES_instruction_set

Patch By: thiagomacieira
Differential Revision: https://reviews.llvm.org/D51510

llvm-svn: 341862
2018-09-10 21:12:21 +00:00
JF Bastien e77b48b078 Implement -Watomic-implicit-seq-cst
Summary:
_Atomic and __sync_* operations are implicitly sequentially-consistent. Some
codebases want to force explicit usage of memory order instead. This warning
allows them to know where implicit sequentially-consistent memory order is used.
The warning isn't on by default because _Atomic was purposefully designed to
have seq_cst as the default: the idea was that it's the right thing to use most
of the time. This warning allows developers who disagree to enforce explicit
usage instead.

A follow-up patch will take care of C++'s std::atomic. It'll be different enough
from this patch that I think it should be separate: for C++ the atomic
operations all have a memory order parameter (or two), but it's defaulted. I
believe this warning should trigger when the default is used, but not when
seq_cst is used explicitly (or implicitly as the failure order for cmpxchg).

<rdar://problem/28172966>

Reviewers: rjmccall

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 341860
2018-09-10 20:42:56 +00:00
Richard Smith 8eeb16f5d1 Enhance -Wc++14-compat for class template argument deduction to list the
deduced type (if known).

llvm-svn: 341858
2018-09-10 20:31:03 +00:00
Alexandre Ganea f8acd723e8 [clang-cl] Enable -march option
This change allows usage of -march when using the clang-cl driver. This is similar to MSVC's /arch; however -march can target precisely all supported CPUs, while /arch has a more restricted set.

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

llvm-svn: 341847
2018-09-10 17:54:32 +00:00
Adrian Prantl 05a623eb87 Remove all uses of DIFlagBlockByrefStruct
This patch removes the last reason why DIFlagBlockByrefStruct from
Clang by directly implementing the drilling into the member type done
in DwarfDebug::DbgVariable::getType() into the frontend.

rdar://problem/31629055

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

llvm-svn: 341842
2018-09-10 16:14:28 +00:00
Erich Keane 659c871a1b Prevent cpu-specific/cpu-dispatch from giong on a lambda.
It is non-sensical to use cpu-specific/cpu-dispatch multiversioning
on a lambda, so prevent it when trying to add the attribute.

llvm-svn: 341833
2018-09-10 14:31:56 +00:00
Kadir Cetinkaya a32d253f10 [clang] Make sure codecompletion is called for calls even when inside a token.
Summary:
Currently CodeCompleteCall only gets called after a comma or parantheses. This
patch makes sure it is called even at the cases like:
```foo(1^);```

Reviewers: ilya-biryukov, ioeric, hokein

Reviewed By: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 341824
2018-09-10 13:46:28 +00:00
Adam Balogh bf77ab7f0e [Analyzer] Commit fix for rL341790/rC341790
Test file was accidentally not added for rL341790/rC341790 and subsequant patches.

llvm-svn: 341795
2018-09-10 09:19:54 +00:00
Adam Balogh 2e7cb34d0f [Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, emplace and erase operations
This patch adds support for the following operations in the iterator checkers: assign, clear, insert, insert_after, emplace, emplace_after, erase and erase_after. This affects mismatched iterator checks ("this" and parameter must match) and invalidation checks (according to the standard).

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

llvm-svn: 341794
2018-09-10 09:07:47 +00:00
Adam Balogh 9a48ba6b4a [Analyzer] Iterator Checker - Part 7: Support for push and pop operations
This patch adds support for the following operations in the iterator checkers: push_back, push_front, emplace_back, emplace_front, pop_back and pop_front. This affects iterator range checks (range is extended after push and emplace and reduced after pop operations) and invalidation checks (according to the standard).

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

llvm-svn: 341793
2018-09-10 09:06:31 +00:00
Adam Balogh 3659f7a8a9 [Analyzer] Iterator Checker - Part 6: Mismatched iterator checker for constructors and comparisons
Extension of the mismatched iterator checker for constructors taking range of first..last (first and last must be iterators of the same container) and also for comparisons of iterators of different containers (one does not compare iterators of different containers, since the set of iterators is partially ordered, there are no relations between iterators of different containers, except that they are always non-equal).

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

llvm-svn: 341792
2018-09-10 09:05:31 +00:00
Adam Balogh 6b23b1a74f [Analyzer] Iterator Checker - Part 5: Move Assignment of Containers
If a container is moved by its move assignment operator, according to the standard all their iterators except the past-end iterators remain valid but refer to the new container. This patch introduces support for this case in the iterator checkers.

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

llvm-svn: 341791
2018-09-10 09:04:27 +00:00
Adam Balogh 21583b733a [Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for function parameters
New check added to the checker which checks whether iterator parameters of template functions typed by the same template parameter refer to the same container.

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

llvm-svn: 341790
2018-09-10 09:03:22 +00:00
Hans Wennborg 0aa0d91e98 ReleaseNotes: update links to use https
llvm-svn: 341786
2018-09-10 08:51:25 +00:00
Richard Smith 4576a77b80 PR33222: Require the declared return type not the actual return type to
match when checking for redeclaration of a function template.

This properly handles differences in deduced return types, particularly
when performing redeclaration checks for a friend function template.

llvm-svn: 341778
2018-09-10 06:35:32 +00:00
Richard Smith 4ced5d751b Part of PR33222: defer enforcing return type mismatch for dependent
friend function declarations of class templates.

llvm-svn: 341775
2018-09-10 05:32:13 +00:00
Kelvin Li bc38e63718 [OpenMP] Add support for nested 'declare target' directives
Add the capability to nest multiple declare target directives 
- including header files within a declare target region.

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

Patch by Patrick Lyster

llvm-svn: 341766
2018-09-10 02:07:09 +00:00
Fangrui Song aadc93c887 [Sema] Make typo correction slightly more efficient
edit_distance returns UpperBound+1 if the distance will exceed UpperBound. We can subtract 1 from UpperBound and change >= to > in the if condition. The threshold does not change but edit_distance will have more opportunity to bail out earlier.

llvm-svn: 341763
2018-09-09 17:20:03 +00:00
Hamza Sood fd1dc75b40 Fix build bots after a mistake in r341760
llvm-svn: 341761
2018-09-09 13:12:53 +00:00
Hamza Sood e05bf60631 [Tooling] Improve handling of CL-style options
This patch fixes the handling of clang-cl options in InterpolatingCompilationDatabase.
They were previously ignored completely, which led to a lot of bugs:

Additional options were being added with the wrong syntax. E.g. a file was
specified as C++ by adding -x c++, which causes an error in CL mode.

The args were parsed and then rendered, which means that the aliasing information
was lost. E.g. /W4 was rendered to -Wall, which in CL mode means -Weverything.

CL options were ignored when checking things like -std=, so a lot of logic was
being bypassed.

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

llvm-svn: 341760
2018-09-09 12:06:35 +00:00
Akira Hatanaka 9bd2452708 Revert r341754.
The commit broke a couple of bots:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12347
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/7310

llvm-svn: 341757
2018-09-09 05:22:49 +00:00
Fangrui Song c14cb73c54 [Parser] Remove an unnecessary `mutable`
llvm-svn: 341756
2018-09-09 01:54:18 +00:00
Nico Weber e2dd15785b ms: Insert $$Z in mangling between directly consecutive parameter packs.
Fixes PR38783.
Differential Revision: https://reviews.llvm.org/D51784

llvm-svn: 341755
2018-09-08 20:58:39 +00:00
Akira Hatanaka 2e00b98027 Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

rdar://problem/39352313

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

llvm-svn: 341754
2018-09-08 20:03:00 +00:00
Richard Smith da3729d1e6 Do not use optimized atomic libcalls for misaligned atomics.
Summary:
The optimized (__atomic_foo_<n>) libcalls assume that the atomic object
is properly aligned, so should never be called on an underaligned
object.

This addresses one of several problems identified in PR38846.

Reviewers: jyknight, t.p.northover

Subscribers: jfb, cfe-commits

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

llvm-svn: 341734
2018-09-07 23:57:54 +00:00
George Karpenkov 3310893288 [analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the class
Differential Revision: https://reviews.llvm.org/D51513

llvm-svn: 341724
2018-09-07 22:13:35 +00:00
George Karpenkov e4707e7a4a [analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics
(NB: could be a clang-tidy / analyzer check)

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

llvm-svn: 341723
2018-09-07 22:13:15 +00:00
George Karpenkov 5577cb70e1 [analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map
The "derived" symbols indicate children fields of a larger symbol.
As parents do not have pointers to their children, the garbage
collection algorithm the analyzer currently uses adds such symbols into
a "postponed" category, and then keeps running through the worklist
until the fixed point is reached.

The current patch rectifies that by instead using a helper map which
stores pointers from parents to children, so that no fixed point
calculation is necessary.

The current patch yields ~5% improvement in running time on sqlite.

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

llvm-svn: 341722
2018-09-07 22:07:57 +00:00
George Karpenkov 8a88c83593 Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests""""
This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6.

Hopefully fixing tests on Windows.

llvm-svn: 341719
2018-09-07 21:58:24 +00:00
Richard Smith edb9fbb78a Make -Watomic-alignment say whether the atomic operation was oversized
or misaligned.

llvm-svn: 341710
2018-09-07 21:24:27 +00:00
Richard Smith 8ed7776bc4 PR38870: Add warning for zero-width unicode characters appearing in
identifiers.

llvm-svn: 341700
2018-09-07 19:25:39 +00:00
Craig Topper ecf2e2fe31 [X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter
This is the clang side of D51803. The llvm intrinsic now returns two results. So we need to emit an explicit store in IR for the out parameter. This is similar to addcarry/subborrow/rdrand/rdseed.

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

llvm-svn: 341699
2018-09-07 19:14:24 +00:00
Alex Lorenz 49c2add9fb warn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'
Addresses first post-commit feedback for r335081 from Nico

llvm-svn: 341697
2018-09-07 18:59:45 +00:00
Craig Topper 52a61fc2ac [X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an store instruction.
This is the clang side of D51769. The llvm intrinsics now return two results instead of using an out parameter.

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

llvm-svn: 341678
2018-09-07 16:58:57 +00:00
Alexey Bataev 47b2ed2e16 Revert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."
Still need the RTTI for NVPTX target to pass sema checks.

llvm-svn: 341668
2018-09-07 14:50:25 +00:00
Ilya Biryukov 832c4afe00 [CodeComplete] Clearly distinguish signature help and code completion.
Summary:
Code completion in clang is actually a mix of two features:
- Code completion is a familiar feature. Results are exposed via the
  CodeCompleteConsumer::ProcessCodeCompleteResults callback.
- Signature help figures out if the current expression is an argument of
  some function call and shows corresponding signatures if so.
  Results are exposed via CodeCompleteConsumer::ProcessOverloadCandidates.

This patch refactors the implementation to untangle those two from each
other and makes some naming tweaks to avoid confusion when reading the
code.

The refactoring is required for signature help fixes, see D51038.

The only intended behavior change is the order of callbacks.
ProcessOverloadCandidates is now called before ProcessCodeCompleteResults.

Reviewers: sammccall, kadircet

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341660
2018-09-07 14:04:39 +00:00
Ivan Donchevskii 38bdf54b49 [libclang] Return the proper pointee type for 'auto' deduced to pointer
Currently the resulting type is always invalid in such case.

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

llvm-svn: 341656
2018-09-07 13:23:51 +00:00
Kristina Brooks 8f060aac2f Differential Revision: https://reviews.llvm.org/D50246
[RISCV] Add support for computing sysroot for riscv32-unknown-elf

Extends r338385 to allow the driver to compute the sysroot when an explicit path is not provided. This allows the linker to find C runtime files and the correct include directory for header files.

Patch by lewis-revill (Lewis Revill)

llvm-svn: 341655
2018-09-07 13:03:31 +00:00
Nico Weber 50824c9caf Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler
The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
<stdin>:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' treated as the '/U' option [-Wslash-u-filename]

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

llvm-svn: 341654
2018-09-07 12:47:02 +00:00
Simon Pilgrim b746df0b0a Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests"""
Reverts analyzer tests from rL341627 again as they still broke windows buildbots

llvm-svn: 341648
2018-09-07 10:27:16 +00:00
Diogo N. Sampaio bac6c88da2 Replaces __inline by __inline__ / C89 compatible
llvm-svn: 341644
2018-09-07 09:37:27 +00:00
Alexander Potapenko d49c32ce3f [MSan] add KMSAN support to Clang driver
Boilerplate code for using KMSAN instrumentation in Clang.

We add a new command line flag, -fsanitize=kernel-memory, with a
corresponding SanitizerKind::KernelMemory, which, along with
SanitizerKind::Memory, maps to the memory_sanitizer feature.

KMSAN is only supported on x86_64 Linux.

It's incompatible with other sanitizers, but supports code coverage
instrumentation.

llvm-svn: 341641
2018-09-07 09:21:09 +00:00
Akira Hatanaka 2ccb31977c [Sema] Check that the destructor for each element of class type is
accessible from the context where aggregate initialization occurs.

rdar://problem/38168772

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

llvm-svn: 341629
2018-09-07 02:38:01 +00:00
George Karpenkov d7acacab94 Revert "Revert "[analyzer] Add coverage information to plist output, update tests""
This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc.

Reverting the revert, fixing tests.

llvm-svn: 341627
2018-09-07 02:02:35 +00:00
George Karpenkov 4762fb5d11 Revert "[analyzer] Add coverage information to plist output, update tests"
This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e.

Temporary revert until the tests are fixed.

llvm-svn: 341626
2018-09-07 01:39:23 +00:00
George Karpenkov bb313b797d [analyzer] Add coverage information to plist output, update tests
Split tests which were still using FileCheck to compare plists.

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

llvm-svn: 341621
2018-09-07 00:44:17 +00:00
George Karpenkov 784c60ac81 [analyzer] [NFC] Prefer passing around reference to std::unique_ptr&
When object is owned elsewhere

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

llvm-svn: 341620
2018-09-07 00:43:55 +00:00
George Karpenkov a3fdd17907 [analyzer] Executed lines: store file IDs, not hashes.
Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames.

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

llvm-svn: 341619
2018-09-07 00:43:37 +00:00
George Karpenkov 55e3d1ec35 [analyzer] Do not add invalid source location to the coverage information
Invalid source locations may arise from generated code.

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

llvm-svn: 341618
2018-09-07 00:43:17 +00:00
George Karpenkov 5f8d361c9c [analyzer] Push updating-the-executed-lines logic into the BugReporter.
So it can be reused across different consumers.

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

llvm-svn: 341617
2018-09-07 00:42:53 +00:00
George Karpenkov 98bee02297 [analyzer] Skip printing trivial nodes in exploded graph
A node is considered to be trivial if it only has one successor, one
predecessor, and a state equal to the predecessor.
Can drastically (> 2x) reduce the size of the generated exploded
graph.

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

llvm-svn: 341616
2018-09-07 00:42:32 +00:00
George Karpenkov d0d0cb38be [analyzer] [NFC] Move dumping program point into a separate function
Differential Revision: https://reviews.llvm.org/D51666

llvm-svn: 341603
2018-09-06 23:08:27 +00:00
George Karpenkov 84a2b30ba3 [analyzer] Dump stable identifiers for exploded nodes
Differential Revision: https://reviews.llvm.org/D51667

llvm-svn: 341602
2018-09-06 23:08:07 +00:00
George Karpenkov 95363e378a [analyzer] Remove traces of ubigraph visualization
Ubigraph project has been dead since about 2008, and to the best of my
knowledge, no one was using it.
Previously, I wasn't able to launch the existing binary at all.

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

llvm-svn: 341601
2018-09-06 23:07:47 +00:00
George Karpenkov e40d4053ba [analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
Differential Revision: https://reviews.llvm.org/D51395

llvm-svn: 341600
2018-09-06 23:07:26 +00:00
Stephen Kelly 96160587f9 Remove deprecated API
Reviewers: teemperor!

Subscribers: cfe-commits

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

llvm-svn: 341573
2018-09-06 18:26:30 +00:00
Reid Kleckner 7a36896864 Re-land r334417 "[MS] Use mangled names and comdats for string merging with ASan"
The issue with -fprofile-generate was fixed and the dependent CL
relanded in r340232.

llvm-svn: 341572
2018-09-06 18:25:39 +00:00
Alexey Bataev d2c1dd5902 [OPENMP] Fix PR38823: Do not emit vtable if it is not used in target
context.

If the explicit template instantiation definition defined outside of the
target context, its vtable should not be marked as used. This is true
for other situations where the compiler want to emit vtables
unconditionally.

llvm-svn: 341570
2018-09-06 17:56:28 +00:00
Erik Pilkington f85e391063 [Sema] Clean up some __builtin_*_chk diagnostics
Namely, print the likely macro name when it's used, and include the actual
computed sizes in the diagnostic message, which are sometimes not obvious.

rdar://43909200

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

llvm-svn: 341566
2018-09-06 17:19:33 +00:00
Pavel Labath c1e0c34e45 Re-commit "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)""
This recommits r341472, which was reverted due to test failures on macos bots.

The issue was that a macos target implies -glldb which, together with
this patch added a -gpubnames switch where there previously wasn't one.
The intentions of those checks was to check that -gpubnames is not
emitted by default so I add an explicit -ggdb arg to those command lines
to get same behavior on all platforms (the fact that -glldb *does* set
-gpubnames is tested by a separate test).

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

llvm-svn: 341564
2018-09-06 17:01:45 +00:00
A Bergen 51fdaba4ad Reverting r 341390 because it is causing test failures on GreenDragon.
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/52810/

llvm-svn: 341560
2018-09-06 16:29:40 +00:00
Simon Pilgrim 58310ec11f Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.
llvm-svn: 341556
2018-09-06 15:16:17 +00:00
Andrew Savonichev 05a15afe6f [OpenCL] Relax diagnostics on OpenCL access qualifiers
Summary:
Emit warning for multiple access qualifiers if they do not conflict.

Patch by Alexey Bader

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: asavonic, bader, cfe-commits

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

llvm-svn: 341553
2018-09-06 15:10:26 +00:00
Sam McCall 026d8a20ec Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
This reverts commit r341519, which generates debug info that causes
backend crashes. (with -split-dwarf-file)

Details in https://reviews.llvm.org/D50495

llvm-svn: 341549
2018-09-06 14:27:40 +00:00
Diogo N. Sampaio 95f9f6a7cd Fix march triple used test from rL341475
Change the march triple of test files, possible fixing
test failures due rL341475

llvm-svn: 341548
2018-09-06 14:13:10 +00:00
Christian Bruel 6ccc4a7c20 Fix the -print-multi-directory flag to print the selected multilib.
Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, timshen, thakis, srhines, cfe-commits

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

llvm-svn: 341547
2018-09-06 14:03:44 +00:00
Andrew Savonichev d353e6d748 [OpenCL] Disallow negative attribute arguments
Summary:
Negative arguments in kernel attributes are silently bitcast'ed to
unsigned, for example:

    __attribute__((reqd_work_group_size(1, -1, 1)))
    __kernel void k() {}

is a complete equivalent of:

    __attribute__((reqd_work_group_size(1, 4294967294, 1)))
    __kernel void k() {}

This is likely an error, so the patch forbids negative arguments in
several OpenCL attributes. Users who really want 4294967294 can still
use it as an unsigned representation.

Reviewers: Anastasia, yaxunl, bader

Reviewed By: Anastasia, yaxunl, bader

Subscribers: bader, cfe-commits

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

llvm-svn: 341539
2018-09-06 11:54:09 +00:00
Hsiangkai Wang 0a875b2f15 [DebugInfo] Generate debug information for labels. (Fix PR37395)
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.

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

llvm-svn: 341519
2018-09-06 06:03:36 +00:00
Richard Smith 5159bbad8b PR38627: Fix handling of exception specification adjustment for
destructors.

We previously tried to patch up the exception specification after
completing the class, which went wrong when the exception specification
was needed within the class body (in particular, by a friend
redeclaration of the destructor in a nested class). We now mark the
destructor as having a not-yet-computed exception specification
immediately after creating it.

This requires delaying various checks against the exception
specification (where we'd previously have just got the wrong exception
specification, and now find we have an exception specification that we
can't compute yet) when those checks fire while the class is being
defined.

This also exposed an issue that we were missing a CodeSynthesisContext
for computation of exception specifications (otherwise we'd fail to make
the module containing the definition of the class visible when computing
its members' exception specs). Adding that incidentally also gives us a
diagnostic quality improvement.

This has also exposed an pre-existing problem: making the exception
specification evaluation context a non-SFINAE context (as it should be)
results in a bootstrap failure; PR38850 filed for this.

llvm-svn: 341499
2018-09-05 22:30:37 +00:00
Richard Trieu 0b9234b915 Remove unnecessary options from test RUN lines.
These tests do not check the color printing, so color options should not
be used when running them.

llvm-svn: 341498
2018-09-05 22:14:46 +00:00
Richard Trieu a7f38f7ca3 Add triple to test case.
This test uses enums, which have different behavior when targeting different
systems.  Specifying a triple will give predictable behavior to this test.

llvm-svn: 341496
2018-09-05 21:55:09 +00:00
Pavel Labath df6c3d4452 Revert "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)"
This reverts commit r341472 due to breakage in green dragon bots.

llvm-svn: 341492
2018-09-05 20:20:28 +00:00
John McCall 7fa8af0abe Forbid address spaces on compound literals in local scope.
Patch by Bevin Hansson!

llvm-svn: 341491
2018-09-05 19:22:40 +00:00
Erik Pilkington 3e4e3b17c1 [Sema] Don't warn about omitting unavailable enum constants in a switch
rdar://42717026

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

llvm-svn: 341490
2018-09-05 19:13:27 +00:00
John McCall 52a503d4f3 Add -Wobjc-property-assign-on-object-type.
This is a warning about using 'assign' instead of 'unsafe_unretained'
in Objective-C property declarations.  It's off by default because there
isn't consensus in the Objective-C steering group that this is the right
thing to do, but we're nonetheless okay with adding it because there's a
substantial pool of Objective-C programmers who will appreciate the warning.

Patch by Alfred Zien!

llvm-svn: 341489
2018-09-05 19:02:00 +00:00
Erich Keane f9f7fa9d03 Test Commit for git-svn-cleanup comment.
Removes the class name for the Expr class, which isn't necessary.

llvm-svn: 341484
2018-09-05 17:14:21 +00:00
Alexey Bataev 33c137bf0c [OPENMP][NVPTX] Disable runtime-type info for CUDA devices.
RTTI is not supported by the NVPTX target.

llvm-svn: 341483
2018-09-05 17:10:30 +00:00
Eric Liu d485df17d5 [Sema] Store MacroInfo in CodeCompletionResult for macro results.
Summary:
This provides information about the macro definition. For example, it
can be used to compute macro USRs.

Reviewers: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341476
2018-09-05 14:59:17 +00:00
Diogo N. Sampaio fcc97daa8a Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89
Summary:
The inline attribute is not valid for C standard 89. Replace the argument in the generation of header files with __inline, as well adding tests for both header files.

Reviewers: pbarrio, SjoerdMeijer, javed.absar, t.p.northover

Subscribers: t.p.northover, kristof.beyls, chrib, cfe-commits

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

test/Headers/arm-fp16-header.c
test/Headers/arm-neon-header.c
utils/TableGen/NeonEmitter.cpp

llvm-svn: 341475
2018-09-05 14:56:21 +00:00
Pavel Labath 5795673ef8 Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)
Summary:
DWARF v5 accelerator tables provide a considerable performance
improvement for lldb and will make the default -glldb behavior same on
all targets (right now we emit apple tables on apple targets, but these
are not controlled by -gpubnames, only by -glldb).

Reviewers: dblaikie

Subscribers: probinson, clayborg, JDevlieghere, aprantl, cfe-commits

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

llvm-svn: 341472
2018-09-05 14:38:44 +00:00
Simon Pilgrim 275288d696 Fix -Wdocumentation warning. NFCI.
llvm-svn: 341460
2018-09-05 10:44:03 +00:00
Eric Liu cea78e3a19 [VFS] Cache the current working directory for the real FS.
Reviewers: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341455
2018-09-05 09:45:27 +00:00
Sam McCall 6f3778c372 clang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier
This fixes formatting namespaces with preceding 'inline' and 'export' (Modules TS) specifiers.

This change fixes namespaces not being identified as such with preceding 'inline' or 'export' specifiers.

Motivation: I was experimenting with the Modules TS (-fmodules-ts) and found it would be useful if clang-format would correctly format 'export namespace'. While making the changes, I noticed that similar issues still exist with 'inline namespace', and addressed them as well.

Patch by Marco Elver!

Reviewers: klimek, djasper, owenpan, sammccall

Reviewed By: owenpan, sammccall

Subscribers: owenpan, cfe-commits

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

llvm-svn: 341450
2018-09-05 07:44:02 +00:00
Richard Smith 8806e512bb Allow all supportable non-type attributes to be used with #pragma clang attribute.
Summary:
We previously disallowed use of undocumented attributes with #pragma clang
attribute, but the justification for doing so was weak and it prevented many
reasonable use cases.

Reviewers: aaron.ballman, arphaman

Subscribers: cfe-commits, rnk, benlangmuir, dexonsmith, erik.pilkington

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

llvm-svn: 341437
2018-09-05 00:28:57 +00:00
Richard Trieu 22ddc282b5 [ODRHash] Extend hash to support all Type's.
llvm-svn: 341421
2018-09-04 22:53:19 +00:00
Tim Shen 034423377c Revert r341373, since it fails on some targets.
Differential Revision: https://reviews.llvm.org/D51354

llvm-svn: 341418
2018-09-04 22:20:11 +00:00
Nico Weber 88f7285415 clang-cl: Pass /Brepro to linker if it was passed to the compiler
Differential Revision: https://reviews.llvm.org/D51635

llvm-svn: 341390
2018-09-04 18:00:14 +00:00
Christian Bruel ed1d6db907 Fix the -print-multi-directory flag to print the selected multilib.
Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: srhines, cfe-commits

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

llvm-svn: 341373
2018-09-04 15:22:13 +00:00
Ilya Biryukov d5554c512d Adding HardLink Support to VirtualFileSystem.
Summary:
Added support of creating a hardlink from one file to another file.
After a hardlink is added between two files, both file will have the same:
  1. UniqueID (inode)
  2. Size
  3. Buffer

This will bring replay of compilation closer to the actual compilation. There are instances where clang checks for the UniqueID of the file/header to be loaded which leads to a different behavior during replay as all files have different UniqueIDs.

Patch by Utkarsh Saxena!

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 341366
2018-09-04 14:15:53 +00:00
Chandler Carruth 664aa868f5 [x86/SLH] Add a real Clang flag and LLVM IR attribute for Speculative
Load Hardening.

Wires up the existing pass to work with a proper IR attribute rather
than just a hidden/internal flag. The internal flag continues to work
for now, but I'll likely remove it soon.

Most of the churn here is adding the IR attribute. I talked about this
Kristof Beyls and he seemed at least initially OK with this direction.
The idea of using a full attribute here is that we *do* expect at least
some forms of this for other architectures. There isn't anything
*inherently* x86-specific about this technique, just that we only have
an implementation for x86 at the moment.

While we could potentially expose this as a Clang-level attribute as
well, that seems like a good question to defer for the moment as it
isn't 100% clear whether that or some other programmer interface (or
both?) would be best. We'll defer the programmer interface side of this
for now, but at least get to the point where the feature can be enabled
without relying on implementation details.

This also allows us to do something that was really hard before: we can
enable *just* the indirect call retpolines when using SLH. For x86, we
don't have any other way to mitigate indirect calls. Other architectures
may take a different approach of course, and none of this is surfaced to
user-level flags.

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

llvm-svn: 341363
2018-09-04 12:38:00 +00:00
David Chisnall ef16ea7f7a Revert "Disable the GNUstep v2 ABI on Windows."
This reverts commit b4547c9cadd2f8adfe3f3182e4c56e466c5256cb.

Apparently git llvm push from the monorepo does not respect branches and
pushes the current branch to master.

llvm-svn: 341352
2018-09-04 10:07:27 +00:00
David Chisnall 6d924ad2bc Disable the GNUstep v2 ABI on Windows.
The code remains so that we can potentially reenable it in a point
release, but the driver will reject it.  Several issues were raised
during testing that made it clear that this was not quite ready for
general consumption.

Approved by: Hans Wennborg

llvm-svn: 341350
2018-09-04 09:23:18 +00:00
Brian Gesiak c1b7a98934 Removing -debug-info-macros from option suggestions test
Summary:
https://reviews.llvm.org/D46776 added better support for prefixes for the
"did you mean ...?" command line option suggestions. One of the tests was
checking against the `-debug-info-macro` option, which was failing on the
PS4 build bot. Tests would succeed against the `--help` and `--version`
options.

From https://llvm.org/devmtg/2013-11/slides/Robinson-PS4Toolchain.pdf, it
looks like the PS4 SDK forces optimizations and *could be* disabling the
`-debug-info-macro` altogether.

This diff removes `-debug-info-macro` altogether.

Patch by Arnaud Coomans!

Test Plan: untested since we do not have access to a PS4 with the SDK.

Reviewers: cfe-commits, modocache

Reviewed By: modocache

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

llvm-svn: 341327
2018-09-03 16:55:02 +00:00
Argyrios Kyrtzidis adc178ef2c Add header guards to some headers that are missing them
llvm-svn: 341324
2018-09-03 16:26:36 +00:00
Gabor Marton a20ce60e48 [ASTImporter] Merge ExprBits
Summary:
Some `Expr` classes set up default values for the `ExprBits` of `Stmt`.  These
default values are then overwritten by the parser sometimes.  One example is
`InitListExpr` which sets the value kind to be an rvalue in the ctor.  However,
this bit may change after the `InitListExpr` is created.  There may be other
expressions similar to `InitListExpr` in this sense, thus the safest solution
is to copy the expression bits.

The lack of copying `ExprBits` causes an assertion in the analyzer engine in a
specific case: Since the value kind is not imported, the analyzer engine
believes that the given InitListExpr is an rvalue, thus it creates a
nonloc::CompoundVal instead of creating memory region (as in case of an lvalue
reference).

Reviewers: a_sidorin, r.stahl, xazax.hun, a.sidorin

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 341316
2018-09-03 13:10:53 +00:00
Alexey Sotkin 260830eb10 [Index] Update tests allowing double4 type to be "invalid"
Fixes test failure after r341309

llvm-svn: 341314
2018-09-03 12:43:26 +00:00
Peter Smith d8e7ed6457 [Aarch64] Fix linker emulation for Aarch64 big endian
This patch fixes target linker emulation for aarch64 big endian.
aarch64_be_linux is not recognized by gnu ld. The equivalent emulation
mode supported by gnu ld is aarch64linuxb.

Patch by: Bharathi Seshadri

Reviewed by: Peter Smith

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

llvm-svn: 341312
2018-09-03 12:36:32 +00:00
Alexey Sotkin 73ae7cb4f1 [OpenCL] Traverse vector types for ocl extensions support
Summary:
Given the following kernel:
__kernel void foo() {
  double d;
  double4 dd;
}

and cl_khr_fp64 is disabled, the compilation would fail due to
the presence of 'double d', but when removed, it passes.

The expectation is that extended vector types of unsupported types
will also be unsupported.

The patch adds the check for this scenario.

Patch by: Ofir Cohen

Reviewers: bader, Anastasia, AlexeySotkin, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits

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

llvm-svn: 341309
2018-09-03 11:43:22 +00:00
Jonas Toth 81b61a8291 Fix Bug 38713: clang-format mishandles a short block after "default:" in a switch statement
Summary:
See https://bugs.llvm.org/show_bug.cgi?id=38713

Patch by Owen Pan!

Reviewers: djasper, klimek, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341284
2018-09-02 09:04:51 +00:00
Craig Topper d88f76a891 [X86] Add ktest intrinsics to match gcc and icc.
These aren't documented in the Intel Intrinsics Guide, but are supported by gcc and icc.

Includes these intrinsics:
_ktestc_mask8_u8, _ktestz_mask8_u8, _ktest_mask8_u8
_ktestc_mask16_u8, _ktestz_mask16_u8, _ktest_mask16_u8
_ktestc_mask32_u8, _ktestz_mask32_u8, _ktest_mask32_u8
_ktestc_mask64_u8, _ktestz_mask64_u8, _ktest_mask64_u8

llvm-svn: 341265
2018-08-31 22:29:56 +00:00
Heejin Ahn 4fa8dd95dd [WebAssembly] clang-format (NFC)
Summary: This patch runs clang-format on all wasm-only files.

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, cfe-commits

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

llvm-svn: 341254
2018-08-31 20:57:00 +00:00
Craig Topper 42a4d0822e [X86] Add k-mask conversion and load/store instrinsics to match gcc and icc.
This adds:
_cvtmask8_u32, _cvtmask16_u32, _cvtmask32_u32, _cvtmask64_u64
_cvtu32_mask8, _cvtu32_mask16, _cvtu32_mask32, _cvtu64_mask64
_load_mask8, _load_mask16, _load_mask32, _load_mask64
_store_mask8, _store_mask16, _store_mask32, _store_mask64

These are currently missing from the Intel Intrinsics Guide webpage.

llvm-svn: 341251
2018-08-31 20:41:06 +00:00
Tim Northover cc8f593d29 Tests: fix tests encoding specific hash values for 32-bit systems.
I changed the seed slightly, but forgot to run the tests on a 32-bit system, so
tests which hard-code a specific hash value started breaking.

llvm-svn: 341240
2018-08-31 19:24:37 +00:00
Craig Topper 2aa8efc820 [X86] Add kshift intrinsics to match gcc and icc.
This adds the following intrinsics:
_kshiftli_mask8
_kshiftli_mask16
_kshiftli_mask32
_kshiftli_mask64
_kshiftri_mask8
_kshiftri_mask16
_kshiftri_mask32
_kshiftri_mask64

llvm-svn: 341234
2018-08-31 18:22:52 +00:00
Sterling Augustine 1c04e1f552 Refactor Addlibgcc to make the when and what logic more straightfoward.
Add Android tests.

llvm-svn: 341231
2018-08-31 17:59:03 +00:00
Alexey Bataev 80e1b5eb34 [DEBUGINFO] Add support for emission of the debug directives only.
Summary:
Added option -gline-directives-only to support emission of the debug directives
only. It behaves very similar to -gline-tables-only, except that it sets
llvm debug info emission kind to
llvm::DICompileUnit::DebugDirectivesOnly.

Reviewers: echristo

Subscribers: aprantl, fedor.sergeev, JDevlieghere, cfe-commits

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

llvm-svn: 341212
2018-08-31 13:56:14 +00:00
Fangrui Song a4db70f945 Import lit.llvm after rC341132
llvm-svn: 341151
2018-08-31 00:24:36 +00:00
Stephen Kelly a21cc1f5df Remove vestiges of configure buildsystem
Summary:

Subscribers: mgorny, cfe-commits

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

llvm-svn: 341146
2018-08-30 23:41:03 +00:00
Stephen Kelly fc934cd916 Allow binding to NamedValue resulting from let expression
Subscribers: cfe-commits

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

llvm-svn: 341142
2018-08-30 23:11:09 +00:00
Stephen Kelly 5fb9dc51dc Extract parseBindID method
Subscribers: cfe-commits

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

llvm-svn: 341141
2018-08-30 23:11:01 +00:00
Stephen Kelly b8e0886006 Add dump() method for SourceRange
Subscribers: cfe-commits

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

llvm-svn: 341140
2018-08-30 23:10:52 +00:00
Nico Weber bc607e9252 Remove LIT_SITE_CFG_IN_FOOTER, clang
It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341132
2018-08-30 22:11:16 +00:00
Artem Belevich fe5b1ac142 Revert the tests that should've been reverted in rL341115
llvm-svn: 341118
2018-08-30 20:53:15 +00:00
Zachary Turner f4f767d534 [MS ABI] Fix mangling issue with dynamic initializer stubs.
There are two types of dynamic initializer stubs.  There's

  `dynamic initializer for 'x''(void)

and

  `dynamic initializer for `static Foo::Bar StaticDataMember''(void)

The second case is disambiguated from the first by the presence of
a ? after the operator code.  So the first will appear something like
?__E<name> while the second will appear something like ?__E?<name>.
clang-cl was mangling these both the same though.  This patch
matches behavior with cl.

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

llvm-svn: 341117
2018-08-30 20:53:11 +00:00
Artem Belevich e4c3c6c873 Reverted the "[CUDA/OpenMP] Define only some host macros during device compilation"
The changes were breaking CUDA compilation.

Reverted revisions:
  r340681 D50845
   [CUDA/OpenMP] Define only some host macros during device compilation
  r340772 D51312
    [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading
  r340967 D51441
     Add predefined macro __gnu_linux__ for proper aux-triple

llvm-svn: 341115
2018-08-30 20:43:39 +00:00
Sterling Augustine 3572b0bd5d Revert r341107. That change breaks lto-android in a way is untested.
llvm-svn: 341114
2018-08-30 20:42:49 +00:00
Richard Smith 0b2a541b90 [cxx_status] Use the correct color for a feature in "SVN" status
llvm-svn: 341110
2018-08-30 20:15:28 +00:00
Sterling Augustine cbe4fc3264 Refactor Addlibgcc to make the when and what logic more straightfoward.
No functional change. A forthcoming change will add support
for -shared-libgcc.

llvm-svn: 341107
2018-08-30 20:07:23 +00:00
Douglas Yung 11982cd7db Change %clang++ to %clangxx in test run line as it was expanding to clang.exe++ on Windows.
llvm-svn: 341106
2018-08-30 19:52:57 +00:00
Richard Smith 23ff7e866c Update FIXME as requested in code review.
llvm-svn: 341100
2018-08-30 19:19:15 +00:00
Richard Smith 59ef620059 Add test file missed from r341097.
llvm-svn: 341099
2018-08-30 19:17:11 +00:00
Richard Smith 218538ebe9 Add missing -Wc++11-compat / -Wc++14-compat warnings for:
* generic lambdas
 * return type deduction
 * class template argument deduction

llvm-svn: 341098
2018-08-30 19:16:35 +00:00
Richard Smith 09ac4a1bc9 Improve attribute documentation to list which spellings are used in which syntaxes.
Summary:
Instead of listing all the spellings (including attribute namespaces) in
the section heading, only list the actual attribute names there, and
list the spellings in the supported syntaxes table.

This allows us to properly describe things like [[fallthrough]], for
which we allow a clang:: prefix in C++ but not in C, and AlwaysInline,
which has one spelling as a GNU attribute and a different spelling as a
keyword, without needing to repeat the syntax description in the
documentation text.

Sample rendering: https://pste.eu/p/T1ZV.html

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 341097
2018-08-30 19:16:33 +00:00
Alexey Bataev bd8ff9bd70 [OPENMP] Fix PR38710: static functions are not emitted as implicitly
'declare target'.

All the functions, referenced in implicit|explicit target regions must
be emitted during code emission for the device.

llvm-svn: 341093
2018-08-30 18:56:11 +00:00
Artem Dergachev 73b38668ce [analyzer] InnerPointerChecker: Fix a segfault when checking symbolic strings.
Return value of dyn_cast_or_null should be checked before use.
Otherwise we may put a null pointer into the map as a key and eventually
crash in checkDeadSymbols.

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

llvm-svn: 341092
2018-08-30 18:45:05 +00:00
Sterling Augustine 5acd669330 Test the cross-product of how libgcc-related arguments are passed to the linker.
llvm-svn: 341083
2018-08-30 16:37:06 +00:00
Matt Morehouse 7e042bb1d1 [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

llvm-svn: 341082
2018-08-30 15:54:44 +00:00
Yaxun Liu 5e98c2b69d [HIP] Add -fvisibility hidden option to clang
AMDGPU target need -fvisibility hidden option for clang to
work around a limitation of no PLT support, otherwise there is compilation
error at -O0.

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

llvm-svn: 341077
2018-08-30 15:10:20 +00:00
Jan Korous ba3334a25f [Sema][NFC] Trivial cleanup in ActOnCallExpr
Use logical or operator instead of a bool variable and if/else.

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

llvm-svn: 341074
2018-08-30 14:46:48 +00:00
Alexey Bataev 80a9a61ded [OPENMP][NVPTX] Add options -f[no-]openmp-cuda-force-full-runtime.
Added options -f[no-]openmp-cuda-force-full-runtime to [not] force use
of the full runtime for OpenMP offloading to CUDA devices.

llvm-svn: 341073
2018-08-30 14:45:24 +00:00
Ilya Biryukov 2fab235316 [CodeComplete] Report location of opening parens for signature help
Summary: Used in clangd.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, kadircet, cfe-commits

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

llvm-svn: 341063
2018-08-30 13:08:03 +00:00
Matt Arsenault cd5bc7be08 AMDGPU: Default to hidden visibility
Object linking isn't supported, so it's not useful
to emit default visibility. Default visibility requires
relocations we don't yet support for functions compiled
in another translation unit.

WebAssembly already does this, although they insert these
arguments in a different place for some reason.

llvm-svn: 341033
2018-08-30 08:18:06 +00:00
Richard Trieu a986a31242 Ensure canonical type is actually canonical.
ASTContext::applyObjCProtocolQualifiers will return a canonical type when given
a canonical type and an array of canonical protocols.  If the protocols are not
canonical then the returned type is also not canonical.  Since a canonical type is needed, canonicalize the returned type before using it.  This later prevents
a type from having a non-canonical canonical type.

llvm-svn: 341013
2018-08-30 01:57:52 +00:00
Richard Smith 1bb64534e7 Adjust Attr representation so that changes to documentation don't affect
how we parse source code.

Instead of implicitly opting all undocumented attributes out of '#pragma
clang attribute' support, explicitly opt them all out and remove the
documentation check from TableGen.

(No new attributes should be added without documentation, so this has
little chance of backsliding. We already support the pragma on one
undocumented attribute, so we don't even want to enforce our old
"rule".)

No functionality change intended.

llvm-svn: 341009
2018-08-30 01:01:07 +00:00
Jordan Rupprecht db92a4a839 [AttrDocs] Fix build bots: add missing GNUInline pragma to test.
llvm-svn: 341002
2018-08-30 00:04:34 +00:00
Artem Dergachev cdf918fc71 [analyzer] Document that pointer arithmetic is not represented by SymExprs.
Add assertions to verify that.

llvm-svn: 340990
2018-08-29 22:57:52 +00:00
Nick Desaulniers afef3d42f9 [AttrDocs]: document gnu_inline function attribute
Summary: This wasn't documented https://clang.llvm.org/docs/AttributeReference.html, and briefly mentioned https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: efriedma, cfe-commits, srhines

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

llvm-svn: 340987
2018-08-29 22:50:47 +00:00
George Karpenkov 574d78e78e [analyzer] Improve tracing for uninitialized struct fields
rdar://13729267

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

llvm-svn: 340986
2018-08-29 22:48:50 +00:00
Artem Dergachev 4e864b8329 [analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.
Introduce a new MemRegion sub-class, CXXDerivedObjectRegion, which is
the opposite of CXXBaseObjectRegion, to represent such casts. Such region is
a bit weird because it is by design bigger than its super-region.
But it's not harmful when it is put on top of a SymbolicRegion
that has unknown extent anyway.

Offset computation for CXXDerivedObjectRegion and proper modeling of casts
still remains to be implemented.

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

llvm-svn: 340984
2018-08-29 22:43:31 +00:00
Artem Dergachev 5a3beea0e3 [analyzer] CFRetainReleaseChecker: Don't check C++ methods with the same name.
Don't try to understand what's going on when there's a C++ method called eg.
CFRetain().

Refactor the checker a bit, to use more modern APIs.

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

llvm-svn: 340982
2018-08-29 22:39:20 +00:00
Artem Dergachev ed19831f63 [CFG] [analyzer] Disable argument construction contexts for variadic functions.
The analyzer doesn't make use of them anyway and they seem to have
pretty weird AST from time to time, so let's just skip them for now.

Fixes a crash reported as pr37769.

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

llvm-svn: 340977
2018-08-29 22:05:35 +00:00
Artem Dergachev 594b5410a6 [CFG] [analyzer] Disable argument construction contexts for variadic functions.
The analyzer doesn't make use of them anyway and they seem to have
pretty weird AST from time to time, so let's just skip them for now.

Fixes pr37769.

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

llvm-svn: 340975
2018-08-29 21:50:52 +00:00
George Karpenkov e12dcf124b [analyzer] Fix tests on 32-bit platforms by specifying the tuple explicitly
llvm-svn: 340972
2018-08-29 21:18:47 +00:00
Alexey Bataev b4dd6d24d7 [OPENMP] Do not create offloading entry for declare target variables
declarations.

We should not create offloading entries for declare target var
declarations as it causes compiler crash.

llvm-svn: 340968
2018-08-29 20:41:37 +00:00
Yaxun Liu 0e9a76dbe3 Add predefined macro __gnu_linux__ for proper aux-triple
Clang predefine macro __linx__ for aux-triple with Linux OS
but does not predefine macro __gnu_linux__. This causes
some compilation error for certain applications, e.g. Eigen.

This patch fixes that.

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

llvm-svn: 340967
2018-08-29 20:39:22 +00:00
George Karpenkov 9ff67a9dda [analyzer] Resolve the crash in ReturnUndefChecker
By making sure the returned value from getKnownSVal is consistent with
the value used inside expression engine.

PR38427

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

llvm-svn: 340965
2018-08-29 20:29:59 +00:00
George Karpenkov eae57a2b13 [analyzer] [NFC] Move class definition out of the function
Differential Revision: https://reviews.llvm.org/D51322

llvm-svn: 340964
2018-08-29 20:29:39 +00:00
George Karpenkov a393e68b27 [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default
Differential Revision: https://reviews.llvm.org/D51251

llvm-svn: 340963
2018-08-29 20:29:17 +00:00
George Karpenkov bd3e5dbf41 [analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN
Differential Revision: https://reviews.llvm.org/D51250

llvm-svn: 340962
2018-08-29 20:28:54 +00:00
George Karpenkov d5ef0d2a4b [analyzer] Better retain count rules for OSObjects
Differential Revision: https://reviews.llvm.org/D51184

llvm-svn: 340961
2018-08-29 20:28:33 +00:00
George Karpenkov cf0b9cbd5f [analyzer] [NFC] Follow the convention when naming classes
Renames InvalidateRegionsWorker and RemoveDeadBindingsWorker

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

llvm-svn: 340960
2018-08-29 20:28:13 +00:00
Matt Morehouse cf311cfc20 Revert "[libFuzzer] Port to Windows"
This reverts r340949 due to bot breakage again.

llvm-svn: 340954
2018-08-29 18:40:41 +00:00
Alexey Bataev 8d8e1235ab [OPENMP][NVPTX] Add support for lightweight runtime.
If the target construct can be executed in SPMD mode + it is a loop
based directive with static scheduling, we can use lightweight runtime
support.

llvm-svn: 340953
2018-08-29 18:32:21 +00:00
Matt Morehouse 245ebd71ef [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

llvm-svn: 340949
2018-08-29 18:08:34 +00:00
Martin Storsjo 5ff7a8e67b [MinGW] Don't mark external variables as DSO local
Since MinGW supports automatically importing external variables from
DLLs even without the DLLImport attribute, we shouldn't mark them
as DSO local unless we actually know them to be local for sure.

Keep marking thread local variables as DSO local.

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

llvm-svn: 340941
2018-08-29 17:26:58 +00:00
Ilya Biryukov 2dbbd910dd [Tooling] Do not restore working dir in ClangTool
Summary:
Resolve all relative paths before running the tool instead.

This fixes the usage of ClangTool in AllTUsExecutor. The executor will
try running multiple ClangTool instances in parallel with compile
commands that usually have the same working directory.

Changing working directory is a global operation, so we end up
changing working directory in the middle of running other actions,
which leads to spurious compile errors.

Reviewers: ioeric, sammccall

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 340937
2018-08-29 16:35:31 +00:00
Mike Rice e1ca7b614f [OPENMP] Create non-const ident_t objects.
Currently ident_t objects are created const when debug info is not
enabled, but the libittnotify libray in the OpenMP runtime writes to
the reserved_2 field (See __kmp_itt_region_forking in
openmp/runtime/src/kmp_itt.inl).  Now create ident_t objects non-const.

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

llvm-svn: 340934
2018-08-29 15:45:11 +00:00
Alexandre Ganea 51c9349ab3 [Preamble] Fix incorrect usage of std::error_category
Differential Revision: https://reviews.llvm.org/D51380

llvm-svn: 340929
2018-08-29 14:28:04 +00:00
Sam Parker 96d4872899 [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
ARM_FEATURE_DSP is already set for targets with the +dsp feature. In
the backend, this target feature is also used to represent the
availability of the of the instructions that the ACLE guard through
the __ARM_FEATURE_SIMD32 macro. We don't have any cores that
implement one and not the other, so set this macro for cores later
than V6 or for Cortex-M cores that the target parser, or user, reports
that the 'dsp' instructions are supported.

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

llvm-svn: 340911
2018-08-29 10:39:03 +00:00
Peter Collingbourne 9c9c8b22d2 Start reserving x18 by default on Android targets.
Differential Revision: https://reviews.llvm.org/D45588

llvm-svn: 340889
2018-08-29 01:38:47 +00:00
Craig Topper a65bf65e0b [X86] Add kadd intrinsics to match gcc and icc.
This adds the following intrinsics:
_kadd_mask64
_kadd_mask32
_kadd_mask16
_kadd_mask8

These are missing from the Intel Intrinsics Guide, but are implemented by both gcc and icc.

llvm-svn: 340879
2018-08-28 22:32:14 +00:00
Yaxun Liu ac8ccd5879 [HIP] Fix output file extension
OffloadBundlingJobAction constructor accepts a list of JobAction as inputs.
The host JobAction is the last one. The file type of OffloadBundlingJobAction
should be determined by the host JobAction (the last one) instead of the first
one.

Since HIP emits LLVM bitcode for device compilation, device JobAction has
different file type as host Job Action. This bug causes incorrect output file
extension for HIP.

This patch fixes it by using the last input JobAction (host JobAction) to determine
file type of OffloadBundlingJobAction.

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

llvm-svn: 340873
2018-08-28 21:09:09 +00:00
Matt Morehouse bab8556f01 Revert "[libFuzzer] Port to Windows"
This reverts commit r340860 due to failing tests.

llvm-svn: 340867
2018-08-28 19:07:24 +00:00
Matt Morehouse c6fff3b6f5 [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: morehouse, kcc, eraman

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

llvm-svn: 340860
2018-08-28 18:34:32 +00:00
Akira Hatanaka a0b866d761 Define variables in test case rather than using values from functions
emitted ealier.

llvm-svn: 340854
2018-08-28 18:18:01 +00:00
Vedant Kumar 9873909b42 [ubsan] Enable -fsanitize=vptr on Apple devices and simulators
It seems like an oversight that this check was not always enabled for
on-device or device simulator targets.

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

llvm-svn: 340849
2018-08-28 18:01:42 +00:00
Fangrui Song fd00fb1f87 [Driver] Delete last reference of lld -flavor old-gnu
This is dead code because lld -flavor old-gnu was removed in 2016 by rLLD262158.

llvm-svn: 340845
2018-08-28 17:20:28 +00:00
Ilya Biryukov 5167e2d1af Parse compile commands lazily in InterpolatingCompilationDatabase
Summary:
This greatly reduces the time to read 'compile_commands.json'.
For Chromium on my machine it's now 0.7 seconds vs 30 seconds before the
change.

Reviewers: sammccall, jfb

Reviewed By: sammccall

Subscribers: mgrang, jfb, cfe-commits

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

llvm-svn: 340838
2018-08-28 16:15:56 +00:00
Adam Balogh 2cfbe933a1 [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments
We add check for invalidation of iterators. The only operation we handle here
is the (copy) assignment.

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

llvm-svn: 340805
2018-08-28 08:41:15 +00:00
Craig Topper cb5fd56c7f [X86] Add kortest intrinsics for 8, 32, and 64 bit masks. Add new intrinsic names for 16 bit masks.
This matches gcc and icc despite not being documented in the Intel Intrinsics Guide.

llvm-svn: 340798
2018-08-28 06:28:25 +00:00
Gheorghe-Teodor Bercea 7af5d66ba0 [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading
Summary: When offloading to a device and using the powerpc64le version of the auxiliary triple, the _CALL_ELF macro is not set correctly to 2 resulting in the attempt to include a header that does not exist. This patch fixes this problem.

Reviewers: Hahnfeld, ABataev, caomhin

Reviewed By: Hahnfeld

Subscribers: guansong, cfe-commits

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

llvm-svn: 340772
2018-08-27 20:16:20 +00:00
Kit Barton 997165b269 [PPC] Remove Darwin support from POWER backend.
This patch removes uses of the Darwin ABI for PowerPC related test cases. This
is the first step in removing Darwin support from the POWER backend.

clang/test/CodeGen/darwin-ppc-varargs.c  was deleted because it was a darwin/ppc
specific test case.

All other tests were updated to remove the darwin/ppc specific invocation.

Phabricator Review: https://reviews.llvm.org/D50989.

llvm-svn: 340770
2018-08-27 19:53:19 +00:00
Leonard Chan fdadd998ee [Sema/Attribute] Make types declared with address_space an AttributedType
Currently an address_space is stored in a qualifier. This makes any type
declared with an address_space attribute in the form
`__attribute__((address_space(1))) int 1;` be wrapped in an AttributedType.

This is for a later patch where if `address_space` is declared in a macro,
any diagnostics that would normally print the address space will instead dump
the macro name. This will require saving any macro information in the
AttributedType.

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

llvm-svn: 340765
2018-08-27 17:57:29 +00:00
Nico Weber 5946e5be17 fix comment typo
llvm-svn: 340743
2018-08-27 14:23:50 +00:00
Chandler Carruth 9918383330 Try to fix this clang driver test case after r340709.
If any of the bots complain about this, I'll just revert. This test case
is essentially trying to test the exact change made, but I think this
matches the intent of the patch in question.

llvm-svn: 340727
2018-08-27 08:49:20 +00:00
Craig Topper c330ca8611 [X86] Add intrinsics for kand/kandn/knot/kor/kxnor/kxor with 8, 32, and 64-bit mask registers.
This also adds a second intrinsic name for the 16-bit mask versions.

These intrinsics match gcc and icc. They just aren't published in the Intel Intrinsics Guide so I only recently found they existed.

llvm-svn: 340719
2018-08-27 06:20:22 +00:00
Craig Topper 9a022280b5 [X86] Remove min_vector_width 512 from some intrinsics that operate only on k-registers.
llvm-svn: 340718
2018-08-27 06:20:20 +00:00
Craig Topper e0b5d4cd9d [X86] Rename __DEFAULT_FN_ATTRS to a__DEFAULT_FN_ATTRS512 in avx512dqintrin.h and avx512bwintrin.h.
This is preparation for adding removing min_vector_width 512 from some intrinsics.

llvm-svn: 340717
2018-08-27 06:20:19 +00:00
Craig Topper 266b858705 [X86] Undef __DEFAULT_FN_ATTRS in avx512fintrin.h.
Fixes test failure after r340713

llvm-svn: 340714
2018-08-27 05:44:45 +00:00
Craig Topper f821f5314e [X86] Don't set min_vector_width to 512 on intrinsics that only operate on k registers.
llvm-svn: 340713
2018-08-27 05:27:15 +00:00
David Carlier 6e116a5b27 [Xray] Darwin - Enable in the driver side
Reviewers: dberris

Reviered By: dberris

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

llvm-svn: 340712
2018-08-27 05:16:09 +00:00
Fangrui Song 15c959a823 [Driver] Change MipsLinux default linker from "lld" to "ld.lld"
Reviewers: kzhuravl, atanasyan

Reviewed By: atanasyan

Subscribers: sdardis, arichardson, jrtc27, atanasyan, cfe-commits

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

llvm-svn: 340709
2018-08-26 19:47:23 +00:00
Argyrios Kyrtzidis 7c3a12ff42 [index] Introduce 'ProtocolInterface' as part of SymbolPropertySet
This is useful to directly infer that a method or property is from a protocol interface
at the point of the symbol occurrences.

llvm-svn: 340696
2018-08-26 06:27:23 +00:00
Jonas Hahnfeld 931939bf92 [CUDA/OpenMP] Define only some host macros during device compilation
When compiling CUDA or OpenMP device code Clang parses header files
that expect certain predefined macros from the host architecture. To
make this work the compiler passes the host triple via the -aux-triple
argument and (until now) pulls in all macros for that "auxiliary triple"
unconditionally.

However this results in defines like __SSE_MATH__ that will trigger
inline assembly making use of the "advertised" target features. See
the discussion of D47849 and PR38464 for a detailed explanation of
the encountered problems.

Instead of blacklisting "known bad" examples this patch starts adding
defines that are needed for certain headers like bits/wordsize.h and
bits/mathinline.h.
The disadvantage of this approach is that it decouples the definitions
from their target toolchain. However in my opinion it's more important
to keep definitions for one header close together. For one this will
include a clear documentation why these particular defines are needed.
Furthermore it simplifies maintenance because adding defines for a new
header or support for a new aux-triple only needs to touch one piece
of code.

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

llvm-svn: 340681
2018-08-25 13:42:40 +00:00
Hans Wennborg b4278895a4 Revert r323281 "Adjust MaxAtomicInlineWidth for i386/i486 targets."
As reported on http://lists.llvm.org/pipermail/cfe-dev/2018-August/058760.html,
this broke i386-freebsd11 due to its lack of atomic 64 bit primitives.

While that's not really this commit's fault, let's revert back to the old
behaviour until this can be fixed. This means generating cmpxchg8b etc for i386
and i486 which don't technically support those, but that's been the behaviour
for a long time, so a little longer probably doesn't hurt that much.

> Adjust MaxAtomicInlineWidth for i386/i486 targets.
>
> This is to fix the bug reported in https://bugs.llvm.org/show_bug.cgi?id=34347#c6.
> Currently, all  MaxAtomicInlineWidth of x86-32 targets are set to 64. However,
> i386 doesn't support any cmpxchg related instructions. i486 only supports cmpxchg.
> So in this patch MaxAtomicInlineWidth is reset as follows:
> For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is supported.
> For i486, the MaxAtomicInlineWidth should be 32 because it supports cmpxchg.
> For others 32 bits x86 cpu, the MaxAtomicInlineWidth should be 64 because of cmpxchg8b.
>
> Differential Revision: https://reviews.llvm.org/D42154

llvm-svn: 340666
2018-08-24 22:46:33 +00:00
Peter Collingbourne faf300f069 Reland r340552, "Driver: Enable address-significance tables by default when targeting COFF." which was reverted in r340579.
The underlying problem that caused the revert was fixed in r340648.

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

llvm-svn: 340649
2018-08-24 20:38:15 +00:00
Eli Friedman 7a4750ffe0 Add REQUIRES: x86-registered-target to test.
(This isn't really x86-specific, but we have to pick some non-Apple
triple to exercise the right codepath.)

llvm-svn: 340644
2018-08-24 20:18:34 +00:00
Eli Friedman 53591233c2 [LTO] Fix -save-temps with LTO and unnamed globals.
If all LLVM passes are disabled, we can't emit a summary because there
could be unnamed globals in the IR.

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

llvm-svn: 340640
2018-08-24 19:31:52 +00:00
Aaron Ballman 57deab77de Thread safety analysis no longer hands when analyzing a self-referencing initializer.
This fixes PR38640.

llvm-svn: 340636
2018-08-24 18:48:35 +00:00
Raphael Isemann 02f1d1315f [ASTImporter] Add test for PackExpansionExpr
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 340627
2018-08-24 18:01:56 +00:00
Jonas Toth 90d2aa2335 [clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier
Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report here: https://bugs.llvm.org/show_bug.cgi?id=38557

Patch by Owen Pan!

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: JonasToth, cfe-commits

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

llvm-svn: 340624
2018-08-24 17:25:06 +00:00
Jonas Toth 4636debc27 [clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All
Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.

Reviewers: djasper, klimek, krasimir, sammccall

Reviewed By: sammccall

Subscribers: hiraditya, JonasToth, cfe-commits

Tags: #clang

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

llvm-svn: 340623
2018-08-24 17:14:31 +00:00
Krzysztof Parzyszek 3e1c1ce569 [Hexagon] Remove unneeded strings from builtin definitions, NFC
llvm-svn: 340622
2018-08-24 17:13:42 +00:00
Eric Liu 8e44a8e7a0 Fix build bot after r340598.
Revert to the original behavior: only calculate real file path when
file is opened and avoid using InterndPath for real path calculation.

llvm-svn: 340602
2018-08-24 09:53:44 +00:00
Ilya Biryukov dbdd8e5238 [Tooling] Add a isSingleProcess() helper to ToolExecutor
Summary:
Used in clangd's symbol builder to optimize for the common
shared-memory executor case.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kadircet, cfe-commits

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

llvm-svn: 340599
2018-08-24 09:03:29 +00:00
Eric Liu 411e710074 [FileManager] Do not call 'real_path' in getFile().
Summary:
This partially rolls back the change in D48903:
89aa7f45a1 (diff-0025af005307891b5429b6a834823d5eR318)

`real_path` can be very expensive on real file systems, and calling it on each
opened file can slow down the compilation. This also slows down deserialized
ASTs for which real paths need to be recalculated for each input files again.

For clangd code completion latency (using preamble):
Before
{F7039629}
After
{F7039630}

Reviewers: ilya-biryukov, simark

Reviewed By: ilya-biryukov

Subscribers: kadircet, cfe-commits

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

llvm-svn: 340598
2018-08-24 08:59:54 +00:00
Chandler Carruth 8ed8433301 [AVR] Fix inline asm calls now that the addrspace(0) there is explicit.
This updates the test case for r340519 so it should pass again. r340522
only got some of the AVR tests that needed an update.

llvm-svn: 340596
2018-08-24 04:45:04 +00:00
Kito Cheng ed08d3739a [RISCV] RISC-V using -fuse-init-array by default
Reviewers: asb, apazos, mgrang

Reviewed By: asb

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

llvm-svn: 340595
2018-08-24 03:05:08 +00:00
Stephen Kelly e63344e862 Fix typo
llvm-svn: 340586
2018-08-23 22:41:52 +00:00
Aaron Puchert cd37c0913f Remove more const_casts by using ConstStmtVisitor [NFC]
Again, this required adding some const specifiers.

llvm-svn: 340580
2018-08-23 21:53:04 +00:00
Peter Collingbourne 577cfb0b5e Revert r340552, "Driver: Enable address-significance tables by default when targeting COFF."
Received multiple reports of breakage due to undefined symbols
suspected to be caused by this change.

llvm-svn: 340579
2018-08-23 21:34:57 +00:00
Aaron Puchert 68c7fcdaf1 Remove unnecessary const_cast [NFC]
This required adding a few const specifiers on functions.

Also a minor formatting fix suggested in D49885.

llvm-svn: 340575
2018-08-23 21:13:32 +00:00
Vedant Kumar 368540f6ee [docs] Regenerate ClangCommandLineReference.rst
llvm-svn: 340559
2018-08-23 17:55:03 +00:00
Vedant Kumar cadb722795 [options] Document -(static|shared)-libsan
llvm-svn: 340558
2018-08-23 17:54:48 +00:00
Peter Collingbourne b801a7d4fa Driver: Enable address-significance tables by default when targeting COFF.
Differential Revision: https://reviews.llvm.org/D51049

llvm-svn: 340552
2018-08-23 17:43:29 +00:00
Shuai Wang 92f9d1b8ac [ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 340547
2018-08-23 17:16:06 +00:00
Raphael Isemann 121ecfd22c Re-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Lands r340468 again, but this time we mark the test as unsupported on Windows
because it seems that try/catch crashes CodeGen at the moment.

llvm-svn: 340541
2018-08-23 16:06:30 +00:00
Mikhail R. Gadelha 9fa662b296 [analyzer] added cache for SMT queries in the SMTConstraintManager
Summary:
This patch implements a new cache for the result of SMT queries; with this patch the regression tests are 25% faster.

It's implemented as a `llvm::DenseMap` where the key is the hash of the set of the constraints in a state.

There is still one method that does not use the cache, `getSymVal`, because it needs to get a symbol interpretation from the SMT, which is not cached yet.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 340535
2018-08-23 13:21:35 +00:00
Mikhail R. Gadelha 766a189dfd [analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC.
Summary:
With this patch, the SMT backend is almost completely detached from the CSA.

Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`.

The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 340534
2018-08-23 13:21:31 +00:00
Mikhail R. Gadelha b0670d349c [analyzer] Templatefy SMTConstraintManager so more generic code can be moved from solver specific implementations. NFC.
Summary:
By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager.

Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 340533
2018-08-23 13:21:00 +00:00
Mikhail R. Gadelha 2420ee9b91 [analyzer] Delete SMTContext. NFC.
Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context.

Reviewers: NoQ, george.karpenkov, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 340532
2018-08-23 13:20:18 +00:00
Mikael Holmen b4a7546c5c Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]
The result of the dyn_cast wasn't used to we can just check isa.

llvm-svn: 340531
2018-08-23 13:18:27 +00:00
Mikael Holmen 9f356ddec8 Removed unused variable [NFC]
The compiler warned:
../tools/clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp:329:19: error: unused variable 'MD' [-Werror,-Wunused-variable]
  if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
                  ^
1 error generated.

llvm-svn: 340524
2018-08-23 10:59:49 +00:00
Alexander Richardson 6cdd12a3ba Update avr attributes test for output change in r340519
After this commit there is an addrspace(1) before the attribute #. Since
these tests are only checking the value of the attribute add a {{.*}} to
make the test resilient to future output changes.

llvm-svn: 340522
2018-08-23 10:21:36 +00:00
Ivan Donchevskii b3ae2bc62b [libclang] Fix cursors for arguments of Subscript and Call operators
The DeclRefExpr of CXXOperatorCallExpr refering to the custom operator
is visited before the arguments to the operator call. For the Call and
Subscript operator the range of this DeclRefExpr includes the whole call
expression, so that all tokens in that range were mapped to the operator
function, even the tokens of the arguments.

Fix this by ensuring that this particular DeclRefExpr is visited last.

Fixes PR25775.

Fix by Nikolai Kosjar.

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

llvm-svn: 340521
2018-08-23 09:48:11 +00:00
Chandler Carruth ae0cafece8 [x86/retpoline] Split the LLVM concept of retpolines into separate
subtarget features for indirect calls and indirect branches.

This is in preparation for enabling *only* the call retpolines when
using speculative load hardening.

I've continued to use subtarget features for now as they continue to
seem the best fit given the lack of other retpoline like constructs so
far.

The LLVM side is pretty simple. I'd like to eventually get rid of the
old feature, but not sure what backwards compatibility issues that will
cause.

This does remove the "implies" from requesting an external thunk. This
always seemed somewhat questionable and is now clearly not desirable --
you specify a thunk the same way no matter which set of things are
getting retpolines.

I really want to keep this nicely isolated from end users and just an
LLVM implementation detail, so I've moved the `-mretpoline` flag in
Clang to no longer rely on a specific subtarget feature by that name and
instead to be directly handled. In some ways this is simpler, but in
order to preserve existing behavior I've had to add some fallback code
so that users who relied on merely passing -mretpoline-external-thunk
continue to get the same behavior. We should eventually remove this
I suspect (we have never tested that it works!) but I've not done that
in this patch.

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

llvm-svn: 340515
2018-08-23 06:06:38 +00:00
JF Bastien 20598b05d0 Missing quote in previous commit
The test was failing because I missed a quote.

llvm-svn: 340511
2018-08-23 04:09:49 +00:00
JF Bastien 4734fa1428 Improve incompatible triple error
When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.

llvm-svn: 340510
2018-08-23 03:55:24 +00:00
George Karpenkov ab0011ebc0 [analyzer] Preliminary version of retain count checking for OSObjects
Has quite a lot of false positives, disabled behind the flag.

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

llvm-svn: 340502
2018-08-23 00:26:59 +00:00
George Karpenkov c433011e02 Revert "[CStringSyntaxChecker] Check strlcat sizeof check"
This reverts commit 3073790e87378fea9a68fb052185fec9596ef135.

The check is not correct, strlact(dest, "mystr", sizeof(dest)) is fine.

llvm-svn: 340501
2018-08-23 00:02:35 +00:00
George Karpenkov b45bf3bb8b Revert "[CStringSyntaxChecker] Reduces space around error message for strlcat."
This reverts commit 6b43b80320722da41ca6ef7a3b57cc300fb83094.

llvm-svn: 340500
2018-08-23 00:02:12 +00:00
Nico Weber a2761e437f win: Omit ".exe" from clang and clang-cl driver-level diagnostics.
Like https://reviews.llvm.org/D51133 but for clang.
https://reviews.llvm.org/D51134

llvm-svn: 340498
2018-08-22 23:53:39 +00:00
Raphael Isemann 0c8dee7642 Revert "[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt"
This test breaks llvm-clang-x86_64-expensive-checks-win.

llvm-svn: 340483
2018-08-22 23:50:30 +00:00
George Karpenkov 2b39006433 [NFC] Add tags file to .gitignore
Differential Revision: https://reviews.llvm.org/D50109

llvm-svn: 340479
2018-08-22 23:23:17 +00:00
George Karpenkov baa78cc6d3 [analyzer] Track non-zero values in ReturnVisitor
Tracking those can help to provide much better diagnostics in many cases.

In general, most of the visitor machinery should be refactored to allow
tracking the origin of arbitrary values.

rdar://36039765

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

llvm-svn: 340475
2018-08-22 23:17:25 +00:00
George Karpenkov 09c6b509fe [analyzer] Track the problematic subexpression in UndefResultChecker
This is tested in a subsequent commit, which allows tracking those values.

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

llvm-svn: 340474
2018-08-22 23:17:02 +00:00
George Karpenkov a97914243a [analyzer] [NFC] Minor refactoring of BugReporterVisitors
Differential Revision: https://reviews.llvm.org/D51130

llvm-svn: 340473
2018-08-22 23:16:44 +00:00
Petr Hosek 678c1c6ccc [Driver] Check normalized triples for multiarch runtime path
Previously we only used target triple as provided which matches the
GCC behavior, but it also means that all clients have to be consistent
in their spelling of target triples since e.g. x86_64-linux-gnu and
x86_64-unknown-linux-gnu will result in Clang driver looking at two
different paths when searching for runtime libraries.

Unfortunatelly, as it turned out many clients aren't consistent in
their spelling of target triples, e.g. many Linux distributions use
the shorter spelling but config.guess and rustc insist on using the
normalized variant which is causing issues. To avoid having to ship
multiple copies of runtimes for different triple spelling or rely on
symlinks which are not portable, we should also check the normalized
triple when constructing paths for multiarch runtimes.

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

llvm-svn: 340471
2018-08-22 22:56:46 +00:00
Raphael Isemann fb97c54cf1 [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 340468
2018-08-22 22:51:37 +00:00
Raphael Isemann 3142a49068 [ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
Summary:
The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs.

This is because we import the `S` struct into the `test.cpp` context
and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to
import is generated by clang directly in the target context. This means we actually
never test the importing of ArrayInitLoopExpr with this test, which becomes obvious
when looking at the missing test coverage for the respective  VisitArrayInitLoopExpr method.

This patch moves the copy-assignment of our struct to the `S.cpp` context, which means
that `test.cpp` now actually has to import the ArrayInitLoopExpr.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 340467
2018-08-22 22:50:45 +00:00
Raphael Isemann ff862be4ef [ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
Summary:
`CXXNamedCastExpr` importing is already handled in the respective `VisitCXXNamedCastExpr` method.
So this code here can never be reached under normal circumstances and we might as well remove it.

This patch shouldn't change any observable behavior of the ASTImporter.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 340466
2018-08-22 22:49:32 +00:00
Raphael Isemann ee4cd22678 [ASTImporter] Add test for ObjCTypeParamDecl
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 340465
2018-08-22 22:48:40 +00:00
Raphael Isemann 5a66dceeb3 [ASTImporter] Add test for SwitchStmt
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 340464
2018-08-22 22:47:10 +00:00
Raphael Isemann 95bfd47cfe [ASTImporter] Add test for ObjCAutoreleasePoolStmt
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 340463
2018-08-22 22:45:04 +00:00
Aaron Puchert c3e37b7538 Thread safety analysis: Allow relockable scopes
Summary:
It's already allowed to prematurely release a scoped lock, now we also
allow relocking it again, possibly even in another mode.

This is the second attempt, the first had been merged as r339456 and
reverted in r339558 because it caused a crash.

Reviewers: delesley, aaron.ballman

Reviewed By: delesley, aaron.ballman

Subscribers: hokein, cfe-commits

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

llvm-svn: 340459
2018-08-22 22:14:53 +00:00
Aaron Puchert 78619430f5 [NFC] Test commit
llvm-svn: 340452
2018-08-22 21:06:04 +00:00
Elizabeth Andrews 6593df241a Currently clang does not emit unused static constants. GCC emits these
constants by default when there is no optimization.

GCC's option -fno-keep-static-consts can be used to not emit
unused static constants.

In Clang, since default behavior does not keep unused static constants, 
-fkeep-static-consts can be used to emit these if required. This could be 
useful for producing identification strings like SVN identifiers 
inside the object file even though the string isn't used by the program.

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

llvm-svn: 340439
2018-08-22 19:05:19 +00:00
Pirama Arumuga Nainar 569dd503db [Android] Default to -fno-math-errno
Summary: Android's libm does not set errno.

Reviewers: srhines, enh

Subscribers: cfe-commits

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

llvm-svn: 340424
2018-08-22 17:43:05 +00:00
Chih-Hung Hsieh 83494d2f8c [Tooling] Allow -flto flags and filter out -Wa, flags
This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332
by allowing driver::Action::BackendJobClass to run with the analyzer.
Otherwise, such jobs will look up the non-existing compilation database
and then run without flags.
Also filter out the -Wa,* flags that could be passed to and ignored
by the clang compiler.  Clang-tidy gives warnings about unused -Wa,* flags.

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

llvm-svn: 340421
2018-08-22 17:13:40 +00:00
Akira Hatanaka 2a5e4639ea [CodeGen] Look at the type of a block capture field rather than the type
of the captured variable when determining whether the capture needs
special handing when the block is copied or disposed.

This fixes bugs in the handling of variables captured by a block that is
nested inside a lambda that captures the variables by reference.

rdar://problem/43540889

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

llvm-svn: 340408
2018-08-22 13:41:19 +00:00
Henry Wong 2ca72e03c3 [analyzer] Improve `CallDescription` to handle c++ method.
Summary:
`CallDecription` can only handle function for the time being. If we want to match c++ method, we can only use method name to match and can't improve the matching accuracy through the qualifiers. 

This patch add the support for `QualifiedName` matching to improve the matching accuracy.

Reviewers: xazax.hun, NoQ, george.karpenkov, rnkovacs

Reviewed By: xazax.hun, NoQ, rnkovacs

Subscribers: Szelethus, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits, MTC

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

llvm-svn: 340407
2018-08-22 13:30:46 +00:00
Haojian Wu a3b34574cc [Preamble] Fix an undefined behavior when checking an empty preamble can be reused.
Summary: Passing nullptr to memcmp is UB.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 340403
2018-08-22 12:34:04 +00:00
Gabor Marton 42e15deb6c Fix import of class templates partial specialization
Summary:
Currently there are several issues with the import of class template
specializations.  (1) Different TUs may have class template specializations
with the same template arguments, but with different set of instantiated
MethodDecls and FieldDecls.  In this patch we provide a fix to merge these
methods and fields.  (2) Currently, we search the partial template
specializations in the set of simple specializations and we add partial
specializations as simple specializations. This is bad, this patch fixes it.

Reviewers: a_sidorin, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

llvm-svn: 340402
2018-08-22 11:52:14 +00:00
David Green ecc698712c [AArch64] Add Tiny Code Model for AArch64
Adds a tiny code model to Clang along side rL340397.

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

llvm-svn: 340398
2018-08-22 11:34:28 +00:00
Simon Pilgrim 707f7619e3 Fix Wdocumentation warnings. NFCI.
llvm-svn: 340394
2018-08-22 10:08:53 +00:00