Commit Graph

81731 Commits

Author SHA1 Message Date
David Green 170de3de2e [ParserTest] Move raw string literal out of macro
Some combinations of gcc and ccache do not deal well with raw strings in
macros. Moving the string out to attempt to fix the bots.
2020-01-05 11:24:04 +00:00
Tyker c4766cadcb [Diagnostic] Add test for previous b4b904e19b 2020-01-04 01:41:21 +01:00
Gabor Horvath 0458e63d28 [fuchsia] Enable Clang Static Analyzer
Differential Revision: https://reviews.llvm.org/D72188
2020-01-03 15:49:32 -08:00
Jonas Paulsson c0f1eac008 [SystemZ] Don't allow CL option -mpacked-stack with -mbackchain.
-mpacked-stack is currently not supported with -mbackchain, so this should
result in a compilation error message instead of being silently ignored.

Review: Ulrich Weigand
2020-01-03 12:26:54 -08:00
Alexander Lanin e5a56f2d50 Remove outdated svn/git information from hacking page
The patch files section is redundant to https://llvm.org/docs/GettingStarted.html.
There is nothing clang specific here. We are talking about a monorepo after all.
While it may seem nice to have one single clang page which explains everything,
it's not: It doesn't cover the topics in sufficient depth, it's redundant to
other pages and it's hard to keep it up to date as we see with the svn
instructions.
2020-01-03 14:13:40 -05:00
Alexey Bataev add743b434 [OPENMP]Fix crash on error message for declare reduction.
If the qualified reduction name is specified and not found, the compiler
may crash because of not specified parameter.
2020-01-03 12:13:03 -05:00
Nico Weber ba3484c051 [clang-format/java] format multiple qualified annotations on one declaration better
Before:
    class Foo {
      @CommandLineFlags
          .Add
          @Features.foo
          public void test() {}
    }

Now:
    class Foo {
        @Features.foo
        @CommandLineFlags.Add
        public void test() { }
    }

See also https://crbug.com/1034115
2020-01-03 12:11:44 -05:00
Kelvin Li 427ffa2cdb [OpenMP] diagnose zero-length array section in the depend clause
The OpenMP specification disallows having zero-length array
sections in the depend clause (OpenMP 5.0 2.17.11).

Differential Revision: https://reviews.llvm.org/D71969
2020-01-03 11:55:37 -05:00
Tyker b4b904e19b [Diagnostic] Fixed add ftabstop to -Wmisleading-indentation
Summary:
this allow much better support of codebases like the linux kernel that mix tabs and spaces.

-ftabstop=//Width// allow specifying how large tabs are considered to be.

Reviewers: xbolva00, aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: mstorsjo, cfe-commits, jyknight, riccibruno, rsmith, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71037
2020-01-03 17:22:24 +01:00
Anastasia Stulova e456165f9f [OpenCL] Add link to C++ for OpenCL documentation
Remove description of language mode from the language
extensions and add a link to pdf document.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72076
2020-01-03 12:01:03 +00:00
Ilya Biryukov 04f627f6b9 [Syntax] Build spanning SimpleDecalration for classes, structs, etc
When they are free-standing, e.g. `struct X;` or `struct X {};`.
Although this complicates the common case (of free-standing class
declarations), this ensures the less common case (e.g. `struct X {} a;`)
are handled uniformly and produce similar syntax trees.
2020-01-03 12:33:11 +01:00
Petr Hosek b63bc648a4 [CMake] clang-scan-deps in Fuchsia distribution
We would like to use clang-scan-deps in Fuchsia build so include it
in the toolchain distribution.

Differential Revision: https://reviews.llvm.org/D72113
2020-01-02 16:49:52 -08:00
Alexey Bataev a58da1a2ff [OPENMP50]Codegen for lastprivate conditional list items.
Added codegen support for lastprivate conditional. According to the
standard, if  when the conditional modifier appears on the clause, if an
assignment to a list item is encountered in the construct then the
original list item is assigned the value that is assigned to the new
list item in the sequentially last iteration or lexically last section
in which such an assignment is encountered.
We look for the assignment operations and check if the left side
references lastprivate conditional variable. Then the next code is
emitted:
if (last_iv_a <= iv) {
  last_iv_a = iv;
  last_a = lp_a;
}

At the end the implicit barrier is generated to wait for the end of all
threads and then in the check for the last iteration the private copy is
assigned the last value.

