]> granicus.if.org Git - clang/log
clang
6 years ago[Sema] Updated note for address spaces to print the type.
Anastasia Stulova [Fri, 22 Jun 2018 15:45:08 +0000 (15:45 +0000)]
[Sema] Updated note for address spaces to print the type.

This allows to reuse the same diagnostic for OpenCL or CUDA.

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

6 years ago[Driver] Make scudo compatible with -fsanitize-minimal-runtime
Kostya Kortchinsky [Fri, 22 Jun 2018 14:31:30 +0000 (14:31 +0000)]
[Driver] Make scudo compatible with -fsanitize-minimal-runtime

Summary:
This is the clang side of the change, there is a compiler-rt counterpart.

Scudo works with UBSan using `-fsanitize=scudo,integer` for example, and to do
so it embeds UBSan runtime. This makes it not compatible with the UBSan minimal
runtime, but this is something we want for production purposes.

The idea is to have a Scudo minimal runtime on the compiler-rt side that will
not embed UBSan. This is basically the runtime that is currently in use for
Fuchsia, without coverage, stacktraces or symbolization. With this, Scudo
becomes compatible with `-fsanitize-minimal-runtime`.

If this approach is suitable, I'll add the tests as well, otherwise I am open
to other options.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, cfe-commits

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

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

