Commit Graph

71842 Commits

Author SHA1 Message Date
Petr Hosek 84d036a0d1 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

llvm-svn: 322452
2018-01-14 03:43:17 +00:00
Mark Zeren 67d486508c [clang-format] [NFC] Remove comment
Remove inaccurate comment that came in with  r312125.

llvm-svn: 322448
2018-01-13 22:52:34 +00:00
Brian Gesiak 4995614f7c [docs] Use monospace for PCH option flags
Summary:
Use monospace for option flags in the PCH section, instead of the
italics that were being used previously.

I believe these used to be links, for which single backticks would
have been appropriate, but since they were un-link-ified in
https://reviews.llvm.org/rL275560, I believe monospace is now more
appropriate, and so two backticks are needed.

Test Plan:
Build the `docs-clang-html` target and confirm the options are rendered
using monospace font.

Reviewers: sepavloff, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 322447
2018-01-13 18:34:07 +00:00
Brian Gesiak ceb987f082 [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

llvm-svn: 322445
2018-01-13 17:09:11 +00:00
Jan Korous fda9daeb03 [Sema] Fix crash for type-dependent base classes
llvm-svn: 322438
2018-01-13 15:24:16 +00:00
Alex Bradbury e0f80ddad1 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.

llvm-svn: 322435
2018-01-13 09:21:11 +00:00
Richard Smith 56ae0a67e8 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.

llvm-svn: 322431
2018-01-13 05:05:45 +00:00
Eric Christopher f9c63174c0 Remove unused addIfPresent function.
llvm-svn: 322427
2018-01-13 00:46:47 +00:00
Richard Trieu 5923a6da05 Try to suppress Windows testing again.
llvm-svn: 322420
2018-01-12 23:13:33 +00:00
Douglas Yung 0d29aaf628 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

llvm-svn: 322417
2018-01-12 22:32:01 +00:00
Richard Smith d1036128ab 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).

llvm-svn: 322414
2018-01-12 22:21:33 +00:00
Paul Robinson 212f3b91ee [DWARFv5] Have -gdwarf-5 generate MD5 checksums
Differential Revision: https://reviews.llvm.org/D42011

