Commit Graph

85251 Commits

Author SHA1 Message Date
Brad Smith 430db35bf2 fix typo 2020-08-08 17:58:13 -04:00
Brad Smith 4eb4ebf76a Hook up OpenBSD 64-bit PowerPC support 2020-08-08 17:51:19 -04:00
Simon Pilgrim 090f9d5a55 Fix MSVC "not all control paths return a value" warning. NFC. 2020-08-08 19:12:11 +01:00
Brad Smith cd5ab56bc4 Change the default target CPU for OpenBSD/i386 to i586 2020-08-08 13:49:45 -04:00
Dávid Bolvanský 6cd23558d3 [Clang] Fixed buildboit failure; bot defaults to older C++ standard 2020-08-08 19:37:50 +02:00
Dávid Bolvanský 0fef780aa7 [Clang] Avoid whitespace in fixit note 2020-08-08 19:34:07 +02:00
Dávid Bolvanský dc096a66cb [Diagnostics] Diagnose missing comma in string array initialization
Motivation (from PR37674):

const char *ss[] = {
  "foo", "bar",
  "baz", "qux"  // <-- Missing comma!
  "abc", "xyz"
  };

This kind of bug was recently also found in LLVM codebase (see PR47030).

Solves PR47038, PR37674

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85545
2020-08-08 19:24:30 +02:00
Richard Smith fb943696cb PR47025, PR47043: Diagnose unexpanded parameter packs in concept
declarations and requires-expressions.
2020-08-07 18:19:39 -07:00
Nick Desaulniers abb9bf4bcf Revert "[Clang] implement -fno-eliminate-unused-debug-types"
This reverts commit e486921fd6.

Breaks windows builds and osx builds.
2020-08-07 16:11:41 -07:00
Nick Desaulniers 73413d266a Revert "fix windows build for D80242"
This reverts commit cbd8ec9370.
2020-08-07 16:11:26 -07:00
cchen 3adc9aeb25 [OpenMP 5.0] Fix PR-45212: Shouldn't error out while using overloaded operator for map clause
LValue map checker should handle CXXOperatorCallExpr

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D85563
2020-08-07 18:07:48 -05:00
Nick Desaulniers cbd8ec9370 fix windows build for D80242 2020-08-07 14:59:35 -07:00
Nick Desaulniers e486921fd6 [Clang] implement -fno-eliminate-unused-debug-types
Fixes pr/11710.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D80242
2020-08-07 14:13:48 -07:00
Artem Belevich cd01980f30 [OpenMP] Split OpenMP/target_map_codegen test [NFC]
The test file is the single longest test among clang's tests and ends up about
doubling the wall time of clang tests on machines with high number of cores.

The test appears to consist of multiple independent subtests and does not have
to be in one file. Splitting it into smaller parts reduces test time on my
machine from ~80s down to ~45.

Differential Revision: https://reviews.llvm.org/D85551
2020-08-07 13:47:53 -07:00
Zequan Wu c354b2e3bf [Clang] Add note for bad conversion when expression is pointer to forward-declared type
Differential Revision: https://reviews.llvm.org/D85390
2020-08-07 11:06:08 -07:00
Eduardo Caldas 8abb5fb68f [SyntaxTree] Use simplified grammar rule for `NestedNameSpecifier` grammar nodes
This is our grammar rule for nested-name-specifiers:
globalbal-specifier:
  /*empty*/
simple-template-specifier:
  template_opt simple-template-id
name-specifier:
  global-specifier
  decltype-specifier
  identifier
  simple-template-specifier
nested-name-specifier:
  list(name-specifier, ::, non-empty, terminated)

It is a relaxed version of C++ [expr.prim.id] and quite simpler to map to our API.