6 years ago[X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR
Gabor Buella [Fri, 22 Jun 2018 11:59:16 +0000 (11:59 +0000)]
[X86] Lower _mm[256|512]_cmp[.]_mask intrinsics to native llvm IR

Summary:
Lowering some vector comparision builtins to fcmp IR instructions.
This ignores the signaling behaviour specified in the predicate
argument of said builtins.

Affected AVX512 builtins:

__builtin_ia32_cmpps128_mask
__builtin_ia32_cmpps256_mask
__builtin_ia32_cmpps512_mask
__builtin_ia32_cmppd128_mask
__builtin_ia32_cmppd256_mask
__builtin_ia32_cmppd512_mask

Reviewers: craig.topper, uriel.k, RKSimon, andrew.w.kaylor, spatel, scanon, efriedma

Reviewed By: craig.topper, spatel, efriedma

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

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

6 years ago[clang-format] Add AlwaysBreakBeforeMultilineString tests
Jacek Olesiak [Fri, 22 Jun 2018 11:57:55 +0000 (11:57 +0000)]
[clang-format] Add AlwaysBreakBeforeMultilineString tests

Summary: Followup to D47393.

Reviewers: stephanemoore

Reviewed By: stephanemoore

Subscribers: benhamilton, cfe-commits

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

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

6 years ago[hmaptool] Turn %hmaptool into a proper substitution
Benjamin Kramer [Fri, 22 Jun 2018 09:46:40 +0000 (09:46 +0000)]
[hmaptool] Turn %hmaptool into a proper substitution

This is still super ugly, but at least it doesn't require working
directories to just line up perfectly for python to find the tool.

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

6 years ago[x86] Fix a tiny bug in my test case in r335309 by marking that we don't
Chandler Carruth [Thu, 21 Jun 2018 23:52:36 +0000 (23:52 +0000)]
[x86] Fix a tiny bug in my test case in r335309 by marking that we don't
expect any diagnostics.

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

6 years ago[x86] Teach the builtin argument range check to allow invalid ranges in
Chandler Carruth [Thu, 21 Jun 2018 23:46:09 +0000 (23:46 +0000)]
[x86] Teach the builtin argument range check to allow invalid ranges in
dead code.

This is important for C++ templates that essentially compute the valid
input in a way that is constant and will cause all the invalid cases to
be dead code that is deleted. Code in the wild actually does this and
GCC also accepts these kinds of patterns so it is important to support
it.

To make this work, we provide a non-error path to diagnose these issues,
and use a default-error warning instead. This keeps the relatively
strict handling but prevents nastiness like SFINAE on these errors. It
also allows us to safely use the system to diagnose this only when it
occurs at runtime (in emitted code).

Entertainingly, this required fixing the syntax in various other ways
for the x86 test because we never bothered to diagnose that the returns
were invalid.

Since debugging these compile failures was super confusing, I've also
improved the diagnostic to actually say what the value was. Most of the
checks I've made ignore this to simplify maintenance, but I've checked
it in a few places to make sure the diagnsotic is working.

Depends on D48462. Without that, we might actually crash some part of
the compiler after bypassing the error here.

Thanks to Richard, Ben Kramer, and especially Craig Topper for all the
help here.

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

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

6 years ago[X86] Update handling in CGBuiltin to be tolerant of out of range immediates.
Craig Topper [Thu, 21 Jun 2018 23:39:47 +0000 (23:39 +0000)]
[X86] Update handling in CGBuiltin to be tolerant of out of range immediates.

D48464 contains changes that will loosen some of the range checks in SemaChecking to a DefaultError warning that can be disabled.

This patch adds explicit masking to avoid using the upper bits of immediates to gracefully handle the warning being disabled.

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

6 years agoIgnore blacklist when generating __cfi_check_fail.
Evgeniy Stepanov [Thu, 21 Jun 2018 23:22:37 +0000 (23:22 +0000)]
Ignore blacklist when generating __cfi_check_fail.

Summary: Fixes PR37898.

Reviewers: pcc, vlad.tsyrklevich

Subscribers: cfe-commits

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

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

6 years agoTest commit, made a minor change to a comment
Emmett Neyman [Thu, 21 Jun 2018 22:08:20 +0000 (22:08 +0000)]
Test commit, made a minor change to a comment

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

6 years agoRe-apply: Add python tool to dump and construct header maps
Bruno Cardoso Lopes [Thu, 21 Jun 2018 21:45:24 +0000 (21:45 +0000)]
Re-apply: Add python tool to dump and construct header maps

Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

Thanks to Stella Stamenova for helping make this work on Windows.

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

rdar://problem/39994722

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

6 years agoRevert "[LTO] Enable module summary emission by default for regular LTO"
Tobias Edler von Koch [Thu, 21 Jun 2018 21:24:30 +0000 (21:24 +0000)]
Revert "[LTO] Enable module summary emission by default for regular LTO"

This is breaking a couple of buildbots. We need to run the
NameAnonGlobal pass for regular LTO now as well (since we're producing a
summary). I'll post a separate patch for review to make this happen and
then re-commit.

This reverts commit c0759b7b1f4a81ff9021b952aa38a222d5fa4dfd.

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

6 years agoAMDGPU: Remove amdgpu-debugger-reserve-regs feature
Konstantin Zhuravlyov [Thu, 21 Jun 2018 20:27:47 +0000 (20:27 +0000)]
AMDGPU: Remove amdgpu-debugger-reserve-regs feature

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

6 years ago[OPENMP, NVPTX] Fix globalization of the variables passed to orphaned
Alexey Bataev [Thu, 21 Jun 2018 20:26:33 +0000 (20:26 +0000)]
[OPENMP, NVPTX] Fix globalization of the variables passed to orphaned
parallel region.

If the current construct requires sharing of the local variable in the
inner parallel region, this variable must be globalized to avoid
runtime crash.

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

6 years ago[LTO] Enable module summary emission by default for regular LTO
Tobias Edler von Koch [Thu, 21 Jun 2018 20:20:41 +0000 (20:20 +0000)]
[LTO] Enable module summary emission by default for regular LTO

Summary:
With D33921, we gained the ability to have module summaries in regular
LTO modules without triggering ThinLTO compilation. Module summaries in
regular LTO allow garbage collection (dead stripping) before LTO
compilation and thus open up additional optimization opportunities.

This patch enables summary emission in regular LTO for all targets
except ld64-based ones (which use the legacy LTO API).

Reviewers: pcc, tejohnson, mehdi_amini

Subscribers: inglorion, eraman, cfe-commits

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

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

6 years ago[bindings] Fix most Python binding unittests on Windows
Jonathan Coe [Thu, 21 Jun 2018 20:07:03 +0000 (20:07 +0000)]
[bindings] Fix most Python binding unittests on Windows

Summary:
This fixes all but one of the test cases for Windows. TestCDB will
take more work to debug, as CompilationDatabase seems not to work correctly.

Reviewers: bkramer, wanders, jbcoe

Reviewed By: bkramer, jbcoe

Subscribers: cfe-commits

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

Patch written by ethanhs (Ethan)

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

6 years ago[X86] Correct the inline assembly implementations of __movsb/w/d/q and __stosw/d...
Craig Topper [Thu, 21 Jun 2018 18:56:30 +0000 (18:56 +0000)]
[X86] Correct the inline assembly implementations of __movsb/w/d/q and __stosw/d/q to mark registers/memory as modified

The inline assembly for these didn't mark that edi, esi, ecx are modified by movs/stos instruction. It also didn't mark that memory is modified.

This issue was reported to llvm-dev last year http://lists.llvm.org/pipermail/cfe-dev/2017-November/055863.html but no bug was ever filed.

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

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

6 years ago[Intrinsics] Add/move some builtin declarations in intrin.h to get ms-intrinsics...
Craig Topper [Thu, 21 Jun 2018 17:07:04 +0000 (17:07 +0000)]
[Intrinsics] Add/move some builtin declarations in intrin.h to get ms-intrinsics.c to not issue warnings

ud2 and int2c were missing declarations entirely. And the bitscans were only under x86_64, but they seem to be in BuiltinsARM.def as well and are tested by ms_intrinsics.c

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

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

6 years ago[DebugInfo] Inline for without DebugLocation
Anastasis Grammenos [Thu, 21 Jun 2018 16:53:48 +0000 (16:53 +0000)]
[DebugInfo] Inline for without DebugLocation

Summary:
This test is a strip down version of a function inside the
amalgamated sqlite source. When converted to IR clang produces
a phi instruction without debug location.

This patch fixes the above issue.

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

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

6 years ago[X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other...
Craig Topper [Thu, 21 Jun 2018 16:41:28 +0000 (16:41 +0000)]
[X86] Rewrite the add/mul/or/and reduction intrinsics to make better use of other intrinsics and remove undef shuffle indices.

Similar to what was done to max/min recently.

These already reduced the vector width to 256 and 128 bit as we go unlike the original max/min code.

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

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

6 years ago[liblang] Remove DOS line endings in libclang.exports
Rainer Orth [Thu, 21 Jun 2018 13:40:50 +0000 (13:40 +0000)]
[liblang] Remove DOS line endings in libclang.exports

Undefined                       first referenced
 symbol                             in file
clang_getCompletionFixIt           /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenLocation             /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getToken                     /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTemplateCursorKind        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTUResourceUsageName       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkKind       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkText       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getSpellingLocation          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionParent          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkCompletionString /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionPriority        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumFixIts       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenExtent               /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumAnnotations  /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenKind                 /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
make[2]: *** [tools/clang/tools/libclang/CMakeFiles/libclang.dir/build.make:651: lib/libclang.so.7] Error 1

It turns out that this is caused by https://reviews.llvm.org/D46862: it added a
couple of CRs (^M) to some lines.  Solaris ld takes them to be part of the symbol
names, which of course are missing from the input objects.  GNU ld handles this
just fine.  Fixed by removing the CRs.

Bootstrapped on i386-pc-solaris2.11.  I guess this is obvious.

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

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

6 years agoFix line endings in recently updated test file
Ivan Donchevskii [Thu, 21 Jun 2018 12:39:24 +0000 (12:39 +0000)]
Fix line endings in recently updated test file

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

6 years ago[Sema] Fix overloaded static functions for templates
Ivan Donchevskii [Thu, 21 Jun 2018 08:34:50 +0000 (08:34 +0000)]
[Sema] Fix overloaded static functions for templates

Apply almost the same fix as https://reviews.llvm.org/D36390 but for templates.

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

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

6 years ago[X86] Remove masking from the 512-bit floating point max/min builtins. Use select...
Craig Topper [Thu, 21 Jun 2018 05:01:01 +0000 (05:01 +0000)]
[X86] Remove masking from the 512-bit floating point max/min builtins. Use select in IR instead.

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

6 years agoRevert "Add python tool to dump and construct header maps"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:58 +0000 (01:23 +0000)]
Revert "Add python tool to dump and construct header maps"

This reverts commit fcfa2dd517ec1a6045a81e8247e346d630a22618.

Broke bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoRevert "Warning for framework headers using double quote includes"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:51 +0000 (01:23 +0000)]
Revert "Warning for framework headers using double quote includes"

