]> granicus.if.org Git - clang/log
clang
7 years ago[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.
Craig Topper [Tue, 8 Aug 2017 17:43:44 +0000 (17:43 +0000)]
[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.

They still need to be implemented in the intrinsics, the command line, and the backend. But this change isn't dependent on any of that and resolves a TODO.

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

7 years ago[Availability] Don't make an availability attribute imply default visibility on macOS
Erik Pilkington [Tue, 8 Aug 2017 17:09:09 +0000 (17:09 +0000)]
[Availability] Don't make an availability attribute imply default visibility on macOS

Fixes PR33796, rdar://33655115

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

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 16:45:36 +0000 (16:45 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310377.

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 16:29:11 +0000 (16:29 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years agoUse "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.
Nico Weber [Tue, 8 Aug 2017 16:21:23 +0000 (16:21 +0000)]
Use "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.

This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj.tmp",
tools like this could now have a rule to ignore .tmp files.
This is a less ambitious reland of https://reviews.llvm.org/D36238

https://reviews.llvm.org/D36413

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

7 years agoNon-functional change. Fix test for D29654.
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 15:13:07 +0000 (15:13 +0000)]
Non-functional change. Fix test for D29654.

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

7 years agoclang-format: [JS] fix union type spacing in object & array types.
Martin Probst [Tue, 8 Aug 2017 15:00:58 +0000 (15:00 +0000)]
clang-format: [JS] fix union type spacing in object & array types.

Summary:
Previously, clang-format would insert whitespace in union types nested in object
and array types, as it wouldn't recognize those as a type operator:

    const x: {foo: number | null};
    const x: [number | null];

While this is correct for actual binary operators, clang-format should not
insert whitespace into union and intersection types to mark those:

    const x: {foo: number|null};
    const x: [number|null];

This change propagates that the context is not an expression by inspecting
the preceding token and marking as non-expression if it was a type colon.

Reviewers: djasper

Subscribers: klimek

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

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

7 years agoclang-format: [JS] handle single lines comments ending in `\\`.
Martin Probst [Tue, 8 Aug 2017 14:52:42 +0000 (14:52 +0000)]
clang-format: [JS] handle single lines comments ending in `\\`.

Summary:
Previously, clang-format would consider the following code line to be part of
the comment and incorrectly format the rest of the file.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 14:44:43 +0000 (14:44 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310360.

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

7 years ago[OpenMP] OpenMP device offloading code generation produces a cubin file which is...
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 14:33:05 +0000 (14:33 +0000)]
[OpenMP] OpenMP device offloading code generation produces a cubin file which is then integrated in the host binary using the host linker.
Diff: D29654

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 14:25:14 +0000 (14:25 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years ago[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)
Nikolai Bozhenov [Tue, 8 Aug 2017 14:13:50 +0000 (14:13 +0000)]
[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)

Fixes a regression introduced by r308218.

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

7 years agoDarwin's toolchain should be initialized before openmp offloading
Alex Lorenz [Tue, 8 Aug 2017 11:22:21 +0000 (11:22 +0000)]
Darwin's toolchain should be initialized before openmp offloading
is processed

This fixes an 'openmp-offload.c' test failure introduced by r310263.

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

7 years agoRevert r310291, r310300 and r310332 because of test failure on Darwin
Alex Lorenz [Tue, 8 Aug 2017 11:20:17 +0000 (11:20 +0000)]
Revert r310291, r310300 and r310332 because of test failure on Darwin

The commit r310291 introduced the failure. r310332 was a test fix commit and
r310300 was a followup commit. I reverted these two to avoid merge conflicts
when reverting.

The 'openmp-offload.c' test is failing on Darwin because the following
run lines:
// RUN:   touch %t1.o
// RUN:   touch %t2.o
// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %t1.o %t2.o 2>&1 \
// RUN:   | FileCheck -check-prefix=CHK-TWOCUBIN %s

trigger the following assertion:

Driver.cpp:3418:
    assert(CachedResults.find(ActionTC) != CachedResults.end() &&
           "Result does not exist??");

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

7 years agoFix openmp-offload.c test on Windows
Reid Kleckner [Tue, 8 Aug 2017 01:36:16 +0000 (01:36 +0000)]
Fix openmp-offload.c test on Windows

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

7 years ago[codeview] Fix class name formatting
Reid Kleckner [Tue, 8 Aug 2017 01:33:53 +0000 (01:33 +0000)]
[codeview] Fix class name formatting

In particular, removes spaces between template arguments of class
templates to better match VS type visualizers.

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

7 years agoThis adds the argument --dump-ir to clang-import-test, which allows
Sean Callanan [Mon, 7 Aug 2017 22:27:30 +0000 (22:27 +0000)]
This adds the argument --dump-ir to clang-import-test, which allows
viewing of the final IR. This is useful for confirming that
structure layout was correct.

I've added two tests:

- A test that checks that structs in top-level code are completed
  correctly during struct layout (they are)
- A test that checks that structs defined in function bodies are
  cpmpleted correctly during struct layout (currently they are not,
  so this is XFAIL).

The second test fails because LookupSameContext()
(ExternalASTMerger.cpp) can't find the struct. This is an issue I
intend to resolve separately.

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

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

7 years ago[OpenMP] Error when trying to offload to an unsupported architecture
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 21:11:10 +0000 (21:11 +0000)]
[OpenMP] Error when trying to offload to an unsupported architecture

Summary: Throw an error when offloading is unsupported for a particular target architecture.

Reviewers: sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld

Reviewed By: ABataev

Subscribers: cfe-commits, rengolin

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

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

7 years ago[OpenMP] Prevent emission of exception handling code when using OpenMP to offload...
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:57:59 +0000 (20:57 +0000)]
[OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

Summary: For the OpenMP toolchain which offloads to NVIDIA GPUs make sure that no exception handling code is emitted.

Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, hfinkel, tstellar

Reviewed By: ABataev, Hahnfeld

Subscribers: rengolin, Hahnfeld, cfe-commits

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

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

7 years ago[AArch64] Ignore stdcall and similar on aarch64/windows
Martin Storsjo [Mon, 7 Aug 2017 20:52:04 +0000 (20:52 +0000)]
[AArch64] Ignore stdcall and similar on aarch64/windows

This is similar to what's done on arm and x86_64, where
these calling conventions are silently ignored, as in
SVN r245076.

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

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

7 years ago[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:31:51 +0000 (20:31 +0000)]
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default

Summary: When device offloading is enabled and the device is an NVIDIA GPU, OpenMP target regions must be compiled with relocation enabled by passing the "-c" flag to the PTXAS invocation.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: Hahnfeld, rengolin, mkuron, cfe-commits

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

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

7 years agoMark static variables static; NFC.
George Burgess IV [Mon, 7 Aug 2017 20:26:33 +0000 (20:26 +0000)]
Mark static variables static; NFC.

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

7 years ago[OpenMP] Pass -v to PTXAS if it was passed to the driver.
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:19:23 +0000 (20:19 +0000)]
[OpenMP] Pass -v to PTXAS if it was passed to the driver.

Summary: When compiling code being offloaded by OpenMP to an NVIDIA GPU, pass the -v to PTXAS if it was passed to the CLANG driver.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, jlebar, hfinkel, tstellar

Reviewed By: jlebar

Subscribers: Hahnfeld, rengolin, cfe-commits

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

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

7 years ago[OpenMP] Integrate OpenMP target region cubin into host binary
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:01:48 +0000 (20:01 +0000)]
[OpenMP] Integrate OpenMP target region cubin into host binary

Summary: OpenMP device offloading code generation produces a cubin file which is then integrated in the host binary using the host linker.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, rnk, hfinkel, tstellar

Reviewed By: hfinkel

Subscribers: sfantao, rnk, rengolin, cfe-commits

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

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

7 years agoNon-functional change. Fix previous patch D34784.
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 18:43:37 +0000 (18:43 +0000)]
Non-functional change. Fix previous patch D34784.

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