if (last_iter) {
  lp_a = last_a; // <--- new code
  a = lp_a;      // <--- store of private value to the original  variable.
}
2020-01-02 16:43:00 -05:00
Alexey Bataev 1fcc9b6ff8 [OPENMP] Restore allowing of braced initializers in the declare reduction
init.

Braced initializers were not accepted after the last fix in the initialier.Restored previous functionality.
2020-01-02 16:10:17 -05:00
Saleem Abdulrasool abb0075306 build: reduce 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 restores 68a235d07f,
e6c7ed6d21.  The problem with the windows
bot is a need for clearing the cache.
2020-01-02 11:19:12 -08:00
Nathan James ec3d8e61b5 Handle init statements in readability-else-after-return
Adds a new ASTMatcher condition called 'hasInitStatement()' that matches if,
switch and range-for statements with an initializer. Reworked clang-tidy
readability-else-after-return to handle variables in the if condition or init
statements in c++17 ifs. Also checks if removing the else would affect object
lifetimes in the else branch.

Fixes PR44364.
2020-01-02 13:39:27 -05:00
Kevin P. Neal 89d6c288ba [SystemZ] Use FNeg in s390x clang builtins
The s390x builtins are still using FSub instead of FNeg. Correct that.
2020-01-02 12:14:43 -05:00
James Henderson e406cca5f9 Revert "build: reduce CMake handling for zlib"
This reverts commit 68a235d07f.

This commit broke the clang-x64-windows-msvc build bot and a follow-up
commit did not fix it. Reverting to fix the bot.
2020-01-02 16:02:10 +00:00
serge_sans_paille 24ab9b537e Generalize the pass registration mechanism used by Polly to any third-party tool
There's quite a lot of references to Polly in the LLVM CMake codebase. However
the registration pattern used by Polly could be useful to other external
projects: thanks to that mechanism it would be possible to develop LLVM
extension without touching the LLVM code base.

This patch has two effects:

1. Remove all code specific to Polly in the llvm/clang codebase, replaicing it
   with a generic mechanism

2. Provide a generic mechanism to register compiler extensions.

A compiler extension is similar to a pass plugin, with the notable difference
that the compiler extension can be configured to be built dynamically (like
plugins) or statically (like regular passes).

As a result, people willing to add extra passes to clang/opt can do it using a
separate code repo, but still have their pass be linked in clang/opt as built-in
passes.

Differential Revision: https://reviews.llvm.org/D61446
2020-01-02 16:45:31 +01:00
Alexey Bataev 87a004d0f8 [OpenMP] Fix formatting of OpenMP error message, by Wang Tianqing.
Summary: `getListOfPossibleValues()` formatted incorrectly when there is only one value, emitting something like `expected 'conditional' or  in OpenMP clause 'lastprivate'`.

Reviewers: jdoerfert, ABataev

Reviewed By: jdoerfert

Subscribers: guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71884
2020-01-02 10:07:04 -05:00
Saleem Abdulrasool 68a235d07f build: reduce 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.
2020-01-01 16:36:59 -08:00
Mark de Wever 8ca79dac55 Revert "Adds -Wrange-loop-analysis to -Wall"
The sanitizer-x86_64-linux buildbot failed to build lld with -Werror.

This reverts commit d8117542ac.
2020-01-01 22:19:18 +01:00
Mark de Wever d8117542ac Adds -Wrange-loop-analysis to -Wall
This makes the range loop warnings part of -Wall.

Fixes PR32823: Warn about accidental coping of data in range based for

Differential Revision: https://reviews.llvm.org/D68912
2020-01-01 20:02:42 +01:00
Mark de Wever e5ab1e49f9 Improve Wrange-loop-analyses for rvalue reference
The Wrange-loop-analyses warns if a copy is made. Suppress this warning when
a temporary is bound to a rvalue reference.

While fixing this issue also found a copy-paste error in test6, which is also
fixed.

Differential Revision: https://reviews.llvm.org/D71806
2020-01-01 20:02:18 +01:00
Mark de Wever f022a5a792 Adds fixit hints to the -Wrange-loop-analysis
Differential Revision: https://reviews.llvm.org/D68913
2020-01-01 20:02:00 +01:00
Mark de Wever 8dc7b982b4 [NFC] Fixes -Wrange-loop-analysis warnings
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D71857
2020-01-01 20:01:37 +01:00
Fangrui Song d2bb8c16e7 [MC][TargetMachine] Delete MCTargetOptions::MCPIECopyRelocations
clang/lib/CodeGen/CodeGenModule performs the -mpie-copy-relocations
check and sets dso_local on applicable global variables. We don't need
to duplicate the work in TargetMachine shouldAssumeDSOLocal.