This reverts commit 9b5ff2db7e31c4bb11a7d468260b068b41c7c285.

Broke bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoRevert "Fix hmaptool cmake file to work on Windows"
Bruno Cardoso Lopes [Thu, 21 Jun 2018 01:23:42 +0000 (01:23 +0000)]
Revert "Fix hmaptool cmake file to work on Windows"

This reverts commit 63711c3cd337a0d22617579a904af07481139611, due to
breaking bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoASan docs: no_sanitize("address") works on globals.
Evgeniy Stepanov [Thu, 21 Jun 2018 00:16:32 +0000 (00:16 +0000)]
ASan docs: no_sanitize("address") works on globals.

Summary: Mention that no_sanitize attribute can be used with globals.

Reviewers: alekseyshl

Subscribers: cfe-commits

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

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

6 years agoWhen a dependent alignas is applied to a non-dependent typedef,
Richard Smith [Wed, 20 Jun 2018 23:36:55 +0000 (23:36 +0000)]
When a dependent alignas is applied to a non-dependent typedef,
prioritize the error for the bad subject over the error for the
dependent / non-dependent mismatch.

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

6 years agoFix hmaptool cmake file to work on Windows
Bruno Cardoso Lopes [Wed, 20 Jun 2018 23:08:43 +0000 (23:08 +0000)]
Fix hmaptool cmake file to work on Windows

Unbreak a few windows buildbots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

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

6 years agoUse cast instead of dyn_cast_or_null.
Akira Hatanaka [Wed, 20 Jun 2018 22:56:59 +0000 (22:56 +0000)]
Use cast instead of dyn_cast_or_null.

This addresses John's post-commit review feedback.

https://reviews.llvm.org/rC335021#inline-2038

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

6 years agoWarning for framework headers using double quote includes
Bruno Cardoso Lopes [Wed, 20 Jun 2018 22:11:59 +0000 (22:11 +0000)]
Warning for framework headers using double quote includes

Introduce -Wquoted-include-in-framework-header, which should fire a warning
whenever a quote include appears in a framework header and suggest a fix-it.
For instance, for header A.h added in the tests, this is how the warning looks
like:

./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "A0.h"
         ^~~~~~
         <A/A0.h>
./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "B.h"
         ^~~~~
         <B.h>

This helps users to prevent frameworks from using local headers when in fact
they should be targetting system level ones.

The warning is off by default.

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

rdar://problem/37077034

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

6 years agoRelated to PR37768: improve diagnostics for class name shadowing.
Richard Smith [Wed, 20 Jun 2018 21:58:20 +0000 (21:58 +0000)]
Related to PR37768: improve diagnostics for class name shadowing.

Diagnose the name of the class being shadowed by using declarations, and
improve the diagnostics for the case where the name of the class is
shadowed by a non-static data member in a class with constructors.  In
the latter case, we now always give the "member with the same name as
its class" diagnostic regardless of the relative order of the member and
the constructor, rather than giving an inscrutible diagnostic if the
constructor appears second.

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

6 years agoAdd python tool to dump and construct header maps
Bruno Cardoso Lopes [Wed, 20 Jun 2018 21:16:37 +0000 (21:16 +0000)]
Add python tool to dump and construct header maps

Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

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

rdar://problem/39994722

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

6 years ago[MS] Make sure __GetExceptionInfo works on types with no linkage
Reid Kleckner [Wed, 20 Jun 2018 21:12:20 +0000 (21:12 +0000)]
[MS] Make sure __GetExceptionInfo works on types with no linkage

Fixes PR36327

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

6 years ago[CUDA] Removed unused __nvvm_* builtins with non-generic pointers.
Artem Belevich [Wed, 20 Jun 2018 20:34:04 +0000 (20:34 +0000)]
[CUDA] Removed unused __nvvm_* builtins with non-generic pointers.