7 years agoAdd some missing -no-canonical-prefixes.
Benjamin Kramer [Mon, 7 Aug 2017 18:31:01 +0000 (18:31 +0000)]
Add some missing -no-canonical-prefixes.

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

7 years ago[OpenMP] Add flag for specifying the target device architecture for OpenMP device...
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 15:39:11 +0000 (15:39 +0000)]
[OpenMP] Add flag for specifying the target device architecture for OpenMP device offloading

Summary:
OpenMP has the ability to offload target regions to devices which may have different architectures.

A new -fopenmp-target-arch flag is introduced to specify the device architecture.

In this patch I use the new flag to specify the compute capability of the underlying NVIDIA architecture for the OpenMP offloading CUDA tool chain.

Only a host-offloading test is provided since full device offloading capability will only be available when [[ https://reviews.llvm.org/D29654 | D29654 ]] lands.

Reviewers: hfinkel, Hahnfeld, carlo.bertolli, caomhin, ABataev

Reviewed By: hfinkel

Subscribers: guansong, cfe-commits

Tags: #openmp

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

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

7 years agoEnable LLVM asan support for NetBSD/i386
Kamil Rytarowski [Mon, 7 Aug 2017 10:57:03 +0000 (10:57 +0000)]
Enable LLVM asan support for NetBSD/i386

Summary:
Verified to work and useful to run check-asan, as this target tests 32-bit and 64-bit execution.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, dim, vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers, cfe-commits

Tags: #sanitizers

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

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

7 years ago[test] Remove an unintentional -x cl flag in an aarch64-windows test
Martin Storsjo [Sun, 6 Aug 2017 19:57:49 +0000 (19:57 +0000)]
[test] Remove an unintentional -x cl flag in an aarch64-windows test

This test was only intended to test compiling C, not OpenCL.

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

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

7 years ago[X86] Enable isel to use the PAUSE instruction even when SSE2 is disabled. Clang...
Craig Topper [Sat, 5 Aug 2017 23:35:54 +0000 (23:35 +0000)]
[X86] Enable isel to use the PAUSE instruction even when SSE2 is disabled. Clang part

Summary:
On older processors this instruction encoding is treated as a NOP.

MSVC doesn't disable intrinsics based on features the way clang/gcc does. Because the PAUSE instruction encoding doesn't crash older processors, some software out there uses these intrinsics without checking for SSE2.

This change also seems to also be consistent with gcc behavior.

Fixes PR34079

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

7 years ago[OpenCL] Remove extra select functions from opencl-c.h
Yaxun Liu [Sat, 5 Aug 2017 02:23:47 +0000 (02:23 +0000)]
[OpenCL] Remove extra select functions from opencl-c.h

OpenCL spec v2.0 s6.13.6:

gentype select (gentype a,
gentype b,
igentype c)

gentype select (gentype a,
gentype b,
ugentype c)

igentype and ugentype must have the same number
of elements and bits as gentype.

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

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

7 years ago[ODRHash] Treat some non-templated classes as templated.
Richard Trieu [Sat, 5 Aug 2017 00:54:19 +0000 (00:54 +0000)]
[ODRHash] Treat some non-templated classes as templated.

When using nested classes, if the inner class is not templated, but the outer
class is templated, the inner class will not be templated, but may have some
traits as if it were.  This is particularly evident if the inner class
refers to the outer class in some fashion.  Treat any class that is in the
context of a templated class as also a templated class.

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

7 years agoRevert "[Coverage] Precise region termination with deferred regions"
Vedant Kumar [Sat, 5 Aug 2017 00:34:10 +0000 (00:34 +0000)]
Revert "[Coverage] Precise region termination with deferred regions"

This reverts commit r310010. I don't think there's anything wrong with
this commit, but it's causing clang to generate output that llvm-cov
doesn't do a good job with and the fix isn't immediately clear.

See Eli's comment in D36250 for more context.

I'm reverting the clang change so the coverage bot can revert back to
producing sensible output, and to give myself some time to investigate
what went wrong in llvm.

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

7 years agoDebug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.
Adrian Prantl [Fri, 4 Aug 2017 23:08:57 +0000 (23:08 +0000)]
Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.

rdar://problem/27640939

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

7 years agoClean up some lambda conversion operator code, NFC
Reid Kleckner [Fri, 4 Aug 2017 22:38:06 +0000 (22:38 +0000)]
Clean up some lambda conversion operator code, NFC

We don't need special handling in CodeGenFunction::GenerateCode for
lambda block pointer conversion operators anymore. The conversion
operator emission code immediately calls back to the generic
EmitFunctionBody.

Rename EmitLambdaStaticInvokeFunction to EmitLambdaStaticInvokeBody for
better consistency with the other Emit*Body methods.

I'm preparing to do something about PR28299, which touches this code.

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

7 years ago[libclang] Determinize order of platform availability attrs
Reid Kleckner [Fri, 4 Aug 2017 21:52:25 +0000 (21:52 +0000)]
[libclang] Determinize order of platform availability attrs

Previously this code was doing std::sort on IdentifierInfo pointers. Now
it sorts alphabetically by platform name.

This should de-flake clang/test/Index/availability.c, which was failing
non-deterministically for me.

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

7 years ago[Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows
Reid Kleckner [Fri, 4 Aug 2017 21:52:00 +0000 (21:52 +0000)]
[Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows

Summary:
Tools like clang that use RemoveFileOnSignal on their output files
weren't actually able to clean up their outputs before this change.  Now
the call to llvm::sys::fs::remove succeeds and the temporary file is
deleted. This is a stop-gap to fix clang before implementing the
solution outlined in PR34070.

Reviewers: davide

Subscribers: llvm-commits, hiraditya

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

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

7 years ago[libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer
Kostya Serebryany [Fri, 4 Aug 2017 21:35:11 +0000 (21:35 +0000)]
[libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Fri, 4 Aug 2017 21:27:11 +0000 (21:27 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310104.

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

7 years agoRevert "[OPENMP] Fix for pacify buildbots, NFC."
Alexey Bataev [Fri, 4 Aug 2017 21:26:25 +0000 (21:26 +0000)]
Revert "[OPENMP] Fix for pacify buildbots, NFC."

This reverts commit r310120.

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

7 years agoReland "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 21:21:00 +0000 (21:21 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"

Reland r310097 with a fix for a debug assertion in NamedDecl.getName()

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

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

7 years agoRevert "Reland "CFI: blacklist STL allocate() from unrelated-casts""
Vlad Tsyrklevich [Fri, 4 Aug 2017 20:37:49 +0000 (20:37 +0000)]
Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""

This reverts commit r310105.

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

7 years ago[OPENMP] Fix for pacify buildbots, NFC.
Alexey Bataev [Fri, 4 Aug 2017 20:29:52 +0000 (20:29 +0000)]
[OPENMP] Fix for pacify buildbots, NFC.

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

7 years agoReland "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:50:39 +0000 (19:50 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"

Reland r310097 with a unit test fix for MS ABI build bots.

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

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Fri, 4 Aug 2017 19:46:10 +0000 (19:46 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years agoRevert "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:17:16 +0000 (19:17 +0000)]
Revert "CFI: blacklist STL allocate() from unrelated-casts"

This reverts commit r310097.

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

7 years ago[OPENMP] Unify generation of outlined function calls.
Alexey Bataev [Fri, 4 Aug 2017 19:10:54 +0000 (19:10 +0000)]
[OPENMP] Unify generation of outlined function calls.

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

7 years agoCFI: blacklist STL allocate() from unrelated-casts
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:10:11 +0000 (19:10 +0000)]
CFI: blacklist STL allocate() from unrelated-casts

Summary:
Previously, STL allocators were blacklisted in compiler_rt's
cfi_blacklist.txt because they mandated a cast from void* to T* before
object initialization completed. This change moves that logic into the
front end because C++ name mangling supports a substitution compression
mechanism for symbols that makes it difficult to blacklist the mangled
symbol for allocate() using a regular expression.

Motivated by crbug.com/751385.

Reviewers: pcc, kcc

Reviewed By: pcc

Subscribers: cfe-commits

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

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

7 years ago[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
Florian Gross [Fri, 4 Aug 2017 18:59:19 +0000 (18:59 +0000)]
[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher

HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types.

So with code like this:
struct X{};
auto x = X{};

This did no longer match:
varDecl(hasType(recordDecl(hasName("X"))))

Because HasDeclarationMatcher didn't resolve the DeducedType of x.

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

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

7 years agoAdd OpenCL 2.0 atomic builtin functions as Clang builtin
Yaxun Liu [Fri, 4 Aug 2017 18:16:31 +0000 (18:16 +0000)]
Add OpenCL 2.0 atomic builtin functions as Clang builtin

OpenCL 2.0 atomic builtin functions have a scope argument which is ideally
represented as synchronization scope argument in LLVM atomic instructions.

Clang supports translating Clang atomic builtin functions to LLVM atomic
instructions. However it currently does not support synchronization scope
of LLVM atomic instructions. Without this, users have to use LLVM assembly
code to implement OpenCL atomic builtin functions.

This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin
functions, which supports generating LLVM atomic instructions with
synchronization scope operand.

Currently only constant memory scope argument is supported. Support of
non-constant memory scope argument will be added later.

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

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

7 years agoclang-format: [JS] support fields with case/switch/default labels.
Martin Probst [Fri, 4 Aug 2017 17:07:15 +0000 (17:07 +0000)]
clang-format: [JS] support fields with case/switch/default labels.

Summary:
`case:` and `default:` would normally parse as labels for a `switch` block.
However in TypeScript, they can be used in field declarations, e.g.:

    interface I {
      case: string;
    }

This change special cases parsing them in declaration lines to avoid wrapping
them.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert r304953 for release 5.0.0
Stefan Maksimovic [Fri, 4 Aug 2017 12:37:34 +0000 (12:37 +0000)]
Revert r304953 for release 5.0.0

This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.

Faliures manifest for stage2 mips build.

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

7 years ago[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.
Florian Hahn [Fri, 4 Aug 2017 10:40:18 +0000 (10:40 +0000)]
[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.

Summary:
M-class profiles do not support ARM execution mode, so providing
-marm/-mno-thumb does not make sense in combination with -mcpu/-march
options that support the M-profile.

This is a follow-up patch to D35569 and it seemed pretty clear that we
should emit an error in the driver in this case.

We probably also should warn/error if the provided -mcpu/-march options
do not match, e.g. -mcpu=cortex-m0 -march=armv8-a is invalid, as
cortex-m0 does not support armv8-a. But that should be a separate patch
I think.

Reviewers: echristo, richard.barton.arm, rengolin, labrinea, charles.baylis

Reviewed By: rengolin

Subscribers: aemerson, javed.absar, kristof.beyls, cfe-commits

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

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

7 years agoFix typo and update documentation.
Manuel Klimek [Fri, 4 Aug 2017 08:41:42 +0000 (08:41 +0000)]
Fix typo and update documentation.

The hasDeclaration documentation was outdated after r288366.

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

7 years ago[mips] Fix typo (missed space) in the warning message
Simon Atanasyan [Fri, 4 Aug 2017 08:25:15 +0000 (08:25 +0000)]
[mips] Fix typo (missed space) in the warning message

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

7 years ago[mips] Code formatting fix. NFC
Simon Atanasyan [Fri, 4 Aug 2017 08:25:09 +0000 (08:25 +0000)]
[mips] Code formatting fix. NFC

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

7 years agoRevert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."
NAKAMURA Takumi [Fri, 4 Aug 2017 06:35:32 +0000 (06:35 +0000)]
Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."

It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm"

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

7 years agoRevert "[coverage] Special-case calls to noreturn functions."
Vedant Kumar [Fri, 4 Aug 2017 04:08:23 +0000 (04:08 +0000)]
Revert "[coverage] Special-case calls to noreturn functions."

This reverts commit r309995. It looks like it's responsible for breaking
the stage2 coverage build:

http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402

The cfe-commits discussion re: r309995 has more context.

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

7 years ago[Driver][Fuchsia] Pass --hash-style=gnu to the linker
Petr Hosek [Fri, 4 Aug 2017 02:39:27 +0000 (02:39 +0000)]
[Driver][Fuchsia] Pass --hash-style=gnu to the linker

The .gnu_hash format is superior, and all versions of the Fuchsia
dynamic linker support it.

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

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

7 years ago[Coverage] Precise region termination with deferred regions
Vedant Kumar [Fri, 4 Aug 2017 00:29:20 +0000 (00:29 +0000)]
[Coverage] Precise region termination with deferred regions

The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang

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

7 years ago[Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.
Akira Hatanaka [Thu, 3 Aug 2017 23:55:42 +0000 (23:55 +0000)]
[Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.

This commit fixes a bug where clang/llvm doesn't emit an unwind table
for a function when it is marked noexcept. Without this patch, the
following code terminates with an uncaught exception on ARM64:

int foo1() noexcept {
  try {
    throw 0;
  } catch (int i) {
    return 0;
  }
  return 1;
}

int main() {
  return foo1();
}

rdar://problem/32411865

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

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

7 years agoEnable AddressSanitizer for Fuchsia targets
Petr Hosek [Thu, 3 Aug 2017 23:02:22 +0000 (23:02 +0000)]
Enable AddressSanitizer for Fuchsia targets

Patch by Roland McGrath

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

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

7 years ago[coverage] Special-case calls to noreturn functions.
Eli Friedman [Thu, 3 Aug 2017 22:27:36 +0000 (22:27 +0000)]
[coverage] Special-case calls to noreturn functions.

The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

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

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

7 years agoUse "foo-12345.o" instead of "foo.o-12345" as temporary file name.
Nico Weber [Thu, 3 Aug 2017 21:06:36 +0000 (21:06 +0000)]
Use "foo-12345.o" instead of "foo.o-12345" as temporary file name.

This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj", tools
like this will now skip the temp files as well.

https://reviews.llvm.org/D36238

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

7 years ago[mips] Revert r309942 & r309940
Simon Dardis [Thu, 3 Aug 2017 19:39:51 +0000 (19:39 +0000)]
[mips] Revert r309942 & r309940

This reverts commit r309942 & commit r309940.

A revert was requested following post commit review.

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

7 years agoRevert accidentally-committed files.
Richard Smith [Thu, 3 Aug 2017 19:25:02 +0000 (19:25 +0000)]
Revert accidentally-committed files.

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

7 years agoDon't emit undefined-internal warnings for CXXDeductionGuideDecls.
Richard Smith [Thu, 3 Aug 2017 19:24:27 +0000 (19:24 +0000)]
Don't emit undefined-internal warnings for CXXDeductionGuideDecls.

Patch by ~paul (cynecx on phabricator)! Some test massaging by me.

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

7 years ago[Analyzer] Add support for displaying cross-file diagnostic paths in HTML output
Devin Coughlin [Thu, 3 Aug 2017 18:12:22 +0000 (18:12 +0000)]
[Analyzer] Add support for displaying cross-file diagnostic paths in HTML output

This change adds support for cross-file diagnostic paths in html output. If the
diagnostic path is not cross-file, there is no change in the output.

Patch by Vlad Tsyrklevich!

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

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

7 years agoRevert r304836.
Nico Weber [Thu, 3 Aug 2017 16:46:17 +0000 (16:46 +0000)]
Revert r304836.

See discussion in https://reviews.llvm.org/D33900#824172

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

7 years ago[diagtool] Add ability to pass in the id and return the name for a
Don Hinton [Thu, 3 Aug 2017 16:13:13 +0000 (16:13 +0000)]
[diagtool] Add ability to pass in the id and return the name for a
particular diagnostic.

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

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

7 years agoFix some typos in the documentation.
Gabor Horvath [Thu, 3 Aug 2017 15:38:14 +0000 (15:38 +0000)]
Fix some typos in the documentation.

Patch by: Reka Nikolett Kovacs

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

7 years ago[mips] Fixup r309940.
Simon Dardis [Thu, 3 Aug 2017 14:35:06 +0000 (14:35 +0000)]
[mips] Fixup r309940.

Needed a // REQUIRES: mips-registered-target

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

7 years ago[clang-format] Fix indent of 'key <...>' and 'key {...}' in text protos
Krasimir Georgiev [Thu, 3 Aug 2017 14:17:29 +0000 (14:17 +0000)]
[clang-format] Fix indent of 'key <...>' and 'key {...}' in text protos

Summary:
This patch fixes the indentation of the code pattern `key <...>`and `key {...}` in text protos.
Previously, such line would be alinged depending on the column of the previous
colon, which usually indents too much.

I'm gonna go ahead and commit this since it's a straightforward bugfix.

Reviewers: djasper, klimek

Subscribers: klimek, cfe-commits

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

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

7 years ago[mips] Implement -muninit-const-in-rodata
Simon Dardis [Thu, 3 Aug 2017 14:01:17 +0000 (14:01 +0000)]
[mips] Implement -muninit-const-in-rodata

This option when combined with -mgpopt and -membedded-data places all
uninitialized constant variables in the read-only section.

Reviewers: atanasyan, nitesh.jain

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

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

7 years ago[clang-format] Fix parsing of <>-style proto options
Krasimir Georgiev [Thu, 3 Aug 2017 13:43:45 +0000 (13:43 +0000)]
[clang-format] Fix parsing of <>-style proto options

Summary:
This patch fixes the parsing of proto option fields like `option op = <...>`.
Previously the parser did not enter the right code path inside the angle braces,
causing the contents to be split into several unwrapped lines inside.

I'll just go ahead and commit this since it's a straightforward bugfix.

Reviewers: djasper, klimek

Subscribers: cfe-commits

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

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

7 years ago[mips] Add support -m(no-)embedded-data option
Simon Dardis [Thu, 3 Aug 2017 13:04:29 +0000 (13:04 +0000)]
[mips] Add support -m(no-)embedded-data option

Add support for the -membedded-data option which places constant data in
the .rodata section, rather than the .sdata section.

Reviewers: atanasyan, nitesh.jain

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

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

7 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Aug 2017 02:16:28 +0000 (02:16 +0000)]
Update for llvm change.

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

7 years ago[Sema] Add a comment on an identified bug on default arguments.
Tim Shen [Thu, 3 Aug 2017 00:18:11 +0000 (00:18 +0000)]
[Sema] Add a comment on an identified bug on default arguments.

Summary:
The mis-compile is triggered by internal code, but I haven't reduced it to a small piece of code. Add a FIXME here, since a decent fix doesn't seem to be trivial.

The decent fix can be changing Decl::Init to PointerUnion<Stmt *, EvaluatedStmt *, ParamVarDecl *>, and make setUninstantiatedDefaultArg take a ParamVarDecl *, which contains the Expr * as the default argument. This way, getTemplateInstantiationArgs can take that ParamVarDecl and do the right thing.

Reviewers: rsmith

Subscribers: sanjoy, cfe-commits

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

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

7 years ago[coverage] Make smaller regions for the first case of a switch.
Eli Friedman [Wed, 2 Aug 2017 23:22:50 +0000 (23:22 +0000)]
[coverage] Make smaller regions for the first case of a switch.

We never overwrite the end location of a region, so we would end up with
an overly large region when we reused the switch's region.

It's possible this code will be substantially rewritten in the near
future to deal with fallthrough more accurately, but this seems like
an improvement on its own for now.

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

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

7 years agoRemove unused diagnostic. NFC.
Benjamin Kramer [Wed, 2 Aug 2017 21:16:50 +0000 (21:16 +0000)]
Remove unused diagnostic. NFC.

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

7 years agoUpdate for llvm change.
Rafael Espindola [Wed, 2 Aug 2017 20:32:35 +0000 (20:32 +0000)]
Update for llvm change.

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

7 years ago[UBSan] Provide default blacklist filename for UBSan
Han Shen [Wed, 2 Aug 2017 19:53:38 +0000 (19:53 +0000)]
[UBSan] Provide default blacklist filename for UBSan

Summary:
This is to provide a default blacklist filename for UBSan.

While UBSan is turned on, it's better that clang pick up a blacklist file (when exists), just as what ASan / MSan does, so we do not end up adding the "-fsanitize-blacklist" option to every command line.

Reviewers: chandlerc, echristo, vsk, eugenis

Reviewed By: vsk, eugenis

Subscribers: vsk, eugenis, echristo, cfe-commits

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

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

7 years ago[docs] Remove accidental unindent to appease the sphinx bot
Vedant Kumar [Wed, 2 Aug 2017 18:24:12 +0000 (18:24 +0000)]
[docs] Remove accidental unindent to appease the sphinx bot

Bot failure:
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/12043/steps/docs-clang-html/logs/stdio

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

7 years ago[ubsan] Have -fsanitize=vptr emit a null check if -fsanitize=null isn't available
Vedant Kumar [Wed, 2 Aug 2017 18:10:31 +0000 (18:10 +0000)]
[ubsan] Have -fsanitize=vptr emit a null check if -fsanitize=null isn't available

In r309007, I made -fsanitize=null a hard prerequisite for -fsanitize=vptr. I
did not see the need for the two checks to have separate null checking logic
for the same pointer. I expected the two checks to either always be enabled
together, or to be mutually compatible.

In the mailing list discussion re: r309007 it became clear that that isn't the
case. If a codebase is -fsanitize=vptr clean but not -fsanitize=null clean,
it's useful to have -fsanitize=vptr emit its own null check. That's what this
patch does: with it, -fsanitize=vptr can be used without -fsanitize=null.

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

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

7 years agoDefine _GNU_SOURCE for RTEMS c++
Walter Lee [Wed, 2 Aug 2017 14:36:52 +0000 (14:36 +0000)]
Define _GNU_SOURCE for RTEMS c++

Summary: This is required by the libc++ locale support.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

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

7 years ago[rename] NFC, extract symbol canonicalization logic into function
Alex Lorenz [Wed, 2 Aug 2017 14:15:27 +0000 (14:15 +0000)]
[rename] NFC, extract symbol canonicalization logic into function

This function will be used by the clang-refactor's rename actions

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

7 years agoUnify and simplify the behavior of the hasDeclaration matcher.
Manuel Klimek [Wed, 2 Aug 2017 13:04:44 +0000 (13:04 +0000)]
Unify and simplify the behavior of the hasDeclaration matcher.

Originally, we weren't able to match on Type nodes themselves (only QualType),
so the hasDeclaration matcher was initially written to give what we thought are
reasonable results for QualType matches.

When we chagned the matchers to allow matching on Type nodes, it turned out
that the hasDeclaration matcher was by chance written templated enough to now
allow hasDeclaration to also match on (some) Type nodes.

This patch change the hasDeclaration matcher to:
a) work the same on Type and QualType nodes,
b) be completely explicit about what nodes we can match instead of just allowing
   anything with a getDecl() to match,
c) explicitly control desugaring only one level in very specific instances.
d) adds hasSpecializedTemplate and tagType matchers to allow migrating
  existing use cases that now need more explicit matchers

Note: This patch breaks clang-tools-extra. The corresponding patch there
is approved and will land in a subsequent patch.

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

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

7 years ago[StaticAnalyzer] Fix false positives for unreachable code in macros.
Daniel Marjamaki [Wed, 2 Aug 2017 08:26:56 +0000 (08:26 +0000)]
[StaticAnalyzer] Fix false positives for unreachable code in macros.

Example:

#define MACRO(C)   if (C) { static int x; .. }
void foo() {
MACRO(0);
}

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

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

7 years agoUse VFS operations in FileManager::makeAbsolutePath.
Ilya Biryukov [Wed, 2 Aug 2017 07:25:24 +0000 (07:25 +0000)]
Use VFS operations in FileManager::makeAbsolutePath.

Summary: It used to call into llvm::sys::fs::make_absolute.

Reviewers: akyrtzi, erikjv, bkramer, krasimir, klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

7 years ago[Bash-autocompletion] Add comment to test so that it is easier to fix
Yuka Takahashi [Wed, 2 Aug 2017 07:20:27 +0000 (07:20 +0000)]
[Bash-autocompletion] Add comment to test so that it is easier to fix

Summary:
clang/test/Driver/autocomplete.c is a test for --autocomplete, and this
test might break if people add/modify flags or HelpText. So I've add
comment for future developers so that they can fix this file according
to the change they had made.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

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

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

7 years ago[CMake] Include llvm-objcopy tool in Fuchsia toolchain
Petr Hosek [Wed, 2 Aug 2017 02:49:09 +0000 (02:49 +0000)]
[CMake] Include llvm-objcopy tool in Fuchsia toolchain

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

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

7 years ago[Driver] Disable static C++ library support on Fuchsia
Petr Hosek [Wed, 2 Aug 2017 01:18:02 +0000 (01:18 +0000)]
[Driver] Disable static C++ library support on Fuchsia

Don't support or build static C++ libraries for Fuchsia.

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

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

7 years ago[Headers][Darwin] Allow #include_next<float.h> to work on Darwin prior to 10.7
Bruno Cardoso Lopes [Tue, 1 Aug 2017 22:10:36 +0000 (22:10 +0000)]
[Headers][Darwin] Allow #include_next<float.h> to work on Darwin prior to 10.7

This fixes PR31504 and it's a follow up from adding #include_next<float.h>
for Darwin in r289018.

rdar://problem/29856682

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

7 years ago[clang] Change the condition of unnecessary packed warning
Yan Wang [Tue, 1 Aug 2017 21:41:39 +0000 (21:41 +0000)]
[clang] Change the condition of unnecessary packed warning

Summary:
Change the condition of this unnecessary packed warning. The packed is unnecessary when
1. the alignment of the struct/class won't alter.
2. the size is unchanged.
3. the offset of each field is the same.

Remove all field-level warning.

Reviewers: chh, akyrtzi, rtrieu

Reviewed By: chh

Subscribers: rsmith, srhines, cfe-commits, xazax.hun

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

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

7 years agoFix creating bitcasts with wrong address space
Matt Arsenault [Tue, 1 Aug 2017 20:36:57 +0000 (20:36 +0000)]
Fix creating bitcasts with wrong address space

In a future commit AMDGPU will start passing
aggregates directly to more functions, triggering
asserts in test/CodeGenOpenCL/addr-space-struct-arg.cl

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

7 years ago[clang-diff] Renames, NFC
Johannes Altmanninger [Tue, 1 Aug 2017 20:17:46 +0000 (20:17 +0000)]
[clang-diff] Renames, NFC

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

7 years ago[clang-diff] Move data declarations to the public header
Johannes Altmanninger [Tue, 1 Aug 2017 20:17:40 +0000 (20:17 +0000)]
[clang-diff] Move data declarations to the public header

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

7 years agoRevert "Thread Safety Analysis: fix assert_capability."
Josh Gao [Tue, 1 Aug 2017 19:53:31 +0000 (19:53 +0000)]
Revert "Thread Safety Analysis: fix assert_capability."

This reverts commit rL309725.

Broke test/Sema/attr-capabilities.c.

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

7 years agoThread Safety Analysis: fix assert_capability.
Josh Gao [Tue, 1 Aug 2017 19:18:05 +0000 (19:18 +0000)]
Thread Safety Analysis: fix assert_capability.

Summary:
Previously, the assert_capability attribute was completely ignored by
thread safety analysis.

Reviewers: delesley, rnk

Reviewed By: delesley

Subscribers: cfe-commits

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

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

7 years ago[CMake] Include sancov tool in Fuchsia toolchain
Petr Hosek [Tue, 1 Aug 2017 19:15:32 +0000 (19:15 +0000)]
[CMake] Include sancov tool in Fuchsia toolchain

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

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