Verified that -mpie-copy-relocations can still emit PC relative
relocations for external variable accesses.

clang -target x86_64 -fpie -mpie-copy-relocations -c => R_X86_64_PC32
clang -target aarch64 -fpie -mpie-copy-relocations -c => R_AARCH64_ADR_PREL_PG_HI21+R_AARCH64_LDST64_ABS_LO12_NC
2020-01-01 00:50:18 -08:00
Martin Storsjö b65ca8e5db Revert "[Diagnostic] Add ftabstop to -Wmisleading-indentation"
This reverts commit b47b35ff51.

This caused failed asserts (Assertion `FIDAndOffset.second >
ColNo && "Column number smaller than file offset?"' failed.)
on a source file with a single line containing
"int main (void) { for( int i = 0; i < 9; i++ ); return 0; }".
2019-12-31 21:38:43 +02:00
Alexey Bataev 8be5a0fe12 [OPENMP]Emit artificial threprivate vars as threadlocal, if possible.
It may improve performance for declare reduction constructs.
2019-12-31 14:11:36 -05:00
Craig Topper 5e5a1d2790 [CodeGen] Emit conj/conjf/confjl libcalls as fneg instructions if possible.
We already recognize the __builtin versions of these, might as well
recognize the libcall version.

Differential Revision: https://reviews.llvm.org/D72028
2019-12-31 10:41:00 -08:00
Stephen Kelly 69bb99914f Implement additional traverse() overloads
Summary:
These overloads make it possible to wrap unless(), anyOf(), has() etc
with the traverse matcher.

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71977
2019-12-31 17:04:40 +00:00
Stephen Kelly 06fdbf3daf Unnest struct in Matcher implementation
This allows implementation of the traverse() matcher to surround
matchers like unless().
2019-12-31 17:04:39 +00:00
Stephen Kelly d89c4cb938 Match code following lambdas when ignoring invisible nodes
Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71976
2019-12-31 17:04:39 +00:00
Sven van Haastregt ff429c5eaf [OpenCL] Remove redundant foreach in OpenCLBuiltins.td; NFC
Remove various `foreach` declarations where the iterator is used only
once.  This makes the .td file more compact.
2019-12-31 15:30:02 +00:00
Michael Platings 0c7ca82161 Fix external-names.c test when separator is \\
This fixes the following failure:

C:\[...]\llvm\tools\clang\test\VFS\external-names.c:34:26: error: CHECK-DEBUG-EXTERNAL: expected string not found in input
// CHECK-DEBUG-EXTERNAL: ![[Num]] = !DIFile(filename: "{{[^"]*}}Inputs{{.}}external-names.h"
                         ^
[...]
<stdin>:42:54: note: possible intended match here
!10 = !DIFile(filename: "C:/[...]\\llvm\\tools\\clang\\test\\VFS\\Inputs\\external-names.h", directory: "")

Differential Revision: https://reviews.llvm.org/D71991
2019-12-31 11:15:46 +00:00
Craig Topper 70f8dd4cf6 [CodeGen] Use IRBuilder::CreateFNeg for __builtin_conj
This replaces the fsub -0.0 idiom with an fneg instruction. We didn't see to have a test that showed the current codegen. Just some tests for constant folding and a test that was only checking the declare lines for libcalls. The latter just checked that we did not have a declare for @conj when using __builtin_conj.

Differential Revision: https://reviews.llvm.org/D72012
2019-12-30 13:25:23 -08:00
Craig Topper 8b23b2bbd9 [CodeGen] Use CreateFNeg in buildFMulAdd
We have an fneg instruction now and should use it instead of the fsub -0.0 idiom. Looks like we had no test that showed that we handled the negation cases here so I've added new tests.

Differential Revision: https://reviews.llvm.org/D72010
2019-12-30 13:24:11 -08:00
Johannes Doerfert 6bd1fcd795 [OpenMP][FIX] Generalize a test check line
The new check line is compatible with the clang code generation check
line as it allows a 64 and 32 bit value.

I hope this makes the llvm-clang-win-x-armv7l buildbot happy.
2019-12-30 15:01:14 -06:00
Johannes Doerfert 10fedd94b4 [OpenMP] Use the OpenMPIRBuilder for `omp parallel`
This allows to use the OpenMPIRBuilder for parallel regions. Code was
extracted from D61953 and adapted to work with the new version (D70109).

All but one feature should be supported. An update of this patch will
provide test coverage and privatization other than shared.

Reviewed By: fghanim

Differential Revision: https://reviews.llvm.org/D70290
2019-12-30 13:57:13 -06:00
Eric Astor 4a7aa252a3 [X86][AsmParser] re-introduce 'offset' operator
Summary:
Amend MS offset operator implementation, to more closely fit with its MS counterpart:

    1. InlineAsm: evaluate non-local source entities to their (address) location
    2. Provide a mean with which one may acquire the address of an assembly label via MS syntax, rather than yielding a memory reference (i.e. "offset asm_label" and "$asm_label" should be synonymous
    3. address PR32530

Based on http://llvm.org/D37461

Fix broken test where the break appears unrelated.

- Set up appropriate memory-input rewrites for variable references.

- Intel-dialect assembly printing now correctly handles addresses by adding "offset".

- Pass offsets as immediate operands (using "r" constraint for offsets of locals).

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D71436
2019-12-30 14:35:26 -05:00
Sven van Haastregt 4a188fdfa7 [OpenCL] Add mipmap builtin functions
Add the mipmap builtin functions from the OpenCL extension
specification.

Patch by Pierre Gondois and Sven van Haastregt.
2019-12-30 10:47:58 +00:00
Tyker b47b35ff51 [Diagnostic] Add ftabstop to -Wmisleading-indentation
Summary:
this allow much better support of codebases like the linux kernel that mix tabs and spaces.

-ftabstop=//Width// allow specifying how large tabs are considered to be.

Reviewers: xbolva00, aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: jyknight, riccibruno, rsmith, nathanchance

Differential Revision: https://reviews.llvm.org/D71037
2019-12-30 09:24:34 +01:00
Vladimir Vereschaka eadc97b0ec [CMake] Added remote test execution support into CrossWinToARMLinux CMake cache file.
Added two confguration argument to provide a host name and SSH user name
to run the tests on the remote target host.

* REMOTE_TEST_HOST  - remote host name or address.
* REMOTE_TEST_USER  - passwordless SSH account name.

Differential Revision: https://reviews.llvm.org/D71625
2019-12-29 20:36:19 -08:00
Stephen Kelly f7d9584c56 Fix formatting in previous commits 2019-12-29 19:41:30 +00:00
Stephen Kelly bee973f4df Fix use of named values surrounded by newlines in clang-query 2019-12-29 14:58:56 +00:00
Stephen Kelly dc93540acb Fix handling of newlines in clang-query
Replace assert with diagnostic for missing newline.
2019-12-29 14:58:56 +00:00
Zachary Henkel 0acfc49317 Allow redeclaration of __declspec(uuid)
msvc allows a subsequent declaration of a uuid attribute on a
struct/class.  Mirror this behavior in clang-cl.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D71439
2019-12-28 13:13:46 -08:00
Alexey Bader 128f39da93 Fix crash in getFullyQualifiedName for inline namespace
Summary: The ICE happens when the most outer namespace is an inline namespace.

Reviewers: bkramer, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ebevhan, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71962
2019-12-28 16:35:51 +03:00
David Blaikie d8018233d1 Revert "CWG2352: Allow qualification conversions during reference binding."
This reverts commit de21704ba9.

Regressed/causes this to error due to ambiguity:

  void f(const int * const &);
  void f(int *);
  int main() {
    int * x;
    f(x);
  }

(in case it's important - the original case where this turned up was a
member function overload in a class template with, essentially:

  f(const T1&)
  f(T2*)

(where T1 == X const *, T2 == X))

It's not super clear to me if this ^ is expected behavior, in which case
I'm sorry about the revert & happy to look into ways to fix the original
code.
2019-12-27 12:27:20 -08:00
Reid Kleckner 780d30660e [VFS] Don't run symlink test on Windows, it may pass or fail
This test was XFAILed because of symlinks, but some versions of ln -s
seem to work on Windows, so the test was unexpectedly passing on our
bot:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13233
Unexpected Passing Tests (1):
    Clang :: VFS/subframework-symlink.m

I don't know how or why, but it seems dependent on system configuration,
and is not something worth debugging. Avoid the problem by marking the
test UNSUPPORTED: system-windows instead of XFAIL: system-windows.
2019-12-27 10:39:47 -08:00