They were hot even hooked into CGBuiltin's machinery. Even if they were,
CUDA does not support AS-specific pointers, so there would be no legal way
no way to call these builtins.

This came up in D47154.

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

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

6 years agoFixed test in prior build where FileCheck tried to match against
Leonard Chan [Wed, 20 Jun 2018 19:34:05 +0000 (19:34 +0000)]
Fixed test in prior build where FileCheck tried to match against
`common` when declaring a global variable when we primarily care about
the value assigned in the test.

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

6 years agoFixed test that failed when checking what variable a value was stored
Leonard Chan [Wed, 20 Jun 2018 18:48:05 +0000 (18:48 +0000)]
Fixed test that failed when checking what variable a value was stored
in for fixed point types.

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

6 years ago[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
Leonard Chan [Wed, 20 Jun 2018 17:19:40 +0000 (17:19 +0000)]
[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.

Fixed point literals are declared using the suffixes

```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values

```
unsigned short _Accum u_short_accum = 256.0uhk;   // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```

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

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

6 years agoSimplify. No behavior change.
Nico Weber [Wed, 20 Jun 2018 15:57:38 +0000 (15:57 +0000)]
Simplify. No behavior change.

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

6 years ago[analyzer] Optimize constraint generation when the range is a concrete value
Mikhail R. Gadelha [Wed, 20 Jun 2018 11:42:12 +0000 (11:42 +0000)]
[analyzer] Optimize constraint generation when the range is a concrete value

Summary:
If a constraint is something like:
```
$0 = [1,1]
```
it'll now be created as:
```
assert($0 == 1)
```
instead of:
```
assert($0 >= 1 && $0 <= 1)
```

In general, ~3% speedup when solving per query in my machine. Biggest improvement was when verifying sqlite3, total time went down from 3000s to 2200s.

I couldn't create a test for this as there is no way to dump the formula yet. D48221 adds a method to dump the formula but there is no way to do it from the command line.

Also, a test that prints the formula will most likely fail in the future, as different solvers print the formula in different formats.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[SPIR] Prevent SPIR targets from using half conversion intrinsics
Sjoerd Meijer [Wed, 20 Jun 2018 09:49:40 +0000 (09:49 +0000)]
[SPIR] Prevent SPIR targets from using half conversion intrinsics

The SPIR target currently allows for half precision floating point types to be
emitted using the LLVM intrinsic functions which convert half types to floats
and doubles. However, this is illegal in SPIR as the only intrinsic allowed by
SPIR is memcpy, as per section 3 of the SPIR specification. Currently this is
leading to an assert being hit in the Clang CodeGen when attempting to emit a
constant or literal _Float16 type in a comparison operation on a SPIR or SPIR64
target. This assert stems from the CodeGen attempting to emit a constant half
value as an integer because the backend has specified that it is using these
half conversion intrinsics (which represents half as i16). This patch prevents
SPIR targets from using these intrinsics by overloading the responsible target
info method, marks SPIR targets as having a legal half type and provides
additional regression testing for the _Float16 type on SPIR targets.

Patch by: Stephen McGroarty

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

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

6 years ago[Sema] Allow creating types with multiple of the same addrspace.
Alexey Bader [Wed, 20 Jun 2018 08:31:24 +0000 (08:31 +0000)]
[Sema] Allow creating types with multiple of the same addrspace.

Summary:
The comment with the OpenCL clause about this clearly
says: "No type shall be qualified by qualifiers for
two or more different address spaces."

This must mean that two or more qualifiers for the
_same_ address space is allowed. However, it is
likely unintended by the programmer, so emit a
warning.

For dependent address space types, reject them like
before since we cannot know what the address space
will be.

Patch by Bevin Hansson (ebevhan).

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: bader, cfe-commits

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

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

6 years agoAdd a test to verify the x86 intrinsic headers compile cleanly with no warnings or...
Douglas Yung [Wed, 20 Jun 2018 01:05:09 +0000 (01:05 +0000)]
Add a test to verify the x86 intrinsic headers compile cleanly with no warnings or errors.

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

6 years ago[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.
Craig Topper [Wed, 20 Jun 2018 00:31:39 +0000 (00:31 +0000)]
[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.

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

6 years agoAppend new attributes to the end of an AttributeList.
Michael Kruse [Tue, 19 Jun 2018 23:46:52 +0000 (23:46 +0000)]
Append new attributes to the end of an AttributeList.

... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.

The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse, and therefore printed in the wrong order by
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.

The change unfortunately has some secondary effects, especially for
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attribute's order was changed instead.

It also causes some 'previous occurrence here' hints to be textually
after the main marker. This typically happens when attributes are
merged, but are incompatible. Interchanging the role of the the main
and note SourceLocation will also cause the case where two different
declaration's attributes (in contrast to multiple attributes of the
same declaration) are merged to be reversed. There is no easy fix
because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway, which often is on the same line.

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

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

6 years agoclang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least...
Nico Weber [Tue, 19 Jun 2018 23:19:34 +0000 (23:19 +0000)]
clang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).

Diagnostics for narrowing conversions in initializer lists are currently
DefaultIgnored in Microsoft mode. But MSVC 2015 did add warnings about
narrowing conversions (C2397), so clang-cl can remove its special case code if
MSCompatibilityVersion is new enough.

(In MSVC, C2397 is just a warning and in clang it's default-mapped to an error,
but it can be remapped, and disabled with -Wno-c++11-narrowing, so that should
be fine.)

Fixes PR37314.
https://reviews.llvm.org/D48296

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

6 years agoRecommit r335063: [Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 22:47:53 +0000 (22:47 +0000)]
Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

The recommit ensures that the tests that failed on bots don't trigger the warning.

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoRecommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 21:00:30 +0000 (21:00 +0000)]
Recommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.""

Test has been updated to reflect the IRGen.

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

6 years agoRevert r335063 as it causes bot failures
Alex Lorenz [Tue, 19 Jun 2018 19:43:07 +0000 (19:43 +0000)]
Revert r335063 as it causes bot failures

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

6 years agoRevert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 19:37:07 +0000 (19:37 +0000)]
Revert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible."

