[PATCH] D45932: [clang-tidy][modernize-raw-string-literal] Don't replace upper ASCII with raw literals

2018-04-23 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis updated this revision to Diff 143679.
zinovy.nis marked an inline comment as done.
zinovy.nis added a comment.

- Use clang::isASCII instead of home-brewed code.


https://reviews.llvm.org/D45932

Files:
  clang-tidy/modernize/RawStringLiteralCheck.cpp
  test/clang-tidy/modernize-raw-string-literal.cpp


Index: test/clang-tidy/modernize-raw-string-literal.cpp
===
--- test/clang-tidy/modernize-raw-string-literal.cpp
+++ test/clang-tidy/modernize-raw-string-literal.cpp
@@ -40,6 +40,8 @@
 char const *const Us("goink\\\037");
 char const *const HexNonPrintable("\\\x03");
 char const *const Delete("\\\177");
+char const *const MultibyteSnowman("\xE2\x98\x83");
+// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}}
 
 char const *const TrailingSpace("A line \\with space. \n");
 char const *const TrailingNewLine("A single \\line.\n");
Index: clang-tidy/modernize/RawStringLiteralCheck.cpp
===
--- clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -10,6 +10,7 @@
 #include "RawStringLiteralCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/CharInfo.h"
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
@@ -65,6 +66,11 @@
 33)) != StringRef::npos)
 return false;
 
+  // Don't replace chars from upper ASCII as they can represent UTF-8 or be
+  // supported by specific code pages only.
+  if (Bytes.find_if_not(isASCII) != StringRef::npos)
+return false;
+
   CharSourceRange CharRange = Lexer::makeFileCharRange(
   CharSourceRange::getTokenRange(Literal->getSourceRange()),
   *Result.SourceManager, Result.Context->getLangOpts());


Index: test/clang-tidy/modernize-raw-string-literal.cpp
===
--- test/clang-tidy/modernize-raw-string-literal.cpp
+++ test/clang-tidy/modernize-raw-string-literal.cpp
@@ -40,6 +40,8 @@
 char const *const Us("goink\\\037");
 char const *const HexNonPrintable("\\\x03");
 char const *const Delete("\\\177");
+char const *const MultibyteSnowman("\xE2\x98\x83");
+// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}}
 
 char const *const TrailingSpace("A line \\with space. \n");
 char const *const TrailingNewLine("A single \\line.\n");
Index: clang-tidy/modernize/RawStringLiteralCheck.cpp
===
--- clang-tidy/modernize/RawStringLiteralCheck.cpp
+++ clang-tidy/modernize/RawStringLiteralCheck.cpp
@@ -10,6 +10,7 @@
 #include "RawStringLiteralCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Basic/CharInfo.h"
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
@@ -65,6 +66,11 @@
 33)) != StringRef::npos)
 return false;
 
+  // Don't replace chars from upper ASCII as they can represent UTF-8 or be
+  // supported by specific code pages only.
+  if (Bytes.find_if_not(isASCII) != StringRef::npos)
+return false;
+
   CharSourceRange CharRange = Lexer::makeFileCharRange(
   CharSourceRange::getTokenRange(Literal->getSourceRange()),
   *Result.SourceManager, Result.Context->getLangOpts());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45932: [clang-tidy][modernize-raw-string-literal] Don't replace upper ASCII with raw literals

2018-04-23 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis marked an inline comment as done.
zinovy.nis added inline comments.



Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:70-72
+  if (Bytes.find_if([](char C) {
+return static_cast(C) > 0x7Fu;
+  }) != StringRef::npos)

aaron.ballman wrote:
> I think you can use `isASCII()` from CharInfo.h rather than reimplement it.
Nice finding! Thanks!



Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:44
+char const *const MultibyteSnowman("\xE2\x98\x83");
+// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}}
 

LegalizeAdulthood wrote:
> IIRC, the default behavior is that if no matching CHECK-FIXES line is found, 
> then it is considered a failure.  Have you tried your test code without your 
> change to verify that this is the case?
1. Without my fix my test fails with a Python decoder error as it cannot print 
Unicode symbols in Windows console. But no FileCheck errors occur:


```
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 974: 
ordinal not in range(128)
```


2. Regardless of my changes when I replace `"char const *const 
Delete("\\\177");"` with `"char const *const Delete("\000\\\177");"` (leading 
`\0`) test still passes! Looks like CHECK-FIXes must be explicit.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45932



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGExprAgg.cpp:1002
+  return EmitFinalDestCopy(
+  E->getType(), CGF.MakeNaturalAlignAddrLValue(Select, E->getType()));
+}

Is there something in Sema actually validating that the comparison types is 
trivially copyable?  Because EmitFinalDestCopy does not work on non-trivial 
types.

Also, are we certain that we're allowed to do a copy from an actual global 
variable here instead of potentially a constexpr evaluation of the variable 
reference?  And if we are doing a copy, are we registering ODR-uses of all the 
variables in Sema?

I don't think you should worry about trying to generate a select between the 
"actual" comparison result values.  At least not yet.


https://reviews.llvm.org/D45476



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330681 - [X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

2018-04-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Apr 23 20:36:08 2018
New Revision: 330681

URL: http://llvm.org/viewvc/llvm-project?rev=330681&view=rev
Log:
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or 
icc limit these to 64-bit mode so we shouldn't either.

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=330681&r1=330680&r2=330681&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon Apr 23 20:36:08 2018
@@ -330,7 +330,6 @@ _mm512_set1_epi64(long long __d)
   return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d };
 }
 
-#ifdef __x86_64__
 static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
 {
@@ -338,7 +337,6 @@ _mm512_maskz_set1_epi64(__mmask8 __M, lo
  (__v8di)_mm512_set1_epi64(__A),
  (__v8di)_mm512_setzero_si512());
 }
-#endif
 
 static __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_broadcastss_ps(__m128 __A)
@@ -9575,7 +9573,6 @@ _mm512_mask_set1_epi32 (__m512i __O, __m
   (__v16si) __O);
 }
 
-#ifdef __x86_64__
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_mask_set1_epi64 (__m512i __O, __mmask8 __M, long long __A)
 {
@@ -9583,7 +9580,6 @@ _mm512_mask_set1_epi64 (__m512i __O, __m
   (__v8di) _mm512_set1_epi64(__A),
   (__v8di) __O);
 }