llvm-svn: 322413
2018-01-12 22:19:03 +00:00
Artem Dergachev 1ebd1c4f9d [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

llvm-svn: 322410
2018-01-12 22:12:11 +00:00
John McCall 5cdf038374 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!

llvm-svn: 322406
2018-01-12 22:07:01 +00:00
Richard Trieu 526fb05c0a Disable test for Windows to fix Windows buildbots.
llvm-svn: 322405
2018-01-12 21:49:20 +00:00
Alex Bradbury e41a5e2490 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

llvm-svn: 322396
2018-01-12 20:08:16 +00:00
Alexey Bataev 475a7440f1 [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.

llvm-svn: 322393
2018-01-12 19:39:11 +00:00
Volodymyr Sapsai abb8dfc114 [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

llvm-svn: 322390
2018-01-12 18:54:35 +00:00
Sam Clegg ffbfc0f827 [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

llvm-svn: 322382
2018-01-12 17:54:49 +00:00
Sam McCall bb2cf63b32 [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

llvm-svn: 322371
2018-01-12 14:51:47 +00:00
Richard Trieu 4eefb4511d [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.

llvm-svn: 322350
2018-01-12 04:42:27 +00:00
Craig Topper a5bdee2414 [Docs] Fix typo in toolchain documentation
llvm-svn: 322347
2018-01-12 02:57:02 +00:00
Eric Fiselier 1af6c114cc 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

llvm-svn: 322334
2018-01-12 00:09:37 +00:00
Sam Clegg 9bbca8c240 [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

llvm-svn: 322321
2018-01-11 22:33:50 +00:00
Rafael Espindola cbca487f49 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.

llvm-svn: 322318
2018-01-11 22:15:12 +00:00
Richard Smith e97654b2f2 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.

llvm-svn: 322316
2018-01-11 22:13:57 +00:00
Alex Bradbury f067a2f769 [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.

llvm-svn: 322294
2018-01-11 17:06:32 +00:00
Alex Bradbury 0acf13f659 [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.

llvm-svn: 322286
2018-01-11 15:38:01 +00:00
Sven van Haastregt 774355e321 [OpenCL] Reorder the CLK_sRGBx/sRGBA defines, NFC
Swap them so that all channel order defines are ordered according to
their values.

llvm-svn: 322278
2018-01-11 14:05:38 +00:00
Alex Bradbury d53ce4a8b5 [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.

llvm-svn: 322277
2018-01-11 13:51:06 +00:00
Alex Bradbury 71f45455e1 [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

llvm-svn: 322276
2018-01-11 13:36:56 +00:00
Pavel Labath da45439fba [Lex] Use WritableMemoryBuffer in ScratchBuffer.cpp
This avoids the need to const_cast the buffer contents to write to it.

NFCI.

llvm-svn: 322268
2018-01-11 10:43:45 +00:00
Petr Hosek 605d3b9225 Revert "[Driver] Update default sanitizer blacklist location"
This reverts commit r322258: broke the dfsan build.

llvm-svn: 322260
2018-01-11 07:05:38 +00:00
Petr Hosek bb9c6fc3bc 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

llvm-svn: 322258
2018-01-11 06:42:12 +00:00
Petr Hosek 98a57ad6ce [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

llvm-svn: 322253
2018-01-11 04:25:30 +00:00
Petr Hosek e4825b8dc4 [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

llvm-svn: 322252
2018-01-11 04:17:57 +00:00
Craig Topper 919264371b [X86][Sema] Range check the constant argument for the vpshld/vpshrd builtins to ensure it fits in 8-bits.
llvm-svn: 322247
2018-01-11 01:38:02 +00:00
Craig Topper 71d4aaa523 [X86] Fix vpshrd builtins to require an ICE for their constant argument to match vpshld.
llvm-svn: 322246
2018-01-11 01:38:00 +00:00
Craig Topper a1ef12a051 [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.

llvm-svn: 322245
2018-01-11 01:37:59 +00:00
Craig Topper 8e63fc70be [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.

llvm-svn: 322244
2018-01-11 01:37:57 +00:00
Petr Hosek aaf4da6c10 Revert "[Driver] Update default sanitizer blacklist location"
This reverts commit r322233: this is breaking dfsan tests.

llvm-svn: 322242
2018-01-11 00:12:02 +00:00
Volodymyr Sapsai cbafa59527 [Lex] Inline a variable in test in preparation for more similar tests. NFC.
llvm-svn: 322240
2018-01-10 23:37:29 +00:00
Richard Smith 93ee9caaed In C++17, when instantiating an out-of-line definition of an inline static data
member, don't forget to instantiate the initializer too.

llvm-svn: 322236
2018-01-10 23:08:26 +00:00
Petr Hosek 7e48abc764 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

llvm-svn: 322233
2018-01-10 22:59:00 +00:00
Matt Morehouse f113deaa3c [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

llvm-svn: 322221
2018-01-10 20:27:48 +00:00
Brian Gesiak 5b60198795 [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

llvm-svn: 322220
2018-01-10 20:23:45 +00:00
Petr Hosek 1747f3572e Revert "[Driver] Update default sanitizer blacklist location"
This reverts commit r322154 because it broke sanitizer bots.

llvm-svn: 322155
2018-01-10 02:24:09 +00:00
Petr Hosek b931670ae6 [Driver] Update default sanitizer blacklist location
This is related to moving the sanitizer blacklists to share/
subdirectory.

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

llvm-svn: 322154
2018-01-10 02:12:24 +00:00
George Karpenkov c41f37987b [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

llvm-svn: 322151
2018-01-10 01:30:32 +00:00
George Karpenkov 57dc6b7c8e [analyzer] [NFC] minor FindLastStoreBRVisitor refactoring
Differential Revision: https://reviews.llvm.org/D41790

llvm-svn: 322150
2018-01-10 01:30:31 +00:00