The test changes are failing the buildbot and its going to take me some time to fix it.

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

6 years ago[X86] Rewrite the max and min reduction intrinsics to make better use of other functi...
Craig Topper [Tue, 19 Jun 2018 19:13:54 +0000 (19:13 +0000)]
[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.

We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX.

For v16i32 and floating point we have legacy 128/256 bit instructions we can use.

I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization.

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

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

6 years ago[Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 17:56:03 +0000 (17:56 +0000)]
[Darwin] Add a warning for missing include path for libstdc++

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:59:11 +0000 (14:59 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years agoReverting due to line ending changes; will reapply after addressing that.
Aaron Ballman [Tue, 19 Jun 2018 14:53:20 +0000 (14:53 +0000)]
Reverting due to line ending changes; will reapply after addressing that.

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:36:04 +0000 (14:36 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years ago[analyzer] Made a buildbot happy.
Kristof Umann [Tue, 19 Jun 2018 08:35:02 +0000 (08:35 +0000)]
[analyzer] Made a buildbot happy.

Since `isPrimitiveType` was only used in an assert, a builbot with `-Werror`
and no asserts enabled failed to build it as it was unused.

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

6 years agoRevert r335019 "Update NRVO logic to support early return (Attempt 2)"
Taiju Tsuiki [Tue, 19 Jun 2018 05:35:30 +0000 (05:35 +0000)]
Revert r335019 "Update NRVO logic to support early return (Attempt 2)"

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

6 years ago[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
Akira Hatanaka [Tue, 19 Jun 2018 05:04:44 +0000 (05:04 +0000)]
[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
after the closing brace of a class declaration.

Merge the two call sites of checkIllFormedTrivialABIStruct and sink it
into CheckCompletedCXXClass so that it is called after the attribute has
been attached to the CXXRecordDecl.

rdar://problem/40873297

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

6 years agoUpdate NRVO logic to support early return (Attempt 2)
Taiju Tsuiki [Tue, 19 Jun 2018 04:39:07 +0000 (04:39 +0000)]
Update NRVO logic to support early return (Attempt 2)

Summary:
This is the second attempt of r333500 (Update NRVO logic to support early return).
The previous one was reverted for a miscompilation for an incorrect NRVO set up on templates such as:
```
struct Foo {};

template <typename T>
T bar() {
  T t;
  if (false)
    return T();
  return t;
}
```

Where, `t` is marked as non-NRVO variable before its instantiation. However, while its instantiation, it's left an NRVO candidate, turned into an NRVO variable later.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoIRgen: Mark aliases of ctors and dtors as unnamed_addr.
Peter Collingbourne [Mon, 18 Jun 2018 20:58:54 +0000 (20:58 +0000)]
IRgen: Mark aliases of ctors and dtors as unnamed_addr.

This is not only semantically correct but ensures that they will not
be marked as address-significant once D48155 lands.

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

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

6 years agoDon't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time...
Nico Weber [Mon, 18 Jun 2018 18:50:35 +0000 (18:50 +0000)]
Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real
%t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if
the test has run before), then this effectively becomes `ln -sf %t.real %t.real`,
symlinking the directory to itself. At least on my mac, this leads to the
directory containing itself.

As fix, just remove %t.fake before creating the symlink. To clean up build dirs
on bots, also remove %t.real for a while.

https://reviews.llvm.org/D48224

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

6 years ago[analyzer] Remove accidentally committed lines.
George Karpenkov [Mon, 18 Jun 2018 17:59:03 +0000 (17:59 +0000)]
[analyzer] Remove accidentally committed lines.

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

6 years agoFix a bug introduced by rL334850
Tomasz Krupa [Mon, 18 Jun 2018 17:57:05 +0000 (17:57 +0000)]
Fix a bug introduced by rL334850

Summary: All *_sqrt_round_s[s|d] intrinsics should execute a square root on
zeroth element from B (Ops[1]) and insert in to A (Ops[0]), not the other way around.

Reviewers: itaraban, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Emit simple reduction if requested.
Alexey Bataev [Mon, 18 Jun 2018 17:11:45 +0000 (17:11 +0000)]
[OPENMP, NVPTX] Emit simple reduction if requested.

If simple reduction is requested, use the simple reduction instead of
the runtime functions calls.

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

6 years agoUpdate copyright year to 2018.
Paul Robinson [Mon, 18 Jun 2018 12:22:17 +0000 (12:22 +0000)]
Update copyright year to 2018.

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

6 years ago[analyzer] Checker for uninitialized C++ objects
Kristof Umann [Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)]
[analyzer] Checker for uninitialized C++ objects

This checker analyzes C++ constructor calls, and reports uninitialized fields.

Due to the nature of this problem (uninitialized fields after an object
construction), this checker doesn't search for bugs, but rather is a tool to
enforce a specific programming model where every field needs to be initialized.

This checker lands in alpha for now, and a number of followup patches will be
made to reduce false negatives and to make it easier for the user to understand
what rules the checker relies on, eg. whether a derived class' constructor is
responsible for initializing inherited data members or whether it should be
handled in the base class' constructor.

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

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

6 years ago[ASTMatchers] Add support for matching the type of a friend decl.
David L. Jones [Mon, 18 Jun 2018 09:23:08 +0000 (09:23 +0000)]
[ASTMatchers] Add support for matching the type of a friend decl.

This allows matchers like:

  friendDecl(hasType(cxxRecordDecl(...)))
  friendDecl(hasType(asString(...)))

It seems that hasType is probably the most reasonable narrowing matcher to
overload, since it is already used to narrow to other declaration kinds.

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

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

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

6 years ago[ASTMatchers] Don't assert-fail in specifiesTypeLoc().
David L. Jones [Mon, 18 Jun 2018 08:59:16 +0000 (08:59 +0000)]
[ASTMatchers] Don't assert-fail in specifiesTypeLoc().

The specifiesTypeLoc() matcher narrows a nestedNameSpecifier matcher based on a
typeloc within the NNS. However, the matcher does not guard against NNS which
are a namespace, and cause getTypeLoc to assert-fail.

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

6 years ago[analyzer] Add method to the generic SMT API to dump the SMT formula
Mikhail R. Gadelha [Sat, 16 Jun 2018 14:36:17 +0000 (14:36 +0000)]
[analyzer] Add method to the generic SMT API to dump the SMT formula

Summary:
New method dump the SMT formula and the Z3 implementation.

There is no test because I only used it for debugging.

However, if requested, I can add an option to the static analyzer to dump the formula (whole program? per path?), maybe something like the trimmed graph but for SMT formulas.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years agoAdd RUN line for amdgcn to lit test conditional-temporaries.cpp
Yaxun Liu [Sat, 16 Jun 2018 12:28:51 +0000 (12:28 +0000)]
Add RUN line for amdgcn to lit test conditional-temporaries.cpp

This is partial re-commit of r332982.

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

6 years agoCall CreateTempAllocaWithoutCast for ActiveFlag
Yaxun Liu [Sat, 16 Jun 2018 01:20:52 +0000 (01:20 +0000)]
Call CreateTempAllocaWithoutCast for ActiveFlag

This is partial re-commit of r332982.

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

6 years ago[docs] -fsanitize=cfi only allowed with -fvisibility=
Fangrui Song [Fri, 15 Jun 2018 23:11:18 +0000 (23:11 +0000)]
[docs] -fsanitize=cfi only allowed with -fvisibility=

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

6 years ago[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'
Bruno Cardoso Lopes [Fri, 15 Jun 2018 20:13:28 +0000 (20:13 +0000)]
[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'

When in the context of suggestion the fix-it from .Private to _Private
for private modules, trim off the 'explicit' and add 'framework' when
appropriate.

rdar://problem/41030554

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

6 years ago[X86] Lowering sqrt intrinsics to native IR
Tomasz Krupa [Fri, 15 Jun 2018 18:05:59 +0000 (18:05 +0000)]
[X86] Lowering sqrt intrinsics to native IR

Reviewers: craig.topper, spatel, RKSimon, igorb, uriel.k

Reviewed By: craig.topper

Subscribers: tkrupa, cfe-commits

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

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

6 years ago[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shuf...
Craig Topper [Fri, 15 Jun 2018 17:40:37 +0000 (17:40 +0000)]
[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shufpd should only accept an ICE constant.

The rotates also need to check for the immediate to fit in 8-bits. Shufpd already checks its immediate range.

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

6 years ago[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only...
Craig Topper [Fri, 15 Jun 2018 17:03:32 +0000 (17:03 +0000)]
[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only be 4 bits wide.

We already checked this for the scalar version, but missed the vector version somehow.

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

6 years agobpf: recognize target specific option -mattr=dwarfris in clang
Yonghong Song [Fri, 15 Jun 2018 15:53:31 +0000 (15:53 +0000)]
bpf: recognize target specific option -mattr=dwarfris in clang

The following is the usage example with clang:
  bash-4.2$ clang -target bpf -O2 -g -c -Xclang -target-feature -Xclang +dwarfris t.c
  bash-4.2$ llvm-objdump -S -d t.o

  t.o:    file format ELF64-BPF

  Disassembly of section .text:
  test:
  ; int test(void) {
       0:       b7 00 00 00 00 00 00 00         r0 = 0
  ; return 0;
         1:       95 00 00 00 00 00 00 00         exit
  bash-4.2$ cat t.c
  int test(void) {
    return 0;
  }
  bash-4.2$

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334839 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NFC] Add CreateMemTempWithoutCast and CreateTempAllocaWithoutCast
Yaxun Liu [Fri, 15 Jun 2018 15:33:22 +0000 (15:33 +0000)]
[NFC] Add CreateMemTempWithoutCast and CreateTempAllocaWithoutCast

This is partial re-commit of r332982

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

6 years ago[AArch64] Reverted rC334696 with Clang VCVTA test fix
Luke Geeson [Fri, 15 Jun 2018 10:10:45 +0000 (10:10 +0000)]
[AArch64] Reverted  rC334696 with Clang VCVTA test fix

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

6 years ago[ASTImporter] Corrected diagnostic client handling in tests.
Adam Balogh [Fri, 15 Jun 2018 06:45:39 +0000 (06:45 +0000)]
[ASTImporter] Corrected diagnostic client handling in tests.

ASTImporter tests may produce source file related warnings, the diagnostic
client should be in correct state to handle it. Added 'beginSourceFile' to set
the client state.

Patch by: Balázs Kéri

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

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

6 years ago[Format] Do not use a global static value for EOF within ScopedMacroState.
David L. Jones [Fri, 15 Jun 2018 06:08:54 +0000 (06:08 +0000)]
[Format] Do not use a global static value for EOF within ScopedMacroState.

ScopedMacroState injects its own EOF token under certain conditions, and the
returned token may be modified in several different locations. If multiple
reformat operations are started in different threads, then they will both see
the same fake EOF token, and may both try to modify it. This is a data race.

This bug was caught with tsan.

Reviewers: klimek

Subscribers: cfe-commits

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

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

6 years ago[cmake] Add linker detection for Apple platforms
Shoaib Meenai [Thu, 14 Jun 2018 23:26:33 +0000 (23:26 +0000)]
[cmake] Add linker detection for Apple platforms

LLVM currently assumes that Apple platforms will always use ld64. In the
future, LLD Mach-O might also be supported, so add the beginnings of
linker detection support. ld64 is currently the only detected linker,
since `ld64.lld -v` doesn't yield any useful version output, but we can
add that detection later, and in the meantime it's still useful to have
the ld64 identification.

Switch clang's order file check to use this new detection rather than
just checking for the presence of an ld64 executable.

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

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

6 years agoModules: Fix implicit output file for .cppm to .pcm instead of stdout
David Blaikie [Thu, 14 Jun 2018 23:09:06 +0000 (23:09 +0000)]
Modules: Fix implicit output file for .cppm to .pcm instead of stdout

This code was introduced back in r178148, a change to introduce
-module-file-info - which still exists & seems like it's still tested (&
this change didn't cause any of those tests to fail).

It doesn't look like this change was necessary there - since it's about
pcm output, whereas -module-file-info looks like it's for pcm /input/.
So I'm not really sure what the original motivation was.

I'm open to ideas though, if it turns out the original change was
necessary/useful.

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

6 years ago[X86] Rename __builtin_ia32_pslldqi128 to __builtin_ia32_pslldqi128_byteshift and...
Craig Topper [Thu, 14 Jun 2018 22:02:35 +0000 (22:02 +0000)]
[X86] Rename __builtin_ia32_pslldqi128 to __builtin_ia32_pslldqi128_byteshift and similar for other sizes. Remove the multiply by 8 from the header files.

The previous names took the shift amount in bits to match gcc and required a multiply by 8 in the header. This creates a misleading error message when we check the range of the immediate to the builtin since the allowed range also got multiplied by 8.

This commit changes the builtins to use a byte shift amount to match the underlying instruction and the Intel intrinsic.

Fixes the remaining issue from PR37795.

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

6 years ago[c++17] If a class inherits virtual functions from a base class, it is
Richard Smith [Thu, 14 Jun 2018 20:03:22 +0000 (20:03 +0000)]
[c++17] If a class inherits virtual functions from a base class, it is
not an aggregtae.

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

6 years ago[X86] Add inline assembly versions of _InterlockedExchange_HLEAcquire/Release and...
Craig Topper [Thu, 14 Jun 2018 18:43:52 +0000 (18:43 +0000)]
[X86] Add inline assembly versions of _InterlockedExchange_HLEAcquire/Release and _InterlockedCompareExchange_HLEAcquire/Release for MSVC compatibility.

Clang/LLVM doesn't have a way to pass an HLE hint through to the X86 backend to emit HLE prefixed instructions. So this is a good short term fix.

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

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

6 years ago[CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2
Bruno Cardoso Lopes [Thu, 14 Jun 2018 18:20:04 +0000 (18:20 +0000)]
[CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2

On MacOS, if CMAKE_OSX_SYSROOT is used and the user has command line tools
installed, we currently get the include path for libxml2 as
/usr/include/libxml2, instead of ${CMAKE_OSX_SYSROOT}/usr/include/libxml2.

Make it consistent on MacOS by prefixing ${CMAKE_OSX_SYSROOT} when
possible.

rdar://problem/41103601

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

6 years ago[X86] Lowering Mask Scalar intrinsics to native IR (Clang part)
Tomasz Krupa [Thu, 14 Jun 2018 17:36:23 +0000 (17:36 +0000)]
[X86] Lowering Mask Scalar intrinsics to native IR (Clang part)

Summary: Lowering add, sub, mul, and div mask scalar intrinsic calls
to native IR.

Reviewers: craig.topper, RKSimon, spatel, sroland

Reviewed By: craig.topper

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objectiv...
Ben Hamilton [Thu, 14 Jun 2018 17:30:10 +0000 (17:30 +0000)]
[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objective-C 📜

Contributed by @stephanemoore.

Reviewers: benhamilton, jolesiak, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

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

6 years ago[Fixed Point Arithmetic] Addition of the remaining fixed point types and their satura...
Leonard Chan [Thu, 14 Jun 2018 14:53:51 +0000 (14:53 +0000)]
[Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

This diff includes changes for the remaining _Fract and _Sat fixed point types.

```
signed short _Fract s_short_fract;
signed _Fract s_fract;
signed long _Fract s_long_fract;
unsigned short _Fract u_short_fract;
unsigned _Fract u_fract;
unsigned long _Fract u_long_fract;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
short _Fract short_fract;
_Fract fract;
long _Fract long_fract;

// Saturated fixed point types
_Sat signed short _Accum sat_s_short_accum;
_Sat signed _Accum sat_s_accum;
_Sat signed long _Accum sat_s_long_accum;
_Sat unsigned short _Accum sat_u_short_accum;
_Sat unsigned _Accum sat_u_accum;
_Sat unsigned long _Accum sat_u_long_accum;
_Sat signed short _Fract sat_s_short_fract;
_Sat signed _Fract sat_s_fract;
_Sat signed long _Fract sat_s_long_fract;
_Sat unsigned short _Fract sat_u_short_fract;
_Sat unsigned _Fract sat_u_fract;
_Sat unsigned long _Fract sat_u_long_fract;

// Aliased saturated fixed point types
_Sat short _Accum sat_short_accum;
_Sat _Accum sat_accum;
_Sat long _Accum sat_long_accum;
_Sat short _Fract sat_short_fract;
_Sat _Fract sat_fract;
_Sat long _Fract sat_long_fract;
```

This diff only allows for declaration of these fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches.

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

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

6 years agoclang-format: Fix documentation generation
Francois Ferrand [Thu, 14 Jun 2018 13:32:14 +0000 (13:32 +0000)]
clang-format: Fix documentation generation

Summary:
It seems that the changes done to `ClangFormatStyleOptions.rst` @334408 are causing the generation of the documentation to fail, with the following error:

  Warning, treated as error:
    /llvm/tools/clang/docs/ClangFormatStyleOptions.rst:1060: WARNING: Definition list ends without a blank line; unexpected unindent.

This is due to missing indent in some code block, and fixed by this patch.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: cfe-commits

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

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

6 years ago[OpenCL] Support new/delete in Sema
Sven van Haastregt [Thu, 14 Jun 2018 09:51:54 +0000 (09:51 +0000)]
[OpenCL] Support new/delete in Sema

Reject uses of the default new/delete operators with a diagnostic
instead of a crash in OpenCL C++ mode and accept user-defined forms.

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

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

6 years ago[AArch64] reverting rC334693 due to build failures
Luke Geeson [Thu, 14 Jun 2018 08:59:33 +0000 (08:59 +0000)]
[AArch64] reverting rC334693 due to build failures

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

6 years agoRemoved trunk-Codegen directory added in error
Luke Geeson [Thu, 14 Jun 2018 08:51:52 +0000 (08:51 +0000)]
Removed trunk-Codegen directory added in error

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

6 years ago[AArch64] Added support for the vcvta_u16_f16 instrinsic for FP16 Armv8.2-A
Luke Geeson [Thu, 14 Jun 2018 08:28:56 +0000 (08:28 +0000)]
[AArch64] Added support for the vcvta_u16_f16 instrinsic for FP16 Armv8.2-A

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

6 years ago[clang-format] Add SpaceBeforeCpp11BracedList option.
Hans Wennborg [Thu, 14 Jun 2018 08:01:09 +0000 (08:01 +0000)]
[clang-format] Add SpaceBeforeCpp11BracedList option.

WebKit C++ style for object initialization is as follows:

  Foo foo { bar };

Yet using clang-format -style=webkit changes this to:

  Foo foo{ bar };

As there is no existing combination of rules that will ensure a space
before a braced list in this fashion, this patch adds a new
SpaceBeforeCpp11BracedList rule.

Patch by Ross Kirsling!

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

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

6 years ago[analyzer] Re-enable C++17-specific RVO construction contexts.
Artem Dergachev [Thu, 14 Jun 2018 01:59:35 +0000 (01:59 +0000)]
[analyzer] Re-enable C++17-specific RVO construction contexts.

Not contexts themselves, but rather support for them in the analyzer.

Such construction contexts appear when C++17 mandatory copy elision occurs
while returning an object from a function, and presence of a destructor causes
a CXXBindTemporaryExpr to appear in the AST.

Additionally, such construction contexts may be chained, because a return-value
construction context doesn't really explain where the object is being returned
into, but only points to the parent stack frame, where the object may be
consumed by literally anything including another return statement. This
behavior is now modeled correctly by the analyzer as long as the object is not
returned beyond the boundaries of the analysis.

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

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

6 years ago[analyzer] Re-enable C++17-specific variable and member construction contexts.
Artem Dergachev [Thu, 14 Jun 2018 01:54:21 +0000 (01:54 +0000)]
[analyzer] Re-enable C++17-specific variable and member construction contexts.

Not contexts themselves, but rather support for them in the analyzer.

Such construction contexts appear when C++17 mandatory copy elision occurs
during initialization, and presence of a destructor causes a
CXXBindTemporaryExpr to appear in the AST.

Similar C++17-specific constructors for return values are still to be supported.

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

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

6 years ago[analyzer] Track class member initializer constructors path-sensitively.
Artem Dergachev [Thu, 14 Jun 2018 01:40:49 +0000 (01:40 +0000)]
[analyzer] Track class member initializer constructors path-sensitively.

The reasoning behind this change is similar to the previous commit, r334681.
Because members are already in scope when construction occurs, we are not
suffering from liveness problems, but we still want to figure out if the object
was constructed with construction context, because in this case we'll be able
to avoid trivial copy, which we don't always model perfectly. It'd also have
more importance when copy elision is implemented.

This also gets rid of the old CFG look-behind mechanism.

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

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