-#endif
 
 static  __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_set_epi8 (char __e63, char __e62, char __e61, char __e60, char __e59,

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=330681&r1=330680&r2=330681&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Mon Apr 23 20:36:08 2018
@@ -5368,7 +5368,6 @@ _mm256_maskz_set1_epi32( __mmask8 __M, i
 }
 
 
-#ifdef __x86_64__
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_mask_set1_epi64 (__m128i __O, __mmask8 __M, long long __A)
 {
@@ -5400,8 +5399,6 @@ _mm256_maskz_set1_epi64 (__mmask8 __M, l
(__v4di) 
_mm256_set1_epi64x(__A),
(__v4di) 
_mm256_setzero_si256());
 }
-  
-#endif
 
 #define _mm_fixupimm_pd(A, B, C, imm) __extension__ ({ \
   (__m128d)__builtin_ia32_fixupimmpd128_mask((__v2df)(__m128d)(A), \

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=330681&r1=330680&r2=330681&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Mon Apr 23 20:36:08 2018
@@ -8051,7 +8051,6 @@ __m512i test_mm512_setr_epi32 (int __A,
   __I, __J, __K, __L,__M, __N, __O, __P);
 }
 
-#ifdef __x86_64__
 __m512i test_mm512_mask_set1_epi64 (__m512i __O, __mmask8 __M, long long __A)
 {
   // CHECK-LABEL: @test_mm512_mask_set1_epi64
@@ -8081,7 +8080,6 @@ __m512i test_mm512_maskz_set1_epi64 (__m
   // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}}
   return _mm512_maskz_set1_epi64 (__M, __A);
 }
-#endif
 
 
 __m512i test_mm512_set_epi64 (long long __A, long long __B, long long __C,

Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vl-builtins.c?rev=330681&r1=330680&r2=330681&view=diff
==
--- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Mon Apr 23 20:36:08 2018
@@ -4610,7 +4610,6 @@ __m256i test_mm256_maskz_set1_epi32(__mm
   return _mm256_maskz_set1_epi32(__M, 5); 
 }
 
-#ifdef __x86_64__
 __m128i test_mm_mask_set1_epi64(__m128i __O, __mmask8 __M, long long __A) {
   // CHECK-LABEL: @test_mm_mask_set1_epi64
   // CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 0
@@ -4650,7 +4649,6 @@ __m256i test_mm256_maskz_set1_epi64(__mm
   // CHECK:  select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
   return _mm256_maskz_set1_epi64(__M, __A); 
 }
-#endif
 
 __m128d test_mm_fixupimm_pd(__m128d __A, __m128d __B, __m128i __C) {
   // CHECK-LABEL: @test_mm_fixupimm_pd


_

Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread John McCall via cfe-commits
On Mon, Apr 23, 2018 at 8:23 PM, Richard Smith 
wrote:

> On 23 April 2018 at 16:23, David Blaikie via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> On Mon, Apr 23, 2018 at 4:12 PM John McCall  wrote:
>>
>>> On Mon, Apr 23, 2018 at 6:32 PM, David Blaikie 
>>> wrote:
>>>
 On Mon, Apr 23, 2018 at 3:29 PM John McCall via Phabricator <
 revi...@reviews.llvm.org> wrote:

> rjmccall added a comment.
>
> In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:
>
> > Is there anything else in the "-w" namespace other than the literal
> "-w" so
> >  far?
>
>
> No. This would be novel.
>

 Ah, I see.


> > I mean, I could imagine it might make more sense to default these
> warnings
> >  off & users can turn them on for non-test code, potentially? So
> >  "-Wnon-test" might make sense.
>
> That's an interesting idea, but it's still not a warning group,
> because you shouldn't get the self-assign warnings unless `-Wself-assign`
> is enabled.
>

 You shouldn't?

>>>
>>> I wouldn't think so.  Remember that the goal of the option is to be a
>>> single thing that users can add to their unit-test CFLAGS to disable these
>>> noisy-in-tests cases.  So if we add an opt-in/experimental
>>> `-Wunpredictable-foozits` warning, and it has a unit-test carve-out,
>>> passing `-wtest -wno-test` or whatever shouldn't turn on the carved-out
>>> special case of `-Wunpredictable-foozits`.
>>>
>>> It's probably not the worst thing to just use a `-W` spelling anyway;
>>> not everything in that namespace is (e.g. `-Werror`).  It could be
>>> `-Wnoisy-in-tests` and `-Wno-noisy-in-tests`, with a documentation note
>>> that `-Wnoisy-in-tests` is just a cancellation of `-Wno-noisy-in-tests` and
>>> doesn't actually enable any warnings by itself.  We could have the
>>> diagnostic printer add `-Wnoisy-in-tests` to the diagnostic-group
>>> annotation for diagnostics that would be suppressed under
>>> `-Wno-noisy-in-tests`, analogously to how it adds `-Werror` for diagnostics
>>> that have been promoted to an error.
>>>
>>
>> That sort of sounds pretty plausible to me. Poked Richard about his
>> opinion here too.
>>
>
> This is not the only warning group that has the property that only one of
> -Wfoo and -Wno-foo seems useful. There are, for instance, plenty of
> diagnostic groups that make sense to turn on, but not to turn off (eg,
> -Wno-all, -Wno-extra are largely meaningless), and some that make sense to
> turn off, but not to turn on (eg, -Wnon-gcc is only intended to be turned
> off). So I don't think that's as special a property as is being suggested.
> If someone uses -Wnoisy-in-tests and it turns on all warnings that are
> noisy in tests, I think they got what they asked for.
>

The issue there is that -Wnoisy-in-tests is likely to be useful as a
cancellation of -Wno-noisy-in-tests, which (as David suggests) might
reasonably be set by default by a build system.  That's completely defeated
if it potentially enables a bunch of unwanted warnings.

This is also not the only warning group for which we want diagnostics to be
> in this group and in some other group or groups. I think the idea to
> include -Wnoisy-in-tests in the diagnostic output is very interesting, but
> as a general feature not as a -Wnoisy-in-tests special case -- for example,
> if I use a binary literal in C++98 mode, I'd like the warning to be tagged
> with [-Wbinary-literal,-Wc++14-extensions,-Wgnu], rather than the current
> [-Wc++14-binary-literal] (an artificial warning group that only exists to
> work around the inability of our infrastructure to properly represent
> warnings that are in multiple groups at once).
>

> As a simple way to get this effect, perhaps we could allow warning groups
> to be tagged as artificial, and for such warning groups, recurse to the
> warning groups including them to find the name to use for diagnostics.
>

That's a really good idea.  I don't think it's a good match for this, but I
completely agree that there's a separate problem of presenting artificial
diagnostic groups to users.

I'm going to quote your other post into this thread in the interest of
making it easier for posterity to read a unified discussion.

I would feel a lot more comfortable adding a `-wtest` flag if we had more
> than one warning that it would control. If there's really only one warning
> out of >600 that qualifies for this treatment, I really don't think we have
> a good argument to introduce a new feature here, and it'll just be dead
> weight we're carrying forever. My inclination is to say that the single
> `-Wno-` flag is sufficient until we actually have multiple warnings that
> this would control, and this is a premature generalization until that
> point. ("We're just about to add these warnings" carries a lot more weight
> for me here than "We have ideas of warnings we might add", but if we're in
> the former situation, there

r330674 - Make add_clang_tool() formatting a bit more consistent.

2018-04-23 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Apr 23 18:30:44 2018
New Revision: 330674

URL: http://llvm.org/viewvc/llvm-project?rev=330674&view=rev
Log:
Make add_clang_tool() formatting a bit more consistent.

Modified:
cfe/trunk/tools/clang-rename/CMakeLists.txt

Modified: cfe/trunk/tools/clang-rename/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-rename/CMakeLists.txt?rev=330674&r1=330673&r2=330674&view=diff
==
--- cfe/trunk/tools/clang-rename/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-rename/CMakeLists.txt Mon Apr 23 18:30:44 2018
@@ -3,7 +3,9 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_tool(clang-rename ClangRename.cpp)
+add_clang_tool(clang-rename
+  ClangRename.cpp
+  )
 
 target_link_libraries(clang-rename
   PRIVATE


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45284: [RISCV] More validations on the input value of -march=

2018-04-23 Thread Ana Pazos via Phabricator via cfe-commits
apazos updated this revision to Diff 143674.
apazos added a comment.

Hi Alex, the refactoring will be simple and can be done later when we need it, 
all the pieces are already parsed (type, name, major, minor) and are in 
strings,  we will only need to convert to the preferred type (enum, int, etc).
I changed the code to not error out on unsupported extension, allowing all the 
non-standard extensions to be parsed and the format errors reported. Only when 
we try to set target features I then enforce unsupported extension.
This way I could push all my tests.


https://reviews.llvm.org/D45284

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Driver/ToolChains/Arch/RISCV.cpp
  test/Driver/riscv-arch.c

Index: test/Driver/riscv-arch.c
===
--- test/Driver/riscv-arch.c
+++ test/Driver/riscv-arch.c
@@ -1,89 +1,317 @@
-// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ic -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32imafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32ia -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32iafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv32-unknown-elf -march=rv32g -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv32-unknown-elf -march=rv32gc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64i -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64im -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ima -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ic -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64imafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64ia -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iaf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafd -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iac -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafc -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64iafdc -### %s -fsyntax-only 2>&1 | FileCheck %s
-
-// RUN: %clang -target riscv64-unknown-elf -march=rv64g -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang -target riscv64-unknown-elf -march=rv64gc -### %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s \
+// RUN: -fsyntax-only 2>&1 | Fil

[PATCH] D45996: [HWASan] Update HWASan assembly snippet in the docs

2018-04-23 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc accepted this revision.
kcc added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D45996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330671 - Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

2018-04-23 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Mon Apr 23 17:59:22 2018
New Revision: 330671

URL: http://llvm.org/viewvc/llvm-project?rev=330671&view=rev
Log:
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=330671&r1=330670&r2=330671&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Apr 23 17:59:22 2018
@@ -50,6 +50,7 @@
 #include "llvm/Transforms/IPO/AlwaysInliner.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Instrumentation.h"
 #include "llvm/Transforms/Instrumentation/BoundsChecking.h"
 #include "llvm/Transforms/Instrumentation/GCOVProfiler.h"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45884: [Sema] Fix parsing of anonymous union in language linkage specification

2018-04-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: Sema/SemaDecl.cpp:4654-4656
+  while (OwnerScope->getDeclKind() == Decl::LinkageSpec) {
+OwnerScope = OwnerScope->getParent();
+  }

vsapsai wrote:
> Looks like `DeclContext::isTransparentContext()` might be relevant here. At 
> least I was able to get the assertion failure
> 
> > Assertion failed: (II && "Attempt to mangle unnamed decl."), function 
> > getMangledNameImpl, file llvm-project/clang/lib/CodeGen/CodeGenModule.cpp, 
> > line 913.
> 
> for
> ```lang=c++
> // clang -std=c++17 -fmodules-ts test-modules.cpp
> 
> export module M;
> export {
> union {
> int int_val;
> float float_val;
> };
> }
> ```
> 
> Also based on `isTransparentContext()` usage, inline namespaces can cause 
> problems. Currently, there are no problems, we have the error
> 
> > error: anonymous unions at namespace or global scope must be declared 
> > 'static'
> 
> and there are no negative consequences (as far as I can tell). According to 
> my bad standard knowledge that should be OK (haven't found non-static 
> anonymous unions to be allowed in this case).
Right, the correct way to spell this is `OwnerScope = 
Owner->getRedeclContext();`.



Comment at: Sema/SemaDecl.cpp:4659-4661
+  (isa(OwnerScope) ||
+   (isa(OwnerScope) &&
+cast(OwnerScope)->getDeclName( {

vsapsai wrote:
> Checked if we need to do the same change s/Owner/OwnerScope/ elsewhere in 
> this method and looks like it is not required. We care if the owner is a 
> Record and we don't allow linkage specification in classes, so skipping 
> linkage scopes doesn't give us anything.
While you're here, `OwnerScope->isFileContext() && 
!OwnerScope->isInlineNamespace()` might be clearer. Or at least replace the 
`getDeclName()` with `!isInlineNamespace()`.


Repository:
  rC Clang

https://reviews.llvm.org/D45884



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Richard Smith via cfe-commits
On 23 April 2018 at 16:23, David Blaikie via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Mon, Apr 23, 2018 at 4:12 PM John McCall  wrote:
>
>> On Mon, Apr 23, 2018 at 6:32 PM, David Blaikie 
>> wrote:
>>
>>> On Mon, Apr 23, 2018 at 3:29 PM John McCall via Phabricator <
>>> revi...@reviews.llvm.org> wrote:
>>>
 rjmccall added a comment.

 In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:

 > Is there anything else in the "-w" namespace other than the literal
 "-w" so
 >  far?


 No. This would be novel.

>>>
>>> Ah, I see.
>>>
>>>
 > I mean, I could imagine it might make more sense to default these
 warnings
 >  off & users can turn them on for non-test code, potentially? So
 >  "-Wnon-test" might make sense.

 That's an interesting idea, but it's still not a warning group, because
 you shouldn't get the self-assign warnings unless `-Wself-assign` is
 enabled.

>>>
>>> You shouldn't?
>>>
>>
>> I wouldn't think so.  Remember that the goal of the option is to be a
>> single thing that users can add to their unit-test CFLAGS to disable these
>> noisy-in-tests cases.  So if we add an opt-in/experimental
>> `-Wunpredictable-foozits` warning, and it has a unit-test carve-out,
>> passing `-wtest -wno-test` or whatever shouldn't turn on the carved-out
>> special case of `-Wunpredictable-foozits`.
>>
>> It's probably not the worst thing to just use a `-W` spelling anyway; not
>> everything in that namespace is (e.g. `-Werror`).  It could be
>> `-Wnoisy-in-tests` and `-Wno-noisy-in-tests`, with a documentation note
>> that `-Wnoisy-in-tests` is just a cancellation of `-Wno-noisy-in-tests` and
>> doesn't actually enable any warnings by itself.  We could have the
>> diagnostic printer add `-Wnoisy-in-tests` to the diagnostic-group
>> annotation for diagnostics that would be suppressed under
>> `-Wno-noisy-in-tests`, analogously to how it adds `-Werror` for diagnostics
>> that have been promoted to an error.
>>
>
> That sort of sounds pretty plausible to me. Poked Richard about his
> opinion here too.
>

This is not the only warning group that has the property that only one of
-Wfoo and -Wno-foo seems useful. There are, for instance, plenty of
diagnostic groups that make sense to turn on, but not to turn off (eg,
-Wno-all, -Wno-extra are largely meaningless), and some that make sense to
turn off, but not to turn on (eg, -Wnon-gcc is only intended to be turned
off). So I don't think that's as special a property as is being suggested.
If someone uses -Wnoisy-in-tests and it turns on all warnings that are
noisy in tests, I think they got what they asked for.

This is also not the only warning group for which we want diagnostics to be
in this group and in some other group or groups. I think the idea to
include -Wnoisy-in-tests in the diagnostic output is very interesting, but
as a general feature not as a -Wnoisy-in-tests special case -- for example,
if I use a binary literal in C++98 mode, I'd like the warning to be tagged
with [-Wbinary-literal,-Wc++14-extensions,-Wgnu], rather than the current
[-Wc++14-binary-literal] (an artificial warning group that only exists to
work around the inability of our infrastructure to properly represent
warnings that are in multiple groups at once).

As a simple way to get this effect, perhaps we could allow warning groups
to be tagged as artificial, and for such warning groups, recurse to the
warning groups including them to find the name to use for diagnostics.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45997: [CMake] Pass additional CMake flags in Fuchsia cache files

2018-04-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich, juliehockett.
Herald added subscribers: cfe-commits, mgorny.

This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

We now also set build type and enable assertions for builtins and
runtimes build which wasn't the case before, but should've been.


Repository:
  rC Clang

https://reviews.llvm.org/D45997

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/cmake/caches/Fuchsia.cmake


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -40,9 +40,11 @@
   install-distribution
   clang CACHE STRING "")
 
-foreach(target x86_64;aarch64)
-  if(FUCHSIA_${target}_SYSROOT)
-list(APPEND EXTRA_ARGS 
-DFUCHSIA_${target}_SYSROOT=${FUCHSIA_${target}_SYSROOT})
+get_cmake_property(variableNames VARIABLES)
+foreach(variableName ${variableNames})
+  if(variableName MATCHES "^STAGE2_")
+string(REPLACE "STAGE2_" "" new_name ${variableName})
+list(APPEND EXTRA_ARGS "-D${new_name}=${${variableName}}")
   endif()
 endforeach()
 
Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -27,12 +27,24 @@
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 
+set(FUCHSIA_RUNTIMES_ENABLE_ASSERTIONS ON CACHE BOOL "")
+set(FUCHSIA_RUNTIMES_BUILD_TYPE Release CACHE STRING "")
+set(FUCHSIA_BUILTINS_BUILD_TYPE Release CACHE STRING "")
+
 set(LLVM_BUILTIN_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING 
"")
 
 # Set the per-target builtins options.
 foreach(target x86_64;aarch64)
-  set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} 
CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_UNIX 1 CACHE BOOL "")
   set(BUILTINS_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_BUILD_TYPE 
${FUCHSIA_BUILTINS_BUILD_TYPE} CACHE STRING "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_CXX_FLAGS 
${FUCHSIA_${target}_CXX_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
+  set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} 
CACHE PATH "")
 endforeach()
 
 set(LLVM_RUNTIME_TARGETS 
"default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia"
 CACHE STRING "")
@@ -63,10 +75,20 @@
 
 # Set the per-target runtimes options.
 foreach(target x86_64;aarch64)
+  set(RUNTIMES_${target}-fuchsia_UNIX 1 CACHE BOOL "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_TYPE 
${FUCHSIA_RUNTIMES_BUILD_TYPE} CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL 
"")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_CXX_FLAGS 
${FUCHSIA_${target}_CXX_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_EXE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_SHARED_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_MODULE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE PATH "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} 
CACHE PATH "")
-  set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
-  set(RUNTIMES_${target}-fuchsia_UNIX 1 CACHE BOOL "")
+  set(RUNTIMES_${target}-fuchsia_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL "")
+  set(RUNTIMES_${target}-fuchsia_COMPILER_RT_TEST_COMPILER_CFLAGS 
${FUCHSIA_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-fuchsia_LLVM_ENABLE_ASSERTIONS 
${FUCHSIA_RUNTIMES_ENABLE_ASSERTIONS} CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")


Index: clang/cmake/caches/Fuchsia.cmake

[PATCH] D45884: [Sema] Fix parsing of anonymous union in language linkage specification

2018-04-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

For the record, DR154: Anonymous unions in unnamed namespaces 
 is relevant 
here.




Comment at: Sema/SemaDecl.cpp:4654-4656
+  while (OwnerScope->getDeclKind() == Decl::LinkageSpec) {
+OwnerScope = OwnerScope->getParent();
+  }

Looks like `DeclContext::isTransparentContext()` might be relevant here. At 
least I was able to get the assertion failure

> Assertion failed: (II && "Attempt to mangle unnamed decl."), function 
> getMangledNameImpl, file llvm-project/clang/lib/CodeGen/CodeGenModule.cpp, 
> line 913.

for
```lang=c++
// clang -std=c++17 -fmodules-ts test-modules.cpp

export module M;
export {
union {
int int_val;
float float_val;
};
}
```

Also based on `isTransparentContext()` usage, inline namespaces can cause 
problems. Currently, there are no problems, we have the error

> error: anonymous unions at namespace or global scope must be declared 'static'

and there are no negative consequences (as far as I can tell). According to my 
bad standard knowledge that should be OK (haven't found non-static anonymous 
unions to be allowed in this case).



Comment at: Sema/SemaDecl.cpp:4659
   if (DS.getStorageClassSpec() != DeclSpec::SCS_static &&
-  (isa(Owner) ||
-   (isa(Owner) &&
-cast(Owner)->getDeclName( {
+  (isa(OwnerScope) ||
+   (isa(OwnerScope) &&

Checked if we need to do the same change s/Owner/OwnerScope/ elsewhere in this 
method and looks like it is not required. We care if the owner is a Record and 
we don't allow linkage specification in classes, so skipping linkage scopes 
doesn't give us anything.


Repository:
  rC Clang

https://reviews.llvm.org/D45884



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45685: [Sema] Add -wtest global flag that silences -Wself-assign for overloaded operators.

2018-04-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

I would feel a lot more comfortable adding a `-wtest` flag if we had more than 
one warning that it would control. If there's really only one warning out of 
>600 that qualifies for this treatment, I really don't think we have a good 
argument to introduce a new feature here, and it'll just be dead weight we're 
carrying forever. My inclination is to say that the single `-Wno-` flag is 
sufficient until we actually have multiple warnings that this would control, 
and this is a premature generalization until that point. ("We're just about to 
add these warnings" carries a lot more weight for me here than "We have ideas 
of warnings we might add", but if we're in the former situation, there seems to 
be no harm in waiting.)

I'm also concerned about the deployability and utility of this feature. 
Identifying "test code" is not going to be easy in a lot of build systems. Even 
if successfully deployed, this would mean that refactorings moving code between 
files (eg, out of test code into shared infrastructure code) could affect 
whether clang accepts the program (eg, under `-Werror`), which seems pretty 
undesirable. And likewise, tests that check that (for instance) certain macro 
expansions produce valid code would stop being reliable -- the expansion might 
be valid in test code but not valid in non-test code. But for me that's a minor 
concern at worst: if there are users who are happy with the tradeoffs here, I'd 
be OK with us carrying support for them. The major concern here is: are there 
users who would enable this feature? (Briefly taking off my Clang hat and 
putting on my Google hat, I think we -- as the people who originally had major 
problems with the expanded `-Wself-assign` warning -- would be very unlikely to 
ever use `-wtest` because of the refactoring issue.)

Finally, let's assume that this is successful and we end up with dozens of 
warnings covered by `-wtest`. How confident are we that we're not going to want 
a case-by-case way to turn them back on? That is, how sure are we that this 
isn't just another warning group (albeit one that only really makes sense to 
turn off, not to turn on)? For `-w`, this isn't really a concern, because `-w` 
is very much a "just compile it, I do not care about bugs or code quality" flag 
which doesn't really make sense to only partially deploy.




Comment at: include/clang/Basic/Diagnostic.td:102-104
+class ShowInTests {
+  bit HideInTests = 0;
+}

This does not seem like it should ever be necessary.


Repository:
  rC Clang

https://reviews.llvm.org/D45685



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45996: [HWASan] Update HWASan assembly snippet in the docs

2018-04-23 Thread Aleksey Shlyapnikov via Phabricator via cfe-commits
alekseyshl created this revision.
alekseyshl added a reviewer: eugenis.

To complement https://reviews.llvm.org/D45840


Repository:
  rC Clang

https://reviews.llvm.org/D45996

Files:
  docs/HardwareAssistedAddressSanitizerDesign.rst


Index: docs/HardwareAssistedAddressSanitizerDesign.rst
===
--- docs/HardwareAssistedAddressSanitizerDesign.rst
+++ docs/HardwareAssistedAddressSanitizerDesign.rst
@@ -52,15 +52,16 @@
   // int foo(int *a) { return *a; }
   // clang -O2 --target=aarch64-linux -fsanitize=hwaddress -c load.c
   foo:
-   0:  08 dc 44 d3 ubfxx8, x0, #4, #52  // shadow address
-   4:  08 01 40 39 ldrbw8, [x8] // load shadow
-   8:  09 fc 78 d3 lsr x9, x0, #56  // address tag
-   c:  3f 01 08 6b cmp w9, w8   // compare tags
-  10:  61 00 00 54 b.ne#12  // jump on mismatch
-  14:  00 00 40 b9 ldr w0, [x0] // original load
-  18:  c0 03 5f d6 ret
-  1c:  40 20 21 d4 brk #0x902   // trap
-
+   0:  08 00 00 90 adrpx8, 0 <__hwasan_shadow>
+   4:  08 01 40 f9 ldr x8, [x8] // shadow base (to be 
resolved by the loader)
+   8:  09 dc 44 d3 ubfxx9, x0, #4, #52  // shadow offset
+   c:  28 69 68 38 ldrbw8, [x9, x8] // load shadow tag
+  10:  09 fc 78 d3 lsr x9, x0, #56  // extract address tag
+  14:  3f 01 08 6b cmp w9, w8   // compare tags
+  18:  61 00 00 54 b.ne24   // jump on mismatch
+  1c:  00 00 40 b9 ldr w0, [x0] // original load
+  20:  c0 03 5f d6 ret
+  24:  40 20 21 d4 brk #0x902   // trap
 
 Alternatively, memory accesses are prefixed with a function call.
 


Index: docs/HardwareAssistedAddressSanitizerDesign.rst
===
--- docs/HardwareAssistedAddressSanitizerDesign.rst
+++ docs/HardwareAssistedAddressSanitizerDesign.rst
@@ -52,15 +52,16 @@
   // int foo(int *a) { return *a; }
   // clang -O2 --target=aarch64-linux -fsanitize=hwaddress -c load.c
   foo:
-   0:	08 dc 44 d3 	ubfx	x8, x0, #4, #52  // shadow address
-   4:	08 01 40 39 	ldrb	w8, [x8] // load shadow
-   8:	09 fc 78 d3 	lsr	x9, x0, #56  // address tag
-   c:	3f 01 08 6b 	cmp	w9, w8   // compare tags
-  10:	61 00 00 54 	b.ne	#12  // jump on mismatch
-  14:	00 00 40 b9 	ldr	w0, [x0] // original load
-  18:	c0 03 5f d6 	ret
-  1c:	40 20 21 d4 	brk	#0x902   // trap
-
+   0:	08 00 00 90 	adrp	x8, 0 <__hwasan_shadow>
+   4:	08 01 40 f9 	ldr	x8, [x8] // shadow base (to be resolved by the loader)
+   8:	09 dc 44 d3 	ubfx	x9, x0, #4, #52  // shadow offset
+   c:	28 69 68 38 	ldrb	w8, [x9, x8] // load shadow tag
+  10:	09 fc 78 d3 	lsr	x9, x0, #56  // extract address tag
+  14:	3f 01 08 6b 	cmp	w9, w8   // compare tags
+  18:	61 00 00 54 	b.ne	24   // jump on mismatch
+  1c:	00 00 40 b9 	ldr	w0, [x0] // original load
+  20:	c0 03 5f d6 	ret
+  24:	40 20 21 d4 	brk	#0x902   // trap
 
 Alternatively, memory accesses are prefixed with a function call.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via cfe-commits
On Mon, Apr 23, 2018 at 4:12 PM John McCall  wrote:

> On Mon, Apr 23, 2018 at 6:32 PM, David Blaikie  wrote:
>
>> On Mon, Apr 23, 2018 at 3:29 PM John McCall via Phabricator <
>> revi...@reviews.llvm.org> wrote:
>>
>>> rjmccall added a comment.
>>>
>>> In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:
>>>
>>> > Is there anything else in the "-w" namespace other than the literal
>>> "-w" so
>>> >  far?
>>>
>>>
>>> No. This would be novel.
>>>
>>
>> Ah, I see.
>>
>>
>>> > I mean, I could imagine it might make more sense to default these
>>> warnings
>>> >  off & users can turn them on for non-test code, potentially? So
>>> >  "-Wnon-test" might make sense.
>>>
>>> That's an interesting idea, but it's still not a warning group, because
>>> you shouldn't get the self-assign warnings unless `-Wself-assign` is
>>> enabled.
>>>
>>
>> You shouldn't?
>>
>
> I wouldn't think so.  Remember that the goal of the option is to be a
> single thing that users can add to their unit-test CFLAGS to disable these
> noisy-in-tests cases.  So if we add an opt-in/experimental
> `-Wunpredictable-foozits` warning, and it has a unit-test carve-out,
> passing `-wtest -wno-test` or whatever shouldn't turn on the carved-out
> special case of `-Wunpredictable-foozits`.
>
> It's probably not the worst thing to just use a `-W` spelling anyway; not
> everything in that namespace is (e.g. `-Werror`).  It could be
> `-Wnoisy-in-tests` and `-Wno-noisy-in-tests`, with a documentation note
> that `-Wnoisy-in-tests` is just a cancellation of `-Wno-noisy-in-tests` and
> doesn't actually enable any warnings by itself.  We could have the
> diagnostic printer add `-Wnoisy-in-tests` to the diagnostic-group
> annotation for diagnostics that would be suppressed under
> `-Wno-noisy-in-tests`, analogously to how it adds `-Werror` for diagnostics
> that have been promoted to an error.
>

That sort of sounds pretty plausible to me. Poked Richard about his opinion
here too.


>
> John.
>
>
>> But yeah, it's tricky either way - either you get them all, then opt out
>> of all the warnings for test code you don't generally want.
>>
>> I'll leave it to you, then - don't feel too strongly. Maybe worth seeing
>> if Richard has an opinion, but up to you.
>>
>> - Dave
>>
>>
>>>
>>>
>>> Repository:
>>>   rL LLVM
>>>
>>> https://reviews.llvm.org/D45766
>>>
>>>
>>>
>>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread John McCall via cfe-commits
On Mon, Apr 23, 2018 at 6:32 PM, David Blaikie  wrote:

> On Mon, Apr 23, 2018 at 3:29 PM John McCall via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> rjmccall added a comment.
>>
>> In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:
>>
>> > Is there anything else in the "-w" namespace other than the literal
>> "-w" so
>> >  far?
>>
>>
>> No. This would be novel.
>>
>
> Ah, I see.
>
>
>> > I mean, I could imagine it might make more sense to default these
>> warnings
>> >  off & users can turn them on for non-test code, potentially? So
>> >  "-Wnon-test" might make sense.
>>
>> That's an interesting idea, but it's still not a warning group, because
>> you shouldn't get the self-assign warnings unless `-Wself-assign` is
>> enabled.
>>
>
> You shouldn't?
>

I wouldn't think so.  Remember that the goal of the option is to be a
single thing that users can add to their unit-test CFLAGS to disable these
noisy-in-tests cases.  So if we add an opt-in/experimental
`-Wunpredictable-foozits` warning, and it has a unit-test carve-out,
passing `-wtest -wno-test` or whatever shouldn't turn on the carved-out
special case of `-Wunpredictable-foozits`.

It's probably not the worst thing to just use a `-W` spelling anyway; not
everything in that namespace is (e.g. `-Werror`).  It could be
`-Wnoisy-in-tests` and `-Wno-noisy-in-tests`, with a documentation note
that `-Wnoisy-in-tests` is just a cancellation of `-Wno-noisy-in-tests` and
doesn't actually enable any warnings by itself.  We could have the
diagnostic printer add `-Wnoisy-in-tests` to the diagnostic-group
annotation for diagnostics that would be suppressed under
`-Wno-noisy-in-tests`, analogously to how it adds `-Werror` for diagnostics
that have been promoted to an error.

John.


> But yeah, it's tricky either way - either you get them all, then opt out
> of all the warnings for test code you don't generally want.
>
> I'll leave it to you, then - don't feel too strongly. Maybe worth seeing
> if Richard has an opinion, but up to you.
>
> - Dave
>
>
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D45766
>>
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45456: [Attr] Print enum attributes at correct position

2018-04-23 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

Ping.

In case it's not clear: this patch doesn't depend on other patches, but others 
depend on it.


https://reviews.llvm.org/D45456



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45093: [AST] Fix -ast-print for _Bool when have diagnostics

2018-04-23 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny updated this revision to Diff 143667.
jdenny added a comment.

Rebased.


https://reviews.llvm.org/D45093

Files:
  include/clang/AST/ASTContext.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseDecl.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  test/Misc/ast-print-bool.c

Index: test/Misc/ast-print-bool.c
===
--- /dev/null
+++ test/Misc/ast-print-bool.c
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL
+//
+// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_CBOOL -DDIAG \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-CBOOL,CBOOL
+//
+// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL
+//
+// RUN: %clang_cc1 -verify -ast-print %s -xc -DDEF_BOOL_INT -DDIAG \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-INT,CBOOL
+//
+// RUN: %clang_cc1 -verify -ast-print %s -xc++ \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL
+//
+// RUN: %clang_cc1 -verify -ast-print %s -xc++ -DDIAG \
+// RUN: | FileCheck %s --check-prefixes=BOOL-AS-BOOL
+
+#if DEF_BOOL_CBOOL
+# define bool _Bool
+#elif DEF_BOOL_INT
+# define bool int
+#endif
+
+// BOOL-AS-CBOOL: _Bool i;
+// BOOL-AS-INT:   int i;
+// BOOL-AS-BOOL:  bool i;
+bool i;
+
+#ifndef __cplusplus
+// CBOOL: _Bool j;
+_Bool j;
+#endif
+
+// Induce a diagnostic (and verify we actually managed to do so), which used to
+// permanently alter the -ast-print printing policy for _Bool.  How bool is
+// defined by the preprocessor is examined only once per compilation, when the
+// diagnostic is emitted, and it used to affect the entirety of -ast-print, so
+// test only one definition of bool per compilation.
+#if DIAG
+void fn() { 1; } // expected-warning {{expression result unused}}
+#else
+// expected-no-diagnostics
+#endif
Index: lib/Sema/SemaTemplateInstantiate.cpp
===
--- lib/Sema/SemaTemplateInstantiate.cpp
+++ lib/Sema/SemaTemplateInstantiate.cpp
@@ -505,7 +505,7 @@
   llvm::raw_svector_ostream OS(TemplateArgsStr);
   Template->printName(OS);
   printTemplateArgumentList(OS, Active->template_arguments(),
-getPrintingPolicy());
+getDiagPrintingPolicy());
   Diags.Report(Active->PointOfInstantiation,
diag::note_default_arg_instantiation_here)
 << OS.str()
@@ -571,7 +571,7 @@
   llvm::raw_svector_ostream OS(TemplateArgsStr);
   FD->printName(OS);
   printTemplateArgumentList(OS, Active->template_arguments(),
-getPrintingPolicy());
+getDiagPrintingPolicy());
   Diags.Report(Active->PointOfInstantiation,
diag::note_default_function_arg_instantiation_here)
 << OS.str()
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -3012,7 +3012,7 @@
   std::string Description;
   {
 llvm::raw_string_ostream Out(Description);
-FailedCond->printPretty(Out, nullptr, getPrintingPolicy());
+FailedCond->printPretty(Out, nullptr, getDiagPrintingPolicy());
   }
   return { FailedCond, Description };
 }
@@ -9821,7 +9821,7 @@
 }
 
 Out << " = ";
-Args[I].print(getPrintingPolicy(), Out);
+Args[I].print(getDiagPrintingPolicy(), Out);
   }
 
   Out << ']';
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -5553,7 +5553,7 @@
 // conversion; use it.
 QualType ConvTy = Conversion->getConversionType().getNonReferenceType();
 std::string TypeStr;
-ConvTy.getAsStringInternal(TypeStr, SemaRef.getPrintingPolicy());
+ConvTy.getAsStringInternal(TypeStr, SemaRef.getDiagPrintingPolicy());
 
 Converter.diagnoseExplicitConv(SemaRef, Loc, T, ConvTy)
 << FixItHint::CreateInsertion(From->getLocStart(),
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -4202,7 +4202,7 @@
   std::string NewQualified = TC.getAsString(SemaRef.getLangOpts());
   std::string OldQualified;
   llvm::raw_string_ostream OldOStream(OldQualified);
-  SS->getScopeRep()->print(OldOStream, SemaRef.getPrintingPolicy());
+  SS->getScopeRep()->print(OldOStream, SemaRef.getDiagPrintingPolicy());
   OldOStream << Typo->getName();
   /

[PATCH] D34331: func.wrap.func.con: Unset function before destroying anything

2018-04-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.
Herald added a subscriber: jkorous.

Ping.


https://reviews.llvm.org/D34331



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via cfe-commits
On Mon, Apr 23, 2018 at 3:29 PM John McCall via Phabricator <
revi...@reviews.llvm.org> wrote:

> rjmccall added a comment.
>
> In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:
>
> > Is there anything else in the "-w" namespace other than the literal "-w"
> so
> >  far?
>
>
> No. This would be novel.
>

Ah, I see.


> > I mean, I could imagine it might make more sense to default these
> warnings
> >  off & users can turn them on for non-test code, potentially? So
> >  "-Wnon-test" might make sense.
>
> That's an interesting idea, but it's still not a warning group, because
> you shouldn't get the self-assign warnings unless `-Wself-assign` is
> enabled.
>

You shouldn't? But yeah, it's tricky either way - either you get them all,
then opt out of all the warnings for test code you don't generally want.

I'll leave it to you, then - don't feel too strongly. Maybe worth seeing if
Richard has an opinion, but up to you.

- Dave


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45766
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45470: Emit an error when mixing and

2018-04-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.
Herald added a subscriber: jkorous.

Ping.


https://reviews.llvm.org/D45470



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D45766#1076176, @dblaikie wrote:

> Is there anything else in the "-w" namespace other than the literal "-w" so
>  far?


No. This would be novel.

> I mean, I could imagine it might make more sense to default these warnings
>  off & users can turn them on for non-test code, potentially? So
>  "-Wnon-test" might make sense.

That's an interesting idea, but it's still not a warning group, because you 
shouldn't get the self-assign warnings unless `-Wself-assign` is enabled.


Repository:
  rL LLVM

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via cfe-commits
Is there anything else in the "-w" namespace other than the literal "-w" so
far?

I mean, I could imagine it might make more sense to default these warnings
off & users can turn them on for non-test code, potentially? So
"-Wnon-test" might make sense.

On Mon, Apr 23, 2018 at 3:22 PM John McCall via Phabricator <
revi...@reviews.llvm.org> wrote:

> rjmccall added a comment.
>
> In https://reviews.llvm.org/D45766#1076090, @dblaikie wrote:
>
> > FWIW I don't fundamentalyl object to also having something like -wtest.
> >  Probably needs a better name though (unfortunately the double-negative
> gets
> >  confusing... - like you want to describe the set of diagnostics that
> should
> >  not be used in test code, so that as a group might be "-Wnon-test" but
> then
> >  "-Wno-non-test" is pretty awkward) - probably worth chatting to Richard
> >  Smith about that, I reckon.
>
>
> That's why I was suggesting putting it in the `-w` namespace.  We really
> wouldn't expect or want users to ever use a *positive* version of this
> warning option — specifically asking for just the warnings that are known
> to be problematic for test code, across all warnings.  It's just not really
> a warning group.
>
> It could also be something like `-fsuppress-problematic-test-warnings`, of
> course, but I was basically thinking of `-w` as meaning
> `-fsuppress-problematic-*-warnings`.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45766
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Is there anything else in the "-w" namespace other than the literal "-w" so
far?

I mean, I could imagine it might make more sense to default these warnings
off & users can turn them on for non-test code, potentially? So
"-Wnon-test" might make sense.


Repository:
  rL LLVM

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44609: [Clang-Format] New option BreakBeforeLambdaBody to manage lambda line break inside function parameter call

2018-04-23 Thread Francois JEAN via Phabricator via cfe-commits
Wawha added a comment.

  Hi djasper,

Here a project where there is lambda and allman style for them : 
https://github.com/boostorg/hof/blob/develop/example/in.cpp
https://github.com/boostorg/hof/blob/develop/example/sequence.cpp

Example of code:

  // Function to find an iterator using a containers built-in find if available
  BOOST_HOF_STATIC_LAMBDA_FUNCTION(find_iterator) = first_of(
  [](const std::string& s, const auto& x)
  {
  auto index = s.find(x);
  if (index == std::string::npos) return s.end();
  else return s.begin() + index;
  },
  #ifdef _MSC_VER
  // On MSVC, trailing decltype doesn't work with generic lambdas, so a
  // seperate function can be used instead.
  BOOST_HOF_LIFT(member_find),
  #else
  [](const auto& r, const auto& x) BOOST_HOF_RETURNS(r.find(x)),
  #endif
  [](const auto& r, const auto& x)
  {
  using std::begin;
  using std::end;
  return std::find(begin(r), end(r), x);
  }
  );

What could be the next to move forward on this topic?
Do you think that some modification should be make on this patch? Change option 
name? Make it default behavior for allman?


Repository:
  rC Clang

https://reviews.llvm.org/D44609



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330657 - [X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

2018-04-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Apr 23 15:18:34 2018
New Revision: 330657

URL: http://llvm.org/viewvc/llvm-project?rev=330657&view=rev
Log:
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to 
BuiltinsX86_64.def to make them unavailable in 32-bit mode.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=330657&r1=330656&r2=330657&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Apr 23 15:18:34 2018
@@ -319,7 +319,6 @@ TARGET_BUILTIN(__builtin_ia32_maskmovdqu
 TARGET_BUILTIN(__builtin_ia32_movmskpd, "iV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_pmovmskb128, "iV16c", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_movnti, "vi*i", "", "sse2")
-TARGET_BUILTIN(__builtin_ia32_movnti64, "vLLi*LLi", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_psadbw128, "V2LLiV16cV16c", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_sqrtpd, "V2dV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_sqrtsd, "V2dV2d", "", "sse2")
@@ -643,7 +642,6 @@ TARGET_BUILTIN(__builtin_ia32_vcvtph2ps2
 // RDRAND
 TARGET_BUILTIN(__builtin_ia32_rdrand16_step, "UiUs*", "", "rdrnd")
 TARGET_BUILTIN(__builtin_ia32_rdrand32_step, "UiUi*", "", "rdrnd")
-TARGET_BUILTIN(__builtin_ia32_rdrand64_step, "UiULLi*", "", "rdrnd")
 
 // FSGSBASE
 TARGET_BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "", "fsgsbase")

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86_64.def?rev=330657&r1=330656&r2=330657&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86_64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86_64.def Mon Apr 23 15:18:34 2018
@@ -48,6 +48,7 @@ TARGET_BUILTIN(__builtin_ia32_cvtss2si64
 TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse")
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvttsd2si64, "LLiV2d", "", "sse2")
+TARGET_BUILTIN(__builtin_ia32_movnti64, "vLLi*LLi", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "", "sse4.2")
 TARGET_BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "", "fsgsbase")
@@ -68,6 +69,7 @@ TARGET_BUILTIN(__builtin_ia32_wrussq, "v
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarry_u64, "UcUcULLiULLiULLi*", "", "")
 TARGET_BUILTIN(__builtin_ia32_subborrow_u64, "UcUcULLiULLiULLi*", "", "")
+TARGET_BUILTIN(__builtin_ia32_rdrand64_step, "UiULLi*", "", "rdrnd")
 TARGET_BUILTIN(__builtin_ia32_rdseed64_step, "UiULLi*", "", "rdseed")
 TARGET_BUILTIN(__builtin_ia32_bextr_u64, "ULLiULLiULLi", "", "bmi")
 TARGET_BUILTIN(__builtin_ia32_bzhi_di, "ULLiULLiULLi", "", "bmi2")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330658 - [X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

2018-04-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Apr 23 15:18:36 2018
New Revision: 330658

URL: http://llvm.org/viewvc/llvm-project?rev=330658&view=rev
Log:
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to 
BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only 
available in 64-bit mode.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=330658&r1=330657&r2=330658&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Apr 23 15:18:36 2018
@@ -643,12 +643,6 @@ TARGET_BUILTIN(__builtin_ia32_vcvtph2ps2
 TARGET_BUILTIN(__builtin_ia32_rdrand16_step, "UiUs*", "", "rdrnd")
 TARGET_BUILTIN(__builtin_ia32_rdrand32_step, "UiUi*", "", "rdrnd")
 
-// FSGSBASE
-TARGET_BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "", "fsgsbase")
-
 // FXSR
 TARGET_BUILTIN(__builtin_ia32_fxrstor, "vv*", "", "fxsr")
 TARGET_BUILTIN(__builtin_ia32_fxsave, "vv*", "", "fxsr")

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86_64.def?rev=330658&r1=330657&r2=330658&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86_64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86_64.def Mon Apr 23 15:18:36 2018
@@ -50,9 +50,13 @@ TARGET_BUILTIN(__builtin_ia32_cvtsd2si64
 TARGET_BUILTIN(__builtin_ia32_cvttsd2si64, "LLiV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_movnti64, "vLLi*LLi", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "", "sse4.2")
+TARGET_BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "", "fsgsbase")
+TARGET_BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "", "fsgsbase")
+TARGET_BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "", "fsgsbase")
+TARGET_BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_fxrstor64, "vv*", "", "fxsr")
 TARGET_BUILTIN(__builtin_ia32_fxsave64, "vv*", "", "fxsr")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D45766#1076090, @dblaikie wrote:

> FWIW I don't fundamentalyl object to also having something like -wtest.
>  Probably needs a better name though (unfortunately the double-negative gets
>  confusing... - like you want to describe the set of diagnostics that should
>  not be used in test code, so that as a group might be "-Wnon-test" but then
>  "-Wno-non-test" is pretty awkward) - probably worth chatting to Richard
>  Smith about that, I reckon.


That's why I was suggesting putting it in the `-w` namespace.  We really 
wouldn't expect or want users to ever use a *positive* version of this warning 
option — specifically asking for just the warnings that are known to be 
problematic for test code, across all warnings.  It's just not really a warning 
group.

It could also be something like `-fsuppress-problematic-test-warnings`, of 
course, but I was basically thinking of `-w` as meaning 
`-fsuppress-problematic-*-warnings`.


Repository:
  rL LLVM

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGCall.cpp:3069
+  if (hasAggregateEvaluationKind(type) &&
+  getContext().isParamDestroyedInCallee(type)) {
+EHScopeStack::stable_iterator cleanup =

ahatanak wrote:
> rjmccall wrote:
> > I wonder if this is something we should be taking from the CGFunctionInfo 
> > instead.  It does seem plausible that it could vary, e.g. according to the 
> > calling convention.  But maybe that's something we can handle in a separate 
> > patch?
> I assume you are talking about the call to isParamDestroyedInCallee? If so, 
> yes, I think we can discuss it in a separate patch. I have plans to clean up 
> the way ParamDestroyedInCallee is handled in Sema and IRGen.
> I assume you are talking about the call to isParamDestroyedInCallee?

Yeah.

> I assume you are talking about the call to isParamDestroyedInCallee? If so, 
> yes, I think we can discuss it in a separate patch. 

Okay, great, thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D45382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330656 - [AST] strcmp/memcmp always compares unsigned chars.

2018-04-23 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Mon Apr 23 15:04:34 2018
New Revision: 330656

URL: http://llvm.org/viewvc/llvm-project?rev=330656&view=rev
Log:
[AST] strcmp/memcmp always compares unsigned chars.

This makes it return the right result in a couple of edge cases. The
wide versions always do the comparison on the underlying wchar_t type.

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/constexpr-string.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=330656&r1=330655&r2=330656&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Apr 23 15:04:34 2018
@@ -8046,14 +8046,24 @@ bool IntExprEvaluator::VisitBuiltinCallE
BuiltinOp != Builtin::BIwmemcmp &&
BuiltinOp != Builtin::BI__builtin_memcmp &&
BuiltinOp != Builtin::BI__builtin_wmemcmp);
+bool IsWide = BuiltinOp == Builtin::BIwcscmp ||
+  BuiltinOp == Builtin::BIwcsncmp ||
+  BuiltinOp == Builtin::BIwmemcmp ||
+  BuiltinOp == Builtin::BI__builtin_wcscmp ||
+  BuiltinOp == Builtin::BI__builtin_wcsncmp ||
+  BuiltinOp == Builtin::BI__builtin_wmemcmp;
 for (; MaxLength; --MaxLength) {
   APValue Char1, Char2;
   if (!handleLValueToRValueConversion(Info, E, CharTy, String1, Char1) ||
   !handleLValueToRValueConversion(Info, E, CharTy, String2, Char2) ||
   !Char1.isInt() || !Char2.isInt())
 return false;
-  if (Char1.getInt() != Char2.getInt())
-return Success(Char1.getInt() < Char2.getInt() ? -1 : 1, E);
+  if (Char1.getInt() != Char2.getInt()) {
+if (IsWide) // wmemcmp compares with wchar_t signedness.
+  return Success(Char1.getInt() < Char2.getInt() ? -1 : 1, E);
+// memcmp always compares unsigned chars.
+return Success(Char1.getInt().ult(Char2.getInt()) ? -1 : 1, E);
+  }
   if (StopAtNull && !Char1.getInt())
 return Success(0, E);
   assert(!(StopAtNull && !Char2.getInt()));

Modified: cfe/trunk/test/SemaCXX/constexpr-string.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-string.cpp?rev=330656&r1=330655&r2=330656&view=diff
==
--- cfe/trunk/test/SemaCXX/constexpr-string.cpp (original)
+++ cfe/trunk/test/SemaCXX/constexpr-string.cpp Mon Apr 23 15:04:34 2018
@@ -53,6 +53,8 @@ namespace StrcmpEtc {
   static_assert(__builtin_strcmp("abab", "abaa") == 1);
   static_assert(__builtin_strcmp("ababa", "abab") == 1);
   static_assert(__builtin_strcmp("abab", "ababa") == -1);
+  static_assert(__builtin_strcmp("a\203", "a") == 1);
+  static_assert(__builtin_strcmp("a\203", "a\003") == 1);
   static_assert(__builtin_strcmp("abab\0banana", "abab") == 0);
   static_assert(__builtin_strcmp("abab", "abab\0banana") == 0);
   static_assert(__builtin_strcmp("abab\0banana", "abab\0canada") == 0);
@@ -78,6 +80,8 @@ namespace StrcmpEtc {
 
   static_assert(__builtin_memcmp("abaa", "abba", 3) == -1);
   static_assert(__builtin_memcmp("abaa", "abba", 2) == 0);
+  static_assert(__builtin_memcmp("a\203", "a", 2) == 1);
+  static_assert(__builtin_memcmp("a\203", "a\003", 2) == 1);
   static_assert(__builtin_memcmp(0, 0, 0) == 0);
   static_assert(__builtin_memcmp("abab\0banana", "abab\0banana", 100) == 0); 
// expected-error {{not an integral constant}} expected-note {{dereferenced 
one-past-the-end}}
   static_assert(__builtin_memcmp("abab\0banana", "abab\0canada", 100) == -1); 
// FIXME: Should we reject this?
@@ -102,6 +106,9 @@ namespace WcscmpEtc {
   static_assert(__builtin_wcscmp(L"abab\0banana", L"abab") == 0);
   static_assert(__builtin_wcscmp(L"abab", L"abab\0banana") == 0);
   static_assert(__builtin_wcscmp(L"abab\0banana", L"abab\0canada") == 0);
+#if __WCHAR_WIDTH__ == 32
+  static_assert(__builtin_wcscmp(L"a\x83838383", L"a") == -1);
+#endif
   static_assert(__builtin_wcscmp(0, L"abab") == 0); // expected-error {{not an 
integral constant}} expected-note {{dereferenced null}}
   static_assert(__builtin_wcscmp(L"abab", 0) == 0); // expected-error {{not an 
integral constant}} expected-note {{dereferenced null}}
 
@@ -116,6 +123,9 @@ namespace WcscmpEtc {
   static_assert(__builtin_wcsncmp(L"abaa", L"abba", 0) == 0);
   static_assert(__builtin_wcsncmp(0, 0, 0) == 0);
   static_assert(__builtin_wcsncmp(L"abab\0banana", L"abab\0canada", 100) == 0);
+#if __WCHAR_WIDTH__ == 32
+  static_assert(__builtin_wcsncmp(L"a\x83838383", L"aa", 2) == -1);
+#endif
 
   static_assert(__builtin_wcsncmp(kFoobar, kFoobazfoobar, 6) == -1);
   static_assert(__builtin_wcsncmp(kFoobar, kFoobazfoobar, 7) == -1); // FIXME: 
Should we reject this?
@@ -125,6 +135,9 @@ namespace WcscmpEtc {
   static_assert(__builtin_wmemc

[libcxx] r330655 - Re-commit r330627 "[libcxx] implement declarations based on P0214R7."

2018-04-23 Thread Tim Shen via cfe-commits
Author: timshen
Date: Mon Apr 23 14:54:06 2018
New Revision: 330655

URL: http://llvm.org/viewvc/llvm-project?rev=330655&view=rev
Log:
Re-commit r330627 "[libcxx] implement  declarations based on 
P0214R7."

There are 3 changes:
* Renamed genertor.pass.cpp to generator.pass.cpp
* Removed nothing_to_do.pass.cpp
* Mark GCC 4.9 as UNSUPPORTED for the test files that have negative
  narrowing conversion SFINAE test (see GCC PR63723).

Added:
libcxx/trunk/include/experimental/simd
libcxx/trunk/test/std/experimental/simd/
libcxx/trunk/test/std/experimental/simd/simd.casts/
libcxx/trunk/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.cons/
libcxx/trunk/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.cons/generator.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/
libcxx/trunk/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd.pass.cpp

libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
Modified:
libcxx/trunk/include/experimental/__config
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp

Modified: libcxx/trunk/include/experimental/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/__config?rev=330655&r1=330654&r2=330655&view=diff
==
--- libcxx/trunk/include/experimental/__config (original)
+++ libcxx/trunk/include/experimental/__config Mon Apr 23 14:54:06 2018
@@ -54,4 +54,16 @@
 
 #define _VSTD_FS ::std::experimental::filesystem::v1
 
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD \
+} _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD namespace simd_abi {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
+} _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
+
 #endif

Added: libcxx/trunk/include/experimental/simd
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/simd?rev=330655&view=auto
==
--- libcxx/trunk/include/experimental/simd (added)
+++ libcxx/trunk/include/experimental/simd Mon Apr 23 14:54:06 2018
@@ -0,0 +1,1285 @@
+// -*- C++ -*-
+//===--- simd 
-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef _LIBCPP_EXPERIMENTAL_SIMD
+#define _LIBCPP_EXPERIMENTAL_SIMD
+
+/*
+experimental/simd synopsis
+
+namespace std::experimental {
+
+inline namespace parallelism_v2 {
+
+namespace simd_abi {
+
+struct scalar {};
+template  struct fixed_size {};
+template  inline constexpr int max_fixed_size = 
implementation-defined;
+template  using compatible = implementation-defined;
+template  using native = implementation-defined;
+
+} // simd_abi
+
+struct element_aligned_tag {};
+struct vector_aligned_tag {};
+template  struct overaligned_tag {};
+inline constexpr element_aligned_tag element_aligned{};
+inline constexpr vector_aligned_tag vector_aligned{};
+template  inline constexpr overaligned_tag overaligned{};
+
+// traits [simd.traits]
+template  struct is_abi_tag;
+template  inline constexpr bool is_abi_tag_v = is_abi_tag::value;
+
+template  struct is_simd;
+template  inline constexpr bool is_simd_v = is_simd::value;
+
+template  struct is_simd_mask;
+template  inline constexpr bool is_simd_mask_v = 
is_simd_mask::value;
+
+template  struct is_simd_flag_type;
+template  inline constexpr bool is_simd_flag_type_v = 
is_simd_flag_type::value;
+
+template  struct abi_for_size { using type = see below; };
+template  using abi_for_size_t = typename abi_for_size::type;
+
+template > struct simd_size;
+template >
+inline constexpr size_t simd_size_v = simd_size::value;
+
+template  struct memory_alignment;
+template 
+inline constexpr size_t memory_alignment_v = memory_alignment::value;
+
+// class template simd [simd.class]
+template > class simd;
+template  using native_simd = simd>;
+template  using fixed_size_simd = simd>;
+
+// class template simd_mask [simd.mask.class]
+template > class simd_mask;
+template  using native_simd_mask = simd_mask>;
+t

[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: lib/Headers/movdirintrin.h:39
+// Move quadword as direct store
+static __inline__ void
+__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))

Sorry, the X86_64 preprocessor check should have stayed. That can't be changed 
by a target attribute.


https://reviews.llvm.org/D45984



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45839: [analyzer] Add support for WebKit "unified sources".

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: 
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h:144
+// includes the full path.
+if (SM.getFilename(IL).contains("UnifiedSource")) {
+  StringRef Name = SM.getFilename(SL);

NoQ wrote:
> probinson wrote:
> > george.karpenkov wrote:
> > > NoQ wrote:
> > > > george.karpenkov wrote:
> > > > > Is this `if` really necessary? This logic has too much overfitting, 
> > > > > and it seems that if someone decides to include `.cc` files, we 
> > > > > should analyze them in any case, right? We also would prefer to not 
> > > > > stop working if webkit decides on using a different naming for those.
> > > > This is indeed an act of overfitting. But also there are very few 
> > > > reasons to include a non-header file, and all of them are pretty 
> > > > exotic. I'm not sure we want to analyze these files in all cases. So i 
> > > > want to play safe until we gather more data.
> > > I would still say that just analyzing included c++ files is a lesser evil.
> > Agreed.  WebKit is not the only project that does this kind of thing.
> The question is, are all such projects in fact interested in having the 
> analyzer analyze the respective code?
> 
> For instance, if the included code is autogenerated by an external tool, 
> users are probably not interested in finding bugs in such code because they 
> will be unable to fix them.
> 
> Are you interested in providing a list of examples of projects that do this 
> kind of thing, explain why are they doing it, and whether they will be 
> interested in having warnings in included files?
Note that we're not talking about warnings that are *emitted* in the included 
file. We're talking about warnings that *originate* within the included file 
(and as such most likely stay within the included file and its includes). This 
makes a difference because we are doing inter-procedural analysis. I.e., if we 
find that passing a null pointer in the main file into a header function causes 
a null dereference in the header function, the report that originates within 
the main file will be emitted in the header with auxiliary path notes in the 
main file.

So if a small chunk of code is included but the main file still contains 
reasonable stuff, we'll be able to find most bugs in the included code as it is 
being used from the rest of the file. The problem only arises when all code is 
included.


https://reviews.llvm.org/D45839



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

x.




Comment at: lib/CodeGen/CGCall.cpp:3069
+  if (hasAggregateEvaluationKind(type) &&
+  getContext().isParamDestroyedInCallee(type)) {
+EHScopeStack::stable_iterator cleanup =

rjmccall wrote:
> I wonder if this is something we should be taking from the CGFunctionInfo 
> instead.  It does seem plausible that it could vary, e.g. according to the 
> calling convention.  But maybe that's something we can handle in a separate 
> patch?
I assume you are talking about the call to isParamDestroyedInCallee? If so, 
yes, I think we can discuss it in a separate patch. I have plans to clean up 
the way ParamDestroyedInCallee is handled in Sema and IRGen.


Repository:
  rC Clang

https://reviews.llvm.org/D45382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330654 - [Docs] Regenerate command line documentation.

2018-04-23 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Apr 23 14:41:06 2018
New Revision: 330654

URL: http://llvm.org/viewvc/llvm-project?rev=330654&view=rev
Log:
[Docs] Regenerate command line documentation.

Modified:
cfe/trunk/docs/ClangCommandLineReference.rst

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=330654&r1=330653&r2=330654&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Mon Apr 23 14:41:06 2018
@@ -36,10 +36,18 @@ Treat source input files as Objective-C
 
 Treat source input files as Objective-C++ inputs
 
+.. option:: -Qn
+
+Do not emit metadata containing compiler name and version
+
 .. option:: -Qunused-arguments
 
 Don't emit warning for unused driver arguments
 
+.. option:: -Qy
+
+Emit metadata containing compiler name and version
+
 .. option:: -Wa,,...
 
 Pass the comma separated arguments in  to the assembler
@@ -202,6 +210,10 @@ Use approximate transcendental functions
 
 Flush denormal floating point values to zero in CUDA device mode.
 
+.. option:: -fcuda-rdc, -fno-cuda-rdc
+
+Generate relocatable device code, also known as separate compilation mode.
+
 .. option:: -ffixed-r19
 
 Reserve the r19 register (Hexagon only)
@@ -2540,6 +2552,8 @@ X86
 
 .. option:: -mvpclmulqdq, -mno-vpclmulqdq
 
+.. option:: -mwaitpkg, -mno-waitpkg
+
 .. option:: -mwbnoinvd, -mno-wbnoinvd
 
 .. option:: -mx87, -m80387, -mno-x87


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a subscriber: lebedev.ri.
dblaikie added a comment.

FWIW I don't fundamentalyl object to also having something like -wtest.
Probably needs a better name though (unfortunately the double-negative gets
confusing... - like you want to describe the set of diagnostics that should
not be used in test code, so that as a group might be "-Wnon-test" but then
"-Wno-non-test" is pretty awkward) - probably worth chatting to Richard
Smith about that, I reckon.


Repository:
  rL LLVM

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45685: [Sema] Add -wtest global flag that silences -Wself-assign for overloaded operators.

2018-04-23 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

@brooksmoses The simple `-Wno-self-assign-overloaded` variant 
(https://reviews.llvm.org/D45766) has landed, so the issue should be resolved?

Not sure what to do with this differential, should i abandon it until there is 
more interest for such functionality?


Repository:
  rC Clang

https://reviews.llvm.org/D45685



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via cfe-commits
FWIW I don't fundamentalyl object to also having something like -wtest.
Probably needs a better name though (unfortunately the double-negative gets
confusing... - like you want to describe the set of diagnostics that should
not be used in test code, so that as a group might be "-Wnon-test" but then
"-Wno-non-test" is pretty awkward) - probably worth chatting to Richard
Smith about that, I reckon.

On Mon, Apr 23, 2018 at 2:39 PM Roman Lebedev via Phabricator <
revi...@reviews.llvm.org> wrote:

> lebedev.ri added inline comments.
>
>
> 
> Comment at: lib/Sema/SemaExpr.cpp:11527-11528
>
> -  S.Diag(OpLoc, diag::warn_self_assignment)
> -  << LHSDeclRef->getType()
> -  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
> +  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
> +  : diag::warn_self_assignment_overloaded)
> +  << LHSDeclRef->getType() << LHSExpr->getSourceRange()
> 
> dblaikie wrote:
> > lebedev.ri wrote:
> > > dblaikie wrote:
> > > > Presumably this also changes how the warning is enabled? But that
> doesn't seem to be tested in this patch?
> > > What testing do you have in mind?
> > > The `test/SemaCXX/warn-self-assign-overloaded.cpp` change was supposed
> to show how it is enabled..
> > ah, misread those - figured they were testing the negative case (given
> the name of this patch) but I see they're testing the positive case.
> >
> > Maybe testing the negative case would be useful too?
> Added & committed.
> Thank you for the review!
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45766
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:11527-11528
 
-  S.Diag(OpLoc, diag::warn_self_assignment)
-  << LHSDeclRef->getType()
-  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
+  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
+  : diag::warn_self_assignment_overloaded)
+  << LHSDeclRef->getType() << LHSExpr->getSourceRange()

dblaikie wrote:
> lebedev.ri wrote:
> > dblaikie wrote:
> > > Presumably this also changes how the warning is enabled? But that doesn't 
> > > seem to be tested in this patch?
> > What testing do you have in mind?
> > The `test/SemaCXX/warn-self-assign-overloaded.cpp` change was supposed to 
> > show how it is enabled..
> ah, misread those - figured they were testing the negative case (given the 
> name of this patch) but I see they're testing the positive case.
> 
> Maybe testing the negative case would be useful too?
Added & committed.
Thank you for the review!


Repository:
  rL LLVM

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330651: [Sema] Add -Wno-self-assign-overloaded (authored by 
lebedevri, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45766?vs=143645&id=143649#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45766

Files:
  cfe/trunk/docs/ReleaseNotes.rst
  cfe/trunk/include/clang/Basic/DiagnosticGroups.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/SemaCXX/warn-self-assign-overloaded-disable.cpp
  cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp

Index: cfe/trunk/docs/ReleaseNotes.rst
===
--- cfe/trunk/docs/ReleaseNotes.rst
+++ cfe/trunk/docs/ReleaseNotes.rst
@@ -62,8 +62,9 @@
 - ``-Wself-assign`` and ``-Wself-assign-field`` were extended to diagnose
   self-assignment operations using overloaded operators (i.e. classes).
   If you are doing such an assignment intentionally, e.g. in a unit test for
-  a data structure, the warning can be suppressed by adding ``*&`` to the
-  right-hand side or casting it to the appropriate reference type.
+  a data structure, the first warning can be disabled by passing
+  ``-Wno-self-assign-overloaded``, also the warning can be suppressed by adding
+  ``*&`` to the right-hand side or casting it to the appropriate reference type.
 
 Non-comprehensive list of changes in this release
 -
Index: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td
@@ -404,7 +404,8 @@
 def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
 [CXX98CompatBindToTemporaryCopy]>;
 def SelfAssignmentField : DiagGroup<"self-assign-field">;
-def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
+def SelfAssignmentOverloaded : DiagGroup<"self-assign-overloaded">;
+def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentOverloaded, SelfAssignmentField]>;
 def SelfMove : DiagGroup<"self-move">;
 def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
 def Sentinel : DiagGroup<"sentinel">;
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5612,9 +5612,12 @@
   "operator '%0' has lower precedence than '%1'; "
   "'%1' will be evaluated first">, InGroup;
 
-def warn_self_assignment : Warning<
+def warn_self_assignment_builtin : Warning<
   "explicitly assigning value of variable of type %0 to itself">,
   InGroup, DefaultIgnore;
+def warn_self_assignment_overloaded : Warning<
+  "explicitly assigning value of variable of type %0 to itself">,
+  InGroup, DefaultIgnore;
 def warn_self_move : Warning<
   "explicitly moving variable of type %0 to itself">,
   InGroup, DefaultIgnore;
Index: cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp
===
--- cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp
+++ cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp
@@ -4,6 +4,12 @@
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV2 -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV3 -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV4 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DDUMMY -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV0 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV1 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV3 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV4 -verify %s
 
 #ifdef DUMMY
 struct S {};
Index: cfe/trunk/test/SemaCXX/warn-self-assign-overloaded-disable.cpp
===
--- cfe/trunk/test/SemaCXX/warn-self-assign-overloaded-disable.cpp
+++ cfe/trunk/test/SemaCXX/warn-self-assign-overloaded-disable.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-self-assign-overloaded -DSILENCE -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign -Wno-self-assign-overloaded -DSILENCE -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -Wno-self-assign-overloaded -DSILENCE -verify %

r330651 - [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Mon Apr 23 14:35:21 2018
New Revision: 330651

URL: http://llvm.org/viewvc/llvm-project?rev=330651&view=rev
Log:
[Sema] Add -Wno-self-assign-overloaded

Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

Added:
cfe/trunk/test/SemaCXX/warn-self-assign-overloaded-disable.cpp
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/warn-self-assign-overloaded.cpp

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=330651&r1=330650&r2=330651&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Mon Apr 23 14:35:21 2018
@@ -62,8 +62,9 @@ Improvements to Clang's diagnostics
 - ``-Wself-assign`` and ``-Wself-assign-field`` were extended to diagnose
   self-assignment operations using overloaded operators (i.e. classes).
   If you are doing such an assignment intentionally, e.g. in a unit test for
-  a data structure, the warning can be suppressed by adding ``*&`` to the
-  right-hand side or casting it to the appropriate reference type.
+  a data structure, the first warning can be disabled by passing
+  ``-Wno-self-assign-overloaded``, also the warning can be suppressed by adding
+  ``*&`` to the right-hand side or casting it to the appropriate reference 
type.
 
 Non-comprehensive list of changes in this release
 -

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=330651&r1=330650&r2=330651&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Apr 23 14:35:21 2018
@@ -404,7 +404,8 @@ def ReturnType : DiagGroup<"return-type"
 def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
 [CXX98CompatBindToTemporaryCopy]>;
 def SelfAssignmentField : DiagGroup<"self-assign-field">;
-def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
+def SelfAssignmentOverloaded : DiagGroup<"self-assign-overloaded">;
+def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentOverloaded, 
SelfAssignmentField]>;
 def SelfMove : DiagGroup<"self-move">;
 def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
 def Sentinel : DiagGroup<"sentinel">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=330651&r1=330650&r2=330651&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Apr 23 14:35:21 
2018
@@ -5612,9 +5612,12 @@ def warn_addition_in_bitshift : Warning<
   "operator '%0' has lower precedence than '%1'; "
   "'%1' will be evaluated first">, InGroup;
 
-def warn_self_assignment : Warning<
+def warn_self_assignment_builtin : Warning<
   "explicitly assigning value of variable of type %0 to itself">,
   InGroup, DefaultIgnore;
+def warn_self_assignment_overloaded : Warning<
+  "explicitly assigning value of variable of type %0 to itself">,
+  InGroup, DefaultIgnore;
 def warn_self_move : Warning<
   "explicitly moving variable of type %0 to itself">,
   InGroup, DefaultIgnore;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=330651&r1=330650&r2=330651&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Apr 23 14:35:21 2018
@@ -11497,7 +11497,7 @@ static inline UnaryOperatorKind ConvertT
 /// DiagnoseSelfAssignment - Emits a warning if a valu

[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 143647.

https://reviews.llvm.org/D45984

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/movdirintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtin-movdir.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1466,6 +1466,8 @@
 // CHECK_TRM_M32: #define __FXSR__ 1
 // CHECK_TRM_M32: #define __GFNI__ 1
 // CHECK_TRM_M32: #define __MMX__ 1
+// CHECK_TRM_M32: #define __MOVDIR64B__ 1
+// CHECK_TRM_M32: #define __MOVDIRI__ 1
 // CHECK_TRM_M32: #define __MPX__ 1
 // CHECK_TRM_M32: #define __PCLMUL__ 1
 // CHECK_TRM_M32: #define __POPCNT__ 1
@@ -1504,6 +1506,8 @@
 // CHECK_TRM_M64: #define __FXSR__ 1
 // CHECK_TRM_M64: #define __GFNI__ 1
 // CHECK_TRM_M64: #define __MMX__ 1
+// CHECK_TRM_M64: #define __MOVDIR64B__ 1
+// CHECK_TRM_M64: #define __MOVDIRI__ 1
 // CHECK_TRM_M64: #define __MPX__ 1
 // CHECK_TRM_M64: #define __PCLMUL__ 1
 // CHECK_TRM_M64: #define __POPCNT__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,13 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIRI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIRI %s
+// MOVDIRI: "-target-feature" "+movdiri"
+// NO-MOVDIRI: "-target-feature" "-movdiri"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIR64B %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIR64B %s
+// MOVDIR64B: "-target-feature" "+movdir64b"
+// NO-MOVDIR64B: "-target-feature" "-movdir64b"
Index: test/CodeGen/builtin-movdir.c
===
--- /dev/null
+++ test/CodeGen/builtin-movdir.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK
+
+#include 
+#include 
+
+void test_directstore32(void *dst, uint32_t value) {
+  // CHECK-LABEL: test_directstore32
+  // CHECK: call void @llvm.x86.directstore32
+  _directstoreu_u32(dst, value);
+}
+
+#ifdef __x86_64__
+
+void test_directstore64(void *dst, uint64_t value) {
+  // X86_64-LABEL: test_directstore64
+  // X86_64: call void @llvm.x86.directstore64
+  _directstoreu_u64(dst, value);
+}
+
+#endif
+
+void test_dir64b(void *dst, const void *src) {
+  // CHECK-LABEL: test_dir64b
+  // CHECK: call void @llvm.x86.movdir64b
+  _movdir64b(dst, src);
+}
+
+// CHECK: declare void @llvm.x86.directstore32(i8*, i32)
+// X86_64: declare void @llvm.x86.directstore64(i8*, i64)
+// CHECK: declare void @llvm.x86.movdir64b(i8*, i8*)
Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -100,4 +100,9 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+  defined(__MOVDIRI__) || defined(__MOVDIR64B__)
+#include 
+#endif
+
 #endif /* __X86INTRIN_H */
Index: lib/Headers/movdirintrin.h
===
--- /dev/null
+++ lib/Headers/movdirintrin.h
@@ -0,0 +1,54 @@
+/*===- movdirintrin.h --===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOF

[PATCH] D45839: [analyzer] Add support for WebKit "unified sources".

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: 
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h:144
+// includes the full path.
+if (SM.getFilename(IL).contains("UnifiedSource")) {
+  StringRef Name = SM.getFilename(SL);

probinson wrote:
> george.karpenkov wrote:
> > NoQ wrote:
> > > george.karpenkov wrote:
> > > > Is this `if` really necessary? This logic has too much overfitting, and 
> > > > it seems that if someone decides to include `.cc` files, we should 
> > > > analyze them in any case, right? We also would prefer to not stop 
> > > > working if webkit decides on using a different naming for those.
> > > This is indeed an act of overfitting. But also there are very few reasons 
> > > to include a non-header file, and all of them are pretty exotic. I'm not 
> > > sure we want to analyze these files in all cases. So i want to play safe 
> > > until we gather more data.
> > I would still say that just analyzing included c++ files is a lesser evil.
> Agreed.  WebKit is not the only project that does this kind of thing.
The question is, are all such projects in fact interested in having the 
analyzer analyze the respective code?

For instance, if the included code is autogenerated by an external tool, users 
are probably not interested in finding bugs in such code because they will be 
unable to fix them.

Are you interested in providing a list of examples of projects that do this 
kind of thing, explain why are they doing it, and whether they will be 
interested in having warnings in included files?


https://reviews.llvm.org/D45839



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 143645.
lebedev.ri added a comment.

Add negative tests, too.


Repository:
  rC Clang

https://reviews.llvm.org/D45766

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  test/SemaCXX/warn-self-assign-overloaded-disable.cpp
  test/SemaCXX/warn-self-assign-overloaded.cpp

Index: test/SemaCXX/warn-self-assign-overloaded.cpp
===
--- test/SemaCXX/warn-self-assign-overloaded.cpp
+++ test/SemaCXX/warn-self-assign-overloaded.cpp
@@ -4,6 +4,12 @@
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV2 -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV3 -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wself-assign -DV4 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DDUMMY -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV0 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV1 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV3 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-self-assign -Wself-assign-overloaded -DV4 -verify %s
 
 #ifdef DUMMY
 struct S {};
Index: test/SemaCXX/warn-self-assign-overloaded-disable.cpp
===
--- /dev/null
+++ test/SemaCXX/warn-self-assign-overloaded-disable.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-self-assign-overloaded -DSILENCE -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign -Wno-self-assign-overloaded -DSILENCE -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -Wno-self-assign-overloaded -DSILENCE -verify %s
+
+struct S {};
+
+void f() {
+  S a;
+#ifndef SILENCE
+  a = a; // expected-warning{{explicitly assigning}}
+#else
+  // expected-no-diagnostics
+  a = a;
+#endif
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -11497,7 +11497,7 @@
 /// DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself.
 /// This warning suppressed in the event of macro expansions.
 static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr,
-   SourceLocation OpLoc) {
+   SourceLocation OpLoc, bool IsBuiltin) {
   if (S.inTemplateInstantiation())
 return;
   if (S.isUnevaluatedContext())
@@ -11524,9 +11524,10 @@
 if (RefTy->getPointeeType().isVolatileQualified())
   return;
 
-  S.Diag(OpLoc, diag::warn_self_assignment)
-  << LHSDeclRef->getType()
-  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
+  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
+  : diag::warn_self_assignment_overloaded)
+  << LHSDeclRef->getType() << LHSExpr->getSourceRange()
+  << RHSExpr->getSourceRange();
 }
 
 /// Check if a bitwise-& is performed on an Objective-C pointer.  This
@@ -11719,7 +11720,7 @@
   OK = LHS.get()->getObjectKind();
 }
 if (!ResultTy.isNull()) {
-  DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc);
+  DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc, true);
   DiagnoseSelfMove(LHS.get(), RHS.get(), OpLoc);
 }
 RecordModifiableNonNullParam(*this, LHS.get());
@@ -11817,7 +11818,7 @@
 break;
   case BO_AndAssign:
   case BO_OrAssign: // fallthrough
-DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc);
+DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc, true);
 LLVM_FALLTHROUGH;
   case BO_XorAssign:
 CompResultTy = CheckBitwiseOperands(LHS, RHS, OpLoc, Opc);
@@ -12124,7 +12125,7 @@
   case BO_AndAssign:
   case BO_OrAssign:
   case BO_XorAssign:
-DiagnoseSelfAssignment(S, LHS, RHS, OpLoc);
+DiagnoseSelfAssignment(S, LHS, RHS, OpLoc, false);
 CheckIdentityFieldAssignment(LHS, RHS, OpLoc, S);
 break;
   default:
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -5612,9 +5612,12 @@
   "operator '%0' has lower precedence than '%1'; "
   "'%1' will be evaluated first">, InGroup;
 
-def warn_self_assignment : Warning<
+def warn_self_assignment_builtin : Warning<
   "explicitly assigning value of variable of type %0 to itself">,
   InGroup, DefaultIgnore;
+def warn_self_assignment_overloaded : Warning<
+  "explicitly assigning value of variab

[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 143644.

https://reviews.llvm.org/D45984

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/movdirintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtin-movdir.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1466,6 +1466,8 @@
 // CHECK_TRM_M32: #define __FXSR__ 1
 // CHECK_TRM_M32: #define __GFNI__ 1
 // CHECK_TRM_M32: #define __MMX__ 1
+// CHECK_TRM_M32: #define __MOVDIR64B__ 1
+// CHECK_TRM_M32: #define __MOVDIRI__ 1
 // CHECK_TRM_M32: #define __MPX__ 1
 // CHECK_TRM_M32: #define __PCLMUL__ 1
 // CHECK_TRM_M32: #define __POPCNT__ 1
@@ -1504,6 +1506,8 @@
 // CHECK_TRM_M64: #define __FXSR__ 1
 // CHECK_TRM_M64: #define __GFNI__ 1
 // CHECK_TRM_M64: #define __MMX__ 1
+// CHECK_TRM_M64: #define __MOVDIR64B__ 1
+// CHECK_TRM_M64: #define __MOVDIRI__ 1
 // CHECK_TRM_M64: #define __MPX__ 1
 // CHECK_TRM_M64: #define __PCLMUL__ 1
 // CHECK_TRM_M64: #define __POPCNT__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,13 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIRI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIRI %s
+// MOVDIRI: "-target-feature" "+movdiri"
+// NO-MOVDIRI: "-target-feature" "-movdiri"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIR64B %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIR64B %s
+// MOVDIR64B: "-target-feature" "+movdir64b"
+// NO-MOVDIR64B: "-target-feature" "-movdir64b"
Index: test/CodeGen/builtin-movdir.c
===
--- /dev/null
+++ test/CodeGen/builtin-movdir.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK
+
+#include 
+#include 
+
+void test_directstore32(void *dst, uint32_t value) {
+  // CHECK-LABEL: test_directstore32
+  // CHECK: call void @llvm.x86.directstore32
+  _directstoreu_u32(dst, value);
+}
+
+#ifdef __x86_64__
+
+void test_directstore64(void *dst, uint64_t value) {
+  // X86_64-LABEL: test_directstore64
+  // X86_64: call void @llvm.x86.directstore64
+  _directstoreu_u64(dst, value);
+}
+
+#endif
+
+void test_dir64b(void *dst, const void *src) {
+  // CHECK-LABEL: test_dir64b
+  // CHECK: call void @llvm.x86.movdir64b
+  _movdir64b(dst, src);
+}
+
+// CHECK: declare void @llvm.x86.directstore32(i8*, i32)
+// X86_64: declare void @llvm.x86.directstore64(i8*, i64)
+// CHECK: declare void @llvm.x86.movdir64b(i8*, i8*)
Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -100,4 +100,9 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+  defined(__MOVDIRI__) || defined(__MOVDIR64B__)
+#include 
+#endif
+
 #endif /* __X86INTRIN_H */
Index: lib/Headers/movdirintrin.h
===
--- /dev/null
+++ lib/Headers/movdirintrin.h
@@ -0,0 +1,54 @@
+/*===- movdirintrin.h --===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOF

[PATCH] D45839: [analyzer] Add support for WebKit "unified sources".

2018-04-23 Thread Paul Robinson via Phabricator via cfe-commits
probinson added inline comments.



Comment at: 
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h:144
+// includes the full path.
+if (SM.getFilename(IL).contains("UnifiedSource")) {
+  StringRef Name = SM.getFilename(SL);

george.karpenkov wrote:
> NoQ wrote:
> > george.karpenkov wrote:
> > > Is this `if` really necessary? This logic has too much overfitting, and 
> > > it seems that if someone decides to include `.cc` files, we should 
> > > analyze them in any case, right? We also would prefer to not stop working 
> > > if webkit decides on using a different naming for those.
> > This is indeed an act of overfitting. But also there are very few reasons 
> > to include a non-header file, and all of them are pretty exotic. I'm not 
> > sure we want to analyze these files in all cases. So i want to play safe 
> > until we gather more data.
> I would still say that just analyzing included c++ files is a lesser evil.
Agreed.  WebKit is not the only project that does this kind of thing.


https://reviews.llvm.org/D45839



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 143642.

https://reviews.llvm.org/D45984

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/movdirintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtin-movdir.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1466,6 +1466,8 @@
 // CHECK_TRM_M32: #define __FXSR__ 1
 // CHECK_TRM_M32: #define __GFNI__ 1
 // CHECK_TRM_M32: #define __MMX__ 1
+// CHECK_TRM_M32: #define __MOVDIR64B__ 1
+// CHECK_TRM_M32: #define __MOVDIRI__ 1
 // CHECK_TRM_M32: #define __MPX__ 1
 // CHECK_TRM_M32: #define __PCLMUL__ 1
 // CHECK_TRM_M32: #define __POPCNT__ 1
@@ -1504,6 +1506,8 @@
 // CHECK_TRM_M64: #define __FXSR__ 1
 // CHECK_TRM_M64: #define __GFNI__ 1
 // CHECK_TRM_M64: #define __MMX__ 1
+// CHECK_TRM_M64: #define __MOVDIR64B__ 1
+// CHECK_TRM_M64: #define __MOVDIRI__ 1
 // CHECK_TRM_M64: #define __MPX__ 1
 // CHECK_TRM_M64: #define __PCLMUL__ 1
 // CHECK_TRM_M64: #define __POPCNT__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,13 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIRI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIRI %s
+// MOVDIRI: "-target-feature" "+movdiri"
+// NO-MOVDIRI: "-target-feature" "-movdiri"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIR64B %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIR64B %s
+// MOVDIR64B: "-target-feature" "+movdir64b"
+// NO-MOVDIR64B: "-target-feature" "-movdir64b"
Index: test/CodeGen/builtin-movdir.c
===
--- /dev/null
+++ test/CodeGen/builtin-movdir.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK
+
+#include 
+#include 
+
+void test_directstore32(void *dst, uint32_t value) {
+  // CHECK-LABEL: test_directstore32
+  // CHECK: call void @llvm.x86.directstore32
+  _directstoreu_u32(dst, value);
+}
+
+#ifdef __x86_64__
+
+void test_directstore64(void *dst, uint64_t value) {
+  // X86_64-LABEL: test_directstore64
+  // X86_64: call void @llvm.x86.directstore64
+  _directstoreu_u64(dst, value);
+}
+
+#endif
+
+void test_dir64b(void *dst, const void *src) {
+  // CHECK-LABEL: test_dir64b
+  // CHECK: call void @llvm.x86.movdir64b
+  _movdir64b(dst, src);
+}
+
+// CHECK: declare void @llvm.x86.directstore32(i8*, i32)
+// X86_64: declare void @llvm.x86.directstore64(i8*, i64)
+// CHECK: declare void @llvm.x86.movdir64b(i8*, i8*)
Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -100,4 +100,9 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+  defined(__MOVDIRI__) || defined(__MOVDIR64B__)
+#include 
+#endif
+
 #endif /* __X86INTRIN_H */
Index: lib/Headers/movdirintrin.h
===
--- /dev/null
+++ lib/Headers/movdirintrin.h
@@ -0,0 +1,54 @@
+/*===- movdirintrin.h --===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOF

[libclc] r330649 - log10: Use sw implementation from amd builtins

2018-04-23 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Mon Apr 23 14:10:42 2018
New Revision: 330649

URL: http://llvm.org/viewvc/llvm-project?rev=330649&view=rev
Log:
log10: Use sw implementation from amd builtins

Add missing table.
Fixes log10d CTS on carrizo.
Signed-off-by: Jan Vesely 
Acked-by: Aaron Watry 
Tested-by: Aaron Watry 

Removed:
libclc/trunk/generic/lib/math/log10.inc
Modified:
libclc/trunk/generic/lib/math/log10.cl
libclc/trunk/generic/lib/math/log_base.h
libclc/trunk/generic/lib/math/tables.cl
libclc/trunk/generic/lib/math/tables.h

Modified: libclc/trunk/generic/lib/math/log10.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/log10.cl?rev=330649&r1=330648&r2=330649&view=diff
==
--- libclc/trunk/generic/lib/math/log10.cl (original)
+++ libclc/trunk/generic/lib/math/log10.cl Mon Apr 23 14:10:42 2018
@@ -1,4 +1,39 @@
+/*
+ * Copyright (c) 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
 #include 
+#include "../clcmacro.h"
+#include "tables.h"
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif // cl_khr_fp64
+
+#define COMPILING_LOG10
+#include "log_base.h"
+#undef COMPILING_LOG10
+
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, log10, float);
 
-#define __CLC_BODY 
-#include 
+#ifdef cl_khr_fp64
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, log10, double);
+#endif // cl_khr_fp64

Removed: libclc/trunk/generic/lib/math/log10.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/log10.inc?rev=330648&view=auto
==
--- libclc/trunk/generic/lib/math/log10.inc (original)
+++ libclc/trunk/generic/lib/math/log10.inc (removed)
@@ -1,13 +0,0 @@
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE log10(__CLC_GENTYPE val) {
-  // log10(x) = log2(x) / log2(10)
-  // 1 / log2(10) = 0.30102999566 = log10(2)
-  // SP representation is 0.30103 (0x1.344136p-2)
-  // DP representation is 
0.30102999565993762312442414(0x1.34413509E61D8p-2)
-#if __CLC_FPSIZE == 32
-  return log2(val) * 0x1.344136p-2f;
-#elif __CLC_FPSIZE == 64
-  return log2(val) * 0x1.34413509E61D8p-2;
-#else
-#error unknown _CLC_FPSIZE
-#endif
-}

Modified: libclc/trunk/generic/lib/math/log_base.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/log_base.h?rev=330649&r1=330648&r2=330649&view=diff
==
--- libclc/trunk/generic/lib/math/log_base.h (original)
+++ libclc/trunk/generic/lib/math/log_base.h Mon Apr 23 14:10:42 2018
@@ -92,14 +92,12 @@ log(float x)
 const float LOG2E_HEAD = 0x1.70p+0f; // 1.4375
 const float LOG2E_TAIL = 0x1.547652p-8f; // 0.00519504072
 #elif defined(COMPILING_LOG10)
-USE_TABLE(float2, p_log, LOG10_TBL);
 const float LOG10E = 0x1.bcb7b2p-2f;// 0.43429448190325182
 const float LOG10E_HEAD = 0x1.bcp-2f;   // 0.43359375
 const float LOG10E_TAIL = 0x1.6f62a4p-11f;  // 0.0007007319
 const float LOG10_2_HEAD = 0x1.34p-2f;  // 0.30078125
 const float LOG10_2_TAIL = 0x1.04d426p-12f; // 0.000248745637
 #else
-USE_TABLE(float2, p_log, LOGE_TBL);
 const float LOG2_HEAD = 0x1.62e000p-1f;  // 0.693115234
 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.319461833
 #endif
@@ -158,11 +156,11 @@ log(float x)
 z1 = tv.s0 + mf;
 z2 = mad(poly, -LOG2E, tv.s1);
 #elif defined(COMPILING_LOG10)
-float2 tv = p_log[indx];
+float2 tv = USE_TABLE(log10_tbl, indx);
 z1 = mad(mf, LOG10_2_HEAD, tv.s0);
 z2 = mad(poly, -LOG10E, mf*LOG10_2_TAIL) + tv.s1;
 #else
-float2 tv = p_log[indx];
+float2 tv = USE_TABLE(log_tbl, indx);
 z1 = mad(mf, LOG2_HEAD, tv.s0);
 z2 = mad(mf, LOG2_TAIL, -poly) + tv.s1;
 #endif

Modified: libclc/trunk/generic/lib/math/tables.cl
URL: 
http://l

[PATCH] D45505: [GCC] Match a GCC version with a patch suffix without a third version component

2018-04-23 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D45505



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44387: [x86] Introduce the pconfig/encl[u|s|v] intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 143640.

https://reviews.llvm.org/D44387

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/module.modulemap
  lib/Headers/pconfigintrin.h
  lib/Headers/sgxintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtins-x86.c
  test/CodeGen/pconfig.c
  test/CodeGen/sgx.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1204,6 +1204,7 @@
 // CHECK_ICX_M32: #define __MMX__ 1
 // CHECK_ICX_M32: #define __MPX__ 1
 // CHECK_ICX_M32: #define __PCLMUL__ 1
+// CHECK_ICX_M32: #define __PCONFIG__ 1
 // CHECK_ICX_M32: #define __PKU__ 1
 // CHECK_ICX_M32: #define __POPCNT__ 1
 // CHECK_ICX_M32: #define __PRFCHW__ 1
@@ -1261,6 +1262,7 @@
 // CHECK_ICX_M64: #define __MMX__ 1
 // CHECK_ICX_M64: #define __MPX__ 1
 // CHECK_ICX_M64: #define __PCLMUL__ 1
+// CHECK_ICX_M64: #define __PCONFIG__ 1
 // CHECK_ICX_M64: #define __PKU__ 1
 // CHECK_ICX_M64: #define __POPCNT__ 1
 // CHECK_ICX_M64: #define __PRFCHW__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,8 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mpconfig %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PCONFIG %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-pconfig %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PCONFIG %s
+// PCONFIG: "-target-feature" "+pconfig"
+// NO-PCONFIG: "-target-feature" "-pconfig"
Index: test/CodeGen/sgx.c
===
--- /dev/null
+++ test/CodeGen/sgx.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -target-feature +sgx -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-64
+// RUN: %clang_cc1 %s -ffreestanding -triple i386-unknown-unknown -emit-llvm -target-feature +sgx -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-32
+
+#include 
+
+#include 
+
+unsigned int test_encls(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_encls
+  //CHECK-64: @llvm.x86.encls.64
+  //CHECK-32: @llvm.x86.encls.32
+  return _encls_u32(leaf, arguments);
+}
+
+unsigned int test_enclu(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_enclu
+  //CHECK-64: @llvm.x86.enclu.64
+  //CHECK-32: @llvm.x86.enclu.32
+  return _enclu_u32(leaf, arguments);
+}
+
+unsigned int test_enclv(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_enclv
+  //CHECK-64: @llvm.x86.enclv.64
+  //CHECK-32: @llvm.x86.enclv.32
+  return _enclv_u32(leaf, arguments);
+}
Index: test/CodeGen/pconfig.c
===
--- /dev/null
+++ test/CodeGen/pconfig.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-darwin -emit-llvm -target-feature +pconfig -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-64
+// RUN: %clang_cc1 %s -ffreestanding -triple i386 -emit-llvm -target-feature +pconfig -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-32
+
+#include 
+
+#include 
+
+unsigned int test_pconfig(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_pconfig
+  //CHECK-64: @llvm.x86.pconfig.64
+  //CHECK-32: @llvm.x86.pconfig.32
+  return _pconfig_u32(leaf, arguments);
+}
+
Index: test/CodeGen/builtins-x86.c
===
--- test/CodeGen/builtins-x86.c
+++ test/CodeGen/builtins-x86.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -DUSE_64 -triple x86_64-unknown-unknown -target-feature +fxsr -target-feature +avx -target-feature +xsaveopt -target-feature +xsaves -target-feature +xsavec -target-feature +mwaitx -target-feature +clzero -target-feature +ibt -target-feature +shstk -target-feature +wbnoinvd -target-feature +cldemote -emit-llvm -o %t %s
-// RUN: %clang_cc1 -DUSE_ALL -triple x86_64-unknown-unknown -target-feature +fxsr -target-feature +avx -target-feature +xsaveopt -target-feature +xsaves -target-feature +xsavec -target-feature +mwaitx -target-feature +ibt -target-feature +shstk -target-feature +clzero -target-feature +wbnoinvd -target-feature +cldemote -fsyntax-only -o %t %s
+// RUN: %clang_cc1 -DUSE_64 -triple x86_64-unknown-unknown -target-feature +fxsr -target-feature +avx -target-feature +xsaveopt -target-feature +xsaves -target-fea

[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: docs/ClangCommandLineReference.rst:2465
 
+.. option:: -mmovdiri, -mno-movdiri
+

Please alphabetize this correctly.



Comment at: include/clang/Basic/BuiltinsX86.def:1896
+TARGET_BUILTIN(__builtin_ia32_directstore_u32, "vUi*Ui", "", "movdiri")
+TARGET_BUILTIN(__builtin_ia32_directstore_u64, "vUWi*UWi", "", "movdiri")
+TARGET_BUILTIN(__builtin_ia32_movdir64b, "vv*vC*", "", "movdir64b")

The u64 versions needs to go in BuiltinsX86_64.def. That will provide an extra 
safety check to prevent anyone from using the builtin without the intrin.h 
header on 32-bit hosts.



Comment at: include/clang/Driver/Options.td:2634
 def mno_cx16 : Flag<["-"], "mno-cx16">, Group;
+def mmovdiri : Flag<["-"], "mmovdiri">, Group;
+def mno_movdiri : Flag<["-"], "mno-movdiri">, Group;

Alphabetize



Comment at: lib/Basic/Targets/X86.cpp:1304
   .Case("cx16", true)
+  .Case("movdiri", true)
+  .Case("movdir64b", true)

Alphabetize



Comment at: lib/Basic/Targets/X86.cpp:1379
   .Case("cx16", HasCX16)
+  .Case("movdiri", HasMOVDIRI)
+  .Case("movdir64b", HasMOVDIR64B)

Alphabetize



Comment at: lib/Headers/movdirintrin.h:30
+
+#ifdef __MOVDIRI__
+

We aren't supposed to be checking the preprocessor defines in headers. We need 
to be able to put a target attribute on each function and control feature 
enabling at a function level.



Comment at: lib/Headers/movdirintrin.h:35
+__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
+_directstoreu_u32 (void *__DST, __UINT32_TYPE__  __VALUE)
+{

Use 'unsigned int' instead of __UINT32_TYPE__



Comment at: lib/Headers/movdirintrin.h:35
+__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
+_directstoreu_u32 (void *__DST, __UINT32_TYPE__  __VALUE)
+{

craig.topper wrote:
> Use 'unsigned int' instead of __UINT32_TYPE__
Lower case variable names



Comment at: lib/Headers/movdirintrin.h:45
+__attribute__((__always_inline__, __nodebug__,  __target__("movdiri")))
+_directstoreu_u64 (void *__DST, __UINT64_TYPE__ __VALUE)
+{

Use unsigned long long


Repository:
  rC Clang

https://reviews.llvm.org/D45984



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44387: [x86] Introduce the pconfig/encl[u|s|v] intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella updated this revision to Diff 143639.
GBuella added a comment.

Rebased the patch.
Added pconfig to Icelake Server.


https://reviews.llvm.org/D44387

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/module.modulemap
  lib/Headers/pconfigintrin.h
  lib/Headers/sgxintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtins-x86.c
  test/CodeGen/pconfig.c
  test/CodeGen/sgx.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1204,6 +1204,7 @@
 // CHECK_ICX_M32: #define __MMX__ 1
 // CHECK_ICX_M32: #define __MPX__ 1
 // CHECK_ICX_M32: #define __PCLMUL__ 1
+// CHECK_ICX_M32: #define __PCONFIG__ 1
 // CHECK_ICX_M32: #define __PKU__ 1
 // CHECK_ICX_M32: #define __POPCNT__ 1
 // CHECK_ICX_M32: #define __PRFCHW__ 1
@@ -1261,6 +1262,7 @@
 // CHECK_ICX_M64: #define __MMX__ 1
 // CHECK_ICX_M64: #define __MPX__ 1
 // CHECK_ICX_M64: #define __PCLMUL__ 1
+// CHECK_ICX_M64: #define __PCONFIG__ 1
 // CHECK_ICX_M64: #define __PKU__ 1
 // CHECK_ICX_M64: #define __POPCNT__ 1
 // CHECK_ICX_M64: #define __PRFCHW__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,8 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mpconfig %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PCONFIG %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-pconfig %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PCONFIG %s
+// PCONFIG: "-target-feature" "+pconfig"
+// NO-PCONFIG: "-target-feature" "-pconfig"
Index: test/CodeGen/sgx.c
===
--- /dev/null
+++ test/CodeGen/sgx.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -target-feature +sgx -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-64
+// RUN: %clang_cc1 %s -ffreestanding -triple i386-unknown-unknown -emit-llvm -target-feature +sgx -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-32
+
+#include 
+
+#include 
+
+unsigned int test_encls(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_encls
+  //CHECK-64: @llvm.x86.encls.64
+  //CHECK-32: @llvm.x86.encls.32
+  return _encls_u32(leaf, arguments);
+}
+
+unsigned int test_enclu(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_enclu
+  //CHECK-64: @llvm.x86.enclu.64
+  //CHECK-32: @llvm.x86.enclu.32
+  return _enclu_u32(leaf, arguments);
+}
+
+unsigned int test_enclv(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_enclv
+  //CHECK-64: @llvm.x86.enclv.64
+  //CHECK-32: @llvm.x86.enclv.32
+  return _enclv_u32(leaf, arguments);
+}
Index: test/CodeGen/pconfig.c
===
--- /dev/null
+++ test/CodeGen/pconfig.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-darwin -emit-llvm -target-feature +pconfig -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-64
+// RUN: %clang_cc1 %s -ffreestanding -triple i386 -emit-llvm -target-feature +pconfig -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-32
+
+#include 
+
+#include 
+
+unsigned int test_pconfig(unsigned int leaf, size_t arguments[]) {
+  //CHECK-LABEL: @test_pconfig
+  //CHECK-64: @llvm.x86.pconfig.64
+  //CHECK-32: @llvm.x86.pconfig.32
+  return _pconfig_u32(leaf, arguments);
+}
+
Index: test/CodeGen/builtins-x86.c
===
--- test/CodeGen/builtins-x86.c
+++ test/CodeGen/builtins-x86.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -DUSE_64 -triple x86_64-unknown-unknown -target-feature +fxsr -target-feature +avx -target-feature +xsaveopt -target-feature +xsaves -target-feature +xsavec -target-feature +mwaitx -target-feature +clzero -target-feature +ibt -target-feature +shstk -target-feature +wbnoinvd -target-feature +cldemote -emit-llvm -o %t %s
-// RUN: %clang_cc1 -DUSE_ALL -triple x86_64-unknown-unknown -target-feature +fxsr -target-feature +avx -target-feature +xsaveopt -target-feature +xsaves -target-feature +xsavec -target-feature +mwaitx -target-feature +ibt -target-feature +shstk -target-feature +clzero -target-feature +wbnoinvd -target-feature +cldemote -fsyntax-only -o %t %s
+// RUN: %clang_cc1 -DUSE_64 -triple x86_64-unknown-unknown -target-feature +fxsr -ta

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D45382#1060452, @ahatanak wrote:

> In https://reviews.llvm.org/D45382#1060163, @rjmccall wrote:
>
> > Hmm.  I'm not actually sure *why* it's not okay to forward callee-cleanup 
> > arguments.  Do we just not have the necessary logic to disable the cleanup 
> > in the caller?
>
>
> It seems that it would be OK if there was a way to disable the cleanup in the 
> caller when we know that we are delegating to another constructor, possibly 
> by setting the DelegateCXXConstructorCall here too. But maybe there are other 
> reasons for not doing so.
>
> Perhaps Richard (who committed r274049) knows why we can't call the delegated 
> constructor when there are callee-cleanup arguments?


I think the only reason was that we didn't have a good way to handle cleanup 
emission in the thunk (as @rjmccall points out, we do need parameter cleanups 
in the thunk, but we need to disable them at the point of the call to the 
inherited constructor). I cannot think of any correctness reason that prevents 
using a thunk for the callee-cleanup case.


Repository:
  rC Clang

https://reviews.llvm.org/D45382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGCall.cpp:3069
+  if (hasAggregateEvaluationKind(type) &&
+  getContext().isParamDestroyedInCallee(type)) {
+EHScopeStack::stable_iterator cleanup =

I wonder if this is something we should be taking from the CGFunctionInfo 
instead.  It does seem plausible that it could vary, e.g. according to the 
calling convention.  But maybe that's something we can handle in a separate 
patch?



Comment at: lib/CodeGen/CodeGenFunction.h:590
   class RunCleanupsScope {
-EHScopeStack::stable_iterator CleanupStackDepth;
+EHScopeStack::stable_iterator CleanupStackDepth, OldCleanupStackDepth;
 size_t LifetimeExtendedCleanupStackSize;

Please rename this variable to something like `OldCleanupScopeDepth`.


Repository:
  rC Clang

https://reviews.llvm.org/D45382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45985: [test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.

2018-04-23 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.
mstorsjo added reviewers: rnk, compnerd, martell.

After having a look at some similar tests, adding a proper testcase for this 
feature didn't turn out to be all that bad after all.


Repository:
  rC Clang

https://reviews.llvm.org/D45985

Files:
  test/Driver/mingw-sysroot.cpp


Index: test/Driver/mingw-sysroot.cpp
===
--- /dev/null
+++ test/Driver/mingw-sysroot.cpp
@@ -0,0 +1,42 @@
+// REQUIRES: shell
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T/testroot-gcc/bin
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc ] || rm 
%T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-clang ] || rm 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-gcc/x86_64-w64-mingw32 ] || rm 
%T/testroot-gcc/x86_64-w64-mingw32
+// RUN: [ ! -s %T/testroot-gcc/lib ] || rm %T/testroot-gcc/lib
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 
%T/testroot-gcc/x86_64-w64-mingw32
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib
+
+// RUN: mkdir -p %T/testroot-clang/bin
+// RUN: [ ! -s %T/testroot-clang/bin/x86_64-w64-mingw32-clang ] || rm 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-clang/x86_64-w64-mingw32 ] || rm 
%T/testroot-clang/x86_64-w64-mingw32
+// RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 
%T/testroot-clang/x86_64-w64-mingw32
+
+
+// If we find a gcc in the path with the right triplet prefix, pick that as
+// sysroot:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target 
x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_TESTROOT_GCC %s
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}backward"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}x86_64-w64-mingw32{{/|}}include"
+
+
+// If there's a matching sysroot next to the clang binary itself, prefer that
+// over a gcc in the path:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=compiler-rt -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_CLANG %s
+// CHECK_TESTROOT_CLANG: 
"{{.*}}/testroot-clang{{/|}}x86_64-w64-mingw32{{/|}}include"
+
+
+// If we pick a root based on a sysroot next to the clang binary, which also
+// happens to be in the same directory as gcc, make sure we still can pick up
+// the libgcc directory:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_GCC %s


Index: test/Driver/mingw-sysroot.cpp
===
--- /dev/null
+++ test/Driver/mingw-sysroot.cpp
@@ -0,0 +1,42 @@
+// REQUIRES: shell
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T/testroot-gcc/bin
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-gcc/x86_64-w64-mingw32 ] || rm %T/testroot-gcc/x86_64-w64-mingw32
+// RUN: [ ! -s %T/testroot-gcc/lib ] || rm %T/testroot-gcc/lib
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-gcc/x86_64-w64-mingw32
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib
+
+// RUN: mkdir -p %T/testroot-clang/bin
+// RUN: [ ! -s %T/testroot-clang/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-clang/x86_64-w64-mingw32 ] || rm %T/testroot-clang/x86_64-w64-mingw32
+// RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-clang/x86_64-w64-mingw32
+
+
+// If we find a gcc in the path with the right triplet prefix, pick that as
+// sysroot:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target x86_64-w64-ming

[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.



Comment at: lib/Sema/SemaExpr.cpp:11527-11528
 
-  S.Diag(OpLoc, diag::warn_self_assignment)
-  << LHSDeclRef->getType()
-  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
+  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
+  : diag::warn_self_assignment_overloaded)
+  << LHSDeclRef->getType() << LHSExpr->getSourceRange()

lebedev.ri wrote:
> dblaikie wrote:
> > Presumably this also changes how the warning is enabled? But that doesn't 
> > seem to be tested in this patch?
> What testing do you have in mind?
> The `test/SemaCXX/warn-self-assign-overloaded.cpp` change was supposed to 
> show how it is enabled..
ah, misread those - figured they were testing the negative case (given the name 
of this patch) but I see they're testing the positive case.

Maybe testing the negative case would be useful too?


Repository:
  rC Clang

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45984: [X86] directstore and movdir64b intrinsics

2018-04-23 Thread Gabor Buella via Phabricator via cfe-commits
GBuella created this revision.
GBuella added a reviewer: craig.topper.
Herald added subscribers: cfe-commits, mgorny.

Repository:
  rC Clang

https://reviews.llvm.org/D45984

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Basic/BuiltinsX86.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/Headers/CMakeLists.txt
  lib/Headers/cpuid.h
  lib/Headers/movdirintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtin-movdir.c
  test/Driver/x86-target-features.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -1466,6 +1466,8 @@
 // CHECK_TRM_M32: #define __FXSR__ 1
 // CHECK_TRM_M32: #define __GFNI__ 1
 // CHECK_TRM_M32: #define __MMX__ 1
+// CHECK_TRM_M32: #define __MOVDIR64B__ 1
+// CHECK_TRM_M32: #define __MOVDIRI__ 1
 // CHECK_TRM_M32: #define __MPX__ 1
 // CHECK_TRM_M32: #define __PCLMUL__ 1
 // CHECK_TRM_M32: #define __POPCNT__ 1
@@ -1504,6 +1506,8 @@
 // CHECK_TRM_M64: #define __FXSR__ 1
 // CHECK_TRM_M64: #define __GFNI__ 1
 // CHECK_TRM_M64: #define __MMX__ 1
+// CHECK_TRM_M64: #define __MOVDIR64B__ 1
+// CHECK_TRM_M64: #define __MOVDIRI__ 1
 // CHECK_TRM_M64: #define __MPX__ 1
 // CHECK_TRM_M64: #define __PCLMUL__ 1
 // CHECK_TRM_M64: #define __POPCNT__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -149,3 +149,13 @@
 // RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s
 // WAITPKG: "-target-feature" "+waitpkg"
 // NO-WAITPKG: "-target-feature" "-waitpkg"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIRI %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdiri %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIRI %s
+// MOVDIRI: "-target-feature" "+movdiri"
+// NO-MOVDIRI: "-target-feature" "-movdiri"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmovdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=MOVDIR64B %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movdir64b %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVDIR64B %s
+// MOVDIR64B: "-target-feature" "+movdir64b"
+// NO-MOVDIR64B: "-target-feature" "-movdir64b"
Index: test/CodeGen/builtin-movdir.c
===
--- /dev/null
+++ test/CodeGen/builtin-movdir.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unkown-unkown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding -triple i386-unkown-unkown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK
+
+#include 
+#include 
+
+void test_directstore32(void *dst, uint32_t value) {
+  // CHECK-LABEL: test_directstore32
+  // CHECK: call void @llvm.x86.directstore32
+  _directstoreu_u32(dst, value);
+}
+
+#ifdef __x86_64__
+
+void test_directstore64(void *dst, uint64_t value) {
+  // X86_64-LABEL: test_directstore64
+  // X86_64: call void @llvm.x86.directstore64
+  _directstoreu_u64(dst, value);
+}
+
+#endif
+
+void test_dir64b(void *dst, const void *src) {
+  // CHECK-LABEL: test_dir64b
+  // CHECK: call void @llvm.x86.movdir64b
+  _movdir64b(dst, src);
+}
+
+// CHECK: declare void @llvm.x86.directstore32(i8*, i32)
+// X86_64: declare void @llvm.x86.directstore64(i8*, i64)
+// CHECK: declare void @llvm.x86.movdir64b(i8*, i8*)
Index: lib/Headers/x86intrin.h
===
--- lib/Headers/x86intrin.h
+++ lib/Headers/x86intrin.h
@@ -100,4 +100,9 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || \
+  defined(__MOVDIRI__) || defined(__MOVDIR64B__)
+#include 
+#endif
+
 #endif /* __X86INTRIN_H */
Index: lib/Headers/movdirintrin.h
===
--- /dev/null
+++ lib/Headers/movdirintrin.h
@@ -0,0 +1,66 @@
+/*===- movdirintrin.h --===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or su

[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:11527-11528
 
-  S.Diag(OpLoc, diag::warn_self_assignment)
-  << LHSDeclRef->getType()
-  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
+  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
+  : diag::warn_self_assignment_overloaded)
+  << LHSDeclRef->getType() << LHSExpr->getSourceRange()

dblaikie wrote:
> Presumably this also changes how the warning is enabled? But that doesn't 
> seem to be tested in this patch?
What testing do you have in mind?
The `test/SemaCXX/warn-self-assign-overloaded.cpp` change was supposed to show 
how it is enabled..


Repository:
  rC Clang

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44882: [clangd] Implementation of workspace/symbol request

2018-04-23 Thread Marc-Andre Laperle via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE330637: [clangd] Implementation of workspace/symbol 
request (authored by malaperle, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44882?vs=143220&id=143626#toc

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44882

Files:
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/FindSymbols.cpp
  clangd/FindSymbols.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  clangd/SourceCode.cpp
  clangd/SourceCode.h
  clangd/index/SymbolCollector.cpp
  clangd/tool/ClangdMain.cpp
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test
  test/clangd/symbols.test
  unittests/clangd/CMakeLists.txt
  unittests/clangd/FindSymbolsTests.cpp
  unittests/clangd/SyncAPI.cpp
  unittests/clangd/SyncAPI.h

Index: unittests/clangd/FindSymbolsTests.cpp
===
--- unittests/clangd/FindSymbolsTests.cpp
+++ unittests/clangd/FindSymbolsTests.cpp
@@ -0,0 +1,247 @@
+//===-- FindSymbolsTests.cpp -*- C++ -*===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include "Annotations.h"
+#include "ClangdServer.h"
+#include "FindSymbols.h"
+#include "SyncAPI.h"
+#include "TestFS.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace clangd {
+
+namespace {
+
+using ::testing::AllOf;
+using ::testing::AnyOf;
+using ::testing::ElementsAre;
+using ::testing::IsEmpty;
+using ::testing::UnorderedElementsAre;
+
+class IgnoreDiagnostics : public DiagnosticsConsumer {
+  void onDiagnosticsReady(PathRef File,
+  std::vector Diagnostics) override {}
+};
+
+// GMock helpers for matching SymbolInfos items.
+MATCHER_P(Named, Name, "") { return arg.name == Name; }
+MATCHER_P(InContainer, ContainerName, "") {
+  return arg.containerName == ContainerName;
+}
+MATCHER_P(WithKind, Kind, "") { return arg.kind == Kind; }
+
+ClangdServer::Options optsForTests() {
+  auto ServerOpts = ClangdServer::optsForTest();
+  ServerOpts.BuildDynamicSymbolIndex = true;
+  return ServerOpts;
+}
+
+class WorkspaceSymbolsTest : public ::testing::Test {
+public:
+  WorkspaceSymbolsTest()
+  : Server(CDB, FSProvider, DiagConsumer, optsForTests()) {}
+
+protected:
+  MockFSProvider FSProvider;
+  MockCompilationDatabase CDB;
+  IgnoreDiagnostics DiagConsumer;
+  ClangdServer Server;
+  int Limit;
+
+  std::vector getSymbols(StringRef Query) {
+EXPECT_TRUE(Server.blockUntilIdleForTest()) << "Waiting for preamble";
+auto SymbolInfos = runWorkspaceSymbols(Server, Query, Limit);
+EXPECT_TRUE(bool(SymbolInfos)) << "workspaceSymbols returned an error";
+return *SymbolInfos;
+  }
+
+  void addFile(StringRef FileName, StringRef Contents) {
+auto Path = testPath(FileName);
+FSProvider.Files[Path] = Contents;
+Server.addDocument(Path, Contents);
+  }
+};
+
+} // namespace
+
+TEST_F(WorkspaceSymbolsTest, NoMacro) {
+  addFile("foo.cpp", R"cpp(
+  #define MACRO X
+  )cpp");
+
+  // Macros are not in the index.
+  EXPECT_THAT(getSymbols("macro"), IsEmpty());
+}
+
+TEST_F(WorkspaceSymbolsTest, NoLocals) {
+  addFile("foo.cpp", R"cpp(
+  void test(int FirstParam, int SecondParam) {
+struct LocalClass {};
+int local_var;
+  })cpp");
+  EXPECT_THAT(getSymbols("l"), IsEmpty());
+  EXPECT_THAT(getSymbols("p"), IsEmpty());
+}
+
+TEST_F(WorkspaceSymbolsTest, Globals) {
+  addFile("foo.h", R"cpp(
+  int global_var;
+
+  int global_func();
+
+  struct GlobalStruct {};)cpp");
+  addFile("foo.cpp", R"cpp(
+  #include "foo.h"
+  )cpp");
+  EXPECT_THAT(getSymbols("global"),
+  UnorderedElementsAre(AllOf(Named("GlobalStruct"), InContainer(""),
+ WithKind(SymbolKind::Struct)),
+   AllOf(Named("global_func"), InContainer(""),
+ WithKind(SymbolKind::Function)),
+   AllOf(Named("global_var"), InContainer(""),
+ WithKind(SymbolKind::Variable;
+}
+
+TEST_F(WorkspaceSymbolsTest, Unnamed) {
+  addFile("foo.h", R"cpp(
+  struct {
+int InUnnamed;
+  } UnnamedStruct;)cpp");
+  addFile("foo.cpp", R"cpp(
+  #include "foo.h"
+  )cpp");
+  EXPECT_THAT(getSymbols("UnnamedStruct"),
+  ElementsAre(AllOf(Named("UnnamedStruct"),
+WithKind(SymbolKind::Variable;
+  EXPECT_THAT(getSymbols("InUnnamed"), IsEmpty());
+}
+
+TES

[clang-tools-extra] r330637 - [clangd] Implementation of workspace/symbol request

2018-04-23 Thread Marc-Andre Laperle via cfe-commits
Author: malaperle
Date: Mon Apr 23 13:00:52 2018
New Revision: 330637

URL: http://llvm.org/viewvc/llvm-project?rev=330637&view=rev
Log:
[clangd] Implementation of workspace/symbol request

Summary:
This is a basic implementation of the "workspace/symbol" request which is
used to find symbols by a string query. Since this is similar to code completion
in terms of result, this implementation reuses the "fuzzyFind" in order to get
matches. For now, the scoring algorithm is the same as code completion and
improvements could be done in the future.

The index model doesn't contain quite enough symbols for this to cover
common symbols like methods, enum class enumerators, functions in unamed
namespaces, etc. The index model will be augmented separately to achieve this.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

Subscribers: jkorous, hokein, simark, sammccall, klimek, mgorny, ilya-biryukov, 
mgrang, jkorous-apple, ioeric, MaskRay, cfe-commits

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

Added:
clang-tools-extra/trunk/clangd/FindSymbols.cpp
clang-tools-extra/trunk/clangd/FindSymbols.h
clang-tools-extra/trunk/test/clangd/symbols.test
clang-tools-extra/trunk/unittests/clangd/FindSymbolsTests.cpp
Modified:
clang-tools-extra/trunk/clangd/CMakeLists.txt
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.h
clang-tools-extra/trunk/clangd/Protocol.cpp
clang-tools-extra/trunk/clangd/Protocol.h
clang-tools-extra/trunk/clangd/ProtocolHandlers.cpp
clang-tools-extra/trunk/clangd/ProtocolHandlers.h
clang-tools-extra/trunk/clangd/SourceCode.cpp
clang-tools-extra/trunk/clangd/SourceCode.h
clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
clang-tools-extra/trunk/test/clangd/initialize-params-invalid.test
clang-tools-extra/trunk/test/clangd/initialize-params.test
clang-tools-extra/trunk/unittests/clangd/CMakeLists.txt
clang-tools-extra/trunk/unittests/clangd/SyncAPI.cpp
clang-tools-extra/trunk/unittests/clangd/SyncAPI.h

Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=330637&r1=330636&r2=330637&view=diff
==
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt Mon Apr 23 13:00:52 2018
@@ -19,6 +19,7 @@ add_clang_library(clangDaemon
   Context.cpp
   Diagnostics.cpp
   DraftStore.cpp
+  FindSymbols.cpp
   FuzzyMatch.cpp
   GlobalCompilationDatabase.cpp
   Headers.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=330637&r1=330636&r2=330637&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Mon Apr 23 13:00:52 2018
@@ -86,6 +86,14 @@ std::vector replacementsToEdit
   return Edits;
 }
 
+SymbolKindBitset defaultSymbolKinds() {
+  SymbolKindBitset Defaults;
+  for (size_t I = SymbolKindMin; I <= static_cast(SymbolKind::Array);
+   ++I)
+Defaults.set(I);
+  return Defaults;
+}
+
 } // namespace
 
 void ClangdLSPServer::onInitialize(InitializeParams &Params) {
@@ -97,6 +105,14 @@ void ClangdLSPServer::onInitialize(Initi
   CCOpts.EnableSnippets =
   
Params.capabilities.textDocument.completion.completionItem.snippetSupport;
 
+  if (Params.capabilities.workspace && Params.capabilities.workspace->symbol &&
+  Params.capabilities.workspace->symbol->symbolKind) {
+for (SymbolKind Kind :
+ *Params.capabilities.workspace->symbol->symbolKind->valueSet) {
+  SupportedSymbolKinds.set(static_cast(Kind));
+}
+  }
+
   reply(json::obj{
   {{"capabilities",
 json::obj{
@@ -122,6 +138,7 @@ void ClangdLSPServer::onInitialize(Initi
 {"documentHighlightProvider", true},
 {"hoverProvider", true},
 {"renameProvider", true},
+{"workspaceSymbolProvider", true},
 {"executeCommandProvider",
  json::obj{
  {"commands",
@@ -245,6 +262,20 @@ void ClangdLSPServer::onCommand(ExecuteC
   }
 }
 
+void ClangdLSPServer::onWorkspaceSymbol(WorkspaceSymbolParams &Params) {
+  Server.workspaceSymbols(
+  Params.query, CCOpts.Limit,
+  [this](llvm::Expected> Items) {
+if (!Items)
+  return replyError(ErrorCode::InternalError,
+llvm::toString(Items.takeError()));
+for (auto &Sym : *Items)
+  Sym.kind = adjustKindToCapability(Sym.kind, SupportedSymbolKinds);
+
+   

[PATCH] D45766: [Sema] Add -Wno-self-assign-overloaded

2018-04-23 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:11527-11528
 
-  S.Diag(OpLoc, diag::warn_self_assignment)
-  << LHSDeclRef->getType()
-  << LHSExpr->getSourceRange() << RHSExpr->getSourceRange();
+  S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
+  : diag::warn_self_assignment_overloaded)
+  << LHSDeclRef->getType() << LHSExpr->getSourceRange()

Presumably this also changes how the warning is enabled? But that doesn't seem 
to be tested in this patch?


Repository:
  rC Clang

https://reviews.llvm.org/D45766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45920: [analyzer] Move RangeSet related declarations into the RangedConstraintManager header.

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D45920#1074437, @george.karpenkov wrote:

> > I could also move RangedConstraintManager.h under include
>
> We probably don't want to do that: currently it can only be imported by files 
> in `Core`, and we probably should keep it that way


I believe that many of our warning messages could be improved by presenting 
ranges to the user. Eg., `ArrayBoundChecker` could benefit from something like 
"index is within range [11, 12] and array size is equal to 10", and then a 
visitor that explains all the places in which the index was constrained to a 
smaller range. So in long term i'll be in favor of providing a way of 
explaining constraints to the users, which means partially exposing constraint 
manager internals to the checkers in a certain way (not necessarily *this* 
way). So for now i have no opinion on this issue :)


Repository:
  rC Clang

https://reviews.llvm.org/D45920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r330636 - Revert "[libcxx] implement declarations based on P0214R7."

2018-04-23 Thread Tim Shen via cfe-commits
Author: timshen
Date: Mon Apr 23 12:56:20 2018
New Revision: 330636

URL: http://llvm.org/viewvc/llvm-project?rev=330636&view=rev
Log:
Revert "[libcxx] implement  declarations based on P0214R7."

This reverts commit r330627.

This causes several bots to freak out.

Removed:
libcxx/trunk/include/experimental/simd
libcxx/trunk/test/std/experimental/simd/
Modified:
libcxx/trunk/include/experimental/__config
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp

Modified: libcxx/trunk/include/experimental/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/__config?rev=330636&r1=330635&r2=330636&view=diff
==
--- libcxx/trunk/include/experimental/__config (original)
+++ libcxx/trunk/include/experimental/__config Mon Apr 23 12:56:20 2018
@@ -54,16 +54,4 @@
 
 #define _VSTD_FS ::std::experimental::filesystem::v1
 
-#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 {
-
-#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD \
-} _LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD namespace simd_abi {
-
-#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
-} _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
-
 #endif

Removed: libcxx/trunk/include/experimental/simd
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/simd?rev=330635&view=auto
==
--- libcxx/trunk/include/experimental/simd (original)
+++ libcxx/trunk/include/experimental/simd (removed)
@@ -1,1285 +0,0 @@
-// -*- C++ -*-
-//===--- simd 
-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-#ifndef _LIBCPP_EXPERIMENTAL_SIMD
-#define _LIBCPP_EXPERIMENTAL_SIMD
-
-/*
-experimental/simd synopsis
-
-namespace std::experimental {
-
-inline namespace parallelism_v2 {
-
-namespace simd_abi {
-
-struct scalar {};
-template  struct fixed_size {};
-template  inline constexpr int max_fixed_size = 
implementation-defined;
-template  using compatible = implementation-defined;
-template  using native = implementation-defined;
-
-} // simd_abi
-
-struct element_aligned_tag {};
-struct vector_aligned_tag {};
-template  struct overaligned_tag {};
-inline constexpr element_aligned_tag element_aligned{};
-inline constexpr vector_aligned_tag vector_aligned{};
-template  inline constexpr overaligned_tag overaligned{};
-
-// traits [simd.traits]
-template  struct is_abi_tag;
-template  inline constexpr bool is_abi_tag_v = is_abi_tag::value;
-
-template  struct is_simd;
-template  inline constexpr bool is_simd_v = is_simd::value;
-
-template  struct is_simd_mask;
-template  inline constexpr bool is_simd_mask_v = 
is_simd_mask::value;
-
-template  struct is_simd_flag_type;
-template  inline constexpr bool is_simd_flag_type_v = 
is_simd_flag_type::value;
-
-template  struct abi_for_size { using type = see below; };
-template  using abi_for_size_t = typename abi_for_size::type;
-
-template > struct simd_size;
-template >
-inline constexpr size_t simd_size_v = simd_size::value;
-
-template  struct memory_alignment;
-template 
-inline constexpr size_t memory_alignment_v = memory_alignment::value;
-
-// class template simd [simd.class]
-template > class simd;
-template  using native_simd = simd>;
-template  using fixed_size_simd = simd>;
-
-// class template simd_mask [simd.mask.class]
-template > class simd_mask;
-template  using native_simd_mask = simd_mask>;
-template  using fixed_size_simd_mask = simd_mask>;
-
-// casts [simd.casts]
-template  see below simd_cast(const simd&);
-template  see below static_simd_cast(const 
simd&);
-
-template 
-fixed_size_simd> to_fixed_size(const simd&) 
noexcept;
-template 
-fixed_size_simd_mask> to_fixed_size(const simd_mask&) noexcept;
-template  native_simd to_native(const fixed_size_simd&) noexcept;
-template 
-native_simd_mask to_native(const fixed_size_simd_mask> &) noexcept;
-template  simd to_compatible(const fixed_size_simd&) noexcept;
-template  simd_mask to_compatible(const 
fixed_size_simd_mask&) noexcept;
-
-template 
-tuple>...> split(const simd&);
-template 
-tuple>...> split(const simd_mask&);
-template 
-array / V::size()> split(
-const simd&);
-template 
-array / V::size()> split(
-const simd_mask&);
-
-template 
-simd + ...)>> concat(const simd&...);
-template 
-simd_mask + ...)>> concat(const 
simd_mask&...);
-
-// reductions [simd.mask.reductions]
-template  bool all_of(const simd_mask&) noexcept;
-template  bool any_of(

[PATCH] D45015: [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.

2018-04-23 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

In https://reviews.llvm.org/D45015#1064930, @EricWF wrote:

> In https://reviews.llvm.org/D45015#1064922, @vsapsai wrote:
>
> > Another approach is `__has_feature` but I don't think it is applicable in 
> > this case.
> >
> > Is there a way right now to detect that aligned allocation is supported by 
> > clang, regardless of link time? Asking to make sure we are consistent.
>
>
> There is a C++ feature test macro, as specified by the standard, 
> `__cpp_aligned_new`.  But I'm not sure how to be consistent with that.


After more thinking I believe a predefined macro is the best option. And in 
spirit it is consistent with SD-6: SG10 Feature Test Recommendations 
.

As for the naming, I see it is consistent with `-faligned-alloc-unavailable` 
but for me it is hard to tell immediately if "unavailable" means "unsupported 
at all" or "supported but unavailable on the target". Maybe it is just me and 
others don't have such problem but probably including "runtime" in the macro 
name would help. Something like `__ALIGNED_ALLOCATION_UNAVAILABLE_RUNTIME__`.

For the overall aligned allocation plan overall. We also need to keep in mind 
users who provide their own aligned allocation / deallocation functions, so 
they can still do that. So far everything seems to be OK but we need to be 
careful.




Comment at: lib/Frontend/InitPreprocessor.cpp:1059-1060
 
+  if (!LangOpts.AlignedAllocation || LangOpts.AlignedAllocationUnavailable)
+Builder.defineMacro("__ALIGNED_ALLOCATION_UNAVAILABLE__");
+

Don't know what the macro will be in the end, please consider adding a comment 
clarifying runtime availability.



Comment at: test/Preprocessor/predefined-macros.c:288
+// RUN: %clang_cc1 %s -x c++ -E -dM -faligned-allocation 
-faligned-alloc-unavailable  \
+// RUN: | FileCheck %s -match-full-lines 
-check-prefix=CHECK-ALIGNED-ALLOC-UNAVAILABLE
+

Would it be useful to test `-fno-aligned-allocation` too? Extensive testing in 
different combinations doesn't add much value but `-std=c++17 
-fno-aligned-allocation` can be useful.


Repository:
  rC Clang

https://reviews.llvm.org/D45015



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 143624.
ahatanak marked 2 inline comments as done.
ahatanak added a comment.

Address review comments.


Repository:
  rC Clang

https://reviews.llvm.org/D45382

Files:
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
  test/CodeGenObjCXX/arc-special-member-functions.mm
  test/CodeGenObjCXX/lambda-expressions.mm

Index: test/CodeGenObjCXX/lambda-expressions.mm
===
--- test/CodeGenObjCXX/lambda-expressions.mm
+++ test/CodeGenObjCXX/lambda-expressions.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks -fobjc-arc | FileCheck -check-prefix=ARC %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks -fobjc-arc -fobjc-runtime-has-weak -DWEAK_SUPPORTED | FileCheck -check-prefix=ARC %s
 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks | FileCheck -check-prefix=MRC %s
 
 typedef int (^fp)();
@@ -138,5 +138,31 @@
 }
 @end
 
+// Check that the delegating invoke function doesn't destruct the Weak object
+// that is passed.
+
+// ARC-LABEL: define internal void @"_ZZN14LambdaDelegate4testEvEN3$_58__invokeENS_4WeakE"(
+// ARC: call void @"_ZZN14LambdaDelegate4testEvENK3$_5clENS_4WeakE"(
+// ARC-NEXT: ret void
+
+// ARC-LABEL: define internal void @"_ZZN14LambdaDelegate4testEvENK3$_5clENS_4WeakE"(
+// ARC: call void @_ZN14LambdaDelegate4WeakD1Ev(
+
+#ifdef WEAK_SUPPORTED
+
+namespace LambdaDelegate {
+
+struct Weak {
+  __weak id x;
+};
+
+void test() {
+  void (*p)(Weak) = [](Weak a) { };
+}
+
+};
+
+#endif
+
 // ARC: attributes [[NUW]] = { noinline nounwind{{.*}} }
 // MRC: attributes [[NUW]] = { noinline nounwind{{.*}} }
Index: test/CodeGenObjCXX/arc-special-member-functions.mm
===
--- test/CodeGenObjCXX/arc-special-member-functions.mm
+++ test/CodeGenObjCXX/arc-special-member-functions.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s
 
 struct ObjCMember {
   id member;
@@ -12,6 +12,59 @@
   int (^bp)(int);
 };
 
+// CHECK: %[[STRUCT_CONTAINSWEAK:.*]] = type { %[[STRUCT_WEAK:.*]] }
+// CHECK: %[[STRUCT_WEAK]] = type { i8* }
+
+// The Weak object that is passed is destructed in this constructor.
+
+// CHECK: define void @_ZN12ContainsWeakC2E4Weak(
+// CHECK: call void @_ZN4WeakC1ERKS_(
+// CHECK: call void @_ZN4WeakD1Ev(
+
+// Check that the Weak object passed to this constructor is not destructed after
+// the delegate constructor is called.
+
+// CHECK: define void @_ZN12ContainsWeakC1E4Weak(
+// CHECK: call void @_ZN12ContainsWeakC2E4Weak(
+// CHECK-NEXT: ret void
+
+struct Weak {
+  Weak(id);
+  __weak id x;
+};
+
+struct ContainsWeak {
+  ContainsWeak(Weak);
+  Weak w;
+};
+
+ContainsWeak::ContainsWeak(Weak a) : w(a) {}
+
+// The Weak object that is passed is destructed in this constructor.
+
+// CHECK: define void @_ZN4BaseC2E4Weak(
+// CHECK: call void @_ZN4WeakD1Ev(
+// CHECK: ret void
+
+// Check that the Weak object passed to this constructor is not destructed after
+// the delegate constructor is called.
+
+// CHECK: define linkonce_odr void @_ZN7DerivedCI14BaseE4Weak(
+// CHECK: call void @_ZN7DerivedCI24BaseE4Weak(
+// CHECK-NEXT: ret void
+
+struct Base {
+  Base(Weak);
+};
+
+Base::Base(Weak a) {}
+
+struct Derived : Base {
+  using Base::Base;
+};
+
+Derived d(Weak(0));
+
 // CHECK-LABEL: define void @_Z42test_ObjCMember_default_construct_destructv(
 void test_ObjCMember_default_construct_destruct() {
   // CHECK: call void @_ZN10ObjCMemberC1Ev
@@ -111,6 +164,13 @@
 // CHECK-NEXT: call void @objc_release(i8* [[T7]])
 // CHECK-NEXT: ret
 
+// Check that the Weak object passed to this constructor is not destructed after
+// the delegate constructor is called.
+
+// CHECK: define linkonce_odr void @_ZN7DerivedCI24BaseE4Weak(
+// CHECK: call void @_ZN4BaseC2E4Weak(
+// CHECK-NEXT: ret void
+
 // Implicitly-generated default constructor for ObjCMember
 // CHECK-LABEL: define linkonce_odr void @_ZN10ObjCMemberC2Ev
 // CHECK-NOT: objc_release
Index: test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
===
--- test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
+++ test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
@@ -10,6 +10,17 @@
   // CHECK-NEXT: ret i8* [[T2]]
 }
 
+// Check that the delegating block invoke function doesn't destruct the Weak
+// object that is passed.
+
+// CHECK-LABEL: define internal void @___Z8testWeakv_block_invoke(
+// CHECK: call void @"_ZZ8testWeakvENK3$_2clE4W

r330634 - [OPENMP] Formatting and code improvement, NFC.

2018-04-23 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Mon Apr 23 12:53:05 2018
New Revision: 330634

URL: http://llvm.org/viewvc/llvm-project?rev=330634&view=rev
Log:
[OPENMP] Formatting and code improvement, NFC.

Modified:
cfe/trunk/lib/Parse/ParseOpenMP.cpp

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=330634&r1=330633&r2=330634&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Mon Apr 23 12:53:05 2018
@@ -80,51 +80,56 @@ static unsigned getOpenMPDirectiveKindEx
   .Default(OMPD_unknown);
 }
 
-static OpenMPDirectiveKind ParseOpenMPDirectiveKind(Parser &P) {
+static OpenMPDirectiveKind parseOpenMPDirectiveKind(Parser &P) {
   // Array of foldings: F[i][0] F[i][1] ===> F[i][2].
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
   static const unsigned F[][3] = {
-{ OMPD_cancellation, OMPD_point, OMPD_cancellation_point },
-{ OMPD_declare, OMPD_reduction, OMPD_declare_reduction },
-{ OMPD_declare, OMPD_simd, OMPD_declare_simd },
-{ OMPD_declare, OMPD_target, OMPD_declare_target },
-{ OMPD_distribute, OMPD_parallel, OMPD_distribute_parallel },
-{ OMPD_distribute_parallel, OMPD_for, OMPD_distribute_parallel_for },
-{ OMPD_distribute_parallel_for, OMPD_simd, 
-  OMPD_distribute_parallel_for_simd },
-{ OMPD_distribute, OMPD_simd, OMPD_distribute_simd },
-{ OMPD_end, OMPD_declare, OMPD_end_declare },
-{ OMPD_end_declare, OMPD_target, OMPD_end_declare_target },
-{ OMPD_target, OMPD_data, OMPD_target_data },
-{ OMPD_target, OMPD_enter, OMPD_target_enter },
-{ OMPD_target, OMPD_exit, OMPD_target_exit },
-{ OMPD_target, OMPD_update, OMPD_target_update },
-{ OMPD_target_enter, OMPD_data, OMPD_target_enter_data },
-{ OMPD_target_exit, OMPD_data, OMPD_target_exit_data },
-{ OMPD_for, OMPD_simd, OMPD_for_simd },
-{ OMPD_parallel, OMPD_for, OMPD_parallel_for },
-{ OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd },
-{ OMPD_parallel, OMPD_sections, OMPD_parallel_sections },
-{ OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd },
-{ OMPD_target, OMPD_parallel, OMPD_target_parallel },
-{ OMPD_target, OMPD_simd, OMPD_target_simd },
-{ OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for },
-{ OMPD_target_parallel_for, OMPD_simd, OMPD_target_parallel_for_simd },
-{ OMPD_teams, OMPD_distribute, OMPD_teams_distribute },
-{ OMPD_teams_distribute, OMPD_simd, OMPD_teams_distribute_simd },
-{ OMPD_teams_distribute, OMPD_parallel, OMPD_teams_distribute_parallel },
-{ OMPD_teams_distribute_parallel, OMPD_for, 
OMPD_teams_distribute_parallel_for },
-{ OMPD_teams_distribute_parallel_for, OMPD_simd, 
OMPD_teams_distribute_parallel_for_simd },
-{ OMPD_target, OMPD_teams, OMPD_target_teams },
-{ OMPD_target_teams, OMPD_distribute, OMPD_target_teams_distribute },
-{ OMPD_target_teams_distribute, OMPD_parallel, 
OMPD_target_teams_distribute_parallel },
-{ OMPD_target_teams_distribute, OMPD_simd, 
OMPD_target_teams_distribute_simd },
-{ OMPD_target_teams_distribute_parallel, OMPD_for, 
OMPD_target_teams_distribute_parallel_for },
-{ OMPD_target_teams_distribute_parallel_for, OMPD_simd, 
OMPD_target_teams_distribute_parallel_for_simd }
-  };
+  {OMPD_cancellation, OMPD_point, OMPD_cancellation_point},
+  {OMPD_declare, OMPD_reduction, OMPD_declare_reduction},
+  {OMPD_declare, OMPD_simd, OMPD_declare_simd},
+  {OMPD_declare, OMPD_target, OMPD_declare_target},
+  {OMPD_distribute, OMPD_parallel, OMPD_distribute_parallel},
+  {OMPD_distribute_parallel, OMPD_for, OMPD_distribute_parallel_for},
+  {OMPD_distribute_parallel_for, OMPD_simd,
+   OMPD_distribute_parallel_for_simd},
+  {OMPD_distribute, OMPD_simd, OMPD_distribute_simd},
+  {OMPD_end, OMPD_declare, OMPD_end_declare},
+  {OMPD_end_declare, OMPD_target, OMPD_end_declare_target},
+  {OMPD_target, OMPD_data, OMPD_target_data},
+  {OMPD_target, OMPD_enter, OMPD_target_enter},
+  {OMPD_target, OMPD_exit, OMPD_target_exit},
+  {OMPD_target, OMPD_update, OMPD_target_update},
+  {OMPD_target_enter, OMPD_data, OMPD_target_enter_data},
+  {OMPD_target_exit, OMPD_data, OMPD_target_exit_data},
+  {OMPD_for, OMPD_simd, OMPD_for_simd},
+  {OMPD_parallel, OMPD_for, OMPD_parallel_for},
+  {OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd},
+  {OMPD_parallel, OMPD_sections, OMPD_parallel_sections},
+  {OMPD_taskloop, OMPD_simd, OMPD_taskloop_simd},
+  {OMPD_target, OMPD_parallel, OMPD_target_parallel},
+  {OMPD_target, OMPD_simd, OMPD_target_simd},
+  {OMPD_target_parallel, OMPD_for, OMPD_target_parallel_for},
+  {OMPD_target_parallel_for, OMPD_simd, OMPD_target_parallel_for_simd},
+  {OMPD_team

[PATCH] D45839: [analyzer] Add support for WebKit "unified sources".

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked 2 inline comments as done.
NoQ added inline comments.



Comment at: 
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h:145-147
+  if (Name.endswith_lower(".c") || Name.endswith_lower(".cpp") ||
+  Name.endswith_lower(".cc") || Name.endswith_lower(".cxx") ||
+  Name.endswith_lower(".m") || Name.endswith_lower(".mm")) {

george.karpenkov wrote:
> NoQ wrote:
> > majnemer wrote:
> > > C++ source code is also found in files which end in .C, this code will 
> > > match against strange file endings like .cXx and .mM
> > > 
> > > I think the above logic should be changed to match 
> > > https://github.com/llvm-mirror/clang/blob/master/lib/Frontend/FrontendOptions.cpp#L27
> > Aha, yeah, thanks, that's the place i was looking for.
> Why not just use the included function then? It's static.
Because it has a different purpose:
> `for now it doesn't discriminate between code and header files`


https://reviews.llvm.org/D45839



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45517: [analyzer] WIP: False positive refutation with Z3

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D45517#1074422, @rnkovacs wrote:

> In https://reviews.llvm.org/D45517#1074057, @NoQ wrote:
>
> > So, yeah, that's a good optimization that we're not invoking the solver on 
> > every node. But i don't think we should focus on improving this 
> > optimization further; instead, i think the next obvious step here is to 
> > implement it in such a way that we only needed to call the solver //once// 
> > for every report. We could simply collect all constraints from all states 
> > along the path and put them into the solver all together. This will work 
> > because symbols are not mutable and they don't reincarnate.
>
>
> Won't collecting all constraints and solving a ~100ish equations at once take 
> a long time? Maybe the timeout limit for Z3 will need to be slightly 
> increased for refutation then.


Well, in the worst case we would still be able to split our full system of 
equations into smaller chunks, and it'd most likely still be better than 
solving roughly-the-same system of equations ~100ish times.


https://reviews.llvm.org/D45517



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Nico Weber via cfe-commits
On Mon, Apr 23, 2018 at 11:53 AM, Andrew V. Tischenko via Phabricator via
cfe-commits  wrote:

> avt77 added a comment.
>
> In https://reviews.llvm.org/D45619#1075437, @bjope wrote:
>
> > I can't see that it has been reverted.
> >  But I guess that the table maybe is sorted based on time spent in each
> pass? So that is why it might be sorted differently on different buildbots
> (or when using pipe etc).
> >
> > So I think a quick fix is to add -DAG to the checks that can be reorder
> and submit that fix.
>
>
> I don't see revert as well. But I did the following:
>
> svn merge -c -330571 .
>

That only prepares a revert locally. You need to run `svn commit` after
that to actually land the revert.


>
> And everything was OK.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45619
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45932: [clang-tidy][modernize-raw-string-literal] Don't replace upper ASCII with raw literals

2018-04-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments.



Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:44
+char const *const MultibyteSnowman("\xE2\x98\x83");
+// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}}
 

IIRC, the default behavior is that if no matching CHECK-FIXES line is found, 
then it is considered a failure.  Have you tried your test code without your 
change to verify that this is the case?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45932



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330633 - Fix typo in comment.

2018-04-23 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Apr 23 12:22:52 2018
New Revision: 330633

URL: http://llvm.org/viewvc/llvm-project?rev=330633&view=rev
Log:
Fix typo in comment.

Modified:
cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=330633&r1=330632&r2=330633&view=diff
==
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Mon Apr 23 12:22:52 2018
@@ -67,7 +67,7 @@ option(LIBCLANG_BUILD_STATIC
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports)
 
 if(MSVC)
-  # Avoid LNK4197 not to spceify libclang.def here.
+  # Avoid LNK4197 by not specifying libclang.exports here.
   # Each functions is exported as "dllexport" in include/clang-c.
   # KB835326
   set(LLVM_EXPORTED_SYMBOL_FILE)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45920: [analyzer] Move RangeSet related declarations into the RangedConstraintManager header.

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D45920#1074439, @george.karpenkov wrote:

> Another approach would be to instead teach `RangedConstraintManager` to 
> convert it's constraints to Z3. That would be an unwanted dependency, but the 
> change would be much smaller, and the internals of the solver would not have 
> to be exposed. @NoQ thoughts?


Dunno. Obviously, the adaptor code between the constraint manager and the 
refutation manager (i think the word "solver" is causing confusion now) would 
have to access internals of both managers, so the situation is quite symmetric.


Repository:
  rC Clang

https://reviews.llvm.org/D45920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45920: [analyzer] Move RangeSet related declarations into the RangedConstraintManager header.

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Core/RangedConstraintManager.h:130
+template <>
+struct ProgramStateTrait
+  : public ProgramStatePartialTrait {

george.karpenkov wrote:
> Why not also `REGISTER_TRAIT_WITH_PROGRAMSTATE` here?
```
   33   /// The macro should not be used inside namespaces, or for traits that 
must
   34   /// be accessible from more than one translation unit.
   35   #define REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, Type) \
   36   ...
```
I don't remember why.


Repository:
  rC Clang

https://reviews.llvm.org/D45920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45532: [StaticAnalyzer] Checker to find uninitialized fields after a constructor call

2018-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Guys, what do you think about a checker that warns on uninitialized fields only 
when at least one field is initialized? I'd be much more confident about 
turning such check on by default. We can still keep a `pedantic` version.

> I can say with confidence that CodeChecker does not break if the same 
> category name is used by two different analyzers. Does the same stand for 
> XCode / Scan-Build?

XCode and Scan-Build only support one analyzer, so it won't be a problem (at 
least not until more analyzers get supported).

But in general if we do overlapping names, we must be super sure that they mean 
the same thing in both analyzers, so that we didn't end up with a user 
interface in which one of the relatively common task would be to enable 
clang-tidy "bugprone" checkers and disable static analyzer "bugprone" checkers 
but the user would have to list all checkers by name in order to accomplish 
that because they all stay in the same package.


https://reviews.llvm.org/D45532



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45597: [Driver] Android triples are not aliases for other triples.

2018-04-23 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

Ping.


Repository:
  rC Clang

https://reviews.llvm.org/D45597



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45292: [Driver] Obey computed sysroot when finding libc++ headers.

2018-04-23 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

Ping.


Repository:
  rC Clang

https://reviews.llvm.org/D45292



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45291: [Driver] Infer Android sysroot location.

2018-04-23 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

Ping.


Repository:
  rC Clang

https://reviews.llvm.org/D45291



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41240: [Solaris] __float128 is supported on Solaris/x86

2018-04-23 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Things are different for a libgcc-based toolchain and a compiler-rt based 
toolchain.


Repository:
  rL LLVM

https://reviews.llvm.org/D41240



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2018-04-23 Thread Tim Shen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330627: [libcxx] implement  
declarations based on P0214R7. (authored by timshen, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D41148?vs=143610&id=143611#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41148

Files:
  libcxx/trunk/include/experimental/__config
  libcxx/trunk/include/experimental/simd
  libcxx/trunk/include/module.modulemap
  libcxx/trunk/test/libcxx/double_include.sh.cpp
  libcxx/trunk/test/std/experimental/simd/nothing_to_do.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.cons/genertor.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp
  libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp

Index: libcxx/trunk/include/module.modulemap
===
--- libcxx/trunk/include/module.modulemap
+++ libcxx/trunk/include/module.modulemap
@@ -550,6 +550,10 @@
   header "experimental/regex"
   export *
 }
+module simd {
+  header "experimental/simd"
+  export *
+}
 module set {
   header "experimental/set"
   export *
Index: libcxx/trunk/include/experimental/simd
===
--- libcxx/trunk/include/experimental/simd
+++ libcxx/trunk/include/experimental/simd
@@ -0,0 +1,1285 @@
+// -*- C++ -*-
+//===--- simd -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef _LIBCPP_EXPERIMENTAL_SIMD
+#define _LIBCPP_EXPERIMENTAL_SIMD
+
+/*
+experimental/simd synopsis
+
+namespace std::experimental {
+
+inline namespace parallelism_v2 {
+
+namespace simd_abi {
+
+struct scalar {};
+template  struct fixed_size {};
+template  inline constexpr int max_fixed_size = implementation-defined;
+template  using compatible = implementation-defined;
+template  using native = implementation-defined;
+
+} // simd_abi
+
+struct element_aligned_tag {};
+struct vector_aligned_tag {};
+template  struct overaligned_tag {};
+inline constexpr element_aligned_tag element_aligned{};
+inline constexpr vector_aligned_tag vector_aligned{};
+template  inline constexpr overaligned_tag overaligned{};
+
+// traits [simd.traits]
+template  struct is_abi_tag;
+template  inline constexpr bool is_abi_tag_v = is_abi_tag::value;
+
+template  struct is_simd;
+template  inline constexpr bool is_simd_v = is_simd::value;
+
+template  struct is_simd_mask;
+template  inline constexpr bool is_simd_mask_v = is_simd_mask::value;
+
+template  struct is_simd_flag_type;
+template  inline constexpr bool is_simd_flag_type_v = is_simd_flag_type::value;
+
+template  struct abi_for_size { using type = see below; };
+template  using abi_for_size_t = typename abi_for_size::type;
+
+template > struct simd_size;
+template >
+inline constexpr size_t simd_size_v = simd_size::value;
+
+template  struct memory_alignment;
+template 
+inline constexpr size_t memory_alignment_v = memory_alignment::value;
+
+// class template simd [simd.class]
+template > class simd;
+template  using native_simd = simd>;
+template  using fixed_size_simd = simd>;
+
+// class template simd_mask [simd.mask.class]
+template > class simd_mask;
+template  using native_simd_mask = simd_mask>;
+template  using fixed_size_simd_mask = simd_mask>;
+
+// casts [simd.casts]
+template  see below simd_cast(const simd&);
+template  see below static_simd_cast(const simd&);
+
+template 
+fixed_size_simd> to_fixed_size(const simd&) noexcept;
+template 
+fixed_size_simd_mask> to_fixed_size(const simd_mask&) noexcept;
+template  native_simd to_native(const fixed_size_simd&) noexcept;
+template 
+native_simd_mask to_native(const fixed_size_simd_mask> &) noexcept;
+template  simd to_compatible(const fixed_size_simd&) noexcept;
+template  simd_mask to_compatible(const fixed_size_simd_mask&) noexcept;
+
+template 
+tuple>...> split(const simd&);
+template 
+tuple>...> split(const simd_mask&);
+template 
+array / V::size()> split(
+const simd&);
+template 
+array / V::size()> split(
+const simd_mask&);
+
+template 
+simd + ...)>> concat(const simd&...);
+template 
+simd_mask + ...)>> con

[libcxx] r330627 - [libcxx] implement declarations based on P0214R7.

2018-04-23 Thread Tim Shen via cfe-commits
Author: timshen
Date: Mon Apr 23 11:47:07 2018
New Revision: 330627

URL: http://llvm.org/viewvc/llvm-project?rev=330627&view=rev
Log:
[libcxx] implement  declarations based on P0214R7.

Summary:
The patch includes all declarations, and also implements the following features:
* ABI.
* narrowing-conversion related SFIANE, including simd<> ctors and 
(static_)simd_cast.

Reviewers: mclow.lists, EricWF

Subscribers: lichray, sanjoy, MaskRay, cfe-commits

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

Added:
libcxx/trunk/include/experimental/simd
libcxx/trunk/test/std/experimental/simd/
libcxx/trunk/test/std/experimental/simd/nothing_to_do.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.casts/
libcxx/trunk/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.cons/
libcxx/trunk/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.cons/genertor.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/
libcxx/trunk/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd.pass.cpp

libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp
libcxx/trunk/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
Modified:
libcxx/trunk/include/experimental/__config
libcxx/trunk/include/module.modulemap
libcxx/trunk/test/libcxx/double_include.sh.cpp

Modified: libcxx/trunk/include/experimental/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/__config?rev=330627&r1=330626&r2=330627&view=diff
==
--- libcxx/trunk/include/experimental/__config (original)
+++ libcxx/trunk/include/experimental/__config Mon Apr 23 11:47:07 2018
@@ -54,4 +54,16 @@
 
 #define _VSTD_FS ::std::experimental::filesystem::v1
 
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD \
+} _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD namespace simd_abi {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
+} _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
+
 #endif

Added: libcxx/trunk/include/experimental/simd
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/simd?rev=330627&view=auto
==
--- libcxx/trunk/include/experimental/simd (added)
+++ libcxx/trunk/include/experimental/simd Mon Apr 23 11:47:07 2018
@@ -0,0 +1,1285 @@
+// -*- C++ -*-
+//===--- simd 
-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef _LIBCPP_EXPERIMENTAL_SIMD
+#define _LIBCPP_EXPERIMENTAL_SIMD
+
+/*
+experimental/simd synopsis
+
+namespace std::experimental {
+
+inline namespace parallelism_v2 {
+
+namespace simd_abi {
+
+struct scalar {};
+template  struct fixed_size {};
+template  inline constexpr int max_fixed_size = 
implementation-defined;
+template  using compatible = implementation-defined;
+template  using native = implementation-defined;
+
+} // simd_abi
+
+struct element_aligned_tag {};
+struct vector_aligned_tag {};
+template  struct overaligned_tag {};
+inline constexpr element_aligned_tag element_aligned{};
+inline constexpr vector_aligned_tag vector_aligned{};
+template  inline constexpr overaligned_tag overaligned{};
+
+// traits [simd.traits]
+template  struct is_abi_tag;
+template  inline constexpr bool is_abi_tag_v = is_abi_tag::value;
+
+template  struct is_simd;
+template  inline constexpr bool is_simd_v = is_simd::value;
+
+template  struct is_simd_mask;
+template  inline constexpr bool is_simd_mask_v = 
is_simd_mask::value;
+
+template  struct is_simd_flag_type;
+template  inline constexpr bool is_simd_flag_type_v = 
is_simd_flag_type::value;
+
+template  struct abi_for_size { using type = see below; };
+template  using abi_for_size_t = typename abi_for_size::type;
+
+template > struct simd_size;
+template >
+inline constexpr size_t simd_size_v = simd_size::value;
+
+template  struct memory_alignment;
+template 
+inline constexpr size_t memory_alignment_v = memory_alignment::value;
+
+// class template simd [simd.class]
+template > class simd;
+template  using native_simd = simd>;
+template  using fixed_size

[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2018-04-23 Thread Tim Shen via Phabricator via cfe-commits
timshen updated this revision to Diff 143610.
timshen added a comment.

Update formatting on static_asserts.


https://reviews.llvm.org/D41148

Files:
  libcxx/include/experimental/__config
  libcxx/include/experimental/simd
  libcxx/include/module.modulemap
  libcxx/test/libcxx/double_include.sh.cpp
  libcxx/test/std/experimental/simd/nothing_to_do.pass.cpp
  libcxx/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
  libcxx/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp
  libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
  libcxx/test/std/experimental/simd/simd.cons/genertor.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp

Index: libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
===
--- /dev/null
+++ libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
@@ -0,0 +1,133 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// 
+//
+// [simd.traits]
+// template  struct is_simd_mask;
+// template  inline constexpr bool is_simd_mask_v = is_simd_mask::value;
+
+#include 
+#include 
+#include "test_macros.h"
+
+using namespace std::experimental::parallelism_v2;
+
+struct UserType {};
+
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+static_assert( is_simd_mask>::value, "");
+
+static_assert(!is_simd_mask::value, "");
+static_assert(!is_simd_mask::value, "");
+static_assert(!is_simd_mask::value, "");
+static_assert(!is_simd_mask>::value, "");
+static_assert(!is_simd_mask>::value, "");
+static_assert(!is_simd_mask::value, "");
+
+#if TEST_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) &&\
+!defined(_LIBCPP_HAS_NO_INLINE_VARIABLES)
+
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+static_assert( is_simd_mask_v>, "");
+sta

r330626 - DR727: remove wrong assertion for use of class-scope explicit

2018-04-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Apr 23 11:38:30 2018
New Revision: 330626

URL: http://llvm.org/viewvc/llvm-project?rev=330626&view=rev
Log:
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/drs/dr7xx.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=330626&r1=330625&r2=330626&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Apr 23 11:38:30 2018
@@ -7561,10 +7561,6 @@ Sema::ActOnClassTemplateSpecialization(S
   ClassTemplate->AddSpecialization(Specialization, InsertPos);
 
 if (CurContext->isDependentContext()) {
-  // -fms-extensions permits specialization of nested classes without
-  // fully specializing the outer class(es).
-  assert(getLangOpts().MicrosoftExt &&
- "Only possible with -fms-extensions!");
   TemplateName CanonTemplate = Context.getCanonicalTemplateName(Name);
   CanonType = Context.getTemplateSpecializationType(
   CanonTemplate, Converted);

Modified: cfe/trunk/test/CXX/drs/dr7xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr7xx.cpp?rev=330626&r1=330625&r2=330626&view=diff
==
--- cfe/trunk/test/CXX/drs/dr7xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr7xx.cpp Mon Apr 23 11:38:30 2018
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
-namespace dr727 { // dr727: 7
+namespace dr727 { // dr727: partial
   struct A {
 template struct C; // expected-note 6{{here}}
 template void f(); // expected-note {{here}}
@@ -48,6 +48,33 @@ namespace dr727 { // dr727: 7
 template struct A::C; // expected-error {{not in class 
'A' or an enclosing namespace}}
 template int A::N; // expected-error {{not in class 
'A' or an enclosing namespace}}
   }
+
+  template
+  struct D {
+template struct C { typename T::error e; }; // expected-error 
{{no members}}
+template void f() { T::error; } // expected-error {{no 
members}}
+template static const int N = T::error; // expected-error 
2{{no members}} expected-error 0-1{{C++14}}
+
+template<> struct C {};
+template<> void f() {}
+template<> static const int N;
+
+template struct C {};
+template static const int N;
+  };
+
+  void d(D di) {
+D::C();
+di.f();
+int a = D::N; // FIXME: expected-note {{instantiation of}}
+
+D::C();
+int b = D::N;
+
+D::C(); // expected-note {{instantiation of}}
+di.f(); // expected-note {{instantiation of}}
+int c = D::N; // expected-note {{instantiation of}}
+  }
 }
 
 namespace dr777 { // dr777: 3.7


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45715: [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests

2018-04-23 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal added a comment.

In https://reviews.llvm.org/D45715#1075665, @mclow.lists wrote:

> - if there are similar tests in the filesystem test suite, and you haven't 
> tripped over them because you spelled your error message the same as we did.


Almost certainly. But we aren't running your filesystem tests yet because they 
are still under experimental. There are probably a lot of POSIX assumptions 
everywhere in there given the root_name parsing business.

In https://reviews.llvm.org/D45715#1075665, @mclow.lists wrote:

> - Should part of this test be moved into test/libcxx


That one's up to you. I don't think the specific message matters to this test; 
clearly the existing asserts for `io_errc::stream` don't care about a specific 
message (which is why they worked on our implementation).


https://reviews.llvm.org/D45715



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45865: [Sema] Emit -Warray-bounds for multiple levels of subscript expressions.

2018-04-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: rsmith.
aaron.ballman added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:11284
+  case Stmt::MemberExprClass: {
+const MemberExpr *ME = cast(expr);
+expr = ME->getBase();

Can use `const auto *` here instead of spelling the type out twice. 
Alternatively, you could skip the local variable entirely if you want.



Comment at: test/SemaCXX/array-bounds.cpp:275
+int test_multiarray() {
+  return multi[2][0][0]; // expected-warning {{array index 2 is past the end 
of the array (which contains 2 elements)}}
+}

Can you also add tests for `multi[0][2][0]` and `multi[0][0][2]` to more 
clearly demonstrate that all levels of array indexing are checked?


Repository:
  rC Clang

https://reviews.llvm.org/D45865



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330622 - Improve checks in test/Frontend/ftime-report-template-decl.cpp

2018-04-23 Thread Bjorn Pettersson via cfe-commits
Author: bjope
Date: Mon Apr 23 11:05:35 2018
New Revision: 330622

URL: http://llvm.org/viewvc/llvm-project?rev=330622&view=rev
Log:
Improve checks in test/Frontend/ftime-report-template-decl.cpp

Some buildbots seems to have problems with the CHECKs in
test/Frontend/ftime-report-template-decl.cpp.

I this the problem is that the order in which timers are printed
is based on consumed wall time. So there is no guarantee in which
order the timers are printed.

This patch uses CHECK-DAG instead of CHECK to make the test
case less sensitive to the actual time used by the different
passes.

The (sometimes) failing test cases where introduced in trunk@330571.

Modified:
cfe/trunk/test/Frontend/ftime-report-template-decl.cpp

Modified: cfe/trunk/test/Frontend/ftime-report-template-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/ftime-report-template-decl.cpp?rev=330622&r1=330621&r2=330622&view=diff
==
--- cfe/trunk/test/Frontend/ftime-report-template-decl.cpp (original)
+++ cfe/trunk/test/Frontend/ftime-report-template-decl.cpp Mon Apr 23 11:05:35 
2018
@@ -151,8 +151,8 @@ struct _Wrap_alloc {
 _Wrap_alloc::rebind w;
 
 // CHECK: Miscellaneous Ungrouped Timers
-// CHECK: LLVM IR Generation Time
-// CHECK: Code Generation Time
+// CHECK-DAG: LLVM IR Generation Time
+// CHECK-DAG: Code Generation Time
 // CHECK: Total
 // CHECK: Clang front-end time report
 // CHECK: Clang front-end timer


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45932: [clang-tidy][modernize-raw-string-literal] Don't replace upper ASCII with raw literals

2018-04-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:70-72
+  if (Bytes.find_if([](char C) {
+return static_cast(C) > 0x7Fu;
+  }) != StringRef::npos)

I think you can use `isASCII()` from CharInfo.h rather than reimplement it.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45932



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30882: Add a callback for __has_include and use it for dependency scanning

2018-04-23 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In https://reviews.llvm.org/D30882#1075589, @dexonsmith wrote:

> In https://reviews.llvm.org/D30882#1075576, @pete wrote:
>
> > Would it be ok to turn this on by default, without a flag, only in the case 
> > of the path actually existing, and only the found path being the one we add 
> > to the .d?
>
>
> I think that pessimizes some incremental builds:
>
> - You have a `__has_include("missing.h")`, but don't include missing.h.
> - Change "missing.h" (but don't delete it).
> - An incremental build now has to rebuild the object file, even though 
> nothing will have changed.
>
>   However, it's fixing an actual bug, so it makes sense to me to be more 
> conservative.


To be clear, I meant "yes" by that!


https://reviews.llvm.org/D30882



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added a comment.

buildbots have been failing all day (and were still failing). So I pushed my 
suggested fix.
I hope that was OK.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45451: [ItaniumMangle] Undeduced auto type doesn't belong in the substitution table

2018-04-23 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/AST/ItaniumMangle.cpp:2342
+  if (isa(Ty))
+return false;
   return true;

erik.pilkington wrote:
> rjmccall wrote:
> > rjmccall wrote:
> > > rjmccall wrote:
> > > > I agree with your analysis that this shouldn't be a substitution 
> > > > candidate.  However, I think this probably needs an ABI-compatibility 
> > > > guard.
> > > You should probably add a comment like "Prior to LLVM v6, Clang 
> > > accidentally treated deduced auto types as substitution candidates."
> > Er, not "prior to", I guess.  "through", maybe, or "up to and including".
> Sure, I added that comment into the new patch. You meant to say "undeduced 
> auto types", right? Deduced auto types should have been desugared to their 
> underlying type before this function get called in mangleType().
Yes, right, thanks.  LGTM.


https://reviews.llvm.org/D45451



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2018-04-23 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: bixia.

This looks ready to land to me.




Comment at: 
libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp:122
+static_assert(is_simd_mask_v>, "");
+static_assert(is_simd_mask_v>, "");
+

Minor formatting nit. When I have stacks of tests like this, I usually leave a 
space after the '(', so that positive and negative tests line up, and so I can 
see at a glance which are which.

Example:
static_assert( is_simd_mask_v>, "");
static_assert(!is_simd_mask_v, "");




https://reviews.llvm.org/D41148



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45715: [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests

2018-04-23 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

I'm fine with this change, but I'm wondering:

- if there are similar tests in the filesystem test suite, and you haven't 
tripped over them because you spelled your error message the same as we did.
- Should part of this test be moved into test/libcxx


https://reviews.llvm.org/D45715



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330620 - [OPENMP] Do not cast captured by value variables with pointer types in

2018-04-23 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Mon Apr 23 10:33:41 2018
New Revision: 330620

URL: http://llvm.org/viewvc/llvm-project?rev=330620&view=rev
Log:
[OPENMP] Do not cast captured by value variables with pointer types in
NVPTX target.

When generating the wrapper function for the offloading region, we need
to call the outlined function and cast the arguments correctly to follow
the ABI. Usually, variables captured by value are casted to `uintptr_t`
type. But this should not performed for the variables with pointer type.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
cfe/trunk/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=330620&r1=330619&r2=330620&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Mon Apr 23 10:33:41 2018
@@ -3037,7 +3037,8 @@ llvm::Function *CGOpenMPRuntimeNVPTX::cr
   /*Volatile=*/false,
   
CGFContext.getPointerType(ElemTy),
   CI->getLocation());
-  if (CI->capturesVariableByCopy()) {
+  if (CI->capturesVariableByCopy() &&
+  !CI->getCapturedVar()->getType()->isAnyPointerType()) {
 Arg = castValueToType(CGF, Arg, ElemTy, CGFContext.getUIntPtrType(),
   CI->getLocation());
   }

Modified: 
cfe/trunk/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp?rev=330620&r1=330619&r2=330620&view=diff
==
--- 
cfe/trunk/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp 
(original)
+++ 
cfe/trunk/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp 
Mon Apr 23 10:33:41 2018
@@ -9,10 +9,11 @@
 #define HEADER
 
 // Check that the execution mode of all 2 target regions on the gpu is set to 
SPMD Mode.
-// CHECK-DAG: {{@__omp_offloading_.+l30}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l36}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l41}}_exec_mode = weak constant i8 0
-// CHECK-DAG: {{@__omp_offloading_.+l46}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l32}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l38}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l43}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l48}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l56}}_exec_mode = weak constant i8 0
 
 #define N 1000
 #define M 10
@@ -26,6 +27,7 @@ tx ftemplate(int n) {
   tx f = n;
   tx l;
   int k;
+  tx *v;
 
 #pragma omp target teams distribute parallel for lastprivate(l) 
dist_schedule(static,128) schedule(static,32)
   for(int i = 0; i < n; i++) {
@@ -51,6 +53,9 @@ tx ftemplate(int n) {
 }
   }
 
+#pragma omp target teams distribute parallel for map(a, v[:N])
+  for(int i = 0; i < n; i++)
+a[i] = v[i];
   return a[0];
 }
 
@@ -120,4 +125,8 @@ int bar(int n){
 // CHECK: call void @__kmpc_for_static_fini(
 // CHECK: ret void
 
+// CHECK: define void @__omp_offloading_{{.*}}_l56(i[[SZ:64|32]] %{{[^,]+}}, 
[1000 x i32]* dereferenceable{{.*}}, i32* %{{[^)]+}})
+// CHECK: call void [[OUTLINED:@__omp_outlined.*]](i32* %{{.+}}, i32* %{{.+}}, 
i[[SZ]] %{{.*}}, i[[SZ]] %{{.*}}, i[[SZ]] %{{.*}}, [1000 x i32]* %{{.*}}, i32* 
%{{.*}})
+// CHECK: define internal void [[OUTLINED]](i32* noalias %{{.*}}, i32* noalias 
%{{.*}} i[[SZ]] %{{.+}}, i[[SZ]] %{{.+}}, i[[SZ]] %{{.+}}, [1000 x i32]* 
dereferenceable{{.*}}, i32* %{{.*}})
+
 #endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45722: [X86] Lowering SAD (sum of absolute differences) intrinsics to native IR (clang side)

2018-04-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:8431
+  CGF.Builder.CreateZExt(CGF.Builder.CreateShuffleVector(
+ AD, llvm::UndefValue::get(BTy), ShuffleMask),
+ VTy);

You can just pass AD twice. You don't need to create an Undef value. It will 
get optimized later.


https://reviews.llvm.org/D45722



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45722: [X86] Lowering SAD (sum of absolute differences) intrinsics to native IR (clang side)

2018-04-23 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:8426
+  llvm::Type *BTy = llvm::VectorType::get(CGF.Builder.getInt8Ty(), N * 8);
+  SmallVector ShuffleMask;
+  for (unsigned i = 0; i < N; ++i)

Size the ShuffleMask to N when it's created. Then you can use just direct 
assign each array entry in the loops. This will remove the need for the clear() 
in the later loop. It will also remove the hidden code that checks if we need 
to grow on every call to push_back.


https://reviews.llvm.org/D45722



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30882: Add a callback for __has_include and use it for dependency scanning

2018-04-23 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In https://reviews.llvm.org/D30882#1075576, @pete wrote:

> Oh, that actually wasn't my intention when I wrote it.
>
> Honestly I didn't expect it to log anything for missing paths at all, as we 
> don't currently log all the missing (but attempted) paths for regular 
> #include's.


Then I misunderstood the patch.  Maybe add a test or two that confirms it only 
adds dependencies, not anti-dependencies?

> Would it be ok to turn this on by default, without a flag, only in the case 
> of the path actually existing, and only the found path being the one we add 
> to the .d?

I think that pessimizes some incremental builds:

- You have a `__has_include("missing.h")`, but don't include missing.h.
- Change "missing.h" (but don't delete it).
- An incremental build now has to rebuild the object file, even though nothing 
will have changed.

However, it's fixing an actual bug, so it makes sense to me to be more 
conservative.


https://reviews.llvm.org/D30882



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30882: Add a callback for __has_include and use it for dependency scanning

2018-04-23 Thread Pete Cooper via Phabricator via cfe-commits
pete added a comment.

In https://reviews.llvm.org/D30882#1075461, @dexonsmith wrote:

> In https://reviews.llvm.org/D30882#1075407, @ddunbar wrote:
>
> > In https://reviews.llvm.org/D30882#1074822, @dexonsmith wrote:
> >
> > > I don't think this is quite right.  I know at least `make`-based 
> > > incremental builds wouldn't deal well with this.
> >
> >
> > This is actually not a novel problem w.r.t. this patch. The exact same 
> > situation comes up with Makefile-included .d files and when one of the 
> > referenced headers is removed.
> >
> > This is typically solved somewhere in the build system, for example Make 
> > has `-include`, and Ninja and llbuild have explicit support for this 
> > situation.
>
>
> Of course, yes, I was wrong.  Thanks for the correction.
>
> > I agree we might want to tread cautiously on how we change the .d output, 
> > but in this case I think it might be safe.
> > 
> > If we decide this isn't safe, then we may want to consider a new flag which 
> > tracks *all* anti-dependencies (file's for which Clang checked existence 
> > but did not exist), and include that here. The major concern with that 
> > approach is it is a much larger list, and while it would support being 
> > substantially more correct, it is also well beyond what people currently 
> > expect out of the build system + compiler generated deps approaches.
>
> Even though this is likely safe, it seems really noisy.  Consider the case 
> where someone has `__has_include()` -- we'll get an entry for every 
> `-I`, `-F`, `-isystem`, and `-iframework`.  If we're going to add that noise, 
> I prefer a separate flag that covers all anti-dependencies.


Oh, that actually wasn't my intention when I wrote it.

Honestly I didn't expect it to log anything for missing paths at all, as we 
don't currently log all the missing (but attempted) paths for regular 
#include's.

Would it be ok to turn this on by default, without a flag, only in the case of 
the path actually existing, and only the found path being the one we add to the 
.d?


https://reviews.llvm.org/D30882



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45917: Pass -Oz/-Os along to the backend

2018-04-23 Thread Jessica Paquette via Phabricator via cfe-commits
paquette updated this revision to Diff 143584.
paquette added a comment.

Add context to diff.


https://reviews.llvm.org/D45917

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/arm64-outline.c


Index: test/CodeGen/arm64-outline.c
===
--- /dev/null
+++ test/CodeGen/arm64-outline.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple arm64--- -Oz -S -mllvm 
-debug-pass=Structure %s -o /dev/null 2> FileCheck %s
+// CHECK: Machine Outliner
+// RUN: %clang_cc1 -emit-llvm -Oz -S -mllvm -debug-pass=Structure %s -o 
/dev/null 2> FileCheck %s
+// CHECK-NOT: Machine Outliner
+// Ensure that -Oz is properly passed down to the backend by checking if the 
+// Machine Outliner is only added by default in ARM64.
+
+void foo(void) {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -354,6 +354,19 @@
   }
 }
 
+static CodeGenSizeOpt::Level getCGSizeOptLevel(const CodeGenOptions 
&CodeGenOpts) {
+  switch (CodeGenOpts.OptimizeSize) {
+default:
+  llvm_unreachable("Invalid size optimization level!");
+case 0:
+  return CodeGenSizeOpt::None;
+case 1:
+  return CodeGenSizeOpt::OptSize; // Os
+case 2:
+  return CodeGenSizeOpt::MinSize; // Oz
+  }
+}
+
 static Optional
 getCodeModel(const CodeGenOptions &CodeGenOpts) {
   unsigned CodeModel = llvm::StringSwitch(CodeGenOpts.CodeModel)
@@ -692,11 +705,12 @@
   llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ",");
   llvm::Reloc::Model RM = CodeGenOpts.RelocationModel;
   CodeGenOpt::Level OptLevel = getCGOptLevel(CodeGenOpts);
-
+  CodeGenSizeOpt::Level SizeOptLevel = getCGSizeOptLevel(CodeGenOpts);
   llvm::TargetOptions Options;
   initTargetOptions(Options, CodeGenOpts, TargetOpts, LangOpts, HSOpts);
   TM.reset(TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr,
-  Options, RM, CM, OptLevel));
+  Options, RM, CM, OptLevel,
+  SizeOptLevel));
 }
 
 bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager &CodeGenPasses,


Index: test/CodeGen/arm64-outline.c
===
--- /dev/null
+++ test/CodeGen/arm64-outline.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple arm64--- -Oz -S -mllvm -debug-pass=Structure %s -o /dev/null 2> FileCheck %s
+// CHECK: Machine Outliner
+// RUN: %clang_cc1 -emit-llvm -Oz -S -mllvm -debug-pass=Structure %s -o /dev/null 2> FileCheck %s
+// CHECK-NOT: Machine Outliner
+// Ensure that -Oz is properly passed down to the backend by checking if the 
+// Machine Outliner is only added by default in ARM64.
+
+void foo(void) {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -354,6 +354,19 @@
   }
 }
 
+static CodeGenSizeOpt::Level getCGSizeOptLevel(const CodeGenOptions &CodeGenOpts) {
+  switch (CodeGenOpts.OptimizeSize) {
+default:
+  llvm_unreachable("Invalid size optimization level!");
+case 0:
+  return CodeGenSizeOpt::None;
+case 1:
+  return CodeGenSizeOpt::OptSize; // Os
+case 2:
+  return CodeGenSizeOpt::MinSize; // Oz
+  }
+}
+
 static Optional
 getCodeModel(const CodeGenOptions &CodeGenOpts) {
   unsigned CodeModel = llvm::StringSwitch(CodeGenOpts.CodeModel)
@@ -692,11 +705,12 @@
   llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ",");
   llvm::Reloc::Model RM = CodeGenOpts.RelocationModel;
   CodeGenOpt::Level OptLevel = getCGOptLevel(CodeGenOpts);
-
+  CodeGenSizeOpt::Level SizeOptLevel = getCGSizeOptLevel(CodeGenOpts);
   llvm::TargetOptions Options;
   initTargetOptions(Options, CodeGenOpts, TargetOpts, LangOpts, HSOpts);
   TM.reset(TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr,
-  Options, RM, CM, OptLevel));
+  Options, RM, CM, OptLevel,
+  SizeOptLevel));
 }
 
 bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager &CodeGenPasses,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330613 - Quick fix for rC330605: specify a target arch for test

