]> granicus.if.org Git - clang/log
clang
5 years agoNFC: Fix some darwin linker warnings introduced in r338385
Erik Pilkington [Thu, 27 Sep 2018 20:36:28 +0000 (20:36 +0000)]
NFC: Fix some darwin linker warnings introduced in r338385

The darwin linker was complaining about Toolchains/RISCV.cpp and
Toolchains/Arch/RISCV.cpp had the same name. Fix is to just rename
Toolchains/RISCV.cpp to Toolchains/RISCVToolchain.cpp.

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

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

5 years ago[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 20:29:00 +0000 (20:29 +0000)]
[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode achieve coalescing

Summary: Set default schedule for parallel for loops to schedule(static, 1) when using SPMD mode on the NVPTX device offloading toolchain to ensure coalescing.

Reviewers: ABataev, Hahnfeld, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

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

5 years agoTest commit. NFC
Patrick Lyster [Thu, 27 Sep 2018 19:30:32 +0000 (19:30 +0000)]
Test commit. NFC

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

5 years ago[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achie...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 19:22:56 +0000 (19:22 +0000)]
[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

Summary: For the OpenMP NVPTX toolchain choose a default distribute schedule that ensures coalescing on the GPU when in SPMD mode. This significantly increases the performance of offloaded target code and reduces the number of registers used on the GPU side.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev, Hahnfeld

Subscribers: Hahnfeld, jholewinski, guansong, cfe-commits

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

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

5 years ago[clang][ubsan][NFC] Slight test cleanup in preparation for D50901
Roman Lebedev [Thu, 27 Sep 2018 19:07:48 +0000 (19:07 +0000)]
[clang][ubsan][NFC] Slight test cleanup in preparation for D50901

Reviewers: vsk, vitalybuka, filcab

Reviewed By: vitalybuka

Subscribers: cfe-commits

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

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

5 years agoFix greedy FileCheck expression in test/Driver/mips-abi.c
Jonas Hahnfeld [Thu, 27 Sep 2018 17:27:48 +0000 (17:27 +0000)]
Fix greedy FileCheck expression in test/Driver/mips-abi.c

'ld{{.*}}"' seems to match the complete line for me which is failing
the test. Only allow an optional '.exe' for Windows systems as most
other tests do.
Another possibility would be to collapse the greedy expression with
the next check to avoid matching the full line.

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

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

5 years ago[analyzer] Highlight nodes which have error reports in them in red in exploded graph
George Karpenkov [Thu, 27 Sep 2018 17:26:41 +0000 (17:26 +0000)]
[analyzer] Highlight nodes which have error reports in them in red in exploded graph

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

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

5 years ago[OpenMP] Improve search for libomptarget-nvptx
Jonas Hahnfeld [Thu, 27 Sep 2018 16:12:32 +0000 (16:12 +0000)]
[OpenMP] Improve search for libomptarget-nvptx

When looking for the bclib Clang considered the default library
path first while it preferred directories in LIBRARY_PATH when
constructing the invocation of nvlink. The latter actually makes
more sense because during development it allows using a non-default
runtime library. So change the search for the bclib to start
looking in directories given by LIBRARY_PATH.
Additionally add a new option --libomptarget-nvptx-path= which
will be searched first. This will be handy for testing purposes.

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

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

5 years ago[Tooling] Get rid of uses of llvm::Twine::str which is slow. NFC
Eric Liu [Thu, 27 Sep 2018 14:50:24 +0000 (14:50 +0000)]
[Tooling] Get rid of uses of llvm::Twine::str which is slow. NFC

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

5 years ago[AArch64][v8.5A] Test optional Armv8.5-A random number extension
Oliver Stannard [Thu, 27 Sep 2018 14:20:59 +0000 (14:20 +0000)]
[AArch64][v8.5A] Test optional Armv8.5-A random number extension

The implementation of this is in TargetParser, so we only need to add a
test for it in clang.

Patch by Pablo Barrio!

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

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

5 years ago[OpenCL] Improve extension-version.cl and to_addr_builtin.cl tests
Sven van Haastregt [Thu, 27 Sep 2018 13:20:29 +0000 (13:20 +0000)]
[OpenCL] Improve extension-version.cl and to_addr_builtin.cl tests

Add cl_khr_depth_images to extension-version.cl.

Extend to_addr_builtin.cl to additionally test the built-in methods
to_private and to_local, and test assignment with to_global to
incorrect types.

Patch by Alistair Davies.

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

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

5 years agoRevert untintentionally commited changes
Kristof Umann [Thu, 27 Sep 2018 12:46:37 +0000 (12:46 +0000)]
Revert untintentionally commited changes

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

5 years ago[Lex] TokenConcatenation now takes const Preprocessor
Kristof Umann [Thu, 27 Sep 2018 12:40:16 +0000 (12:40 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

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

5 years ago[Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM
Martin Storsjo [Thu, 27 Sep 2018 08:24:15 +0000 (08:24 +0000)]
[Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM

This fixes PR39090.

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

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

5 years agoRevert "[DebugInfo] Generate debug information for labels."
Vitaly Buka [Thu, 27 Sep 2018 08:15:24 +0000 (08:15 +0000)]
Revert "[DebugInfo] Generate debug information for labels."

This reverts commit r343148.

It crashes on sanitizer-x86_64-linux-autoconf.

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

5 years agoclang-format: [JS] conditional types.
Martin Probst [Thu, 27 Sep 2018 06:48:13 +0000 (06:48 +0000)]
clang-format: [JS] conditional types.

Summary:
This change adds some rudimentary support for conditional types.
Specifically it avoids breaking before `extends` and `infer` keywords,
which are subject to Automatic Semicolon Insertion, so breaking before
them creates incorrect syntax.

The actual formatting of the type expression is odd, but there is as of
yet no clear idea on how to format these.

See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#conditional-types.

Reviewers: krasimir

Subscribers: cfe-commits

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

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

5 years ago[driver][mips] Adjust target triple accordingly to provided ABI name
Simon Atanasyan [Thu, 27 Sep 2018 05:04:50 +0000 (05:04 +0000)]
[driver][mips] Adjust target triple accordingly to provided ABI name

Explicitly selected MIPS ABI using the `-mabi` option implies
corresponding target triple. For 'O32' ABI it's a 32-bit target triple
like `mips-linux-gnu`. For 'N32' and 'N64' ABIs it's a 64-bit target
triple like `mips64-linux-gnu`. This patch adjusts target triple
accordingly these rules like we do for pseudo-target flags '-m64',
'-m32' etc already.

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

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

5 years ago[analyzer] [NFC] Move the code for dumping the program point to ProgramPoint
George Karpenkov [Thu, 27 Sep 2018 01:46:18 +0000 (01:46 +0000)]
[analyzer] [NFC] Move the code for dumping the program point to ProgramPoint

So we can dump them outside of viewing the exploded grpah.

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

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

5 years ago[analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue
George Karpenkov [Thu, 27 Sep 2018 01:45:57 +0000 (01:45 +0000)]
[analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue

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

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

5 years ago[analyzer] [testing] Pass through an extra argument for specifying extra analyzer...
George Karpenkov [Thu, 27 Sep 2018 01:10:59 +0000 (01:10 +0000)]
[analyzer] [testing] Pass through an extra argument for specifying extra analyzer options

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

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

5 years agoRemove trailing space in rC343150
Fangrui Song [Wed, 26 Sep 2018 23:47:00 +0000 (23:47 +0000)]
Remove trailing space in rC343150

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

5 years agoInit LookupResult::AmbiguityKind
Vitaly Buka [Wed, 26 Sep 2018 22:58:53 +0000 (22:58 +0000)]
Init LookupResult::AmbiguityKind

We don't expect useful value there unless it's "ambiguous".
However we use read it for copying and moving, so we need either init the field
add login to avoid reading invalid values. Such reads trigger ubsan errors.

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

5 years ago[DebugInfo] Generate debug information for labels.
Hsiangkai Wang [Wed, 26 Sep 2018 22:18:45 +0000 (22:18 +0000)]
[DebugInfo] Generate debug information for labels.

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.

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

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

5 years agollvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Fangrui Song [Wed, 26 Sep 2018 22:16:28 +0000 (22:16 +0000)]
llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)

Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: rsmith, #clang, dblaikie

Reviewed By: rsmith, #clang

Subscribers: mgrang, arphaman, kadircet, cfe-commits

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

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

5 years agoP1008R1 Classes with user-declared constructors are never aggregates in
Richard Smith [Wed, 26 Sep 2018 19:00:16 +0000 (19:00 +0000)]
P1008R1 Classes with user-declared constructors are never aggregates in
C++20.

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

5 years ago[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set...
Craig Topper [Wed, 26 Sep 2018 17:01:44 +0000 (17:01 +0000)]
[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set to false.

Previously we used a select and the zero_undef=true intrinsic. In -O2 this pattern will get optimized to zero_undef=false. But in -O0 this optimization won't happen. This results in a compare and cmov being wrapped around a tzcnt/lzcnt instruction.

By using the zero_undef=false intrinsic directly without the select, we can improve the -O0 codegen to just an lzcnt/tzcnt instruction.

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

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

5 years ago[ARM/AArch64][v8.5A] Add Armv8.5-A target
Oliver Stannard [Wed, 26 Sep 2018 14:20:29 +0000 (14:20 +0000)]
[ARM/AArch64][v8.5A] Add Armv8.5-A target

This patch allows targetting Armv8.5-A from Clang. Most of the
implementation is in TargetParser, so this is mostly just adding tests.

Patch by Pablo Barrio!

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

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

5 years ago[analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status...
Roman Lebedev [Wed, 26 Sep 2018 13:08:44 +0000 (13:08 +0000)]
[analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status of the actual build

Summary:
This has been bothering me for a while, but only now i have actually looked into this.
I'm using one CI job for static analysis - clang static analyzers as compilers + clang-tidy via cmake.
And i'd like for the build to fail if at least one of those finds issues.
If clang-tidy finds issues, it will fail the build since the warnings-as-errors is set.
If static analyzer finds anything, since --status-bugs is set, it will fail the build.
But if clang-tidy find anything, but static analyzer does not, the build succeeds :/

Reviewers: sylvestre.ledru, alexfh, jroelofs, ygribov, george.karpenkov, krememek

Reviewed By: jroelofs

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits

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

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

5 years agoRemoved extra semicolon to fix Wpedantic. (NFCI).
Simon Pilgrim [Wed, 26 Sep 2018 09:12:55 +0000 (09:12 +0000)]
Removed extra semicolon to fix Wpedantic. (NFCI).

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

5 years agoclang-format: [JS] space after parameter naming.
Martin Probst [Wed, 26 Sep 2018 08:28:33 +0000 (08:28 +0000)]
clang-format: [JS] space after parameter naming.

Summary:
Previously:
    foo(/*bar=*/baz);

Now:
    foo(/*bar=*/ baz);

The run-in parameter naming comment is not intended in JS.

Reviewers: mboehme

Subscribers: cfe-commits

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

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

5 years ago[clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074)
Hans Wennborg [Wed, 26 Sep 2018 07:39:04 +0000 (07:39 +0000)]
[clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074)

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

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

5 years ago[CUDA] Fix two failed test cases using --cuda-path-ignore-env
Jiading Gai [Wed, 26 Sep 2018 07:07:48 +0000 (07:07 +0000)]
[CUDA] Fix two failed test cases using --cuda-path-ignore-env

Add --cuda-path-ignore-env option to those test cases to ensure the clang
driver always pick the CUDA path specified by --sysroot.

Reviewers: tra, Hahnfeld

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

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

5 years ago[Frontend] Tidy up -print-decl-contexts conditions
Fangrui Song [Wed, 26 Sep 2018 06:28:14 +0000 (06:28 +0000)]
[Frontend] Tidy up -print-decl-contexts conditions

The existing conditions are not consistent. Some have braces and define a temporary Decl while others simply call `<< *cast<XXXDecl>(I)` (mostly the NamedDecl overload of operator<<).
Just use the latter for consistency and brevity.

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

5 years agoP0859R0: List-initialization is potentially-constant-evaluated and
Richard Smith [Wed, 26 Sep 2018 04:36:55 +0000 (04:36 +0000)]
P0859R0: List-initialization is potentially-constant-evaluated and
triggers instantiation of constexpr functions.

We mostly implemented this since Clang 6, but missed the template
instantiation case.

We do not implement the '&cast-expression' special case. It appears to
be a mistake / oversight. I've mailed CWG to see if we can remove it.

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

5 years ago[OPENMP] Add support for OMP5 requires directive + unified_address clause
Kelvin Li [Wed, 26 Sep 2018 04:28:39 +0000 (04:28 +0000)]
[OPENMP] Add support for OMP5 requires directive + unified_address clause

Add support for OMP5.0 requires directive and unified_address clause.
Patches to follow will include support for additional clauses.

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

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

5 years ago[analyzer] Fix a crash on casting symbolic pointers to derived classes.
Artem Dergachev [Wed, 26 Sep 2018 00:17:14 +0000 (00:17 +0000)]
[analyzer] Fix a crash on casting symbolic pointers to derived classes.

Commit r340984 causes a crash when a pointer to a completely unrelated type
UnrelatedT (eg., opaque struct pattern) is being casted from base class BaseT to
derived class DerivedT, which results in an ill-formed region
Derived{SymRegion{$<UnrelatedT x>}, DerivedT}.

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

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

5 years agoFix a bot failure from r343042.
Erik Pilkington [Tue, 25 Sep 2018 23:52:29 +0000 (23:52 +0000)]
Fix a bot failure from r343042.

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

5 years ago[analyzer] Add a testing facility for testing relationships between symbols.
Artem Dergachev [Tue, 25 Sep 2018 23:50:53 +0000 (23:50 +0000)]
[analyzer] Add a testing facility for testing relationships between symbols.

Tests introduced in r329780 was disabled in r342317 because these tests
were accidentally testing dump infrastructure, when all they cared about was
how symbols relate to each other. So when dump infrastructure changed,
tests became annoying to maintain.

Add a new feature to ExprInspection: clang_analyzer_denote() and
clang_analyzer_explain(). The former adds a notation to a symbol, the latter
expresses another symbol in terms of previously denoted symbols.

It's currently a bit wonky - doesn't print parentheses and only supports
denoting atomic symbols. But it's even more readable that way.

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

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

5 years ago[clang-check-codegen][cfstring] Accept either @ or % for progbits to make ppc64be...
Kristina Brooks [Tue, 25 Sep 2018 23:17:09 +0000 (23:17 +0000)]
[clang-check-codegen][cfstring] Accept either @ or % for progbits to make ppc64be bots happy.

PPC64BE bots use % instead of @ for directives like progbits. Since CFString tests also
check asm output, they fail on the following:

  cfstring3.c:44:19: error: CHECK-ASM-ELF: expected string not found in input
  // CHECK-ASM-ELF: .section cfstring,"aw",@progbits
  <stdin>:30:2: note: possible intended match here
  .section cfstring,"aw",%progbits

Updating that check with a {{[@%]}}progbits regex to make those bots happy.

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

5 years ago[Sema] Use a more civilized hash map to implement -Wduplicate-enum.
Erik Pilkington [Tue, 25 Sep 2018 22:53:06 +0000 (22:53 +0000)]
[Sema] Use a more civilized hash map to implement -Wduplicate-enum.

DenseMap<long, SOMETHING> used LONG_MAX as a tombstone, so it asserts
when you try to insert it!

rdar://44774672

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

5 years agoDon't emit "will be treated as an identifier character" warning for
Richard Smith [Tue, 25 Sep 2018 22:34:45 +0000 (22:34 +0000)]
Don't emit "will be treated as an identifier character" warning for
UTF-8 characters that aren't identifier characters in the current
language mode.

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

5 years agoReland "[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`"
Kristina Brooks [Tue, 25 Sep 2018 22:27:40 +0000 (22:27 +0000)]
Reland "[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`"

Relanding rL342883 with more fragmented tests to test ELF-specific
section emission separately from broad-scope CFString tests. Now this
tests the following separately

1). CoreFoundation builds and linkage for ELF while building it.
2). CFString ELF section emission outside CF in assembly output.
3). Broad scope `cfstring3.c` tests which cover all object formats at
    bitcode level and assembly level (including ELF).

This fixes non-bridged CoreFoundation builds on ELF targets
that use -fconstant-cfstrings. The original changes from differential
for a similar patch to PE/COFF (https://reviews.llvm.org/D44491) did not
check for an edge case where the global could be a constant which surfaced
as an issue when building for ELF because of different linkage semantics.

This patch addresses several issues with crashes related to CF builds on ELF
as well as improves data layout by ensuring string literals that back
the actual CFConstStrings end up in .rodata in line with Mach-O.

Change itself tested with CoreFoundation on Linux x86_64 but should be valid
for BSD-like systems as well that use ELF as the native object format.

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

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

5 years ago[analyzer] NFC: CallDescription: Improve array management.
Artem Dergachev [Tue, 25 Sep 2018 22:13:31 +0000 (22:13 +0000)]
[analyzer] NFC: CallDescription: Improve array management.

Combine the two constructor overrides into a single ArrayRef constructor
to allow easier brace initializations and simplify how the respective field
is used internally.

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

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

5 years agoP0969R0: allow structured binding of accessible members, not only public members.
Richard Smith [Tue, 25 Sep 2018 22:12:44 +0000 (22:12 +0000)]
P0969R0: allow structured binding of accessible members, not only public members.

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

5 years ago[analyzer] NFC: Legalize state manager factory injection.
Artem Dergachev [Tue, 25 Sep 2018 22:10:12 +0000 (22:10 +0000)]
[analyzer] NFC: Legalize state manager factory injection.

When a checker maintains a program state trait that isn't a simple list/set/map, but is a combination of multiple lists/sets/maps (eg., a multimap - which may be implemented as a map from something to set of something), ProgramStateManager only contains the factory for the trait itself. All auxiliary lists/sets/maps need a factory to be provided by the checker, which is annoying.

So far two checkers wanted a multimap, and both decided to trick the
ProgramStateManager into keeping the auxiliary factory within itself
by pretending that it's some sort of trait they're interested in,
but then never using this trait but only using the factory.

Make this trick legal. Define a convenient macro.

One thing that becomes apparent once all pieces are put together is that
these two checkers are in fact using the same factory, because the type that
identifies it, ImmutableMap<const MemRegion *, ImmutableSet<SymbolRef>>,
is the same. This situation is different from two checkers registering similar
primitive traits.

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

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

5 years agoRevert "[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file
Alexey Bataev [Tue, 25 Sep 2018 18:31:56 +0000 (18:31 +0000)]
Revert "[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file
types."

It reverts commit r342991 + several other commits intended to fix the
tests. Still have some failed tests, need to investigate it.

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

5 years ago[OPENMP] Fix the test, NFC.
Alexey Bataev [Tue, 25 Sep 2018 17:58:08 +0000 (17:58 +0000)]
[OPENMP] Fix the test, NFC.

Fixed test to pacify buildbot.

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

5 years ago[OPENMP] Fix failed test, NFC.
Alexey Bataev [Tue, 25 Sep 2018 17:47:53 +0000 (17:47 +0000)]
[OPENMP] Fix failed test, NFC.

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

5 years ago[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
Alexey Bataev [Tue, 25 Sep 2018 17:09:17 +0000 (17:09 +0000)]
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

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

5 years ago[AArch64] Support adding X[8-15,18] registers as CSRs.
Tri Vo [Tue, 25 Sep 2018 16:48:40 +0000 (16:48 +0000)]
[AArch64] Support adding X[8-15,18] registers as CSRs.

Summary:
Making X[8-15,18] registers call-saved is used to support
CONFIG_ARM64_LSE_ATOMICS in Linux kernel.

Signed-off-by: Tri Vo <trong@android.com>
Reviewers: srhines, nickdesaulniers, javed.absar

Reviewed By: nickdesaulniers

Subscribers: kristof.beyls, jfb, cfe-commits

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

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

5 years ago[clang-cl] Provide separate flags for all the /O variants
Hans Wennborg [Tue, 25 Sep 2018 14:10:26 +0000 (14:10 +0000)]
[clang-cl] Provide separate flags for all the /O variants

This provides better help text in "clang-cl /?".

Also it cleans things up a bit: previously "/Od" could be handled either
as a separate flag aliased to "-O0", or by the main optimization flag
processing in TranslateOptArg. With this patch, all the flags get
aliased back to /O so they're handled by TranslateOptArg.

Thanks to Nico for the idea!

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

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

5 years ago[VFS] Add a proxy FS that delegates calls to underlying FS by default.
Eric Liu [Tue, 25 Sep 2018 14:02:01 +0000 (14:02 +0000)]
[VFS] Add a proxy FS that delegates calls to underlying FS by default.

Summary:
This is useful when derived file systems want to override some calls
and still proxy other calls.

Reviewers: ilya-biryukov, sammccall

Subscribers: cfe-commits

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

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

5 years ago[AST] Squeeze some bits in LinkageComputer::QueryType
Bruno Ricci [Tue, 25 Sep 2018 13:43:25 +0000 (13:43 +0000)]
[AST] Squeeze some bits in LinkageComputer::QueryType

Replace the pair std::pair<const NamedDecl *, unsigned> where the
unsigned represents an LVComputationKind by a PointerIntPair.
This saves a pointer per entry in the map LinkageComputer::CachedLinkageInfo.

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

Reviewed by: rjmccall, george.burgess.iv, erichkeane

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

5 years ago[OpenCL] Allow zero assignment and comparisons between queue_t type variables
Sven van Haastregt [Tue, 25 Sep 2018 12:59:34 +0000 (12:59 +0000)]
[OpenCL] Allow zero assignment and comparisons between queue_t type variables

This change allows for zero assignment and comparison of queue_t
type variables, and extends null_queue.cl to test this.

Patch by Alistair Davies.

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

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

5 years agoAnnotate LookupResult::clear() as LLVM_ATTRIBUTE_REINITIALIZES to silence bugprone...
Fangrui Song [Tue, 25 Sep 2018 08:07:42 +0000 (08:07 +0000)]
Annotate LookupResult::clear() as LLVM_ATTRIBUTE_REINITIALIZES to silence bugprone-use-after-move after rC342925

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

5 years agoDriver: render arguments for the embedded bitcode correctly
Saleem Abdulrasool [Mon, 24 Sep 2018 23:50:02 +0000 (23:50 +0000)]
Driver: render arguments for the embedded bitcode correctly

When embedding bitcode, only a subset of the arguments should be recorded into
the bitcode compilation commandline.  The frontend job is split into two jobs,
one which will generate the bitcode.  Ensure that the arguments for the
compilation to bitcode is properly stripped so that the embedded arguments are
the permitted subset.

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

5 years ago[www] Change 'Clang 7' items from yellow to green now Clang 7 is
Richard Smith [Mon, 24 Sep 2018 23:21:09 +0000 (23:21 +0000)]
[www] Change 'Clang 7' items from yellow to green now Clang 7 is
released.

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

5 years ago[www] Update cxx_status to mark P0962R1 as done.
Richard Smith [Mon, 24 Sep 2018 23:19:11 +0000 (23:19 +0000)]
[www] Update cxx_status to mark P0962R1 as done.

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

5 years agoP0962R1: only use the member form of 'begin' and 'end' in a range-based
Richard Smith [Mon, 24 Sep 2018 23:17:44 +0000 (23:17 +0000)]
P0962R1: only use the member form of 'begin' and 'end' in a range-based
for loop if both members exist.

This resolves a DR whereby an errant 'begin' or 'end' member in a base
class could result in a derived class not being usable as a range with
non-member 'begin' and 'end'.

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

5 years ago[CUDA] Added basic support for compiling with CUDA-10.0
Artem Belevich [Mon, 24 Sep 2018 23:10:44 +0000 (23:10 +0000)]
[CUDA] Added basic support for compiling with CUDA-10.0

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

5 years ago[analyzer] Prevent crashes in FindLastStoreBRVisitor
George Karpenkov [Mon, 24 Sep 2018 21:20:30 +0000 (21:20 +0000)]
[analyzer] Prevent crashes in FindLastStoreBRVisitor

This patch is a band-aid. A proper solution would be too change
trackNullOrUndefValue to only try to dereference the pointer when it is
relevant to the problem.

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

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

5 years ago[CodeGen] Revert commit https://reviews.llvm.org/rL342717
Calixte Denizet [Mon, 24 Sep 2018 18:24:18 +0000 (18:24 +0000)]
[CodeGen] Revert commit https://reviews.llvm.org/rL342717

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

5 years ago[Power9] [CLANG] Add __float128 exponent GET and SET builtins
Stefan Pintilie [Mon, 24 Sep 2018 18:14:50 +0000 (18:14 +0000)]
[Power9] [CLANG] Add __float128 exponent GET and SET builtins

Added

__builtin_vsx_scalar_extract_expq
__builtin_vsx_scalar_insert_exp_qp

Builtins should behave the same way as in GCC.

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

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

5 years agoFix the type of 1<<31 integer constants.
Benjamin Kramer [Mon, 24 Sep 2018 17:51:15 +0000 (17:51 +0000)]
Fix the type of 1<<31 integer constants.

Shifting into the sign bit is technically undefined behavior. No known
compiler exploits it though.

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

5 years ago[python] [tests] Update test_code_completion
Michal Gorny [Mon, 24 Sep 2018 16:10:25 +0000 (16:10 +0000)]
[python] [tests] Update test_code_completion

Update expected completions to match output generated by clang-7.0.

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

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

5 years agoRevert "rL342883: [Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant...
Kristina Brooks [Mon, 24 Sep 2018 15:26:08 +0000 (15:26 +0000)]
Revert "rL342883: [Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`."

Seems to be causing buildbot failures, need to look into it.

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

5 years ago[CFString][ELF] Fix a missed test causing buildbot failures from 342883.
Kristina Brooks [Mon, 24 Sep 2018 14:52:48 +0000 (14:52 +0000)]
[CFString][ELF] Fix a missed test causing buildbot failures from 342883.

Accidetanlly forgot to update it, big sorry.

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

5 years ago[VFS] Use llvm::StringMap instead of std::map. NFC
Eric Liu [Mon, 24 Sep 2018 14:52:11 +0000 (14:52 +0000)]
[VFS] Use llvm::StringMap instead of std::map. NFC

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

5 years agoRevert "We allow implicit function declarations as an extension in all C dialects...
Anastasia Stulova [Mon, 24 Sep 2018 14:21:56 +0000 (14:21 +0000)]
Revert "We allow implicit function declarations as an extension in all C dialects. Remove OpenCL special case."

Discussed on cfe-commits (Week-of-Mon-20180820), this change leads to
the generation of invalid IR for OpenCL without giving an error.
Therefore, the conclusion was to revert.

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

5 years ago[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`.
Kristina Brooks [Mon, 24 Sep 2018 14:06:47 +0000 (14:06 +0000)]
[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`.

[Clang][CodeGen][ObjC]: Fix non-bridged CoreFoundation builds on ELF targets
that use `-fconstant-cfstrings`. The original changes from differential
for a similar patch to PE/COFF (https://reviews.llvm.org/D44491) did not
check for an edge case where the global could be a constant which surfaced
as an issue when building for ELF because of different linkage semantics.

This patch addresses several issues with crashes related to CF builds on ELF
as well as improves data layout by ensuring string literals that back
the actual CFConstStrings end up in .rodata in line with Mach-O.

Change itself tested with CoreFoundation on Linux x86_64 but should be valid
for BSD-like systems as well that use ELF as the native object format.

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

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

5 years agoFix Wundef NDEBUG warning; NFC
Sven van Haastregt [Mon, 24 Sep 2018 12:12:03 +0000 (12:12 +0000)]
Fix Wundef NDEBUG warning; NFC

Check for definedness of the NDEBUG macro rather than its value,
to be consistent with other uses.

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

5 years ago[ARM][AArch64] Add feature +fp16fml
Sjoerd Meijer [Mon, 24 Sep 2018 07:55:20 +0000 (07:55 +0000)]
[ARM][AArch64] Add feature +fp16fml

Armv8.4-A adds a few FP16 instructions that can optionally be implemented
in CPUs of Armv8.2-A and above.

This patch adds a feature to clang to permit selection of these
instructions. This interacts with the +fp16 option as follows:

Prior to Armv8.4-A:
*) +fp16fml implies +fp16
*) +nofp16 implies +nofp16fml

From Armv8.4-A:
*) The above conditions apply, additionally: +fp16 implies +fp16fml

Patch by Bernard Ogden.

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

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

5 years agoAdd inherited attributes before parsed attributes.
Michael Kruse [Mon, 24 Sep 2018 06:31:37 +0000 (06:31 +0000)]
Add inherited attributes before parsed attributes.

Currently, attributes from previous declarations ('inherited attributes')
are added to the end of a declaration's list of attributes. Before
r338800, the attribute list was in reverse. r338800 changed the order
of non-inherited (parsed from the current declaration) attributes, but
inherited attributes are still appended to the end of the list.

This patch appends inherited attributes after other inherited
attributes, but before any non-inherited attribute. This is to make the
order of attributes in the AST correspond to the order in the source
code.

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

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

5 years ago[analyzer][UninitializedObjectChecker] Using the new const methods of ImmutableList
Kristof Umann [Sun, 23 Sep 2018 09:16:27 +0000 (09:16 +0000)]
[analyzer][UninitializedObjectChecker] Using the new const methods of ImmutableList

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

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

5 years ago[CMake] Use internal_linkage rather than always_inline for libc++
Petr Hosek [Sun, 23 Sep 2018 08:46:31 +0000 (08:46 +0000)]
[CMake] Use internal_linkage rather than always_inline for libc++

This is a workaround for PR39053 which was uncovered by D50652 when
the default attribute has been changed from internal_linkage to
always_inline.

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

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

5 years ago[CStringSyntaxChecker] Check strlcat sizeof check
David Carlier [Sun, 23 Sep 2018 08:30:17 +0000 (08:30 +0000)]
[CStringSyntaxChecker] Check strlcat sizeof check

Assuming strlcat is used with strlcpy we check as we can if the last argument does not equal os not larger than the buffer.
Advising the proper usual pattern.

Reviewers: george.karpenkov, NoQ, MaskRay

Reviewed By: MaskRay

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

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

5 years ago[Index] Report specialization bases as references when IndexImplicitInstantiation...
Fangrui Song [Sun, 23 Sep 2018 08:23:48 +0000 (08:23 +0000)]
[Index] Report specialization bases as references when IndexImplicitInstantiation is true

Summary:
    template <typename T> struct B {};
    template <typename T> struct D : B<T> {}; // `B` was not reported as a reference

This patch fixes this.

Reviewers: akyrtzi, arphaman, devnexen

Reviewed By: devnexen

Subscribers: cfe-commits

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

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

5 years agoFix modules build with shared library.
Eric Fiselier [Sun, 23 Sep 2018 00:48:05 +0000 (00:48 +0000)]
Fix modules build with shared library.

r341994 caused clangAnalysis to pull all of the AST matchers
library into clang. Due to inline key functions in the headers,
importing the AST matchers library gives a link dependency on the
AST matchers (and thus the AST), which clang should not
have.

This patch works around the issues by excluding the offending
libclangAnalysis header in the modulemap.

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

5 years ago[Index] Fix header guard naming
Fangrui Song [Sat, 22 Sep 2018 22:49:38 +0000 (22:49 +0000)]
[Index] Fix header guard naming

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

5 years agoEliminate some unneeded signed/unsigned conversions
Aaron Puchert [Sat, 22 Sep 2018 21:56:16 +0000 (21:56 +0000)]
Eliminate some unneeded signed/unsigned conversions

No functional change is intended, but generally this should be a bit
more safe.

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

5 years agoFix codemodels.c test case (only test mcmodel=medium on X86).
Caroline Tice [Sat, 22 Sep 2018 18:25:58 +0000 (18:25 +0000)]
Fix codemodels.c test case (only test mcmodel=medium on X86).

aarch64 testing is broken because "medium" is not a valid
code-model on aarch64, and codemodels.c tests that.  This fixes
that problem by adding "-triple x86_64-unknown-linux-gnu" to the
test with "-mcode-model moedium".

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

5 years agouse the current url for bugzilla
Sylvestre Ledru [Sat, 22 Sep 2018 07:41:09 +0000 (07:41 +0000)]
use the current url for bugzilla

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

5 years agoupdate the links to use https
Sylvestre Ledru [Sat, 22 Sep 2018 07:39:44 +0000 (07:39 +0000)]
update the links to use https

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

5 years agoUpdate smart pointer detection for thread safety analysis.
Richard Trieu [Sat, 22 Sep 2018 01:50:52 +0000 (01:50 +0000)]
Update smart pointer detection for thread safety analysis.

Objects are determined to be smart pointers if they have both a star and arrow
operator.  Some implementations of smart pointers have these overloaded
operators in a base class, while the check only searched the derived class.
This fix will also look for the operators in the base class.

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

5 years ago[Lexer] Add udefined_behavior_sanitizer feature
Leonard Chan [Sat, 22 Sep 2018 01:03:16 +0000 (01:03 +0000)]
[Lexer] Add udefined_behavior_sanitizer feature

This can be used to detect whether the code is being built with UBSan using
the __has_feature(undefined_behavior_sanitizer) predicate.

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

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

5 years agoThread safety analysis: Make printSCFG compile again [NFC]
Aaron Puchert [Fri, 21 Sep 2018 23:46:35 +0000 (23:46 +0000)]
Thread safety analysis: Make printSCFG compile again [NFC]

Not used productively, so no observable functional change.

Note that printSCFG doesn't yet work reliably, it seems to crash
sometimes.

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

5 years agoFix codemodels.c test case (only test mcmodel-kernel on x86)
Caroline Tice [Fri, 21 Sep 2018 23:19:49 +0000 (23:19 +0000)]
Fix codemodels.c test case (only test mcmodel-kernel on x86)

A recent commit I made broke aarch64 testing, because "kernel"
apparently is not a valid code-model on aarch64, and one of my tests
tested that. This fixes the problem (hopefully) by adding "-triple
x86_64-unknown-linux-gnu" to the test build with "-mcodel-model
kernel".

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

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

5 years agoThread safety analysis: Make sure FactEntrys stored in FactManager are immutable...
Aaron Puchert [Fri, 21 Sep 2018 23:08:30 +0000 (23:08 +0000)]
Thread safety analysis: Make sure FactEntrys stored in FactManager are immutable [NFC]

Since FactEntrys are stored in the FactManager, we can't manipulate them
anymore when they are stored there.

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

5 years agoMake compare function in r342648 have strict weak ordering.
Richard Trieu [Fri, 21 Sep 2018 21:20:33 +0000 (21:20 +0000)]
Make compare function in r342648 have strict weak ordering.

Comparison functions used in sorting algorithms need to have strict weak
ordering.  Remove the assert and allow comparisons on all lists.

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

5 years ago[analyzer] Process state in checkEndFunction in RetainCountChecker
George Karpenkov [Fri, 21 Sep 2018 20:37:20 +0000 (20:37 +0000)]
[analyzer] Process state in checkEndFunction in RetainCountChecker

Modify the RetainCountChecker to perform state "adjustments" in
checkEndFunction, as performing work in PreStmt<ReturnStmt> does not
work with destructors.
The previous version made an implicit assumption that no code runs
after the return statement is executed.

rdar://43945028

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

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

5 years ago[analyzer] Highlight sink nodes in red
George Karpenkov [Fri, 21 Sep 2018 20:37:01 +0000 (20:37 +0000)]
[analyzer] Highlight sink nodes in red

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

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

5 years ago[analyzer] Associate diagnostics created in checkEndFunction with a return statement...
George Karpenkov [Fri, 21 Sep 2018 20:36:41 +0000 (20:36 +0000)]
[analyzer] Associate diagnostics created in checkEndFunction with a return statement, if possible

If not possible, use the last line of the declaration, as before.

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

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

5 years ago[analyzer] [NFC] Prefer make_unique over "new"
George Karpenkov [Fri, 21 Sep 2018 20:36:21 +0000 (20:36 +0000)]
[analyzer] [NFC] Prefer make_unique over "new"

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

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

5 years ago[analyzer] Fix bug in isInevitablySinking
George Karpenkov [Fri, 21 Sep 2018 20:36:01 +0000 (20:36 +0000)]
[analyzer] Fix bug in isInevitablySinking

If the non-sink report is generated at the exit node, it will be
suppressed by the current functionality in isInevitablySinking, as it
only checks the successors of the block, but not the block itself.

The bug shows up in RetainCountChecker checks.

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

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

5 years ago[analyzer] [NFC] Dead code removal
George Karpenkov [Fri, 21 Sep 2018 20:35:39 +0000 (20:35 +0000)]
[analyzer] [NFC] Dead code removal

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

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

5 years agoAdd necessary support for storing code-model to module IR.
Caroline Tice [Fri, 21 Sep 2018 18:34:59 +0000 (18:34 +0000)]
Add necessary support for storing code-model to module IR.

Currently the code-model does not get saved in the module IR, so if a
code model is specified when compiling with LTO, it gets lost and is
not propagated properly to LTO. This patch does what is necessary in
the front end to pass the code-model to the module, so that the back
end can store it in the Module .

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

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

5 years ago[CUDA] Fixed parsing of optional template-argument-list.
Artem Belevich [Fri, 21 Sep 2018 17:46:28 +0000 (17:46 +0000)]
[CUDA] Fixed parsing of optional template-argument-list.

We need to consider all tokens that start with '>' when
we're checking for the end of an empty template argument list.

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

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

5 years ago[NFC] remove unused variable
JF Bastien [Fri, 21 Sep 2018 17:38:41 +0000 (17:38 +0000)]
[NFC] remove unused variable

It was causing a warning.

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

5 years ago[CUDA] Ignore uncallable functions when we check for usual deallocators.
Artem Belevich [Fri, 21 Sep 2018 17:29:33 +0000 (17:29 +0000)]
[CUDA] Ignore uncallable functions when we check for usual deallocators.

Previously clang considered function variants from both sides of
compilation and that resulted in picking up wrong deallocation function.

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

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

5 years ago[OPENMP] Disable emission of the class with vptr if they are not used in
Alexey Bataev [Fri, 21 Sep 2018 14:55:26 +0000 (14:55 +0000)]
[OPENMP] Disable emission of the class with vptr if they are not used in
target constructs.

Prevent compilation of the classes with the virtual tables when
compiling for the device.

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