]> granicus.if.org Git - clang/log
clang
6 years ago[Driver] Add "did you mean?" suggestions to -cc1as
Brian Gesiak [Sat, 13 Jan 2018 17:09:11 +0000 (17:09 +0000)]
[Driver] Add "did you mean?" suggestions to -cc1as

Summary:
In https://reviews.llvm.org/D41733, the driver was modified such that,
when a user provided a mispelled option such as `-hel`, it would
suggest a valid option with a nearby edit distance: "did you mean
'-help'?".

Add these suggestions to invocations of `clang -cc1as` as well.

Test Plan: `check-clang`

Reviewers: v.g.vassilev, bruno

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years ago[Sema] Fix crash for type-dependent base classes
Jan Korous [Sat, 13 Jan 2018 15:24:16 +0000 (15:24 +0000)]
[Sema] Fix crash for type-dependent base classes

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

6 years agoFix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER
Alex Bradbury [Sat, 13 Jan 2018 09:21:11 +0000 (09:21 +0000)]
Fix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER

Petr Hosek reported an external buildbot was failing on riscv32-toolchain.c,
seemingly as it set CLANG_DEFAULT_LINKER to lld. Address this by explicitly
setting -fuse-ld=ld in the tests.

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

6 years agoDR126: partially implement the const-correct rules for exception handler matching.
Richard Smith [Sat, 13 Jan 2018 05:05:45 +0000 (05:05 +0000)]
DR126: partially implement the const-correct rules for exception handler matching.

While here, fix up the myriad other ways in which Sema's two "can this handler
catch that exception?" implementations get things wrong and unify them.

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

6 years agoRemove unused addIfPresent function.
Eric Christopher [Sat, 13 Jan 2018 00:46:47 +0000 (00:46 +0000)]
Remove unused addIfPresent function.

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

6 years agoTry to suppress Windows testing again.
Richard Trieu [Fri, 12 Jan 2018 23:13:33 +0000 (23:13 +0000)]
Try to suppress Windows testing again.

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

6 years agoFix test on Windows that was added in r322382.
Douglas Yung [Fri, 12 Jan 2018 22:32:01 +0000 (22:32 +0000)]
Fix test on Windows that was added in r322382.

The test was using "%clang++" which on Windows became "clang.exe++". Use %clangxx instead.

Reviewed by Paul Robinson

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

6 years agoWhen rebuilding an InitListExpr, don't give it a type.
Richard Smith [Fri, 12 Jan 2018 22:21:33 +0000 (22:21 +0000)]
When rebuilding an InitListExpr, don't give it a type.

InitListExprs without types (well, with type 'void') represent not-yet-analyzed
initializer lists; InitListExpr with types fool Sema into thinking they don't
need further analysis in some cases (particularly C++17 copy omission).

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

6 years ago[DWARFv5] Have -gdwarf-5 generate MD5 checksums
Paul Robinson [Fri, 12 Jan 2018 22:19:03 +0000 (22:19 +0000)]
[DWARFv5] Have -gdwarf-5 generate MD5 checksums

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

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