2018-04-23 Thread Aleksei Sidorin via cfe-commits
Author: a.sidorin
Date: Mon Apr 23 09:38:29 2018
New Revision: 330613

URL: http://llvm.org/viewvc/llvm-project?rev=330613&view=rev
Log:
Quick fix for rC330605: specify a target arch for test


Modified:
cfe/trunk/test/Analysis/sval-dump-int128.c

Modified: cfe/trunk/test/Analysis/sval-dump-int128.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/sval-dump-int128.c?rev=330613&r1=330612&r2=330613&view=diff
==
--- cfe/trunk/test/Analysis/sval-dump-int128.c (original)
+++ cfe/trunk/test/Analysis/sval-dump-int128.c Mon Apr 23 09:38:29 2018
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection %s -verify
+// RUN: %clang_analyze_cc1 -triple x86_64-linux-gnu 
-analyzer-checker=debug.ExprInspection %s -verify
 
 void clang_analyzer_dump(unsigned __int128 x);
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45965: [Targets] Implement getConstraintRegister for ARM and AArch64

2018-04-23 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: lib/Basic/Targets/AArch64.h:85-89
+  StringRef getConstraintRegister(StringRef Constraint,
+  StringRef Expression) const override {
+return Expression;
+  }
+

From what I understood of the original patch, getConstraintRegister is a sort 
of a more comprehensive version of convertRegister. On ARM convertRegister 
handles U and p constraint specially, should this do the same?


https://reviews.llvm.org/D45965



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >