]> granicus.if.org Git - clang/log
clang
6 years ago[Sema][ObjC] Infer availability of +new from availability of -init.
Erik Pilkington [Mon, 10 Sep 2018 22:20:09 +0000 (22:20 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341874 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix test regression in r341862
Erich Keane [Mon, 10 Sep 2018 21:57:53 +0000 (21:57 +0000)]
Fix test regression in r341862

The commit updates when AES is enabled, but failed to update the tests.
This patch fixes them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341871 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AST] Fix a crash on invalid.
Erik Pilkington [Mon, 10 Sep 2018 21:54:04 +0000 (21:54 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341869 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMove AESNI generation to Skylake and Goldmont
Erich Keane [Mon, 10 Sep 2018 21:12:21 +0000 (21:12 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341862 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImplement -Watomic-implicit-seq-cst
JF Bastien [Mon, 10 Sep 2018 20:42:56 +0000 (20:42 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341860 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEnhance -Wc++14-compat for class template argument deduction to list the
Richard Smith [Mon, 10 Sep 2018 20:31:03 +0000 (20:31 +0000)]
Enhance -Wc++14-compat for class template argument deduction to list the
deduced type (if known).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341858 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang-cl] Enable -march option
Alexandre Ganea [Mon, 10 Sep 2018 17:54:32 +0000 (17:54 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341847 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove all uses of DIFlagBlockByrefStruct
Adrian Prantl [Mon, 10 Sep 2018 16:14:28 +0000 (16:14 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341842 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPrevent cpu-specific/cpu-dispatch from giong on a lambda.
Erich Keane [Mon, 10 Sep 2018 14:31:56 +0000 (14:31 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341833 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang] Make sure codecompletion is called for calls even when inside a token.
Kadir Cetinkaya [Mon, 10 Sep 2018 13:46:28 +0000 (13:46 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341824 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Commit fix for rL341790/rC341790
Adam Balogh [Mon, 10 Sep 2018 09:19:54 +0000 (09:19 +0000)]
[Analyzer] Commit fix for rL341790/rC341790

Test file was accidentally not added for rL341790/rC341790 and subsequant patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341795 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, emplace...
Adam Balogh [Mon, 10 Sep 2018 09:07:47 +0000 (09:07 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341794 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Iterator Checker - Part 7: Support for push and pop operations
Adam Balogh [Mon, 10 Sep 2018 09:06:31 +0000 (09:06 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341793 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Iterator Checker - Part 6: Mismatched iterator checker for constructors...
Adam Balogh [Mon, 10 Sep 2018 09:05:31 +0000 (09:05 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341792 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Iterator Checker - Part 5: Move Assignment of Containers
Adam Balogh [Mon, 10 Sep 2018 09:04:27 +0000 (09:04 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341791 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for function parameters
Adam Balogh [Mon, 10 Sep 2018 09:03:22 +0000 (09:03 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341790 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReleaseNotes: update links to use https
Hans Wennborg [Mon, 10 Sep 2018 08:51:25 +0000 (08:51 +0000)]
ReleaseNotes: update links to use https

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341786 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR33222: Require the declared return type not the actual return type to
Richard Smith [Mon, 10 Sep 2018 06:35:32 +0000 (06:35 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341778 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPart of PR33222: defer enforcing return type mismatch for dependent
Richard Smith [Mon, 10 Sep 2018 05:32:13 +0000 (05:32 +0000)]
Part of PR33222: defer enforcing return type mismatch for dependent
friend function declarations of class templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341775 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OpenMP] Add support for nested 'declare target' directives
Kelvin Li [Mon, 10 Sep 2018 02:07:09 +0000 (02:07 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341766 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Make typo correction slightly more efficient
Fangrui Song [Sun, 9 Sep 2018 17:20:03 +0000 (17:20 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341763 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix build bots after a mistake in r341760
Hamza Sood [Sun, 9 Sep 2018 13:12:53 +0000 (13:12 +0000)]
Fix build bots after a mistake in r341760

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341761 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Tooling] Improve handling of CL-style options
Hamza Sood [Sun, 9 Sep 2018 12:06:35 +0000 (12:06 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341760 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r341754.
Akira Hatanaka [Sun, 9 Sep 2018 05:22:49 +0000 (05:22 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341757 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Parser] Remove an unnecessary `mutable`
Fangrui Song [Sun, 9 Sep 2018 01:54:18 +0000 (01:54 +0000)]
[Parser] Remove an unnecessary `mutable`

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341756 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoms: Insert $$Z in mangling between directly consecutive parameter packs.
Nico Weber [Sat, 8 Sep 2018 20:58:39 +0000 (20:58 +0000)]
ms: Insert $$Z in mangling between directly consecutive parameter packs.

Fixes PR38783.
Differential Revision: https://reviews.llvm.org/D51784

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341755 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Sat, 8 Sep 2018 20:03:00 +0000 (20:03 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341754 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDo not use optimized atomic libcalls for misaligned atomics.
Richard Smith [Fri, 7 Sep 2018 23:57:54 +0000 (23:57 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341734 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the...
George Karpenkov [Fri, 7 Sep 2018 22:13:35 +0000 (22:13 +0000)]
[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the class

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341724 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics
George Karpenkov [Fri, 7 Sep 2018 22:13:15 +0000 (22:13 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341723 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map
George Karpenkov [Fri, 7 Sep 2018 22:07:57 +0000 (22:07 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341722 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output...
George Karpenkov [Fri, 7 Sep 2018 21:58:24 +0000 (21:58 +0000)]
Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests""""

This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6.

Hopefully fixing tests on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341719 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake -Watomic-alignment say whether the atomic operation was oversized
Richard Smith [Fri, 7 Sep 2018 21:24:27 +0000 (21:24 +0000)]
Make -Watomic-alignment say whether the atomic operation was oversized
or misaligned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341710 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR38870: Add warning for zero-width unicode characters appearing in
Richard Smith [Fri, 7 Sep 2018 19:25:39 +0000 (19:25 +0000)]
PR38870: Add warning for zero-width unicode characters appearing in
identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341700 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter
Craig Topper [Fri, 7 Sep 2018 19:14:24 +0000 (19:14 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341699 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agowarn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'
Alex Lorenz [Fri, 7 Sep 2018 18:59:45 +0000 (18:59 +0000)]
warn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'

Addresses first post-commit feedback for r335081 from Nico

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341697 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an...
Craig Topper [Fri, 7 Sep 2018 16:58:57 +0000 (16:58 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341678 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."
Alexey Bataev [Fri, 7 Sep 2018 14:50:25 +0000 (14:50 +0000)]
Revert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."

Still need the RTTI for NVPTX target to pass sema checks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341668 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeComplete] Clearly distinguish signature help and code completion.
Ilya Biryukov [Fri, 7 Sep 2018 14:04:39 +0000 (14:04 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341660 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libclang] Return the proper pointee type for 'auto' deduced to pointer
Ivan Donchevskii [Fri, 7 Sep 2018 13:23:51 +0000 (13:23 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341656 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDifferential Revision: https://reviews.llvm.org/D50246
Kristina Brooks [Fri, 7 Sep 2018 13:03:31 +0000 (13:03 +0000)]
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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341655 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler
Nico Weber [Fri, 7 Sep 2018 12:47:02 +0000 (12:47 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341654 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Revert "Revert "[analyzer] Add coverage information to plist output, update...
Simon Pilgrim [Fri, 7 Sep 2018 10:27:16 +0000 (10:27 +0000)]
Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests"""

Reverts analyzer tests from rL341627 again as they still broke windows buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341648 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReplaces __inline by __inline__ / C89 compatible
Diogo N. Sampaio [Fri, 7 Sep 2018 09:37:27 +0000 (09:37 +0000)]
Replaces __inline by __inline__ / C89 compatible

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341644 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MSan] add KMSAN support to Clang driver
Alexander Potapenko [Fri, 7 Sep 2018 09:21:09 +0000 (09:21 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341641 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Check that the destructor for each element of class type is
Akira Hatanaka [Fri, 7 Sep 2018 02:38:01 +0000 (02:38 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341629 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Revert "[analyzer] Add coverage information to plist output, update tests""
George Karpenkov [Fri, 7 Sep 2018 02:02:35 +0000 (02:02 +0000)]
Revert "Revert "[analyzer] Add coverage information to plist output, update tests""

This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc.

Reverting the revert, fixing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341627 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[analyzer] Add coverage information to plist output, update tests"
George Karpenkov [Fri, 7 Sep 2018 01:39:23 +0000 (01:39 +0000)]
Revert "[analyzer] Add coverage information to plist output, update tests"

This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e.

Temporary revert until the tests are fixed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341626 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Add coverage information to plist output, update tests
George Karpenkov [Fri, 7 Sep 2018 00:44:17 +0000 (00:44 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341621 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&
George Karpenkov [Fri, 7 Sep 2018 00:43:55 +0000 (00:43 +0000)]
[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&

When object is owned elsewhere

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341620 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Executed lines: store file IDs, not hashes.
George Karpenkov [Fri, 7 Sep 2018 00:43:37 +0000 (00:43 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341619 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Do not add invalid source location to the coverage information
George Karpenkov [Fri, 7 Sep 2018 00:43:17 +0000 (00:43 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341618 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Push updating-the-executed-lines logic into the BugReporter.
George Karpenkov [Fri, 7 Sep 2018 00:42:53 +0000 (00:42 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341617 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Skip printing trivial nodes in exploded graph
George Karpenkov [Fri, 7 Sep 2018 00:42:32 +0000 (00:42 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341616 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [NFC] Move dumping program point into a separate function
George Karpenkov [Thu, 6 Sep 2018 23:08:27 +0000 (23:08 +0000)]
[analyzer] [NFC] Move dumping program point into a separate function

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341603 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Dump stable identifiers for exploded nodes
George Karpenkov [Thu, 6 Sep 2018 23:08:07 +0000 (23:08 +0000)]
[analyzer] Dump stable identifiers for exploded nodes

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341602 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Remove traces of ubigraph visualization
George Karpenkov [Thu, 6 Sep 2018 23:07:47 +0000 (23:07 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341601 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
George Karpenkov [Thu, 6 Sep 2018 23:07:26 +0000 (23:07 +0000)]
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341600 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove deprecated API
Stephen Kelly [Thu, 6 Sep 2018 18:26:30 +0000 (18:26 +0000)]
Remove deprecated API

Reviewers: teemperor!

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341573 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-land r334417 "[MS] Use mangled names and comdats for string merging with ASan"
Reid Kleckner [Thu, 6 Sep 2018 18:25:39 +0000 (18:25 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341572 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP] Fix PR38823: Do not emit vtable if it is not used in target
Alexey Bataev [Thu, 6 Sep 2018 17:56:28 +0000 (17:56 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341570 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Clean up some __builtin_*_chk diagnostics
Erik Pilkington [Thu, 6 Sep 2018 17:19:33 +0000 (17:19 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341566 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-commit "Enable DWARF accelerator tables by default when tuning for lldb (-glldb...
Pavel Labath [Thu, 6 Sep 2018 17:01:45 +0000 (17:01 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341564 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReverting r 341390 because it is causing test failures on GreenDragon.
A Bergen [Thu, 6 Sep 2018 16:29:40 +0000 (16:29 +0000)]
Reverting r 341390 because it is causing test failures on GreenDragon.

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/52810/

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341560 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove unnecessary semicolon to silence -Wpedantic warning. NFCI.
Simon Pilgrim [Thu, 6 Sep 2018 15:16:17 +0000 (15:16 +0000)]
Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341556 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OpenCL] Relax diagnostics on OpenCL access qualifiers
Andrew Savonichev [Thu, 6 Sep 2018 15:10:26 +0000 (15:10 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341553 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
Sam McCall [Thu, 6 Sep 2018 14:27:40 +0000 (14:27 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341549 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix march triple used test from rL341475
Diogo N. Sampaio [Thu, 6 Sep 2018 14:13:10 +0000 (14:13 +0000)]
Fix march triple used test from rL341475

Change the march triple of test files, possible fixing
test failures due rL341475

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341548 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix the -print-multi-directory flag to print the selected multilib.
Christian Bruel [Thu, 6 Sep 2018 14:03:44 +0000 (14:03 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341547 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OpenCL] Disallow negative attribute arguments
Andrew Savonichev [Thu, 6 Sep 2018 11:54:09 +0000 (11:54 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341539 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo] Generate debug information for labels. (Fix PR37395)
Hsiangkai Wang [Thu, 6 Sep 2018 06:03:36 +0000 (06:03 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341519 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR38627: Fix handling of exception specification adjustment for
Richard Smith [Wed, 5 Sep 2018 22:30:37 +0000 (22:30 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341499 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove unnecessary options from test RUN lines.
Richard Trieu [Wed, 5 Sep 2018 22:14:46 +0000 (22:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341498 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd triple to test case.
Richard Trieu [Wed, 5 Sep 2018 21:55:09 +0000 (21:55 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341496 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Enable DWARF accelerator tables by default when tuning for lldb (-glldb ...
Pavel Labath [Wed, 5 Sep 2018 20:20:28 +0000 (20:20 +0000)]
Revert "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)"

This reverts commit r341472 due to breakage in green dragon bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341492 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoForbid address spaces on compound literals in local scope.
John McCall [Wed, 5 Sep 2018 19:22:40 +0000 (19:22 +0000)]
Forbid address spaces on compound literals in local scope.

Patch by Bevin Hansson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341491 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Don't warn about omitting unavailable enum constants in a switch
Erik Pilkington [Wed, 5 Sep 2018 19:13:27 +0000 (19:13 +0000)]
[Sema] Don't warn about omitting unavailable enum constants in a switch

rdar://42717026

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341490 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd -Wobjc-property-assign-on-object-type.
John McCall [Wed, 5 Sep 2018 19:02:00 +0000 (19:02 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341489 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTest Commit for git-svn-cleanup comment.
Erich Keane [Wed, 5 Sep 2018 17:14:21 +0000 (17:14 +0000)]
Test Commit for git-svn-cleanup comment.

Removes the class name for the Expr class, which isn't necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341484 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP][NVPTX] Disable runtime-type info for CUDA devices.
Alexey Bataev [Wed, 5 Sep 2018 17:10:30 +0000 (17:10 +0000)]
[OPENMP][NVPTX] Disable runtime-type info for CUDA devices.

RTTI is not supported by the NVPTX target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341483 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Store MacroInfo in CodeCompletionResult for macro results.
Eric Liu [Wed, 5 Sep 2018 14:59:17 +0000 (14:59 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341476 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix arm_neon.h and arm_fp16.h generation for compiling with std=c89
Diogo N. Sampaio [Wed, 5 Sep 2018 14:56:21 +0000 (14:56 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341475 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEnable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)
Pavel Labath [Wed, 5 Sep 2018 14:38:44 +0000 (14:38 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341472 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 5 Sep 2018 10:44:03 +0000 (10:44 +0000)]
Fix -Wdocumentation warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341460 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[VFS] Cache the current working directory for the real FS.
Eric Liu [Wed, 5 Sep 2018 09:45:27 +0000 (09:45 +0000)]
[VFS] Cache the current working directory for the real FS.

Reviewers: sammccall

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341455 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoclang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier
Sam McCall [Wed, 5 Sep 2018 07:44:02 +0000 (07:44 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341450 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAllow all supportable non-type attributes to be used with #pragma clang attribute.
Richard Smith [Wed, 5 Sep 2018 00:28:57 +0000 (00:28 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341437 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ODRHash] Extend hash to support all Type's.
Richard Trieu [Tue, 4 Sep 2018 22:53:19 +0000 (22:53 +0000)]
[ODRHash] Extend hash to support all Type's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341421 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r341373, since it fails on some targets.
Tim Shen [Tue, 4 Sep 2018 22:20:11 +0000 (22:20 +0000)]
Revert r341373, since it fails on some targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341418 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoclang-cl: Pass /Brepro to linker if it was passed to the compiler
Nico Weber [Tue, 4 Sep 2018 18:00:14 +0000 (18:00 +0000)]
clang-cl: Pass /Brepro to linker if it was passed to the compiler

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341390 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix the -print-multi-directory flag to print the selected multilib.
Christian Bruel [Tue, 4 Sep 2018 15:22:13 +0000 (15:22 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341373 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdding HardLink Support to VirtualFileSystem.
Ilya Biryukov [Tue, 4 Sep 2018 14:15:53 +0000 (14:15 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341366 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86/SLH] Add a real Clang flag and LLVM IR attribute for Speculative
Chandler Carruth [Tue, 4 Sep 2018 12:38:00 +0000 (12:38 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341363 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Disable the GNUstep v2 ABI on Windows."
David Chisnall [Tue, 4 Sep 2018 10:07:27 +0000 (10:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341352 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDisable the GNUstep v2 ABI on Windows.
David Chisnall [Tue, 4 Sep 2018 09:23:18 +0000 (09:23 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341350 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemoving -debug-info-macros from option suggestions test
Brian Gesiak [Mon, 3 Sep 2018 16:55:02 +0000 (16:55 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341327 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd header guards to some headers that are missing them
Argyrios Kyrtzidis [Mon, 3 Sep 2018 16:26:36 +0000 (16:26 +0000)]
Add header guards to some headers that are missing them

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341324 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Merge ExprBits
Gabor Marton [Mon, 3 Sep 2018 13:10:53 +0000 (13:10 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341316 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Index] Update tests allowing double4 type to be "invalid"
Alexey Sotkin [Mon, 3 Sep 2018 12:43:26 +0000 (12:43 +0000)]
[Index] Update tests allowing double4 type to be "invalid"

Fixes test failure after r341309

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341314 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Aarch64] Fix linker emulation for Aarch64 big endian
Peter Smith [Mon, 3 Sep 2018 12:36:32 +0000 (12:36 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341312 91177308-0d34-0410-b5e6-96231b3b80d8