TODO: refine name specifiers, `simple-template-name-specifier` and
decltype-name-specifier` are token soup for now.
2020-08-07 18:05:47 +00:00
Yaxun (Sam) Liu ac3e720dc1 Make clang HIP headers compatible with C++98
Automation to detect compiler features, such as CMake's target_compile_features,
would attempt to detect compiler features by explicitly using langugage flags.
This change ensures that the HIP headers would still work with C++98.

Patch by Siu Chi Chan

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

Change-Id: I304e964b18a525b0fde55efd841da74b6c4dc8ed
2020-08-07 13:50:22 -04:00
Artem Dergachev 47cadd6106 [analyzer] pr47030: MoveChecker: Unforget a comma in the suppression list. 2020-08-07 10:39:28 -07:00
Alexey Bataev 4a7aedb843 [OPENMP]Simplify representation for atomic, critical, master and section
constrcut.

Several constructs may be represented wityout relying on CapturedStmt.
It saves memory and improves compilation speed.
2020-08-07 09:58:23 -04:00
Bevin Hansson aa0d19a0c8 [Fixed Point] Add fixed-point shift operations and consteval.
Reviewers: rjmccall, leonardchan, bjope

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83212
2020-08-07 15:09:24 +02:00
Vince Bridgers 351aac0985 [Sema] Add casting check for fixed to fixed point conversions
This change squelches the warning for a cast from fixed to fixed point
conversions when -Wbad-function-cast is enabled.

Fixes:

cast from function call of type '_Fract' to non-matching type '_Fract'
[-Wbad-function-cast]

Reviewed By: bjope

Differential Revision: https://reviews.llvm.org/D85157
2020-08-07 07:58:53 -05:00
Simon Pilgrim 18212cbcda Remove duplicate/unreachable break (PR47029) 2020-08-07 11:48:48 +01:00
Simon Pilgrim ffd258f7bb Remove unreachable return (PR47028) 2020-08-07 11:33:23 +01:00
Simon Tatham 1d78294250 [Sema][BFloat] Forbid arithmetic on vectors of bfloat.
Vectors of bfloat are a storage format only; you're supposed to
explicitly convert them to a wider type to do arithmetic on them.
But currently, if you write something like

  bfloat16x4_t test(bfloat16x4_t a, bfloat16x4_t b) { return a + b; }

then the clang frontend accepts it without error, and (ARM or AArch64)
isel fails to generate code for it.

Added a rule in Sema that forbids the attempt from even being made,
and tests that check it. In particular, we also outlaw arithmetic
between vectors of bfloat and any other vector type.

Patch by Luke Cheeseman.

Reviewed By: LukeGeeson

Differential Revision: https://reviews.llvm.org/D85009
2020-08-07 11:25:19 +01:00
Simon Pilgrim 24cca30f7f Remove unreachable return (PR47026) 2020-08-07 11:23:43 +01:00
Kazushi (Jam) Marukawa 3ac1eb6358 [VE] Remove obsoleted getVEAsmModeForCPU function
Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85507
2020-08-07 18:20:34 +09:00
Haojian Wu 67174765db [AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr in TreeTransform.
Differential Revision: https://reviews.llvm.org/D85423
2020-08-07 11:15:19 +02:00
Eduardo Caldas ba41a0f733 [SyntaxTree][NFC] remove redundant namespace-specifiers
Differential Revision: https://reviews.llvm.org/D85427
2020-08-07 08:45:29 +00:00
Thomas Preud'homme 6dc863cd85 [clang, test, Darwin] Fix tests expecting Darwin target
Clang tests Driver/apple-arm64-arch.c and
Driver/darwin-warning-options.c test Darwin driver functionality but
only require the host system to be Darwin. This leads the tests to fail
when building a cross-compiler on Darwin and to be marked unsupported
when cross-compiling to Darwin from another system. This commit changes
the requirements for those tests to require the target to be Darwin.

Reviewed By: steven_wu

Differential Revision: https://reviews.llvm.org/D85367
2020-08-07 09:21:31 +01:00
Christian Kühnel f3cc4df51d Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit 1adc494bce.
This patch broke the Windows compilation on buildbot and pre-merge testing:
http://lab.llvm.org:8011/builders/mlir-windows/builds/5945
https://buildkite.com/llvm-project/llvm-master-build/builds/780
2020-08-07 09:36:49 +02:00
biplmish cce1b0e891 [PowerPC] Implement Vector Extract Low/High Order Builtins in LLVM/Clang
This patch implements the function prototypes vec_extractl and vec_extracth in altivec.h to utilize the vector extract double element instructions introduced in Power10.

Differential Revision: https://reviews.llvm.org/D84622
2020-08-07 01:02:29 -05:00
Richard Smith ed5a18fc03 PR30738: Implement two-phase name lookup for fold-expressions. 2020-08-06 16:56:39 -07:00
Richard Smith d6492d8744 Add -Wtautological-value-range-compare warning.
This warning diagnoses cases where an expression is compared to a
constant, and the comparison is tautological due to the form of the
expression (but not merely due to its type). This applies in cases such
as comparisons of bit-fields and the result of bit-masks.

The new warning is added to the Clang diagnostic group
-Wtautological-constant-in-range-compare but not to the
formerly-equivalent GCC-compatibility diagnostic group -Wtype-limits,
which retains its old meaning of diagnosing only tautological
comparisons to extremal values of a type (eg, int > INT_MAX).

Reviewed By: rtrieu

Differential Revision: https://reviews.llvm.org/D85256
2020-08-06 13:28:50 -07:00
Craig Topper 4df38a5589 [X86] Optimize out a few extra strlen calls in getX86TargetCPU. NFCI
We had a conversion from const char * to StringRef and const char *
to std::string conversion. These both do their own
strlen call if the compiler doens't figure out how to share them.
By adding the temporary StringRef we can convert it to std::string
instead.

The other case is to use a StringSwitch<StringRef> instead of
StringSwitch<const char *> since the output values of the switch
are string literals. This allows the length to be computed at
compile time. Otherwise we have to convert from const char *
to std::string after the StringSwitch.
2020-08-06 13:18:15 -07:00
Craig Topper e1cad4234c [X86] Make getX86TargetCPU return std::string instead of const char *. Remove call to MakeArgString. NFCI
I believe this function used to be called directly from X86
specific code and was used to immediately create -target-cpu
command line. A later refactoring changed it to to be called from
a generic getCPU function that returns std::string. So on some
paths we created a string using MakeArgString converted that to
std::string then called MakeArgString again from that.

Instead just return std::string directly like the other targets.
2020-08-06 13:18:15 -07:00
Matt Arsenault 30eeb742f1 clang: Use byref for aggregate kernel arguments
Add address space to indirect abi info and use it for kernels.

Previously, indirect arguments assumed assumed a stack passed object
in the alloca address space using byval. A stack pointer is unsuitable
for kernel arguments, which are passed in a separate, constant buffer
with a different address space.

Start using the new byref for aggregate kernel arguments. Previously
these were emitted as raw struct arguments, and turned into loads in
the backend. These will lower identically, although with byref you now
have the option of applying an explicit alignment. In the future, a
reasonable implementation would use byref for all kernel arguments
(this would be a practical problem at the moment due to losing things
like noalias on pointer arguments).

This is mostly to avoid fighting the optimizer's treatment of
aggregate load/store. SROA and instcombine both turn aggregate loads
and stores into a long sequence of element loads and stores, rather
than the optimizable memcpy I would expect in this situation. Now an
explicit memcpy will be introduced up-front which is better understood
and helps eliminate the alloca in more situations.

This skips using byref in the case where HIP kernel pointer arguments
in structs are promoted to global pointers. At minimum an additional
patch is needed to allow coercion with indirect arguments. This also
skips using it for OpenCL due to the current workaround used to
support kernels calling kernels. Distinct function bodies would need
to be generated up front instead of emitting an illegal call.
2020-08-06 15:52:26 -04:00
Aaron En Ye Shi 96c2d5e99e [HIP] Ignore invalid ar linker options
Instead of accepting the same arguments as regular linker,
the static linker will only accept input files.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D85442
2020-08-06 17:39:41 +00:00
Alexey Bataev 8d072a4405 [OPENMP]Fix for Windows buildbots, NFC. 2020-08-06 12:36:52 -04:00
Alexey Bataev 0af7835eae [OPENMP]Redesign of OMPExecutableDirective/OMPDeclarativeDirective representation.
Summary:
Introduced OMPChildren class to handle all associated clauses, statement
and child expressions/statements. It allows to represent some directives
more correctly (like flush, depobj etc. with pseudo clauses, ordered
depend directives, which are standalone, and target data directives).
Also, it will make easier to avoid using of CapturedStmt in directives,
if required (atomic, tile etc. directives).
Also, it simplifies serialization/deserialization of the
executable/declarative directives.
Reduces number of allocation operations for mapper declarations.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, jfb, cfe-commits, sstefan1, aaron.ballman, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83261
2020-08-06 12:25:19 -04:00
Peter Smith 839d974ee0 [DOCS] Add more detail to stack protector documentation
The Clang -fstack-protector documentation mentions what functions are considered
vulnerable but does not mention the details of the implementation such as the use
of a global variable for the guard value. This brings the documentation more in
line with the GCC documentation at:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
and gives someone using the option more idea about what is protected.

This partly addresses https://bugs.llvm.org/show_bug.cgi?id=42764

Differential Revision: https://reviews.llvm.org/D85239
2020-08-06 13:47:21 +01:00
Anatoly Trosinenko 5a07490d76 [ABI][NFC] Fix the confusion of ByVal and ByRef argument names
The second argument of getNaturalAlignIndirect() was `bool ByRef`, but
the implementation was just delegating to getIndirect() with `ByRef`
passed unchanged to `bool ByVal` parameter of getIndirect().

Fix a couple of /*ByRef=*/ comments as well.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D85113
2020-08-06 15:20:18 +03:00
Valeriy Savchenko 6ddef92474 [analyzer][tests] Understand when diagnostics change between builds
Before the patch `SATest compare`, produced quite obscure results
when something about the diagnostic have changed (i.e. its description
or the name of the corresponding checker) because it was simply two
lists of warnings, ADDED and REMOVED.  It was up to the developer
to match those warnings, understand that they are essentially the
same, and figure out what caused the difference.

This patch introduces another category of results: MODIFIED.
It tries to match new warnings against the old ones and prints out
clues on what is different between two builds.

Differential Revision: https://reviews.llvm.org/D85311
2020-08-06 12:53:20 +03:00
Rainer Orth 710949482e [clang][Driver] Don't hardcode --as-needed/--no-as-needed on Illumos
`ninja check-all` currently fails on Illumos:

  [84/716] Generating default/Asan-i386-inline-Test
  FAILED: projects/compiler-rt/lib/asan/tests/default/Asan-i386-inline-Test
  cd /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests && /var/llvm/dist-amd64-release/./bin/clang ASAN_INST_TEST_OBJECTS.gtest-all.cc.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_globals_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_internal_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_oob_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_mem_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_str_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test_main.cpp.i386-inline.o -o /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests/default/./Asan-i386-inline-Test -g --driver-mode=g++ -fsanitize=address -m32
  ld: fatal: unrecognized option '--no-as-needed'
  ld: fatal: use the -z help option for usage information
  clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

`clang` unconditionally passes `--as-needed`/`--no-as-needed` to the
linker.  This works on Solaris 11.[34] which added a couple of option
aliases to the native linker to improve compatibility with GNU `ld`.
Illumos `ld` didn't do this, so one needs to use the corresponding
native options `-z ignore`/`-z record` instead.

Because this works on both Solaris and Illumos, the current patch always
passes the native options on Solaris.  This isn't fully correct, however:
when using GNU `ld` on Solaris (not yet supported; I'm working on that),
one still needs `--as-needed` instead.

I'm hardcoding this decision because a generic detection via a `cmake` test
is hard: many systems have their own implementation of `getDefaultLinker`
and `cmake` would have to duplicate the information encoded there.
Besides, it would still break when `-fuse-ld` is used.

Tested on `amd64-pc-solaris2.11` (Solaris 11.4 and OpenIndiana 2020.04),
`sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D84412
2020-08-06 10:47:16 +02:00
Alex Richardson e150d2cab8 [update_cc_test_checks.py] Add test for D84511
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D85115
2020-08-06 09:15:56 +01:00
Craig Topper 504a197fe5 [X86] Rename X86::getImpliedFeatures to X86::updateImpliedFeatures and pass clang's StringMap directly to it.
No point in building a vector of StringRefs for clang to apply to the
StringMap. Just pass the StringMap and modify it directly.
2020-08-06 00:20:46 -07:00
Petr Hosek 633e3dacf2 [CMake] Print the autodetected host linker version
There's no easy way to find out what the autodetected version is, but
sometimes it may be useful to confirm that the right version is being
used. Print it as CMake status message.

Differential Revision: https://reviews.llvm.org/D85362
2020-08-05 20:22:28 -07:00
Jan Korous 820e8d8656 [Analyzer][WebKit] UncountedLambdaCaptureChecker
Differential Revision: https://reviews.llvm.org/D82837
2020-08-05 15:23:55 -08:00
Petr Hosek 1adc494bce [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-05 16:07:11 -07:00
Richard Smith 076b120beb CFG: Destroy temporaries in (a,b) expression in the correct order. 2020-08-05 14:52:53 -07:00
Thomas Lively f496950001 [WebAssembly] Fix types in wasm_simd128.h and add tests
47f7174ffa changed the types used in the Wasm SIMD builtin functions,
but not all of their uses in wasm_simd128.h were updated. This commit
fixes wasm_simd128.h and adds tests to make sure similar problems do
not pass uncaught in the future.

Differential Revision: https://reviews.llvm.org/D85347
2020-08-05 14:00:01 -07:00