6 years ago[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.
Artem Dergachev [Fri, 12 Jan 2018 22:12:11 +0000 (22:12 +0000)]
[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.

In the security package, we have a simple syntactic check that warns about
strcpy() being insecure, due to potential buffer overflows.

Suppress that check's warning in the trivial situation when the source is an
immediate null-terminated string literal and the target is an immediate
sufficiently large buffer.

Patch by AndrĂ¡s Leitereg!

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

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

6 years agoAllocate and access NormalCleanupDest with the natural alignment of i32.
John McCall [Fri, 12 Jan 2018 22:07:01 +0000 (22:07 +0000)]
Allocate and access NormalCleanupDest with the natural alignment of i32.

This alignment can be less than 4 on certain embedded targets, which may
not even be able to deal with 4-byte alignment on the stack.

Patch by Jacob Young!

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

6 years agoDisable test for Windows to fix Windows buildbots.
Richard Trieu [Fri, 12 Jan 2018 21:49:20 +0000 (21:49 +0000)]
Disable test for Windows to fix Windows buildbots.

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

6 years agoRefactor handling of signext/zeroext in ABIArgInfo
Alex Bradbury [Fri, 12 Jan 2018 20:08:16 +0000 (20:08 +0000)]
Refactor handling of signext/zeroext in ABIArgInfo

As @rjmccall suggested in D40023, we can get rid of
ABIInfo::shouldSignExtUnsignedType (used to handle cases like the Mips calling
convention where 32-bit integers are always sign extended regardless of the
sign of the type) by adding a SignExt field to ABIArgInfo. In the common case,
this new field is set automatically by ABIArgInfo::getExtend based on the sign
of the type. For targets that want greater control, they can use
ABIArgInfo::getSignExtend or ABIArgInfo::getZeroExtend when necessary. This
change also cleans up logic in CGCall.cpp.

There is no functional change intended in this patch, and all tests pass
unchanged. As noted in D40023, Mips might want to sign-extend unsigned 32-bit
integer return types. A future patch might modify
MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType.

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

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

6 years ago[OPENMP] Replace calls of getAssociatedStmt().
Alexey Bataev [Fri, 12 Jan 2018 19:39:11 +0000 (19:39 +0000)]
[OPENMP] Replace calls of getAssociatedStmt().

getAssociatedStmt() returns the outermost captured statement for the
OpenMP directive. It may return incorrect region in case of combined
constructs. Reworked the code to reduce the number of calls of
getAssociatedStmt() and used getInnermostCapturedStmt() and
getCapturedStmt() functions instead.
In case of firstprivate variables it may lead to an extra allocas
generation for private copies even if the variable is passed by value
into outlined function and could be used directly as private copy.

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

6 years ago[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.
Volodymyr Sapsai [Fri, 12 Jan 2018 18:54:35 +0000 (18:54 +0000)]
[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.

Fix makes the loop in LexAngledStringLiteral more like the loops in
LexStringLiteral, LexCharConstant. When we skip a character after
backslash, we need to check if we reached the end of the file instead of
reading the next character unconditionally.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832

rdar://problem/35572754

Reviewers: arphaman, kcc, rsmith, dexonsmith

Reviewed By: rsmith, dexonsmith

Subscribers: cfe-commits, rsmith, dexonsmith

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

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

6 years ago[WebAssembly] Support -stdlib=libc++ switch
Sam Clegg [Fri, 12 Jan 2018 17:54:49 +0000 (17:54 +0000)]
[WebAssembly] Support -stdlib=libc++ switch

Referenced implementation from Fuchsia and Darwin Toolchain.
Still only support CST_Libcxx.  Now checks that the argument
is really '-stdlib=libc++', and display error.

Also, now will pass -lc++ and -lc++abi to the linker.

Patch by Patrick Cheng!

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

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

6 years ago[CodeComplete] Add an option to omit results from the preamble.
Sam McCall [Fri, 12 Jan 2018 14:51:47 +0000 (14:51 +0000)]
[CodeComplete] Add an option to omit results from the preamble.

Summary:
Enumerating the contents of a namespace or global scope will omit any
decls that aren't already loaded, instead of deserializing them from the
PCH.

This allows a fast hybrid code completion where symbols from headers are
provided by an external index. (Sema already exposes the information
needed to do a reasonabl job of filtering them).
Clangd plans to implement this hybrid.

This option is just a hint - callers still need to postfilter results if
they want to *avoid* completing decls outside the main file.

Reviewers: bkramer, ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[ODRHash] Don't hash friend functions.
Richard Trieu [Fri, 12 Jan 2018 04:42:27 +0000 (04:42 +0000)]
[ODRHash] Don't hash friend functions.

In certain combinations of templated classes and friend functions, the body
of friend functions does not get propagated along with function signature.
Exclude friend functions for hashing to avoid this case.

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

6 years ago[Docs] Fix typo in toolchain documentation
Craig Topper [Fri, 12 Jan 2018 02:57:02 +0000 (02:57 +0000)]
[Docs] Fix typo in toolchain documentation

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

6 years agoAdd `__reference_binds_to_temporary` trait for checking safe reference initialization.
Eric Fiselier [Fri, 12 Jan 2018 00:09:37 +0000 (00:09 +0000)]
Add `__reference_binds_to_temporary` trait for checking safe reference initialization.

Summary:
The STL types `std::pair` and `std::tuple` can both store reference types. However their constructors cannot adequately check if the initialization of reference types is safe.  For example:

```
std::tuple<std::tuple<int> const&> t = 42;
// The stored reference is already dangling.
```

Libc++ has a best effort attempts in tuple to diagnose this, but they're not able to handle all valid cases (If I'm not mistaken). For example initialization of a reference from the result of a class's conversion operator.  Libc++ would benefit from having a builtin traits which can provide a much better implementation.

This patch introduce the `__reference_binds_to_temporary(T, U)` trait  that determines whether a reference of type `T` bound to an expression of type `U` would bind to a materialized temporary object.

Note that the trait simply returns false if `T` is not a reference type instead of reporting it as an error.

```
static_assert(__is_constructible(int const&, long));
static_assert(__reference_binds_to_temporary(int const&, long));
```

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: compnerd, cfe-commits

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

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

6 years ago[WebAssembly] Remove `-allow-undefined-file wasm.syms` from linker args
Sam Clegg [Thu, 11 Jan 2018 22:33:50 +0000 (22:33 +0000)]
[WebAssembly] Remove `-allow-undefined-file wasm.syms` from linker args

See: https://github.com/WebAssembly/tool-conventions/issues/35

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

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

6 years agoMake internal/private GVs implicitly dso_local.
Rafael Espindola [Thu, 11 Jan 2018 22:15:12 +0000 (22:15 +0000)]
Make internal/private GVs implicitly dso_local.

While updating clang tests for having clang set dso_local I noticed
that:

- There are *a lot* of tests to update.
- Many of the updates are redundant.

They are redundant because a GV is "obviously dso_local". This patch
starts formalizing that a bit by requiring that internal and private
GVs be dso_local too. Since they all are, we don't have to print
dso_local to the textual representation, making it a bit more compact
and easier to read.

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

6 years agoHandle scoped_lockable objects being returned by value in C++17.
Richard Smith [Thu, 11 Jan 2018 22:13:57 +0000 (22:13 +0000)]
Handle scoped_lockable objects being returned by value in C++17.

In C++17, guaranteed copy elision means that there isn't necessarily a
constructor call when a local variable is initialized by a function call that
returns a scoped_lockable by value. In order to model the effects of
initializing a local variable with a function call returning a scoped_lockable,
pretend that the move constructor was invoked within the caller at the point of
return.

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

6 years ago[Driver][RISCV] Another Windows file separator fix for riscv32-toolchain.c test
Alex Bradbury [Thu, 11 Jan 2018 17:06:32 +0000 (17:06 +0000)]
[Driver][RISCV] Another Windows file separator fix for riscv32-toolchain.c test

I've checking the failure log, this _should_ be the last one. Sorry for not
spotting this additional case first time round.

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

6 years ago[Driver][RISCV] Fix r322276 for Windows (path separator issue)
Alex Bradbury [Thu, 11 Jan 2018 15:38:01 +0000 (15:38 +0000)]
[Driver][RISCV] Fix r322276 for Windows (path separator issue)

We were seeing test failures of riscv32-toolchain.c on windows due to the \
path separator being used for the linker. Add {{/|\\\\}} pattern (made
horrible due to escaping), just like introduced in r214931.

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

6 years ago[OpenCL] Reorder the CLK_sRGBx/sRGBA defines, NFC
Sven van Haastregt [Thu, 11 Jan 2018 14:05:38 +0000 (14:05 +0000)]
[OpenCL] Reorder the CLK_sRGBx/sRGBA defines, NFC

Swap them so that all channel order defines are ordered according to
their values.

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

6 years ago[Driver][RISCV] Fix r322276 by adding missing dummy crtbegin.o files to test input
Alex Bradbury [Thu, 11 Jan 2018 13:51:06 +0000 (13:51 +0000)]
[Driver][RISCV] Fix r322276 by adding missing dummy crtbegin.o files to test input

The dummy crtbegin.o files were left out in r322276 (as they were ignored by
svn add of test/Driver/Inputs/multilib_riscv_linux_sdk) and are necessary for
the driver test to work.

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

6 years ago[RISCV] Add the RISCV target and compiler driver
Alex Bradbury [Thu, 11 Jan 2018 13:36:56 +0000 (13:36 +0000)]
[RISCV] Add the RISCV target and compiler driver

As RV64 codegen has not yet been upstreamed into LLVM, we focus on RV32 driver
support (RV64 to follow).

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

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

6 years ago[Lex] Use WritableMemoryBuffer in ScratchBuffer.cpp
Pavel Labath [Thu, 11 Jan 2018 10:43:45 +0000 (10:43 +0000)]
[Lex] Use WritableMemoryBuffer in ScratchBuffer.cpp

This avoids the need to const_cast the buffer contents to write to it.

NFCI.

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

6 years agoRevert "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Thu, 11 Jan 2018 07:05:38 +0000 (07:05 +0000)]
Revert "[Driver] Update default sanitizer blacklist location"

This reverts commit r322258: broke the dfsan build.

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

6 years agoReland "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Thu, 11 Jan 2018 06:42:12 +0000 (06:42 +0000)]
Reland "[Driver] Update default sanitizer blacklist location"

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

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

6 years ago[Fuchsia] Remove LLDB from the toolchain distribution
Petr Hosek [Thu, 11 Jan 2018 04:25:30 +0000 (04:25 +0000)]
[Fuchsia] Remove LLDB from the toolchain distribution

This is currently not being used so disable it to reduce toolchain size.

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

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

6 years ago[Fuchsia] Use llvm-objcopy as objcopy on non-Darwin hosts
Petr Hosek [Thu, 11 Jan 2018 04:17:57 +0000 (04:17 +0000)]
[Fuchsia] Use llvm-objcopy as objcopy on non-Darwin hosts

llvm-objcopy already supports all the necessary functionality for ELF.

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

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

6 years ago[X86][Sema] Range check the constant argument for the vpshld/vpshrd builtins to ensur...
Craig Topper [Thu, 11 Jan 2018 01:38:02 +0000 (01:38 +0000)]
[X86][Sema] Range check the constant argument for the vpshld/vpshrd builtins to ensure it fits in 8-bits.

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

6 years ago[X86] Fix vpshrd builtins to require an ICE for their constant argument to match...
Craig Topper [Thu, 11 Jan 2018 01:38:00 +0000 (01:38 +0000)]
[X86] Fix vpshrd builtins to require an ICE for their constant argument to match vpshld.

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

6 years ago[X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend.
Craig Topper [Thu, 11 Jan 2018 01:37:59 +0000 (01:37 +0000)]
[X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend.

Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f.

Withou this  "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend.

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

6 years ago[X86][Sema] Remove constant range checks on on builtins that take a char.
Craig Topper [Thu, 11 Jan 2018 01:37:57 +0000 (01:37 +0000)]
[X86][Sema] Remove constant range checks on on builtins that take a char.

The constant is already reduced to 8-bits by the time we get here and the checks were just ensuring that it was 8 bits. Thus I don't think there's anyway for them to fail.

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

6 years agoRevert "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Thu, 11 Jan 2018 00:12:02 +0000 (00:12 +0000)]
Revert "[Driver] Update default sanitizer blacklist location"

This reverts commit r322233: this is breaking dfsan tests.

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

6 years ago[Lex] Inline a variable in test in preparation for more similar tests. NFC.
Volodymyr Sapsai [Wed, 10 Jan 2018 23:37:29 +0000 (23:37 +0000)]
[Lex] Inline a variable in test in preparation for more similar tests. NFC.

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

6 years agoIn C++17, when instantiating an out-of-line definition of an inline static data
Richard Smith [Wed, 10 Jan 2018 23:08:26 +0000 (23:08 +0000)]
In C++17, when instantiating an out-of-line definition of an inline static data
member, don't forget to instantiate the initializer too.

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

6 years agoReland "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Wed, 10 Jan 2018 22:59:00 +0000 (22:59 +0000)]
Reland "[Driver] Update default sanitizer blacklist location"

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

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

6 years ago[MSan] Enable use-after-dtor instrumentation by default.
Matt Morehouse [Wed, 10 Jan 2018 20:27:48 +0000 (20:27 +0000)]
[MSan] Enable use-after-dtor instrumentation by default.

Summary:
Enable the compile-time flag -fsanitize-memory-use-after-dtor by
default. Note that the run-time option MSAN_OPTIONS=poison_in_dtor=1
still needs to be enabled for destructors to be poisoned.

Reviewers: eugenis, vitalybuka, kcc

Reviewed By: eugenis, vitalybuka

Subscribers: cfe-commits, llvm-commits

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

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

6 years ago[Driver] Test for correct '--version' suggestion
Brian Gesiak [Wed, 10 Jan 2018 20:23:45 +0000 (20:23 +0000)]
[Driver] Test for correct '--version' suggestion

Summary:
The `llvm::OptTable::findNearest` bug fixed in
https://reviews.llvm.org/D41873 manifested itself as the following
erroneous message when invoking Clang:

```
clang -version
clang-6.0: error: unknown argument '-version', did you mean 'version'?
```

Add a test to catch any future regressions to the now correct behavior,
which asks "did you mean '--version'?".

Test Plan: `check-clang`

Reviewers: v.g.vassilev, teemperor, ruiu, jroelofs, yamaguchi

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years agoRevert "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Wed, 10 Jan 2018 02:24:09 +0000 (02:24 +0000)]
Revert "[Driver] Update default sanitizer blacklist location"

This reverts commit r322154 because it broke sanitizer bots.

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

6 years ago[Driver] Update default sanitizer blacklist location
Petr Hosek [Wed, 10 Jan 2018 02:12:24 +0000 (02:12 +0000)]
[Driver] Update default sanitizer blacklist location

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

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

6 years ago[analyzer] [NFC] Minor refactoring of trackNullOrUndefValue
George Karpenkov [Wed, 10 Jan 2018 01:30:32 +0000 (01:30 +0000)]
[analyzer] [NFC] Minor refactoring of trackNullOrUndefValue

Simple refactoring attempt: factor out some code, remove some
repetition, use auto where appropriate.

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

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

6 years ago[analyzer] [NFC] minor FindLastStoreBRVisitor refactoring
George Karpenkov [Wed, 10 Jan 2018 01:30:31 +0000 (01:30 +0000)]
[analyzer] [NFC] minor FindLastStoreBRVisitor refactoring

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

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

6 years ago[analyzer] suppress nullability inference from a macro when result is used in another...
George Karpenkov [Wed, 10 Jan 2018 01:22:14 +0000 (01:22 +0000)]
[analyzer] suppress nullability inference from a macro when result is used in another macro

The current code used to not suppress the report, if the dereference was
performed in a macro, assuming it is that same macro.
However, the assumption might not be correct, and XNU has quite a bit of
code where dereference is actually performed in a different macro.

As the code uses macro name and not a unique identifier it might be fragile,
but in a worst-case scenario we would simply emit an extra diagnostic.

rdar://36160245

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

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

6 years ago[cmake] Delete redundant install command for clang-refactor.
Don Hinton [Wed, 10 Jan 2018 01:00:28 +0000 (01:00 +0000)]
[cmake] Delete redundant install command for clang-refactor.

Summary: Install targets for clang tools are controlled by
CLANG_BUILD_TOOLS, and when OFF, cmake issues the following warning:

WARNING: Target "clang-refactor" has EXCLUDE_FROM_ALL set and will not
be built by default but an install rule has been provided for it.
CMake does not define behavior for this case.

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

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

6 years agoReland "Emit Function IDs table for Control Flow Guard"
Adrian McCarthy [Tue, 9 Jan 2018 23:49:30 +0000 (23:49 +0000)]
Reland "Emit Function IDs table for Control Flow Guard"

Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

The original patch didn't have the lit.local.cfg file that restricts the new
test to x86, thus the new test was failing on the non-x86 bots.

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

The reverts r322008, which was a revert of r322005.

This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba.

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

6 years agoWire up GCOV to the new pass manager
David Blaikie [Tue, 9 Jan 2018 22:03:47 +0000 (22:03 +0000)]
Wire up GCOV to the new pass manager

GCOV in the old pass manager also strips debug info (if debug info is
disabled/only produced for profiling anyway) after the GCOV pass runs.

I think the strip pass hasn't been ported to the new pass manager, so it
might take me a little while to wire that up.

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

6 years ago[Frontend] Remove unused FileMgr in pp arg parse
Brian Gesiak [Tue, 9 Jan 2018 21:26:47 +0000 (21:26 +0000)]
[Frontend] Remove unused FileMgr in pp arg parse

Summary:
A FIXME added 8 years ago (2010) in https://reviews.llvm.org/rL118203
mentioned that a FileManager should not need to be used when parsing
preprocessor arguments. In fact, its only use was removed 6 years ago
(2012), in https://reviews.llvm.org/rL166452. Remove the unused
variable and the obsolete FIXME.

Test Plan: `check-clang`

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Fix directive kind on stand-alone target data directives, NFC.
Alexey Bataev [Tue, 9 Jan 2018 19:59:25 +0000 (19:59 +0000)]
[OPENMP] Fix directive kind on stand-alone target data directives, NFC.

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

6 years ago[OpenMP] Fix handling of clause on wrong directive, by Joel. E. Denny
Alexey Bataev [Tue, 9 Jan 2018 19:21:04 +0000 (19:21 +0000)]
[OpenMP] Fix handling of clause on wrong directive, by Joel. E. Denny

Summary:
First, this patch fixes an assert failure when, for example, "omp for"
has num_teams.

Second, this patch prevents duplicate diagnostics when, for example,
"omp for" has uniform.

This patch makes the general assumption (even where it doesn't
necessarily fix an existing bug) that it is worthless to perform sema
for a clause that appears on a directive on which OpenMP does not
permit that clause.  However, due to this assumption, this patch
suppresses some diagnostics that were expected in the test suite.  I
assert that those diagnostics were likely just distracting to the
user.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Support importing CXXUnresolvedConstructExpr and UnresolvedLookupExpr
Aleksei Sidorin [Tue, 9 Jan 2018 16:40:40 +0000 (16:40 +0000)]
[ASTImporter] Support importing CXXUnresolvedConstructExpr and UnresolvedLookupExpr

* Note: This solution is based on
  https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L7605.

Patch by Peter Szecsi!

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

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

6 years agoExplicitly specify output file.
Alexander Kornienko [Tue, 9 Jan 2018 15:05:13 +0000 (15:05 +0000)]
Explicitly specify output file.

Otherwise the test fails when LLVM sources are on a read-only partition.

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

6 years ago[ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors
Aleksei Sidorin [Tue, 9 Jan 2018 14:25:05 +0000 (14:25 +0000)]
[ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors

Patch by Nico Rieck, test case by Sean Callanan!

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

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

6 years agoTrack in the AST whether the operand to a UnaryOperator can overflow and then use...
Aaron Ballman [Tue, 9 Jan 2018 13:07:03 +0000 (13:07 +0000)]
Track in the AST whether the operand to a UnaryOperator can overflow and then use that logic when evaluating constant expressions and emitting codegen.

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

6 years agoAvoid assumption that lit tests are writable (in a couple more places). NFC
Sam McCall [Tue, 9 Jan 2018 09:32:53 +0000 (09:32 +0000)]
Avoid assumption that lit tests are writable (in a couple more places). NFC

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

6 years agoananas: Add shared library support
Ed Schouten [Tue, 9 Jan 2018 09:18:14 +0000 (09:18 +0000)]
ananas: Add shared library support

The Ananas Operating System (https://github.com/zhmu/ananas) has shared
library support as of commit 57739c0b6ece56dd4872aedf30264ed4b9412c77.

This change adds the necessary settings to clang so that shared
executables and libraries can be build correctly.

Submitted by: Rink Springer
Differential Revision: https://reviews.llvm.org/D41500

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

6 years agoAdded Control Flow Protection Flag
Oren Ben Simhon [Tue, 9 Jan 2018 08:53:59 +0000 (08:53 +0000)]
Added Control Flow Protection Flag

Cf-protection is a target independent flag that instructs the back-end to instrument control flow mechanisms like: Branch, Return, etc.
For example in X86 this flag will be used to instrument Indirect Branch Tracking instructions.

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

Change-Id: I5126e766c0e6b84118cae0ee8a20fe78cc373dea

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

6 years agoFix use-after-free found by address-san on -r322028.
Erich Keane [Tue, 9 Jan 2018 01:09:12 +0000 (01:09 +0000)]
Fix use-after-free found by address-san on -r322028.

r322028 attempted to remove something from the "Manglings"
list when it was no longer valid, and did so with 'erase'.

However, StringRefs to these were stored, so these became
dangling references.  This patch changes to using 'remove' instead
of 'erase' to keep the strings valid.

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

6 years agoDocument attribute target multiversioning.
Erich Keane [Mon, 8 Jan 2018 23:36:29 +0000 (23:36 +0000)]
Document attribute target multiversioning.

Add attribute target multiversioning to the release notes.
Additionally adds multiversioning support to the attribute
documentation for 'target'.

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

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

6 years ago[X86] Replace cvt*2mask intrinsics with native IR using 'icmp slt X, zeroinitializer.
Craig Topper [Mon, 8 Jan 2018 22:37:56 +0000 (22:37 +0000)]
[X86] Replace cvt*2mask intrinsics with native IR using 'icmp slt X, zeroinitializer.

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

6 years agoPR35862: Suppress -Wmissing-variable-declarations warning on inline variables,
Richard Smith [Mon, 8 Jan 2018 21:46:42 +0000 (21:46 +0000)]
PR35862: Suppress -Wmissing-variable-declarations warning on inline variables,
variable templates, and instantiations thereof.

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

6 years agoImplement Attribute Target MultiVersioning
Erich Keane [Mon, 8 Jan 2018 21:34:17 +0000 (21:34 +0000)]
Implement Attribute Target MultiVersioning

GCC's attribute 'target', in addition to being an optimization hint,
also allows function multiversioning. We currently have the former
implemented, this is the latter's implementation.

This works by enabling functions with the same name/signature to coexist,
so that they can all be emitted. Multiversion state is stored in the
FunctionDecl itself, and SemaDecl manages the definitions.
Note that it ends up having to permit redefinition of functions so
that they can all be emitted. Additionally, all versions of the function
must be emitted, so this also manages that.

Note that this includes some additional rules that GCC does not, since
defining something as a MultiVersion function after a usage has been made illegal.

The only 'history rewriting' that happens is if a function is emitted before
it has been converted to a multiversion'ed function, at which point its name
needs to be changed.

Function templates and virtual functions are NOT yet supported (not supported
in GCC either).

Additionally, constructors/destructors are disallowed, but the former is
planned.

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

6 years ago[DOXYGEN] Fix doxygen and content issues in avxintrin.h
Douglas Yung [Mon, 8 Jan 2018 21:21:17 +0000 (21:21 +0000)]
[DOXYGEN] Fix doxygen and content issues in avxintrin.h

- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".
- Fix a few typos and errors found during review.
- Restore new line endings.

This patch was made by Craig Flores

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

6 years agoFactor out comparison handling for arithmetic types.
Richard Smith [Mon, 8 Jan 2018 21:12:04 +0000 (21:12 +0000)]
Factor out comparison handling for arithmetic types.

This is not quite NFC: we don't perform the usual arithmetic conversions unless
we have an operand of arithmetic or enumeration type any more. This matches the
standard rule, but actually has no effect other than to marginally improve our
diagnostics for the non-arithmetic, non-enumeration cases (by not performing
integral promotions on one operand if the other is a pointer).

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

6 years ago[Myriad] Remove invalidated -elf flag for MoviAsm
Walter Lee [Mon, 8 Jan 2018 20:36:08 +0000 (20:36 +0000)]
[Myriad] Remove invalidated -elf flag for MoviAsm

Summary:
The flag has been deprecated, and is becoming invalid in the latest
MDK.

Reviewers: jyknight

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Fix debug info for outlined functions in NVPTX + add more tests.
Alexey Bataev [Mon, 8 Jan 2018 20:09:47 +0000 (20:09 +0000)]
[OPENMP] Fix debug info for outlined functions in NVPTX  + add more tests.

Fixed name of emitted outlined functions in NVPTX target + extra tests
for the debug info.

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

6 years ago[OPENMP] Current status of OpenMP support.
Alexey Bataev [Mon, 8 Jan 2018 19:02:51 +0000 (19:02 +0000)]
[OPENMP] Current status of OpenMP support.

Summary: Some info about supported features of OpenMP 4.5-5.0.

Reviewers: hfinkel, rsmith

Subscribers: kkwli0, Hahnfeld, cfe-commits

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

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

6 years ago[index] Return when DC is null in handleReference
Fangrui Song [Mon, 8 Jan 2018 18:57:38 +0000 (18:57 +0000)]
[index] Return when DC is null in handleReference

Summary:
DC may sometimes be NULL and getContainerInfo(DC, Container) will dereference a null pointer.

Default template arguments (the following example and many test files in https://github.com/nlohmann/json)
may cause null pointer dereference.

```c++
template <typename>
struct actor;

template <template <typename> class Actor = actor>
struct terminal;
```

In tools/libclang/CXIndexDataConsumer.cpp#L203

    handleReference(ND, Loc, Cursor,
                    dyn_cast_or_null<NamedDecl>(ASTNode.Parent),
                    ASTNode.ContainerDC, ASTNode.OrigE, Kind);

`dyn_cast_or_null<NamedDecl>(ASTNode.Parent)` is somehow a null pointer and in tools/libclang/CXIndexDataConsumer.cpp:935

  ContainerInfo Container;
  getContainerInfo(DC, Container);

The null DC is casted `ContInfo.cursor = getCursor(cast<Decl>(DC));` and SIGSEGV.

```

See discussions in https://github.com/jacobdufault/cquery/issues/219 https://github.com/jacobdufault/cquery/issues/192

Reviewers: akyrtzi, sammccall, yvvan

Reviewed By: sammccall

Subscribers: mehdi_amini, cfe-commits

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

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

6 years agoRevert "Emit Function IDs table for Control Flow Guard"
Adrian McCarthy [Mon, 8 Jan 2018 17:12:01 +0000 (17:12 +0000)]
Revert "Emit Function IDs table for Control Flow Guard"

The new test fails on the Hexagon bot.  Reverting while I investigate.

This reverts https://reviews.llvm.org/rL322005

This reverts commit b7e0026b4385180c378edc658ec91a39566f2942.

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

6 years agoEmit Function IDs table for Control Flow Guard
Adrian McCarthy [Mon, 8 Jan 2018 16:33:42 +0000 (16:33 +0000)]
Emit Function IDs table for Control Flow Guard

Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

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

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

6 years agoFix test added in r321992 failing on some buildbots (again), test requires x86.
Sean Eveson [Mon, 8 Jan 2018 15:46:18 +0000 (15:46 +0000)]
Fix test added in r321992 failing on some buildbots (again), test requires x86.

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

6 years ago[CodeGen] Fix TBAA info for accesses to members of base classes
Ivan A. Kosarev [Mon, 8 Jan 2018 15:36:06 +0000 (15:36 +0000)]
[CodeGen] Fix TBAA info for accesses to members of base classes

Resolves:
Bug 35724 - regression (r315984): fatal error: error in backend:
Broken function found (Did not see access type in access path!)
https://bugs.llvm.org/show_bug.cgi?id=35724

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

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

6 years agoAvoid assumption that lit tests are writable. NFC
Sam McCall [Mon, 8 Jan 2018 15:05:01 +0000 (15:05 +0000)]
Avoid assumption that lit tests are writable. NFC

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

6 years agoFix test added in r321992 failing on some buildbots.
Sean Eveson [Mon, 8 Jan 2018 14:43:28 +0000 (14:43 +0000)]
Fix test added in r321992 failing on some buildbots.

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

6 years ago[Driver] Add flag enabling the function stack size section that was added in r319430
Sean Eveson [Mon, 8 Jan 2018 13:42:26 +0000 (13:42 +0000)]
[Driver] Add flag enabling the function stack size section that was added in r319430

Adds the -fstack-size-section flag to enable the .stack_sizes section. The flag defaults to on for the PS4 triple.

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

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

6 years agoRemove bogus check for template specialization from self-comparison warning.
Richard Smith [Sun, 7 Jan 2018 22:25:55 +0000 (22:25 +0000)]
Remove bogus check for template specialization from self-comparison warning.

The important check is that we're not within a template *instantiation*, which
we check separately.

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

6 years agoFix a couple of wrong self-comparison diagnostics.
Richard Smith [Sun, 7 Jan 2018 22:18:05 +0000 (22:18 +0000)]
Fix a couple of wrong self-comparison diagnostics.

Check whether we are comparing the same entity, not merely the same
declaration, and don't assume that weak declarations resolve to distinct
entities.

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

6 years agoAdd tests for three-way self- and array comparison.
Richard Smith [Sun, 7 Jan 2018 22:03:44 +0000 (22:03 +0000)]
Add tests for three-way self- and array comparison.

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

6 years agoFactor out common tautological comparison code from scalar and vector compare checking.
Richard Smith [Sun, 7 Jan 2018 21:57:48 +0000 (21:57 +0000)]
Factor out common tautological comparison code from scalar and vector compare checking.

In passing, improve vector compare diagnostic to match scalar compare diagnostic.

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

6 years agoRemove outdated doxygen comment [-Wdocumentation]
Benjamin Kramer [Sun, 7 Jan 2018 09:11:16 +0000 (09:11 +0000)]
Remove outdated doxygen comment [-Wdocumentation]

No functionality change.

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

6 years agoSimplify the internal API for checking whether swiftcall passes a type indirectly...
John McCall [Sun, 7 Jan 2018 06:28:49 +0000 (06:28 +0000)]
Simplify the internal API for checking whether swiftcall passes a type indirectly and expose that API externally.

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

6 years agoAdd support for a limited subset of TS 18661-3 math builtins.
Benjamin Kramer [Sat, 6 Jan 2018 21:49:54 +0000 (21:49 +0000)]
Add support for a limited subset of TS 18661-3 math builtins.

These just overloads for _Float128. They're supported by GCC 7 and used
by glibc. APFloat support is already there so just add the overloads.

__builtin_copysignf128
__builtin_fabsf128
__builtin_huge_valf128
__builtin_inff128
__builtin_nanf128
__builtin_nansf128

This is the same support that GCC has, according to the documentation,
but limited to _Float128.

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

6 years ago[analyzer] Fix some check's output plist not containing the check name
Gabor Horvath [Sat, 6 Jan 2018 10:51:00 +0000 (10:51 +0000)]
[analyzer] Fix some check's output plist not containing the check name

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

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

6 years agoTest case for r321396
Richard Trieu [Sat, 6 Jan 2018 03:20:59 +0000 (03:20 +0000)]
Test case for r321396

Any hashing for methods should be able to compile this test case without
emitting an error.  Since the class and method come from the same header from
each module, there should be no messages about ODR violations.

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

6 years agoSerialize the IDNS for a UsingShadowDecl rather than recomputing it.
Richard Smith [Sat, 6 Jan 2018 01:07:05 +0000 (01:07 +0000)]
Serialize the IDNS for a UsingShadowDecl rather than recomputing it.

Attempting to recompute it are doomed to fail because the IDNS of a declaration
is not necessarily preserved across serialization and deserialization (in turn
because whether a friend declaration is visible depends on whether some prior
non-friend declaration exists).

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

6 years ago[Driver] Suggest correctly spelled driver options
Brian Gesiak [Sat, 6 Jan 2018 00:25:40 +0000 (00:25 +0000)]
[Driver] Suggest correctly spelled driver options

Summary:
Depends on https://reviews.llvm.org/D41732.

Utilities such as `opt`, when invoked with arguments that are very
nearly spelled correctly, suggest the correctly spelled options:

```
bin/opt -hel
opt: Unknown command line argument '-hel'.  Try: 'bin/opt -help'
opt: Did you mean '-help'?
```

Clang, on the other hand, prior to this commit, does not:

```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel'
```

This commit makes use of the new libLLVMOption API from
https://reviews.llvm.org/D41732 in order to provide correct suggestions:

```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel', did you mean '-help'?
```

Test Plan: `check-clang`

Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno

Reviewed By: bruno

Subscribers: bruno, jroelofs, cfe-commits

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

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

6 years agoWhen name lookup finds a non-imported declaration and looks back along the
Richard Smith [Sat, 6 Jan 2018 00:09:23 +0000 (00:09 +0000)]
When name lookup finds a non-imported declaration and looks back along the
redecl chain for an imported declaration, make sure to check the IDNS of prior
imported decls.

Otherwise we can end up finding an invisible friend declaration and incorrectly
believing that it should be visible.

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

6 years agoPreserve unknown STDC pragma through preprocessor
Steven Wu [Fri, 5 Jan 2018 22:45:03 +0000 (22:45 +0000)]
Preserve unknown STDC pragma through preprocessor

Summary:
#pragma STDC FP_CONTRACT handler is only registered in parser so we
should keep the unknown STDC pragma through preprocessor and we also
should not emit warning for unknown STDC pragma during preprocessor.

rdar://problem/35724351

Reviewers: efriedma, rsmith, arphaman

Reviewed By: efriedma

Subscribers: cfe-commits

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

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

6 years agoTrack shadow modules with a generation counter.
Bruno Cardoso Lopes [Fri, 5 Jan 2018 22:13:56 +0000 (22:13 +0000)]
Track shadow modules with a generation counter.

This is a follow up to r321855, closing the gap between our internal shadow
modules implementation and upstream. It has been tested for longer and
provides a better approach for tracking shadow modules. Mostly NFCI.

rdar://problem/23612102

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

6 years agoAdd AST dumping support for _Generic expressions.
Richard Smith [Fri, 5 Jan 2018 21:31:07 +0000 (21:31 +0000)]
Add AST dumping support for _Generic expressions.

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

6 years agoFix TLS support check for Darwin 32-bit simulator targets.
Volodymyr Sapsai [Fri, 5 Jan 2018 20:20:03 +0000 (20:20 +0000)]
Fix TLS support check for Darwin 32-bit simulator targets.

Also instead of checking architecture explicitly, use recently added
"simulator" environment in the triple.

rdar://problem/35083787

Reviewers: arphaman, bob.wilson

Reviewed By: arphaman

Subscribers: gparker42, cfe-commits

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

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

6 years agoAdd a tool executor that runs actions on all TUs in the compilation database.
Eric Liu [Fri, 5 Jan 2018 10:32:16 +0000 (10:32 +0000)]
Add a tool executor that runs actions on all TUs in the compilation database.

Summary: Tool results are deduplicated by the result key.

Reviewers: hokein

Subscribers: klimek, mgorny, cfe-commits

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

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

6 years agoCommit new test file forgotten in previous commit
Stephan Bergmann [Fri, 5 Jan 2018 07:59:57 +0000 (07:59 +0000)]
Commit new test file forgotten in previous commit

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

6 years agoNo -fsanitize=function warning when calling noexcept function through non-noexcept...
Stephan Bergmann [Fri, 5 Jan 2018 07:57:12 +0000 (07:57 +0000)]
No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17

As discussed in the mail thread <https://groups.google.com/a/isocpp.org/forum/
#!topic/std-discussion/T64_dW3WKUk> "Calling noexcept function throug non-
noexcept pointer is undefined behavior?", such a call should not be UB.
However, Clang currently warns about it.

This change removes exception specifications from the function types recorded
for -fsanitize=function, both in the functions themselves and at the call sites.
That means that calling a non-noexcept function through a noexcept pointer will
also not be flagged as UB.  In the review of this change, that was deemed
acceptable, at least for now.  (See the "TODO" in compiler-rt
test/ubsan/TestCases/TypeCheck/Function/function.cpp.)

To remove exception specifications from types, the existing internal
ASTContext::getFunctionTypeWithExceptionSpec was made public, and some places
otherwise unrelated to this change have been adapted to call it, too.

This is the cfe part of a patch covering both cfe and compiler-rt.

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

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

6 years agoReapply r321781: [Modules] Allow modules specified by -fmodule-map-file to shadow...
Bruno Cardoso Lopes [Fri, 5 Jan 2018 02:33:18 +0000 (02:33 +0000)]
Reapply r321781: [Modules] Allow modules specified by -fmodule-map-file to shadow implicitly found ones

When modules come from module map files explicitly specified by
-fmodule-map-file= arguments, allow those to override/shadow modules
with the same name that are found implicitly by header search. If such a
module is looked up by name (e.g. @import), we will always find the one
from -fmodule-map-file. If we try to use a shadowed module by including
one of its headers report an error.

This enables developers to force use of a specific copy of their module
to be used if there are multiple copies that would otherwise be visible,
for example if they develop modules that are installed in the default
search paths.

Patch originally by Ben Langmuir,
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20151116/143425.html

Based on cfe-dev discussion:
http://lists.llvm.org/pipermail/cfe-dev/2015-November/046164.html

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

rdar://problem/23612102

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

6 years agoNFC.
Evgeny Stupachenko [Fri, 5 Jan 2018 02:22:52 +0000 (02:22 +0000)]
NFC.
The patch fixes r321395, that cuased
 -Werror=unused-but-set-variable issue for
 Diagnosed var on prod build.

From: Evgeny Stupachenko <evstupac@gmail.com>

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