r294419 - [X86] Add -mmpx/-mno-mpx command line options and __MPX__ define to match gcc.

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Feb  8 01:56:42 2017
New Revision: 294419

URL: http://llvm.org/viewvc/llvm-project?rev=294419&view=rev
Log:
[X86] Add -mmpx/-mno-mpx command line options and __MPX__ define to match gcc.

Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/x86-target-features.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=294419&r1=294418&r2=294419&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Feb  8 01:56:42 2017
@@ -2181,6 +2181,8 @@ X86
 
 .. option:: -mmmx, -mno-mmx
 
+.. option:: -mmpx, -mno-mpx
+
 .. option:: -mmwaitx, -mno-mwaitx
 
 .. option:: -mpclmul, -mno-pclmul

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=294419&r1=294418&r2=294419&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Feb  8 01:56:42 2017
@@ -1718,6 +1718,7 @@ def mno_pku : Flag<["-"], "mno-pku">, Gr
 def mno_clflushopt : Flag<["-"], "mno-clflushopt">, 
Group;
 def mno_clwb : Flag<["-"], "mno-clwb">, Group;
 def mno_movbe : Flag<["-"], "mno-movbe">, Group;
+def mno_mpx : Flag<["-"], "mno-mpx">, Group;
 
 def munaligned_access : Flag<["-"], "munaligned-access">, 
Group,
   HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64 only)">;
@@ -1913,6 +1914,7 @@ def mmwaitx : Flag<["-"], "mmwaitx">, Gr
 def mclflushopt : Flag<["-"], "mclflushopt">, Group;
 def mclwb : Flag<["-"], "mclwb">, Group;
 def mmovbe : Flag<["-"], "mmovbe">, Group;
+def mmpx : Flag<["-"], "mmpx">, Group;
 def mips16 : Flag<["-"], "mips16">, Group;
 def mno_mips16 : Flag<["-"], "mno-mips16">, Group;
 def mmicromips : Flag<["-"], "mmicromips">, Group;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294419&r1=294418&r2=294419&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Feb  8 01:56:42 2017
@@ -3881,6 +3881,8 @@ void X86TargetInfo::getTargetDefines(con
 Builder.defineMacro("__CLFLUSHOPT__");
   if (HasCLWB)
 Builder.defineMacro("__CLWB__");
+  if (HasMPX)
+Builder.defineMacro("__MPX__");
 
   // Each case falls through to the previous one here.
   switch (SSELevel) {

Modified: cfe/trunk/test/Driver/x86-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86-target-features.c?rev=294419&r1=294418&r2=294419&view=diff
==
--- cfe/trunk/test/Driver/x86-target-features.c (original)
+++ cfe/trunk/test/Driver/x86-target-features.c Wed Feb  8 01:56:42 2017
@@ -64,3 +64,8 @@
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-movbe %s -### 
-o %t.o 2>&1 | FileCheck -check-prefix=NO-MOVBE %s
 // MOVBE: "-target-feature" "+movbe"
 // NO-MOVBE: "-target-feature" "-movbe"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mmpx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=MPX %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-mpx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=NO-MPX %s
+// MPX: "-target-feature" "+mpx"
+// NO-MPX: "-target-feature" "-mpx"

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=294419&r1=294418&r2=294419&view=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Wed Feb  8 01:56:42 
2017
@@ -656,6 +656,7 @@
 // CHECK_SKL_M32: #define __FMA__ 1
 // CHECK_SKL_M32: #define __LZCNT__ 1
 // CHECK_SKL_M32: #define __MMX__ 1
+// CHECK_SKL_M32: #define __MPX__ 1
 // CHECK_SKL_M32: #define __PCLMUL__ 1
 // CHECK_SKL_M32: #define __POPCNT__ 1
 // CHECK_SKL_M32: #define __RDRND__ 1
@@ -687,6 +688,7 @@
 // CHECK_SKL_M64: #define __FMA__ 1
 // CHECK_SKL_M64: #define __LZCNT__ 1
 // CHECK_SKL_M64: #define __MMX__ 1
+// CHECK_SKL_M64: #define __MPX__ 1
 // CHECK_SKL_M64: #define __PCLMUL__ 1
 // CHECK_SKL_M64: #define __POPCNT__ 1
 // CHECK_SKL_M64: #define __RDRND__ 1
@@ -801,6 +803,7 @@
 // CHECK_SKX_M32: #define __FMA__ 1
 // CHECK_SKX_M32: #define __LZCNT__ 1
 // CHECK_SKX_M32: #define __MMX__ 1
+// CHECK_SKX_M32: #define __MPX__ 1
 // CHECK_SKX_M32: #define __PCLM

r294420 - [X86] Update command line documentation for -mclwb and -mmovbe which I forgot in my previous commits.

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Feb  8 01:57:01 2017
New Revision: 294420

URL: http://llvm.org/viewvc/llvm-project?rev=294420&view=rev
Log:
[X86] Update command line documentation for -mclwb and -mmovbe which I forgot 
in my previous commits.

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=294420&r1=294419&r2=294420&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Feb  8 01:57:01 2017
@@ -2165,6 +2165,8 @@ X86
 
 .. option:: -mclflushopt, -mno-clflushopt
 
+.. option:: -mclwb, -mno-clwb
+
 .. option:: -mcx16, -mno-cx16
 
 .. option:: -mf16c, -mno-f16c
@@ -2181,6 +2183,8 @@ X86
 
 .. option:: -mmmx, -mno-mmx
 
+.. option:: -mmovbe, -mno-movbe
+
 .. option:: -mmpx, -mno-mpx
 
 .. option:: -mmwaitx, -mno-mwaitx


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


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir marked an inline comment as done.
krasimir added inline comments.



Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.

klimek wrote:
> Given this, I'd perhaps call this addSection or addCommentSection or 
> something similar? analyze sounds like it doesn't change the state of the 
> class...
Maybe distributeCommentsAccordingToAlignment?


https://reviews.llvm.org/D29626



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


[PATCH] D26244: [Driver] Add CLANG_PREFER_GCC_LIBRARIES which can be disabled

2017-02-08 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

gentle ping


https://reviews.llvm.org/D26244



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


r294423 - [X86] Add -msgx/-mno-sgx command line options and __SGX__ define to match gcc.

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Feb  8 02:23:17 2017
New Revision: 294423

URL: http://llvm.org/viewvc/llvm-project?rev=294423&view=rev
Log:
[X86] Add -msgx/-mno-sgx command line options and __SGX__ define to match gcc.

Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/x86-target-features.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=294423&r1=294422&r2=294423&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Feb  8 02:23:17 2017
@@ -2203,6 +2203,8 @@ X86
 
 .. option:: -mrtm, -mno-rtm
 
+.. option:: -msgx, -mno-sgx
+
 .. option:: -msha, -mno-sha
 
 .. option:: -msse, -mno-sse

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=294423&r1=294422&r2=294423&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Feb  8 02:23:17 2017
@@ -1719,6 +1719,7 @@ def mno_clflushopt : Flag<["-"], "mno-cl
 def mno_clwb : Flag<["-"], "mno-clwb">, Group;
 def mno_movbe : Flag<["-"], "mno-movbe">, Group;
 def mno_mpx : Flag<["-"], "mno-mpx">, Group;
+def mno_sgx : Flag<["-"], "mno-sgx">, Group;
 
 def munaligned_access : Flag<["-"], "munaligned-access">, 
Group,
   HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64 only)">;
@@ -1915,6 +1916,7 @@ def mclflushopt : Flag<["-"], "mclflusho
 def mclwb : Flag<["-"], "mclwb">, Group;
 def mmovbe : Flag<["-"], "mmovbe">, Group;
 def mmpx : Flag<["-"], "mmpx">, Group;
+def msgx : Flag<["-"], "msgx">, Group;
 def mips16 : Flag<["-"], "mips16">, Group;
 def mno_mips16 : Flag<["-"], "mno-mips16">, Group;
 def mmicromips : Flag<["-"], "mmicromips">, Group;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294423&r1=294422&r2=294423&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Feb  8 02:23:17 2017
@@ -3883,6 +3883,8 @@ void X86TargetInfo::getTargetDefines(con
 Builder.defineMacro("__CLWB__");
   if (HasMPX)
 Builder.defineMacro("__MPX__");
+  if (HasSGX)
+Builder.defineMacro("__SGX__");
 
   // Each case falls through to the previous one here.
   switch (SSELevel) {

Modified: cfe/trunk/test/Driver/x86-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86-target-features.c?rev=294423&r1=294422&r2=294423&view=diff
==
--- cfe/trunk/test/Driver/x86-target-features.c (original)
+++ cfe/trunk/test/Driver/x86-target-features.c Wed Feb  8 02:23:17 2017
@@ -69,3 +69,8 @@
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-mpx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=NO-MPX %s
 // MPX: "-target-feature" "+mpx"
 // NO-MPX: "-target-feature" "-mpx"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -msgx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=SGX %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-sgx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=NO-SGX %s
+// SGX: "-target-feature" "+sgx"
+// NO-SGX: "-target-feature" "-sgx"

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=294423&r1=294422&r2=294423&view=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Wed Feb  8 02:23:17 
2017
@@ -662,6 +662,7 @@
 // CHECK_SKL_M32: #define __RDRND__ 1
 // CHECK_SKL_M32: #define __RDSEED__ 1
 // CHECK_SKL_M32: #define __RTM__ 1
+// CHECK_SKL_M32: #define __SGX__ 1
 // CHECK_SKL_M32: #define __SSE2__ 1
 // CHECK_SKL_M32: #define __SSE3__ 1
 // CHECK_SKL_M32: #define __SSE4_1__ 1
@@ -694,6 +695,7 @@
 // CHECK_SKL_M64: #define __RDRND__ 1
 // CHECK_SKL_M64: #define __RDSEED__ 1
 // CHECK_SKL_M64: #define __RTM__ 1
+// CHECK_SKL_M64: #define __SGX__ 1
 // CHECK_SKL_M64: #define __SSE2_MATH__ 1
 // CHECK_SKL_M64: #define __SSE2__ 1
 // CHECK_SKL_M64: #define __SSE3__ 1
@@ -808,6 +810,7 @@
 // CHECK_SKX_M32: #define __POPCNT__ 1
 // CHECK_SKX_M32: #define __RDRND__ 1
 // CHECK_SKX_M32: #define __RTM__ 1
+// CHECK_SKX_M32: #define __SGX__ 1
 // CHECK_SKX_M32: #define __SSE2__ 1
 // CHECK_SKX_M32: #define __SSE3__ 1
 // CHECK_SK

r294424 - [X86] Add -mprefetchwt1/-mno-prefetchwt1 command line options and __PREFETCHWT1__ define to match gcc.

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Feb  8 02:23:40 2017
New Revision: 294424

URL: http://llvm.org/viewvc/llvm-project?rev=294424&view=rev
Log:
[X86] Add -mprefetchwt1/-mno-prefetchwt1 command line options and 
__PREFETCHWT1__ define to match gcc.

Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/x86-target-features.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=294424&r1=294423&r2=294424&view=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Wed Feb  8 02:23:40 2017
@@ -2195,6 +2195,8 @@ X86
 
 .. option:: -mpopcnt, -mno-popcnt
 
+.. option:: -mprefetchwt1, -mno-prefetchwt1
+
 .. option:: -mprfchw, -mno-prfchw
 
 .. option:: -mrdrnd, -mno-rdrnd

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=294424&r1=294423&r2=294424&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Feb  8 02:23:40 2017
@@ -1720,6 +1720,7 @@ def mno_clwb : Flag<["-"], "mno-clwb">,
 def mno_movbe : Flag<["-"], "mno-movbe">, Group;
 def mno_mpx : Flag<["-"], "mno-mpx">, Group;
 def mno_sgx : Flag<["-"], "mno-sgx">, Group;
+def mno_prefetchwt1 : Flag<["-"], "mno-prefetchwt1">, 
Group;
 
 def munaligned_access : Flag<["-"], "munaligned-access">, 
Group,
   HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64 only)">;
@@ -1917,6 +1918,7 @@ def mclwb : Flag<["-"], "mclwb">, Group<
 def mmovbe : Flag<["-"], "mmovbe">, Group;
 def mmpx : Flag<["-"], "mmpx">, Group;
 def msgx : Flag<["-"], "msgx">, Group;
+def mprefetchwt1 : Flag<["-"], "mprefetchwt1">, Group;
 def mips16 : Flag<["-"], "mips16">, Group;
 def mno_mips16 : Flag<["-"], "mno-mips16">, Group;
 def mmicromips : Flag<["-"], "mmicromips">, Group;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294424&r1=294423&r2=294424&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Feb  8 02:23:40 2017
@@ -3885,6 +3885,8 @@ void X86TargetInfo::getTargetDefines(con
 Builder.defineMacro("__MPX__");
   if (HasSGX)
 Builder.defineMacro("__SGX__");
+  if (HasPREFETCHWT1)
+Builder.defineMacro("__PREFETCHWT1__");
 
   // Each case falls through to the previous one here.
   switch (SSELevel) {

Modified: cfe/trunk/test/Driver/x86-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86-target-features.c?rev=294424&r1=294423&r2=294424&view=diff
==
--- cfe/trunk/test/Driver/x86-target-features.c (original)
+++ cfe/trunk/test/Driver/x86-target-features.c Wed Feb  8 02:23:40 2017
@@ -74,3 +74,8 @@
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-sgx %s -### -o 
%t.o 2>&1 | FileCheck -check-prefix=NO-SGX %s
 // SGX: "-target-feature" "+sgx"
 // NO-SGX: "-target-feature" "-sgx"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mprefetchwt1 %s 
-### -o %t.o 2>&1 | FileCheck -check-prefix=PREFETCHWT1 %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-prefetchwt1 %s 
-### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PREFETCHWT1 %s
+// PREFETCHWT1: "-target-feature" "+prefetchwt1"
+// NO-PREFETCHWT1: "-target-feature" "-prefetchwt1"

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=294424&r1=294423&r2=294424&view=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Wed Feb  8 02:23:40 
2017
@@ -731,6 +731,7 @@
 // CHECK_KNL_M32: #define __MMX__ 1
 // CHECK_KNL_M32: #define __PCLMUL__ 1
 // CHECK_KNL_M32: #define __POPCNT__ 1
+// CHECK_KNL_M32: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M32: #define __RDRND__ 1
 // CHECK_KNL_M32: #define __RTM__ 1
 // CHECK_KNL_M32: #define __SSE2__ 1
@@ -766,6 +767,7 @@
 // CHECK_KNL_M64: #define __MMX__ 1
 // CHECK_KNL_M64: #define __PCLMUL__ 1
 // CHECK_KNL_M64: #define __POPCNT__ 1
+// CHECK_KNL_M64: #define __PREFETCHWT1__ 1
 // CHECK_KNL_M64: #define __RDRND__ 1
 // CHECK_KNL_M64: #define __RTM__ 1
 // CHECK_KNL_M64: #define __SSE2_MATH__ 1


___
cfe-commits mailing list
cfe-co

[PATCH] D20689: [clang-tidy] Suspicious Call Argument checker

2017-02-08 Thread Varju Janos via Phabricator via cfe-commits
varjujan added a comment.

@xazax.hun
Yes I do. Obviously some of them seem to be better than the others so I can 
remove a couple if needed.


https://reviews.llvm.org/D20689



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


[PATCH] D29628: [compiler-rt] [test] Enable the strace_test only if strace is installed

2017-02-08 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294425: [test] Enable the strace_test only if strace is 
installed (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D29628?vs=87392&id=87603#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29628

Files:
  compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
  compiler-rt/trunk/test/lsan/lit.common.cfg


Index: compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
===
--- compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
+++ compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
@@ -1,4 +1,5 @@
 // Test that lsan reports a proper error when running under strace.
+// REQUIRES: strace
 // RUN: %clangxx_lsan %s -o %t
 // RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s
 
Index: compiler-rt/trunk/test/lsan/lit.common.cfg
===
--- compiler-rt/trunk/test/lsan/lit.common.cfg
+++ compiler-rt/trunk/test/lsan/lit.common.cfg
@@ -4,6 +4,8 @@
 
 import os
 
+import lit.util
+
 def get_required_attr(config, attr_name):
   attr_value = getattr(config, attr_name, None)
   if attr_value == None:
@@ -29,6 +31,9 @@
   lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
 config.name += config.name_suffix
 
+if lit.util.which('strace'):
+  config.available_features.add('strace')
+
 clang_cflags = ["-O0", config.target_cflags] + config.debug_info_flags
 clang_cxxflags = config.cxx_mode_flags + clang_cflags
 lsan_incdir = config.test_source_root + "/../"


Index: compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
===
--- compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
+++ compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
@@ -1,4 +1,5 @@
 // Test that lsan reports a proper error when running under strace.
+// REQUIRES: strace
 // RUN: %clangxx_lsan %s -o %t
 // RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s
 
Index: compiler-rt/trunk/test/lsan/lit.common.cfg
===
--- compiler-rt/trunk/test/lsan/lit.common.cfg
+++ compiler-rt/trunk/test/lsan/lit.common.cfg
@@ -4,6 +4,8 @@
 
 import os
 
+import lit.util
+
 def get_required_attr(config, attr_name):
   attr_value = getattr(config, attr_name, None)
   if attr_value == None:
@@ -29,6 +31,9 @@
   lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
 config.name += config.name_suffix
 
+if lit.util.which('strace'):
+  config.available_features.add('strace')
+
 clang_cflags = ["-O0", config.target_cflags] + config.debug_info_flags
 clang_cxxflags = config.cxx_mode_flags + clang_cflags
 lsan_incdir = config.test_source_root + "/../"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.

krasimir wrote:
> klimek wrote:
> > Given this, I'd perhaps call this addSection or addCommentSection or 
> > something similar? analyze sounds like it doesn't change the state of the 
> > class...
> Maybe distributeCommentsAccordingToAlignment?
I don't think "AccordingToAlignment" needs to be in the name - it's fine that 
that's in the comment, and it's kind of a detail of what this does.

The important thing at the call site is that this adds comments to the current 
unwrapped line, right?


https://reviews.llvm.org/D29626



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


[PATCH] D29699: [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py

2017-02-08 Thread Manuel Klimek via Phabricator via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D29699



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


[PATCH] D29469: Fix PR31843: Clang-4.0 crashes/assert while evaluating __builtin_object_size

2017-02-08 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

Ping? This is hitting 4.0


https://reviews.llvm.org/D29469



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


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.

klimek wrote:
> krasimir wrote:
> > klimek wrote:
> > > Given this, I'd perhaps call this addSection or addCommentSection or 
> > > something similar? analyze sounds like it doesn't change the state of the 
> > > class...
> > Maybe distributeCommentsAccordingToAlignment?
> I don't think "AccordingToAlignment" needs to be in the name - it's fine that 
> that's in the comment, and it's kind of a detail of what this does.
> 
> The important thing at the call site is that this adds comments to the 
> current unwrapped line, right?
That's just half of it: it may add comments to the current line, and it may add 
comments to the sequence of tokens preceding the next token with conceptually 
belong to the next token and will be put in a new line if the next token has to 
be put on a new line.
After a while, there is "flushComments" which takes care of the mentioned 
comments before next token.


https://reviews.llvm.org/D29626



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


[PATCH] D29706: [libcxx] [test] Fix hard_link_count test to account for fs with dir nlink==1

2017-02-08 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.

Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.


Repository:
  rL LLVM

https://reviews.llvm.org/D29706

Files:
  
test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp


Index: 
test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
===
--- 
test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ 
test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -57,15 +57,19 @@
 Dir3Expect = 3; // .  ..  file5
 #endif
 TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-   hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 
 std::error_code ec;
 TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 }
 TEST_CASE(hard_link_count_increments_test)
 {


Index: test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
===
--- test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -57,15 +57,19 @@
 Dir3Expect = 3; // .  ..  file5
 #endif
 TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-   hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 
 std::error_code ec;
 TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 }
 TEST_CASE(hard_link_count_increments_test)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.

krasimir wrote:
> klimek wrote:
> > krasimir wrote:
> > > klimek wrote:
> > > > Given this, I'd perhaps call this addSection or addCommentSection or 
> > > > something similar? analyze sounds like it doesn't change the state of 
> > > > the class...
> > > Maybe distributeCommentsAccordingToAlignment?
> > I don't think "AccordingToAlignment" needs to be in the name - it's fine 
> > that that's in the comment, and it's kind of a detail of what this does.
> > 
> > The important thing at the call site is that this adds comments to the 
> > current unwrapped line, right?
> That's just half of it: it may add comments to the current line, and it may 
> add comments to the sequence of tokens preceding the next token with 
> conceptually belong to the next token and will be put in a new line if the 
> next token has to be put on a new line.
> After a while, there is "flushComments" which takes care of the mentioned 
> comments before next token.
Sure, but the important part seems to be that it decides which comment tokens 
belong into the current line?


https://reviews.llvm.org/D29626



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


[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class

2017-02-08 Thread Rudy Pons via Phabricator via cfe-commits
Ilod created this revision.

Clang emits a warning when using pure specifier =0 in function definition at 
class scope, which is a MS-specific construct, when using -fms-extensions.
However, to detect this, it was using FD->isCanonicalDecl() on function 
declaration, which was also detecting out-of-class definition of member 
functions of template class.
This fix it by instead of !FD->isOutOfLine() to detect the places where we must 
emit the warning.
This will fix https://llvm.org/bugs/show_bug.cgi?id=21334


https://reviews.llvm.org/D29707

Files:
  lib/Sema/SemaDecl.cpp
  test/Parser/MicrosoftExtensions.cpp


Index: test/Parser/MicrosoftExtensions.cpp
===
--- test/Parser/MicrosoftExtensions.cpp
+++ test/Parser/MicrosoftExtensions.cpp
@@ -290,6 +290,17 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function 
definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template 
pure_virtual_dtor_template::~pure_virtual_dtor_template() { }
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 { }// expected-warning 
{{function definition with pure-specifier is a Microsoft extension}} 
expected-warning {{function definition with pure-specifier is a Microsoft 
extension}}
+};
+template struct pure_virtual_dtor_template_inline;// expected-note {{in 
instantiation of member function}}
+
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -12025,7 +12025,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {


Index: test/Parser/MicrosoftExtensions.cpp
===
--- test/Parser/MicrosoftExtensions.cpp
+++ test/Parser/MicrosoftExtensions.cpp
@@ -290,6 +290,17 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template pure_virtual_dtor_template::~pure_virtual_dtor_template() { }
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}} expected-warning {{function definition with pure-specifier is a Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline;// expected-note {{in instantiation of member function}}
+
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -12025,7 +12025,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir updated this revision to Diff 87614.
krasimir added a comment.

- Invent better name for comment analysis.


https://reviews.llvm.org/D29626

Files:
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11924,6 +11924,122 @@
"\n"
"// long",
getLLVMStyleWithColumns(15)));
+
+  // Align comment line sections aligned with the next token with the next
+  // token.
+  EXPECT_EQ("class A {\n"
+"public: // public comment\n"
+"  // comment about a\n"
+"  int a;\n"
+"};",
+format("class A {\n"
+   "public: // public comment\n"
+   "  // comment about a\n"
+   "  int a;\n"
+   "};",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("class A {\n"
+"public: // public comment 1\n"
+"// public comment 2\n"
+"  // comment 1 about a\n"
+"  // comment 2 about a\n"
+"  int a;\n"
+"};",
+format("class A {\n"
+   "public: // public comment 1\n"
+   "   // public comment 2\n"
+   "  // comment 1 about a\n"
+   "  // comment 2 about a\n"
+   "  int a;\n"
+   "};",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("int f(int n) { // comment line 1 on f\n"
+"   // comment line 2 on f\n"
+"  // comment line 1 before return\n"
+"  // comment line 2 before return\n"
+"  return n; // comment line 1 on return\n"
+"// comment line 2 on return\n"
+"  // comment line 1 after return\n"
+"}",
+format("int f(int n) { // comment line 1 on f\n"
+   "   // comment line 2 on f\n"
+   "  // comment line 1 before return\n"
+   "  // comment line 2 before return\n"
+   "  return n; // comment line 1 on return\n"
+   "   // comment line 2 on return\n"
+   "  // comment line 1 after return\n"
+   "}",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("int f(int n) {\n"
+"  switch (n) { // comment line 1 on switch\n"
+"   // comment line 2 on switch\n"
+"  // comment line 1 before case 1\n"
+"  // comment line 2 before case 1\n"
+"  case 1: // comment line 1 on case 1\n"
+"  // comment line 2 on case 1\n"
+"// comment line 1 before return 1\n"
+"// comment line 2 before return 1\n"
+"return 1; // comment line 1 on return 1\n"
+"  // comment line 2 on return 1\n"
+"  // comment line 1 before default\n"
+"  // comment line 2 before default\n"
+"  default: // comment line 1 on default\n"
+"   // comment line 2 on default\n"
+"// comment line 1 before return 2\n"
+"return 2 * f(n - 1); // comment line 1 on return 2\n"
+" // comment line 2 on return 2\n"
+"// comment line 1 after return\n"
+"// comment line 2 after return\n"
+"  }\n"
+"}",
+format("int f(int n) {\n"
+   "  switch (n) { // comment line 1 on switch\n"
+   "  // comment line 2 on switch\n"
+   "// comment line 1 before case 1\n"
+   "// comment line 2 before case 1\n"
+   "case 1: // comment line 1 on case 1\n"
+   "  // comment line 2 on case 1\n"
+   "// comment line 1 before return 1\n"
+   "// comment line 2 before return 1\n"
+   "return 1;  // comment line 1 on return 1\n"
+   " // comment line 2 on return 1\n"
+   "// comment line 1 before default\n"
+   "// comment line 2 before default\n"
+   "default:   // comment line 1 on default\n"
+   "// comment line 2 on default\n"
+   "// comment line 1 before return 2\n"
+   "return 2 * f(n - 1); // comment line 1 on return 2\n"
+   "// comment line 2 on return 2\n"
+   "// comment line 1 after return\n"
+   " // comment line 2 after return\n"
+   "  }\n"
+   "}"

[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir updated this revision to Diff 87615.
krasimir marked an inline comment as done.
krasimir added a comment.

- Updated call sites.


https://reviews.llvm.org/D29626

Files:
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11924,6 +11924,122 @@
"\n"
"// long",
getLLVMStyleWithColumns(15)));
+
+  // Align comment line sections aligned with the next token with the next
+  // token.
+  EXPECT_EQ("class A {\n"
+"public: // public comment\n"
+"  // comment about a\n"
+"  int a;\n"
+"};",
+format("class A {\n"
+   "public: // public comment\n"
+   "  // comment about a\n"
+   "  int a;\n"
+   "};",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("class A {\n"
+"public: // public comment 1\n"
+"// public comment 2\n"
+"  // comment 1 about a\n"
+"  // comment 2 about a\n"
+"  int a;\n"
+"};",
+format("class A {\n"
+   "public: // public comment 1\n"
+   "   // public comment 2\n"
+   "  // comment 1 about a\n"
+   "  // comment 2 about a\n"
+   "  int a;\n"
+   "};",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("int f(int n) { // comment line 1 on f\n"
+"   // comment line 2 on f\n"
+"  // comment line 1 before return\n"
+"  // comment line 2 before return\n"
+"  return n; // comment line 1 on return\n"
+"// comment line 2 on return\n"
+"  // comment line 1 after return\n"
+"}",
+format("int f(int n) { // comment line 1 on f\n"
+   "   // comment line 2 on f\n"
+   "  // comment line 1 before return\n"
+   "  // comment line 2 before return\n"
+   "  return n; // comment line 1 on return\n"
+   "   // comment line 2 on return\n"
+   "  // comment line 1 after return\n"
+   "}",
+   getLLVMStyleWithColumns(40)));
+  EXPECT_EQ("int f(int n) {\n"
+"  switch (n) { // comment line 1 on switch\n"
+"   // comment line 2 on switch\n"
+"  // comment line 1 before case 1\n"
+"  // comment line 2 before case 1\n"
+"  case 1: // comment line 1 on case 1\n"
+"  // comment line 2 on case 1\n"
+"// comment line 1 before return 1\n"
+"// comment line 2 before return 1\n"
+"return 1; // comment line 1 on return 1\n"
+"  // comment line 2 on return 1\n"
+"  // comment line 1 before default\n"
+"  // comment line 2 before default\n"
+"  default: // comment line 1 on default\n"
+"   // comment line 2 on default\n"
+"// comment line 1 before return 2\n"
+"return 2 * f(n - 1); // comment line 1 on return 2\n"
+" // comment line 2 on return 2\n"
+"// comment line 1 after return\n"
+"// comment line 2 after return\n"
+"  }\n"
+"}",
+format("int f(int n) {\n"
+   "  switch (n) { // comment line 1 on switch\n"
+   "  // comment line 2 on switch\n"
+   "// comment line 1 before case 1\n"
+   "// comment line 2 before case 1\n"
+   "case 1: // comment line 1 on case 1\n"
+   "  // comment line 2 on case 1\n"
+   "// comment line 1 before return 1\n"
+   "// comment line 2 before return 1\n"
+   "return 1;  // comment line 1 on return 1\n"
+   " // comment line 2 on return 1\n"
+   "// comment line 1 before default\n"
+   "// comment line 2 before default\n"
+   "default:   // comment line 1 on default\n"
+   "// comment line 2 on default\n"
+   "// comment line 1 before return 2\n"
+   "return 2 * f(n - 1); // comment line 1 on return 2\n"
+   "// comment line 2 on return 2\n"
+   "// comment line 1 after return\n"
+   " // comment line 2 after return\n"
+   "  }\n"
+

[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.

klimek wrote:
> krasimir wrote:
> > klimek wrote:
> > > krasimir wrote:
> > > > klimek wrote:
> > > > > Given this, I'd perhaps call this addSection or addCommentSection or 
> > > > > something similar? analyze sounds like it doesn't change the state of 
> > > > > the class...
> > > > Maybe distributeCommentsAccordingToAlignment?
> > > I don't think "AccordingToAlignment" needs to be in the name - it's fine 
> > > that that's in the comment, and it's kind of a detail of what this does.
> > > 
> > > The important thing at the call site is that this adds comments to the 
> > > current unwrapped line, right?
> > That's just half of it: it may add comments to the current line, and it may 
> > add comments to the sequence of tokens preceding the next token with 
> > conceptually belong to the next token and will be put in a new line if the 
> > next token has to be put on a new line.
> > After a while, there is "flushComments" which takes care of the mentioned 
> > comments before next token.
> Sure, but the important part seems to be that it decides which comment tokens 
> belong into the current line?
Renamed. While at it, I added a line of comments for "flushComments" since now 
we have two methods with similar enough names to cause a little confusion with 
no comments.


https://reviews.llvm.org/D29626



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


[PATCH] D29708: [compiler-rt] [test] #ifdef new builtin tests for __arm__ platform

2017-02-08 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
Herald added subscribers: dberris, aemerson.

Add an #if that excludes the newly added aeabi* tests on non-ARM
platforms. This is consistent with other ARM tests, and aims to make
running builtin tests easier. Lacking a proper infrastructure to run
tests selectively, it is more convenient if we do not have to implement
directory-platform exclusions and can just rely on tests compiling to
no-op on other platforms.


Repository:
  rL LLVM

https://reviews.llvm.org/D29708

Files:
  test/builtins/Unit/arm/aeabi_idivmod_test.c
  test/builtins/Unit/arm/aeabi_uidivmod_test.c
  test/builtins/Unit/arm/aeabi_uldivmod_test.c

Index: test/builtins/Unit/arm/aeabi_uldivmod_test.c
===
--- test/builtins/Unit/arm/aeabi_uldivmod_test.c
+++ test/builtins/Unit/arm/aeabi_uldivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on udivmoddi4_test.c
 
 COMPILER_RT_ABI void /* __value_in_regs */ __aeabi_uldivmod(du_int a, du_int b);
@@ -20637,14 +20638,19 @@
 {0xuLL, 0xFFFEuLL, 0x0001uLL, 0x0001uLL},
 {0xuLL, 0xuLL, 0x0001uLL, 0xuLL}
 };
+#endif
 
 int main()
 {
+#if __arm__
 const unsigned N = sizeof(tests) / sizeof(tests[0]);
 unsigned i;
 for (i = 0; i < N; ++i)
 if (test_aeabi_uldivmod(tests[i][0], tests[i][1], tests[i][2], tests[i][3]))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 return 0;
 }
Index: test/builtins/Unit/arm/aeabi_uidivmod_test.c
===
--- test/builtins/Unit/arm/aeabi_uidivmod_test.c
+++ test/builtins/Unit/arm/aeabi_uidivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on udivmodsi4_test.c
 
 extern du_int __aeabi_uidivmod(su_int a, su_int b);
@@ -38,10 +39,12 @@
 
 return 0;
 }
+#endif
 
 
 int main()
 {
+#if __arm__
 if (test__aeabi_uidivmod(0, 1, 0, 0))
 return 1;
 
@@ -56,6 +59,9 @@
  
  	if (test__aeabi_uidivmod(0x8003, 8, 0x1000, 3))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 	return 0;
 }
Index: test/builtins/Unit/arm/aeabi_idivmod_test.c
===
--- test/builtins/Unit/arm/aeabi_idivmod_test.c
+++ test/builtins/Unit/arm/aeabi_idivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on divmodsi4_test.c
 
 extern du_int __aeabi_idivmod(si_int a, si_int b);
@@ -38,10 +39,12 @@
 
 return 0;
 }
+#endif
 
 
 int main()
 {
+#if __arm__
 if (test__aeabi_idivmod(0, 1, 0, 0))
 return 1;
 if (test__aeabi_idivmod(0, -1, 0, 0))
@@ -69,6 +72,9 @@
 return 1;
 	if (test__aeabi_idivmod(0x8007, 8, 0xf001, -1))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 return 0;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r294431 - [test] Fix hard_link_count test to account for fs with dir nlink==1

2017-02-08 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Wed Feb  8 03:57:32 2017
New Revision: 294431

URL: http://llvm.org/viewvc/llvm-project?rev=294431&view=rev
Log:
[test] Fix hard_link_count test to account for fs with dir nlink==1

Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.

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

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp?rev=294431&r1=294430&r2=294431&view=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
 Wed Feb  8 03:57:32 2017
@@ -57,15 +57,19 @@ TEST_CASE(hard_link_count_for_directory)
 Dir3Expect = 3; // .  ..  file5
 #endif
 TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-   hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 
 std::error_code ec;
 TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 }
 TEST_CASE(hard_link_count_increments_test)
 {


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


[PATCH] D29706: [libcxx] [test] Fix hard_link_count test to account for fs with dir nlink==1

2017-02-08 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294431: [test] Fix hard_link_count test to account for fs 
with dir nlink==1 (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D29706?vs=87613&id=87618#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29706

Files:
  
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp


Index: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
===
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -57,15 +57,19 @@
 Dir3Expect = 3; // .  ..  file5
 #endif
 TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-   hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 
 std::error_code ec;
 TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 }
 TEST_CASE(hard_link_count_increments_test)
 {


Index: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
===
--- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -57,15 +57,19 @@
 Dir3Expect = 3; // .  ..  file5
 #endif
 TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-   hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 
 std::error_code ec;
 TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+   hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+   hard_link_count(StaticEnv::Dir) == 1);
 TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+   hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+   hard_link_count(StaticEnv::Dir3) == 1);
 }
 TEST_CASE(hard_link_count_increments_test)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Manuel Klimek via Phabricator via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg.

I'd probably still call it consumeComments or something, as we require a flush 
afterwards for the unconsumed comments, but I don't feel too strongly about 
that.


https://reviews.llvm.org/D29626



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


[PATCH] D29692: [clang-tidy] add check modernize-use-const-instead-of-define

2017-02-08 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseConstInsteadOfDefineCheck.cpp:20
+namespace {
+class MacroParenthesesPPCallbacks : public PPCallbacks {
+public:

s/MacroParentheses/ConstantValues/ ?



Comment at: docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst:11
+
+voif defineSeven() {
+  #define X 7

s/voif/void/
Why is this in a function anyway?



Comment at: test/clang-tidy/modernize-use-const-instead-of-define.cpp:3
+
+// allthough there might be cases where the - sign is actually used those
+// should be rare enough. e.g. int a = 5 BAD1;

s/allthough/Although/



Comment at: test/clang-tidy/modernize-use-const-instead-of-define.cpp:6
+#define BAD1  -1
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD2  2

Check the message?


Repository:
  rL LLVM

https://reviews.llvm.org/D29692



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


r294435 - [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Wed Feb  8 04:30:44 2017
New Revision: 294435

URL: http://llvm.org/viewvc/llvm-project?rev=294435&view=rev
Log:
[clang-format] Break before a sequence of line comments aligned with the next 
line.

Summary:
Make the comment alignment respect sections of line comments originally alinged
with the next token. Until now the decision how to break a continuous sequence
of line comments into sections was taken without reference to the next token.

source:
```
class A {
public: // comment about public
  // comment about a
  int a;
}
```

format before:
```
class A {
public: // comment about public
// comment about a
  int a;
}
```

format after:
```
class A {
public: // comment about public
  // comment about a
  int a;
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/lib/Format/UnwrappedLineParser.h
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=294435&r1=294434&r2=294435&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Wed Feb  8 04:30:44 2017
@@ -2220,13 +2220,71 @@ const FormatToken *UnwrappedLineParser::
   return Line->Tokens.back().Tok;
 }
 
+void UnwrappedLineParser::distributeComments(
+const SmallVectorImpl &Comments,
+const FormatToken *NextTok) {
+  // Whether or not a line comment token continues a line is controlled by
+  // the method continuesLineComment, with the following caveat:
+  //
+  // Define a trail of Comments to be a nonempty proper postfix of Comments 
such
+  // that each comment line from the trail is aligned with the next token, if
+  // the next token exists. If a trail exists, the beginning of the maximal
+  // trail is marked as a start of a new comment section.
+  //
+  // For example in this code:
+  //
+  // int a; // line about a
+  //   // line 1 about b
+  //   // line 2 about b
+  //   int b;
+  //
+  // the two lines about b form a maximal trail, so there are two sections, the
+  // first one consisting of the single comment "// line about a" and the
+  // second one consisting of the next two comments.
+  if (Comments.empty())
+return;
+  bool ShouldPushCommentsInCurrentLine = true;
+  bool HasTrailAlignedWithNextToken = false;
+  unsigned StartOfTrailAlignedWithNextToken = 0;
+  if (NextTok) {
+// We are skipping the first element intentionally.
+for (unsigned i = Comments.size() - 1; i > 0; --i) {
+  if (Comments[i]->OriginalColumn == NextTok->OriginalColumn) {
+HasTrailAlignedWithNextToken = true;
+StartOfTrailAlignedWithNextToken = i;
+  }
+}
+  }
+  for (unsigned i = 0, e = Comments.size(); i < e; ++i) {
+FormatToken *FormatTok = Comments[i];
+if (HasTrailAlignedWithNextToken &&
+i == StartOfTrailAlignedWithNextToken) {
+  FormatTok->ContinuesLineCommentSection = false;
+} else {
+  FormatTok->ContinuesLineCommentSection =
+  continuesLineComment(*FormatTok, *Line, CommentPragmasRegex);
+}
+if (!FormatTok->ContinuesLineCommentSection &&
+(isOnNewLine(*FormatTok) || FormatTok->IsFirst)) {
+  ShouldPushCommentsInCurrentLine = false;
+}
+if (ShouldPushCommentsInCurrentLine) {
+  pushToken(FormatTok);
+} else {
+  CommentsBeforeNextToken.push_back(FormatTok);
+}
+  }
+}
+
 void UnwrappedLineParser::readToken() {
-  bool CommentsInCurrentLine = true;
+  SmallVector Comments;
   do {
 FormatTok = Tokens->getNextToken();
 assert(FormatTok);
 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
(FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
+  distributeComments(Comments, FormatTok);
+  Comments.clear();
   // If there is an unfinished unwrapped line, we flush the preprocessor
   // directives only after that unwrapped line was finished later.
   bool SwitchToPreprocessorLines = !Line->Tokens.empty();
@@ -2256,20 +2314,17 @@ void UnwrappedLineParser::readToken() {
   continue;
 }
 
-if (!FormatTok->Tok.is(tok::comment))
+if (!FormatTok->Tok.is(tok::comment)) {
+  distributeComments(Comments, FormatTok);
+  Comments.clear();
   return;
-FormatTok->ContinuesLineCommentSection =
-continuesLineComment(*FormatTok, *Line, CommentPragmasRegex);
-if (!FormatTok->ContinuesLineCommentSection &&
-(isOnNewLine(*FormatTok) || FormatTok->IsFirst)) {
-  CommentsInCurrentLine = false;
-}
-if (CommentsInCurrentLine) {
-  pushToken(FormatTok);
-} else {
-  CommentsBeforeNextToken.push_back(FormatTok);
 }
+
+Comments.push_back(FormatT

[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294435: [clang-format] Break before a sequence of line 
comments aligned with the next… (authored by krasimir).

Changed prior to commit:
  https://reviews.llvm.org/D29626?vs=87615&id=87622#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29626

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/lib/Format/UnwrappedLineParser.h
  cfe/trunk/unittests/Format/FormatTest.cpp

Index: cfe/trunk/lib/Format/UnwrappedLineParser.h
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.h
+++ cfe/trunk/lib/Format/UnwrappedLineParser.h
@@ -117,6 +117,21 @@
   void nextToken();
   const FormatToken *getPreviousToken();
   void readToken();
+
+  // Decides which comment tokens should be added to the current line and which
+  // should be added as comments before the next token.
+  //
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.
+  //
+  // NextTok specifies the next token. A null pointer NextTok is supported, and
+  // signifies either the absense of a next token, or that the next token
+  // shouldn't be taken into accunt for the analysis.
+  void distributeComments(const SmallVectorImpl &Comments,
+  const FormatToken *NextTok);
+
+  // Adds the comment preceding the next token to unwrapped lines.
   void flushComments(bool NewlineBeforeNext);
   void pushToken(FormatToken *Tok);
   void calculateBraceTypes(bool ExpectClassBody = false);
Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -2220,13 +2220,71 @@
   return Line->Tokens.back().Tok;
 }
 
+void UnwrappedLineParser::distributeComments(
+const SmallVectorImpl &Comments,
+const FormatToken *NextTok) {
+  // Whether or not a line comment token continues a line is controlled by
+  // the method continuesLineComment, with the following caveat:
+  //
+  // Define a trail of Comments to be a nonempty proper postfix of Comments such
+  // that each comment line from the trail is aligned with the next token, if
+  // the next token exists. If a trail exists, the beginning of the maximal
+  // trail is marked as a start of a new comment section.
+  //
+  // For example in this code:
+  //
+  // int a; // line about a
+  //   // line 1 about b
+  //   // line 2 about b
+  //   int b;
+  //
+  // the two lines about b form a maximal trail, so there are two sections, the
+  // first one consisting of the single comment "// line about a" and the
+  // second one consisting of the next two comments.
+  if (Comments.empty())
+return;
+  bool ShouldPushCommentsInCurrentLine = true;
+  bool HasTrailAlignedWithNextToken = false;
+  unsigned StartOfTrailAlignedWithNextToken = 0;
+  if (NextTok) {
+// We are skipping the first element intentionally.
+for (unsigned i = Comments.size() - 1; i > 0; --i) {
+  if (Comments[i]->OriginalColumn == NextTok->OriginalColumn) {
+HasTrailAlignedWithNextToken = true;
+StartOfTrailAlignedWithNextToken = i;
+  }
+}
+  }
+  for (unsigned i = 0, e = Comments.size(); i < e; ++i) {
+FormatToken *FormatTok = Comments[i];
+if (HasTrailAlignedWithNextToken &&
+i == StartOfTrailAlignedWithNextToken) {
+  FormatTok->ContinuesLineCommentSection = false;
+} else {
+  FormatTok->ContinuesLineCommentSection =
+  continuesLineComment(*FormatTok, *Line, CommentPragmasRegex);
+}
+if (!FormatTok->ContinuesLineCommentSection &&
+(isOnNewLine(*FormatTok) || FormatTok->IsFirst)) {
+  ShouldPushCommentsInCurrentLine = false;
+}
+if (ShouldPushCommentsInCurrentLine) {
+  pushToken(FormatTok);
+} else {
+  CommentsBeforeNextToken.push_back(FormatTok);
+}
+  }
+}
+
 void UnwrappedLineParser::readToken() {
-  bool CommentsInCurrentLine = true;
+  SmallVector Comments;
   do {
 FormatTok = Tokens->getNextToken();
 assert(FormatTok);
 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
(FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
+  distributeComments(Comments, FormatTok);
+  Comments.clear();
   // If there is an unfinished unwrapped line, we flush the preprocessor
   // directives only after that unwrapped line was finished later.
   bool SwitchToPreprocessorLines = !Line->Tokens.empty();
@@ -2256,20 +2314,17 @@
   continue;
 }
 
-if (!FormatTok->Tok.is(tok::comment))
+if (!FormatTok->Tok.is(tok::comment)) {
+  distributeComments(Comments, FormatTok);
+  Comments.clear();
   return;
-FormatTok->ContinuesLineCommentSection =
-continuesLineComment(*FormatTok, *

[PATCH] D29708: [compiler-rt] [test] #ifdef new builtin tests for __arm__ platform

2017-02-08 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294438: [test] #ifdef new builtin tests for __arm__ platform 
(authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D29708?vs=87617&id=87629#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29708

Files:
  compiler-rt/trunk/test/builtins/Unit/arm/aeabi_idivmod_test.c
  compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uidivmod_test.c
  compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uldivmod_test.c

Index: compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uidivmod_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uidivmod_test.c
+++ compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uidivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on udivmodsi4_test.c
 
 extern du_int __aeabi_uidivmod(su_int a, su_int b);
@@ -38,10 +39,12 @@
 
 return 0;
 }
+#endif
 
 
 int main()
 {
+#if __arm__
 if (test__aeabi_uidivmod(0, 1, 0, 0))
 return 1;
 
@@ -56,6 +59,9 @@
  
  	if (test__aeabi_uidivmod(0x8003, 8, 0x1000, 3))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 	return 0;
 }
Index: compiler-rt/trunk/test/builtins/Unit/arm/aeabi_idivmod_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/arm/aeabi_idivmod_test.c
+++ compiler-rt/trunk/test/builtins/Unit/arm/aeabi_idivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on divmodsi4_test.c
 
 extern du_int __aeabi_idivmod(si_int a, si_int b);
@@ -38,10 +39,12 @@
 
 return 0;
 }
+#endif
 
 
 int main()
 {
+#if __arm__
 if (test__aeabi_idivmod(0, 1, 0, 0))
 return 1;
 if (test__aeabi_idivmod(0, -1, 0, 0))
@@ -69,6 +72,9 @@
 return 1;
 	if (test__aeabi_idivmod(0x8007, 8, 0xf001, -1))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 return 0;
 }
Index: compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uldivmod_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uldivmod_test.c
+++ compiler-rt/trunk/test/builtins/Unit/arm/aeabi_uldivmod_test.c
@@ -14,6 +14,7 @@
 #include "int_lib.h"
 #include 
 
+#if __arm__
 // Based on udivmoddi4_test.c
 
 COMPILER_RT_ABI void /* __value_in_regs */ __aeabi_uldivmod(du_int a, du_int b);
@@ -20637,14 +20638,19 @@
 {0xuLL, 0xFFFEuLL, 0x0001uLL, 0x0001uLL},
 {0xuLL, 0xuLL, 0x0001uLL, 0xuLL}
 };
+#endif
 
 int main()
 {
+#if __arm__
 const unsigned N = sizeof(tests) / sizeof(tests[0]);
 unsigned i;
 for (i = 0; i < N; ++i)
 if (test_aeabi_uldivmod(tests[i][0], tests[i][1], tests[i][2], tests[i][3]))
 return 1;
+#else
+printf("skipped\n");
+#endif
 
 return 0;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29713: [clang-format] Move comment tests to their own file.

2017-02-08 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D29713



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


[PATCH] D28973: Supresses misc-move-constructor-init warning for const fields.

2017-02-08 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. I'll commit the patch for you.


https://reviews.llvm.org/D28973



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


r294457 - [clang-format] Move OriginalPrefix from base to subclass.

2017-02-08 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Wed Feb  8 08:45:19 2017
New Revision: 294457

URL: http://llvm.org/viewvc/llvm-project?rev=294457&view=rev
Log:
[clang-format] Move OriginalPrefix from base to subclass.

Summary:
OriginalPrefix is only needed for line comment sections. Moved from the base 
class to the child class.
No functional changes.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/lib/Format/BreakableToken.h

Modified: cfe/trunk/lib/Format/BreakableToken.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.h?rev=294457&r1=294456&r2=294457&view=diff
==
--- cfe/trunk/lib/Format/BreakableToken.h (original)
+++ cfe/trunk/lib/Format/BreakableToken.h Wed Feb  8 08:45:19 2017
@@ -282,10 +282,6 @@ protected:
   // line.
   bool FirstInLine;
 
-  // In case of line comments, holds the original prefix, including trailing
-  // whitespace.
-  SmallVector OriginalPrefix;
-
   // The prefix to use in front a line that has been reflown up.
   // For example, when reflowing the second line after the first here:
   // // comment 1
@@ -394,6 +390,14 @@ private:
   unsigned getContentStartColumn(unsigned LineIndex,
  unsigned TailOffset) const override;
 
+  // OriginalPrefix[i] contains the original prefix of line i, including
+  // trailing whitespace before the start of the content. The indentation
+  // preceding the prefix is not included.
+  // For example, if the line is:
+  // // content
+  // then the original prefix is "// ".
+  SmallVector OriginalPrefix;
+
   // Prefix[i] contains the intended leading "//" with trailing spaces to
   // account for the indentation of content within the comment at line i after
   // formatting. It can be different than the original prefix when the original


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


[PATCH] D29716: [clang-format] Move OriginalPrefix from base to subclass.

2017-02-08 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D29716



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


[PATCH] D29716: [clang-format] Move OriginalPrefix from base to subclass.

2017-02-08 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294457: [clang-format] Move OriginalPrefix from base to 
subclass. (authored by krasimir).

Changed prior to commit:
  https://reviews.llvm.org/D29716?vs=87643&id=87653#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29716

Files:
  cfe/trunk/lib/Format/BreakableToken.h


Index: cfe/trunk/lib/Format/BreakableToken.h
===
--- cfe/trunk/lib/Format/BreakableToken.h
+++ cfe/trunk/lib/Format/BreakableToken.h
@@ -282,10 +282,6 @@
   // line.
   bool FirstInLine;
 
-  // In case of line comments, holds the original prefix, including trailing
-  // whitespace.
-  SmallVector OriginalPrefix;
-
   // The prefix to use in front a line that has been reflown up.
   // For example, when reflowing the second line after the first here:
   // // comment 1
@@ -394,6 +390,14 @@
   unsigned getContentStartColumn(unsigned LineIndex,
  unsigned TailOffset) const override;
 
+  // OriginalPrefix[i] contains the original prefix of line i, including
+  // trailing whitespace before the start of the content. The indentation
+  // preceding the prefix is not included.
+  // For example, if the line is:
+  // // content
+  // then the original prefix is "// ".
+  SmallVector OriginalPrefix;
+
   // Prefix[i] contains the intended leading "//" with trailing spaces to
   // account for the indentation of content within the comment at line i after
   // formatting. It can be different than the original prefix when the original


Index: cfe/trunk/lib/Format/BreakableToken.h
===
--- cfe/trunk/lib/Format/BreakableToken.h
+++ cfe/trunk/lib/Format/BreakableToken.h
@@ -282,10 +282,6 @@
   // line.
   bool FirstInLine;
 
-  // In case of line comments, holds the original prefix, including trailing
-  // whitespace.
-  SmallVector OriginalPrefix;
-
   // The prefix to use in front a line that has been reflown up.
   // For example, when reflowing the second line after the first here:
   // // comment 1
@@ -394,6 +390,14 @@
   unsigned getContentStartColumn(unsigned LineIndex,
  unsigned TailOffset) const override;
 
+  // OriginalPrefix[i] contains the original prefix of line i, including
+  // trailing whitespace before the start of the content. The indentation
+  // preceding the prefix is not included.
+  // For example, if the line is:
+  // // content
+  // then the original prefix is "// ".
+  SmallVector OriginalPrefix;
+
   // Prefix[i] contains the intended leading "//" with trailing spaces to
   // account for the indentation of content within the comment at line i after
   // formatting. It can be different than the original prefix when the original
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r294459 - [clang-tidy] Supresses misc-move-constructor-init warning for const fields.

2017-02-08 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Feb  8 08:56:16 2017
New Revision: 294459

URL: http://llvm.org/viewvc/llvm-project?rev=294459&view=rev
Log:
[clang-tidy] Supresses misc-move-constructor-init warning for const fields.

Patch by CJ DiMeglio!

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

Modified:
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=294459&r1=294458&r2=294459&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Wed 
Feb  8 08:56:16 2017
@@ -57,6 +57,9 @@ void MoveConstructorInitCheck::check(con
   if (QT.isTriviallyCopyableType(*Result.Context))
 return;
 
+  if (QT.isConstQualified())
+return;
+
   const auto *RD = QT->getAsCXXRecordDecl();
   if (RD && RD->isTriviallyCopyable())
 return;

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp?rev=294459&r1=294458&r2=294459&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp Wed 
Feb  8 08:56:16 2017
@@ -84,6 +84,16 @@ struct N {
   N(N &&RHS) : Mem(move(RHS.Mem)) {}
 };
 
+struct O {
+  O(O&& other) : b(other.b) {} // ok
+  const B b;
+};
+
+struct P {
+  P(O&& other) : b(other.b) {} // ok
+  B b;
+};
+
 struct Movable {
   Movable(Movable &&) = default;
   Movable(const Movable &) = default;


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


[PATCH] D28973: Supresses misc-move-constructor-init warning for const fields.

2017-02-08 Thread Alexander Kornienko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294459: [clang-tidy] Supresses misc-move-constructor-init 
warning for const fields. (authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D28973?vs=87484&id=87655#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28973

Files:
  clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp


Index: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
@@ -57,6 +57,9 @@
   if (QT.isTriviallyCopyableType(*Result.Context))
 return;
 
+  if (QT.isConstQualified())
+return;
+
   const auto *RD = QT->getAsCXXRecordDecl();
   if (RD && RD->isTriviallyCopyable())
 return;
Index: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
@@ -84,6 +84,16 @@
   N(N &&RHS) : Mem(move(RHS.Mem)) {}
 };
 
+struct O {
+  O(O&& other) : b(other.b) {} // ok
+  const B b;
+};
+
+struct P {
+  P(O&& other) : b(other.b) {} // ok
+  B b;
+};
+
 struct Movable {
   Movable(Movable &&) = default;
   Movable(const Movable &) = default;


Index: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
@@ -57,6 +57,9 @@
   if (QT.isTriviallyCopyableType(*Result.Context))
 return;
 
+  if (QT.isConstQualified())
+return;
+
   const auto *RD = QT->getAsCXXRecordDecl();
   if (RD && RD->isTriviallyCopyable())
 return;
Index: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
@@ -84,6 +84,16 @@
   N(N &&RHS) : Mem(move(RHS.Mem)) {}
 };
 
+struct O {
+  O(O&& other) : b(other.b) {} // ok
+  const B b;
+};
+
+struct P {
+  P(O&& other) : b(other.b) {} // ok
+  B b;
+};
+
 struct Movable {
   Movable(Movable &&) = default;
   Movable(const Movable &) = default;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29718: [libclang] [OpenCL] Expose half type

2017-02-08 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh created this revision.

Expose the half type (fp16) through libclang and the python bindings.

It seems CXType_LastBuiltin was not updated in b2ea6d9 ("Enable
support for __float128 in Clang", 2016-04-13), so update it now.

Add an Index test for OpenCL types; in the future we will add other
OpenCL types such as images to this test.


https://reviews.llvm.org/D29718

Files:
  bindings/python/clang/cindex.py
  include/clang-c/Index.h
  test/Index/opencl-types.cl
  tools/libclang/CXType.cpp


Index: tools/libclang/CXType.cpp
===
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -48,6 +48,7 @@
 BTCASE(Long);
 BTCASE(LongLong);
 BTCASE(Int128);
+BTCASE(Half);
 BTCASE(Float);
 BTCASE(Double);
 BTCASE(LongDouble);
@@ -503,6 +504,7 @@
 TKIND(Long);
 TKIND(LongLong);
 TKIND(Int128);
+TKIND(Half);
 TKIND(Float);
 TKIND(Double);
 TKIND(LongDouble);
Index: test/Index/opencl-types.cl
===
--- /dev/null
+++ test/Index/opencl-types.cl
@@ -0,0 +1,24 @@
+// RUN: c-index-test -test-print-type %s | FileCheck %s
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+typedef half half4 __attribute__((ext_vector_type(4)));
+typedef float float4 __attribute__((ext_vector_type(4)));
+typedef double double4 __attribute__((ext_vector_type(4)));
+
+void kernel testFloatTypes() {
+  half scalarHalf;
+  half4 vectorHalf;
+  float scalarFloat;
+  float4 vectorFloat;
+  double scalarDouble;
+  double4 vectorDouble;
+}
+
+// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=half] [typekind=Half] 
[isPOD=1]
+// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] 
[canonicaltype=half __attribute__((ext_vector_type(4)))] 
[canonicaltypekind=Unexposed] [isPOD=1]
+// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] 
[isPOD=1]
+// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] 
[typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] 
[canonicaltypekind=Unexposed] [isPOD=1]
+// CHECK: VarDecl=scalarDouble:15:10 (Definition) [type=double] 
[typekind=Double] [isPOD=1]
+// CHECK: VarDecl=vectorDouble:16:11 (Definition) [type=double4] 
[typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] 
[canonicaltypekind=Unexposed] [isPOD=1]
Index: include/clang-c/Index.h
===
--- include/clang-c/Index.h
+++ include/clang-c/Index.h
@@ -3011,8 +3011,9 @@
   CXType_ObjCClass = 28,
   CXType_ObjCSel = 29,
   CXType_Float128 = 30,
+  CXType_Half = 31,
   CXType_FirstBuiltin = CXType_Void,
-  CXType_LastBuiltin  = CXType_ObjCSel,
+  CXType_LastBuiltin  = CXType_Half,
 
   CXType_Complex = 100,
   CXType_Pointer = 101,
Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -1887,6 +1887,7 @@
 TypeKind.OBJCCLASS = TypeKind(28)
 TypeKind.OBJCSEL = TypeKind(29)
 TypeKind.FLOAT128 = TypeKind(30)
+TypeKind.HALF = TypeKind(31)
 TypeKind.COMPLEX = TypeKind(100)
 TypeKind.POINTER = TypeKind(101)
 TypeKind.BLOCKPOINTER = TypeKind(102)


Index: tools/libclang/CXType.cpp
===
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -48,6 +48,7 @@
 BTCASE(Long);
 BTCASE(LongLong);
 BTCASE(Int128);
+BTCASE(Half);
 BTCASE(Float);
 BTCASE(Double);
 BTCASE(LongDouble);
@@ -503,6 +504,7 @@
 TKIND(Long);
 TKIND(LongLong);
 TKIND(Int128);
+TKIND(Half);
 TKIND(Float);
 TKIND(Double);
 TKIND(LongDouble);
Index: test/Index/opencl-types.cl
===
--- /dev/null
+++ test/Index/opencl-types.cl
@@ -0,0 +1,24 @@
+// RUN: c-index-test -test-print-type %s | FileCheck %s
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+typedef half half4 __attribute__((ext_vector_type(4)));
+typedef float float4 __attribute__((ext_vector_type(4)));
+typedef double double4 __attribute__((ext_vector_type(4)));
+
+void kernel testFloatTypes() {
+  half scalarHalf;
+  half4 vectorHalf;
+  float scalarFloat;
+  float4 vectorFloat;
+  double scalarDouble;
+  double4 vectorDouble;
+}
+
+// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=half] [typekind=Half] [isPOD=1]
+// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1]
+// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1]
+// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_ve

[PATCH] D29621: Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

2017-02-08 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments.



Comment at: lib/Tooling/RefactoringCallbacks.cpp:160
+llvm::Expected>
+ReplaceNodeWithTemplate::create(StringRef FromId, StringRef ToTemplate) {
+  std::vector ParsedTemplate;

Is this covered in the test?



Comment at: unittests/Tooling/RefactoringCallbacksTest.cpp:101
+  std::string Expected = "void f() { FOO }";
+  ReplaceNodeWithTemplate Callback("id", "FOO");
+  expectRewritten(Code, Expected, id("id", declStmt()), Callback);

Have you rerun the tests? Does this still build?


https://reviews.llvm.org/D29621



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


[clang-tools-extra] r294467 - [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()

2017-02-08 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Feb  8 10:11:22 2017
New Revision: 294467

URL: http://llvm.org/viewvc/llvm-project?rev=294467&view=rev
Log:
[clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()

hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about
errors that lead to invalid AST.

Modified:
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=294467&r1=294466&r2=294467&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Wed 
Feb  8 10:11:22 2017
@@ -72,7 +72,7 @@ void DefinitionsInHeadersCheck::register
 
 void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
   // Don't run the check in failing TUs.
-  if (Result.Context->getDiagnostics().hasErrorOccurred())
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
 return;
 
   // C++ [basic.def.odr] p6:

Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=294467&r1=294466&r2=294467&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp Wed 
Feb  8 10:11:22 2017
@@ -30,7 +30,7 @@ void SuspiciousSemicolonCheck::registerM
 }
 
 void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {
-  if (Result.Context->getDiagnostics().hasErrorOccurred())
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
 return;
 
   const auto *Semicolon = Result.Nodes.getNodeAs("semi");

Modified: 
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=294467&r1=294466&r2=294467&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
Wed Feb  8 10:11:22 2017
@@ -1,4 +1,10 @@
-// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 | 
FileCheck %s
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- -DERROR 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK-ERROR \
+// RUN:   -implicit-check-not="{{warning|error}}:"
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon,clang-diagnostic*" 
\
+// RUN:-- -DWERROR -Wno-everything -Werror=unused-variable 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK-WERROR \
+// RUN:   -implicit-check-not="{{warning|error}}:"
 
 // Note: This test verifies that, the checker does not emit any warning for
 //   files that do not compile.
@@ -7,6 +13,14 @@ bool g();
 
 void f() {
   if (g());
-  // CHECK-NOT: [misc-suspicious-semicolon]
+  // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon 
[misc-suspicious-semicolon]
+#if ERROR
   int a
+  // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration 
[clang-diagnostic-error]
+#elif WERROR
+  int a;
+  // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' 
[clang-diagnostic-unused-variable]
+#else
+#error "One of ERROR or WERROR should be defined.
+#endif
 }


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


r294465 - [MS] Fix C++ destructor thunk line info for a declaration

2017-02-08 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Feb  8 10:09:32 2017
New Revision: 294465

URL: http://llvm.org/viewvc/llvm-project?rev=294465&view=rev
Log:
[MS] Fix C++ destructor thunk line info for a declaration

Sometimes the MS ABI needs to emit thunks for declarations that don't
have bodies. Destructor thunks make calls to inlinable functions, so
they need line info or LLVM will complain.

Fixes PR31893

Added:
cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=294465&r1=294464&r2=294465&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Feb  8 10:09:32 2017
@@ -1089,8 +1089,13 @@ void CodeGenFunction::GenerateCode(Globa
   if (FD->hasAttr())
 DebugInfo = nullptr; // disable debug info indefinitely for this function
 
+  // The function might not have a body if we're generating thunks for a
+  // function declaration.
   SourceRange BodyRange;
-  if (Stmt *Body = FD->getBody()) BodyRange = Body->getSourceRange();
+  if (Stmt *Body = FD->getBody())
+BodyRange = Body->getSourceRange();
+  else
+BodyRange = FD->getLocation();
   CurEHLocation = BodyRange.getEnd();
 
   // Use the location of the start of the function to determine where

Added: cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp?rev=294465&view=auto
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp Wed Feb  8 10:09:32 
2017
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple i686--windows -emit-llvm 
-debug-info-kind=line-tables-only -x c++ %s -fms-extensions -o - | FileCheck %s
+
+struct __declspec(dllexport) S { virtual ~S(); };
+struct __declspec(dllexport) T { virtual ~T(); };
+struct __declspec(dllexport) U : S, T { virtual ~U(); };
+
+// CHECK-LABEL: define {{.*}} @"\01??_GS@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DS@@UAE@XZ"(%struct.S* 
%this1){{.*}}!dbg !{{[0-9]+}}
+
+// CHECK-LABEL: define {{.*}} @"\01??_GT@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DT@@UAE@XZ"(%struct.T* 
%this1){{.*}}!dbg !{{[0-9]+}}
+
+// CHECK-LABEL: define {{.*}} @"\01??_GU@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DU@@UAE@XZ"(%struct.U* 
%this1){{.*}}!dbg !{{[0-9]+}}


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


[PATCH] D29630: [libcxx] Threading support: externalize sleep_for()

2017-02-08 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath updated this revision to Diff 87669.
rmaprath added a comment.

Sorry for the delay, I've updated the patch with all the comments addressed.

@EricWF: Got one question before I commit: The `sleep_for` function in the 
dylib (`thread.cpp`) is now quite small. Is there a particular reason to keep 
it there? I was wondering if we should move that bit to the `` header 
altogether.


https://reviews.llvm.org/D29630

Files:
  include/__threading_support
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -114,33 +114,9 @@
 void
 sleep_for(const chrono::nanoseconds& ns)
 {
-using namespace chrono;
-if (ns > nanoseconds::zero())
+if (ns > chrono::nanoseconds::zero())
 {
-#if defined(_LIBCPP_WIN32API)
-milliseconds ms = duration_cast(ns);
-if (ms.count() == 0 || ns > duration_cast(ms))
-  ++ms;
-Sleep(ms.count());
-#else
-seconds s = duration_cast(ns);
-timespec ts;
-typedef decltype(ts.tv_sec) ts_sec;
-_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max();
-if (s.count() < ts_sec_max)
-{
-ts.tv_sec = static_cast(s.count());
-ts.tv_nsec = static_cast((ns-s).count());
-}
-else
-{
-ts.tv_sec = ts_sec_max;
-ts.tv_nsec = giga::num - 1;
-}
-
-while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
-;
-#endif
+__libcpp_thread_sleep_for(ns);
 }
 }
 
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -12,6 +12,8 @@
 #define _LIBCPP_THREADING_SUPPORT
 
 #include <__config>
+#include 
+#include 
 
 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #pragma GCC system_header
@@ -28,8 +30,6 @@
 #include 
 #include 
 #include 
-
-#include 
 #endif
 
 #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
@@ -183,6 +183,9 @@
 _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_yield();
 
+_LIBCPP_THREAD_ABI_VISIBILITY
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
+
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -345,6 +348,28 @@
   sched_yield();
 }
 
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+   using namespace chrono;
+   seconds __s = duration_cast(__ns);
+   timespec __ts;
+   typedef decltype(__ts.tv_sec) ts_sec;
+   _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits::max();
+
+   if (__s.count() < __ts_sec_max)
+   {
+ __ts.tv_sec = static_cast(__s.count());
+ __ts.tv_nsec = static_cast((__ns - __s).count());
+   }
+   else
+   {
+ __ts.tv_sec = __ts_sec_max;
+ __ts.tv_nsec = 9; // (10^9 - 1)
+   }
+
+   while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
+}
+
 // Thread local storage
 int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
 {
@@ -562,6 +587,14 @@
   SwitchToThread();
 }
 
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+  using namespace chrono;
+  // round-up to the nearest milisecond
+  milliseconds __ms = duration_cast(__ns + 99);
+  Sleep(__ms.count());
+}
+
 // Thread Local Storage
 int __libcpp_tls_create(__libcpp_tls_key* __key,
 void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29630: [libcxx] Threading support: externalize sleep_for()

2017-02-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D29630#670873, @rmaprath wrote:

> Sorry for the delay, I've updated the patch with all the comments addressed.
>
> @EricWF: Got one question before I commit: The `sleep_for` function in the 
> dylib (`thread.cpp`) is now quite small. Is there a particular reason to keep 
> it there? I was wondering if we should move that bit to the `` header 
> altogether.


Removing the definition in the dylib would be ABI breaking.


https://reviews.llvm.org/D29630



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


[PATCH] D29630: [libcxx] Threading support: externalize sleep_for()

2017-02-08 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath added a comment.

In https://reviews.llvm.org/D29630#670876, @EricWF wrote:

> In https://reviews.llvm.org/D29630#670873, @rmaprath wrote:
>
> > Sorry for the delay, I've updated the patch with all the comments addressed.
> >
> > @EricWF: Got one question before I commit: The `sleep_for` function in the 
> > dylib (`thread.cpp`) is now quite small. Is there a particular reason to 
> > keep it there? I was wondering if we should move that bit to the `` 
> > header altogether.
>
>
> Removing the definition in the dylib would be ABI breaking.


Ah! of course.

Thanks.


https://reviews.llvm.org/D29630



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


[libcxx] r294483 - Docs: drop minor version

2017-02-08 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Feb  8 11:28:23 2017
New Revision: 294483

URL: http://llvm.org/viewvc/llvm-project?rev=294483&view=rev
Log:
Docs: drop minor version

Modified:
libcxx/branches/release_40/docs/conf.py

Modified: libcxx/branches/release_40/docs/conf.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/docs/conf.py?rev=294483&r1=294482&r2=294483&view=diff
==
--- libcxx/branches/release_40/docs/conf.py (original)
+++ libcxx/branches/release_40/docs/conf.py Wed Feb  8 11:28:23 2017
@@ -47,9 +47,9 @@ copyright = u'2011-2017, LLVM Project'
 # built documents.
 #
 # The short X.Y version.
-version = '4.0'
+version = '4'
 # The full version, including alpha/beta/rc tags.
-release = '4.0'
+release = '4'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


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


[clang-tools-extra] r294491 - [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py

2017-02-08 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Wed Feb  8 11:50:24 2017
New Revision: 294491

URL: http://llvm.org/viewvc/llvm-project?rev=294491&view=rev
Log:
[clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py

Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh, klimek, bkramer

Subscribers: JDevlieghere, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py

Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=294491&r1=294490&r2=294491&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Wed Feb  8 
11:50:24 2017
@@ -55,6 +55,14 @@ def main():
   help='checks filter, when not specified, use clang-tidy '
   'default',
   default='')
+  parser.add_argument('-extra-arg', dest='extra_arg',
+  action='append', default=[],
+  help='Additional argument to append to the compiler '
+  'command line.')
+  parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+  action='append', default=[],
+  help='Additional argument to prepend to the compiler '
+  'command line.')
   clang_tidy_args = []
   argv = sys.argv[1:]
   if '--' in argv:
@@ -113,6 +121,10 @@ def main():
   if args.checks != '':
 command.append('-checks=' + quote + args.checks + quote)
   command.extend(lines_by_file.keys())
+  for arg in args.extra_arg:
+  command.append('-extra-arg=%s' % arg)
+  for arg in args.extra_arg_before:
+  command.append('-extra-arg-before=%s' % arg)
   command.extend(clang_tidy_args)
 
   sys.exit(subprocess.call(' '.join(command), shell=True))


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


[PATCH] D29699: [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py

2017-02-08 Thread Ehsan Akhgari via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294491: [clang-tidy] Add -extra-arg and -extra-arg-before to 
clang-tidy-diff.py (authored by ehsan).

Changed prior to commit:
  https://reviews.llvm.org/D29699?vs=87576&id=87673#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29699

Files:
  clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py


Index: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
@@ -55,6 +55,14 @@
   help='checks filter, when not specified, use clang-tidy '
   'default',
   default='')
+  parser.add_argument('-extra-arg', dest='extra_arg',
+  action='append', default=[],
+  help='Additional argument to append to the compiler '
+  'command line.')
+  parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+  action='append', default=[],
+  help='Additional argument to prepend to the compiler '
+  'command line.')
   clang_tidy_args = []
   argv = sys.argv[1:]
   if '--' in argv:
@@ -113,6 +121,10 @@
   if args.checks != '':
 command.append('-checks=' + quote + args.checks + quote)
   command.extend(lines_by_file.keys())
+  for arg in args.extra_arg:
+  command.append('-extra-arg=%s' % arg)
+  for arg in args.extra_arg_before:
+  command.append('-extra-arg-before=%s' % arg)
   command.extend(clang_tidy_args)
 
   sys.exit(subprocess.call(' '.join(command), shell=True))


Index: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
@@ -55,6 +55,14 @@
   help='checks filter, when not specified, use clang-tidy '
   'default',
   default='')
+  parser.add_argument('-extra-arg', dest='extra_arg',
+  action='append', default=[],
+  help='Additional argument to append to the compiler '
+  'command line.')
+  parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+  action='append', default=[],
+  help='Additional argument to prepend to the compiler '
+  'command line.')
   clang_tidy_args = []
   argv = sys.argv[1:]
   if '--' in argv:
@@ -113,6 +121,10 @@
   if args.checks != '':
 command.append('-checks=' + quote + args.checks + quote)
   command.extend(lines_by_file.keys())
+  for arg in args.extra_arg:
+  command.append('-extra-arg=%s' % arg)
+  for arg in args.extra_arg_before:
+  command.append('-extra-arg-before=%s' % arg)
   command.extend(clang_tidy_args)
 
   sys.exit(subprocess.call(' '.join(command), shell=True))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29723: [Sema] Add lvalue-to-rvalue cast in direct-list-initialization of enum

2017-02-08 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.

After r264564, we allowed direct-list-initialization of an enum from an
integral value in C++1z mode, so long as that value can convert to the
enum's underlying type.

In this kind of initialization, we need a lvalue-to-rvalue conversion
for the initializer value if it is not a rvalue. This lets us accept the
following code:

  enum class A : unsigned {};
  A foo(unsigned x) { return A{x}; }


https://reviews.llvm.org/D29723

Files:
  lib/Sema/SemaInit.cpp
  test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp


Index: test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
===
--- test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
+++ test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
@@ -150,35 +150,44 @@
 
 void f(T);
 f(T{0});
+
+char c;
+auto t3 = T{c};
   }
 #if __cplusplus <= 201402L
-  // expected-error@-15 5{{cannot initialize}}
-  // expected-error@-15 5{{cannot initialize}}
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  //
   //
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
   //
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  //
+  // expected-error@-18 5{{cannot initialize}}
 #else
-  // expected-error@-29 {{cannot initialize}}
-  // expected-error@-29 {{cannot initialize}}
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  //
   //
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
   //
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
+  //
+  // expected-error@-35 {{cannot initialize}}
 #endif
 
   template void bad() {
@@ -252,4 +261,12 @@
 (void)B{0.0}; // expected-error {{type 'double' cannot be narrowed}}
 #endif
   }
+
+#if __cplusplus > 201402L
+  enum class F : unsigned {};
+  F f1(unsigned x) { return F{x}; }
+  F f2(const unsigned x) { return F{x}; }
+  F f3(bool x) { return F{x}; }
+  F f4(const bool x) { return F{x}; }
+#endif
 }
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -3981,6 +3981,8 @@
   ImplicitConversionSequence ICS;
   ICS.setStandard();
   ICS.Standard.setAsIdentityConversion();
+  if (!E->isRValue())
+ICS.Standard.First = ICK_Lvalue_To_Rvalue;
   // If E is of a floating-point type, then the conversion is ill-formed
   // due to narrowing, but go through the motions in order to produce the
   // right diagnostic.


Index: test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
===
--- test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
+++ test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp
@@ -150,35 +150,44 @@
 
 void f(T);
 f(T{0});
+
+char c;
+auto t3 = T{c};
   }
 #if __cplusplus <= 201402L
-  // expected-error@-15 5{{cannot initialize}}
-  // expected-error@-15 5{{cannot initialize}}
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
+  //
   //
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
   //
+  // expected-error@-18 5{{cannot initialize}}
   //
-  // expected-error@-15 5{{cannot initialize}}
+  //
+  // expected-error@-18 5{{cannot initialize}}
 #else
-  // expected-error@-29 {{cannot initialize}}
-  // expected-error@-29 {{cannot initialize}}
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
+  //
   //
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}
   //
-  // expected-error@-29 {{cannot initialize}}
+  // expected-error@-35 {{cannot initialize}}

[libcxx] r294501 - Update info for LWG 2665 in upcoming_meeting.html

2017-02-08 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Feb  8 13:04:18 2017
New Revision: 294501

URL: http://llvm.org/viewvc/llvm-project?rev=294501&view=rev
Log:
Update info for LWG 2665 in upcoming_meeting.html

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=294501&r1=294500&r2=294501&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Feb  8 13:04:18 2017
@@ -85,7 +85,7 @@
http://wg21.link/LWG2855";>2855std::throw_with_nested("string_literal")Kona
 
Priority 1 
Bugs
-   http://wg21.link/LWG2665";>2665remove_filename() post 
condition is incorrectKona
+   http://wg21.link/LWG2665";>2665remove_filename() post 
condition is incorrectKonaWe do this already
http://wg21.link/LWG2806";>2806Base class 
of bad_optional_accessKonaWe do this already
http://wg21.link/LWG2857";>2857{variant,optional,any}::emplace
 should return the constructed valueKona
 
@@ -118,12 +118,12 @@
 2853 - I think that this will be mostly adding tests.
 2855 - This should be easy; trick will be devising tests.
 
-2665 - Eric? 
+2665 - We do this already.
 2806 - We do this already.
 2857 - This is the subject of several NB comments.
 
 
-Last Updated: 6-Feb-2017
+Last Updated: 7-Feb-2017
 
 
 


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


[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-08 Thread Paweł Żukowski via Phabricator via cfe-commits
idlecode created this revision.

In case user did not provide valid standard name for `-std` option,
available values (with short description) will be reported.

To test: `clang -std=iso3103 -c source.c`


https://reviews.llvm.org/D29724

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Frontend/CompilerInvocation.cpp


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1694,10 +1694,21 @@
   .Case(alias, LangStandard::lang_##id)
 #include "clang/Frontend/LangStandards.def"
   .Default(LangStandard::lang_unspecified);
-if (LangStd == LangStandard::lang_unspecified)
+if (LangStd == LangStandard::lang_unspecified) {
   Diags.Report(diag::err_drv_invalid_value)
 << A->getAsString(Args) << A->getValue();
-else {
+  // Report all supported standards with description.
+  Diags.Report(diag::note_drv_supported_values);
+  for (unsigned KindValue = 0;
+  KindValue != LangStandard::lang_unspecified;
+  ++KindValue)
+  {
+const LangStandard &Std = LangStandard::getLangStandardForKind(
+  static_cast(KindValue));
+Diags.Report(diag::note_drv_supported_value_with_description)
+  << Std.getName() << Std.getDescription();
+  }
+} else {
   // Valid standard, check to make sure language and standard are
   // compatible.
   const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -230,6 +230,8 @@
   "The last /TC or /TP option takes precedence over earlier instances">;
 def note_drv_address_sanitizer_debug_runtime : Note<
   "AddressSanitizer doesn't support linking with debug runtime libraries yet">;
+def note_drv_supported_values : Note<"supported values are:">;
+def note_drv_supported_value_with_description : Note<" %0 - %1">;
 
 def err_analyzer_config_no_value : Error<
   "analyzer-config option '%0' has a key but no value">;


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1694,10 +1694,21 @@
   .Case(alias, LangStandard::lang_##id)
 #include "clang/Frontend/LangStandards.def"
   .Default(LangStandard::lang_unspecified);
-if (LangStd == LangStandard::lang_unspecified)
+if (LangStd == LangStandard::lang_unspecified) {
   Diags.Report(diag::err_drv_invalid_value)
 << A->getAsString(Args) << A->getValue();
-else {
+  // Report all supported standards with description.
+  Diags.Report(diag::note_drv_supported_values);
+  for (unsigned KindValue = 0;
+  KindValue != LangStandard::lang_unspecified;
+  ++KindValue)
+  {
+const LangStandard &Std = LangStandard::getLangStandardForKind(
+  static_cast(KindValue));
+Diags.Report(diag::note_drv_supported_value_with_description)
+  << Std.getName() << Std.getDescription();
+  }
+} else {
   // Valid standard, check to make sure language and standard are
   // compatible.
   const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -230,6 +230,8 @@
   "The last /TC or /TP option takes precedence over earlier instances">;
 def note_drv_address_sanitizer_debug_runtime : Note<
   "AddressSanitizer doesn't support linking with debug runtime libraries yet">;
+def note_drv_supported_values : Note<"supported values are:">;
+def note_drv_supported_value_with_description : Note<" %0 - %1">;
 
 def err_analyzer_config_no_value : Error<
   "analyzer-config option '%0' has a key but no value">;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29725: Lit C++11 Compatibility - Parse OpenMP

2017-02-08 Thread Charles Li via Phabricator via cfe-commits
tigerleapgorge created this revision.

I am continuing to make out Lit tests C++11 compatible.
There are two tests in this patch.
Both tests verify parse errors with ill formed OpenMP expressions.

test/OpenMP/declare_reduction_messages.cpp

  In C++11, an opening square bracket is the start of a lambda capture.
  Therefore, a unmatched opening square bracket will cause the following 
diagnostics change.
C++98: error: expected '(' after 'initializer'
   error: expected expression
   warning: extra tokens at the end of '#pragma omp declare reduction' 
are ignored [-Wextra-tokens]
C++11: error: expected '(' after 'initializer'
   error: expected variable name or 'this' in lambda capture list
   error: expected ')'
   note: to match this '('

test/OpenMP/openmp_check.cpp

  This test is created in response to bug 25221, where C++11 code running under 
C++98 causes the parser to go into an infinite loop.
  Since this is C++11 code, all expected diagnostics will go away when 
compiling at C++11.
  Therefore, guard all of the following diagnostics under C++98.
C++98: warning: 'auto' type specifier is a C++11 extension 
[-Wc++11-extensions]
   error: expected expression
   error: expected ';' at end of declaration
C++98: error: C++ requires a type specifier for all declarations
C++98: error: expected unqualified-id
C++98: error: extraneous closing brace ('}')


https://reviews.llvm.org/D29725

Files:
  test/OpenMP/declare_reduction_messages.cpp
  test/OpenMP/openmp_check.cpp


Index: test/OpenMP/openmp_check.cpp
===
--- test/OpenMP/openmp_check.cpp
+++ test/OpenMP/openmp_check.cpp
@@ -1,15 +1,35 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
+
 int nested(int a) {
 #pragma omp parallel
   ++a;
 
-  auto F = [&]() { // expected-error {{expected expression}} expected-error 
{{expected ';' at end of declaration}} expected-warning {{'auto' type specifier 
is a C++11 extension}}
+  auto F = [&]() {
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
+  // expected-error@-3 {{expected expression}}
+  // expected-error@-4 {{expected ';' at end of declaration}}
+#else
+  // expected-no-diagnostics
+#endif
+
 #pragma omp parallel
 {
 #pragma omp target
   ++a;
 }
   };
-  F(); // expected-error {{C++ requires a type specifier for all declarations}}
-  return a; // expected-error {{expected unqualified-id}}
-}// expected-error {{extraneous closing brace ('}')}}
+  F();
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{C++ requires a type specifier for all declarations}}
+#endif
+  return a;
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{expected unqualified-id}}
+#endif
+}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{extraneous closing brace ('}')}}
+#endif
Index: test/OpenMP/declare_reduction_messages.cpp
===
--- test/OpenMP/declare_reduction_messages.cpp
+++ test/OpenMP/declare_reduction_messages.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
 
 int temp; // expected-note 7 {{'temp' declared here}}
 
@@ -51,7 +53,17 @@
 #pragma omp declare reduction(fun222 : long : omp_out += omp_in)   
 // expected-error {{redefinition of user-defined 
reduction for type 'long'}}
 #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer 
 // expected-error {{expected '(' after 'initializer'}}
 #pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer {   
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
-#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
+#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
+#if __cplusplus <= 199711L
+// expected-error@-2 {{expected '(' after 'initializer'}}
+// expected-error@-3 {{expected expression}}
+// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare 
reduction' are ignored}}
+#else
+// expected-error@-6 {{expected '(' after 'initializer'}}
+// expected-error@-7 {{expected variable name or 'this' in lambda capture 
list}}
+// expected-error@-8 {{expected ')'}}
+/

[PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2017-02-08 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added inline comments.



Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.cpp:54
+// FIXME use DiagnosticIDs::Level::Note
+diag(NoExceptRange.getBegin(), "in a function declared no-throw here:", 
DiagnosticIDs::Note)
+<< FixItHint::CreateRemoval(NoExceptRange);

sbarzowski wrote:
> Prazek wrote:
> > sbarzowski wrote:
> > > alexfh wrote:
> > > > nit: `nothrow` (without a dash), no colon needed (it will look weird, 
> > > > since the location is mentioned _before_ the message, not after it)
> > > No, it's after the message now. When I changed the level to note the 
> > > order of messages changed as well.
> > > 
> > > It looks like that:
> > > ```
> > > /Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:5:5:
> > >  warning: 'throw' expression in a function declared with a non-throwing 
> > > exception specification [misc-throw-with-noexcept]
> > > throw 5;
> > > ^
> > > /Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:3:24:
> > >  note: FIX-IT applied suggested code changes
> > > void f_throw_with_ne() noexcept(true) {
> > >^
> > > /Users/uland/clang-new/build/tools/clang/tools/extra/test/clang-tidy/Output/misc-throw-with-noexcept.cpp.tmp.cpp:3:24:
> > >  note: in a function declared nothrow here:
> > > void f_throw_with_ne() noexcept(true) {
> > >^
> > > 
> > > ```
> > > 
> > > So, should I leave the colon or remove it anyway?
> > I think that the best way would be to have warnings in order:
> > 
> > warning function declared nothrow here have throw statement inside:
> > Note: throw statement here
> > 
> > Note: Fixit applied for every other declaration
> > 
> > What do you think Alex?
> > 
> > 
> > 
> @Prazek 
> So, do you suggest that we don't emit anything for additional declarations 
> (without -fix)?
> 
> BTW (in the current version) I don't know if I can control if FIX-IT goes 
> first or the location message. As you can see in the code the FIX-IT goes 
> after the location.
Yep, there is no need for user to know all the locations if he doesn't want to 
perform fixit. This way it is easier to read the warning.


https://reviews.llvm.org/D19201



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


[PATCH] D29725: Lit C++11 Compatibility - Parse OpenMP

2017-02-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


https://reviews.llvm.org/D29725



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


[PATCH] D29725: Lit C++11 Compatibility - Parse OpenMP

2017-02-08 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294504: [Lit Test] Make tests C++11 compatible - Parse 
OpenMP (authored by lcharles).

Changed prior to commit:
  https://reviews.llvm.org/D29725?vs=87684&id=87687#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29725

Files:
  cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
  cfe/trunk/test/OpenMP/openmp_check.cpp


Index: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
===
--- cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
+++ cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
 
 int temp; // expected-note 7 {{'temp' declared here}}
 
@@ -51,7 +53,17 @@
 #pragma omp declare reduction(fun222 : long : omp_out += omp_in)   
 // expected-error {{redefinition of user-defined 
reduction for type 'long'}}
 #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer 
 // expected-error {{expected '(' after 'initializer'}}
 #pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer {   
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
-#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
+#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
+#if __cplusplus <= 199711L
+// expected-error@-2 {{expected '(' after 'initializer'}}
+// expected-error@-3 {{expected expression}}
+// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare 
reduction' are ignored}}
+#else
+// expected-error@-6 {{expected '(' after 'initializer'}}
+// expected-error@-7 {{expected variable name or 'this' in lambda capture 
list}}
+// expected-error@-8 {{expected ')'}}
+// expected-note@-9 {{to match this '('}}
+#endif
 #pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer()   
 // expected-error {{expected expression}}
 #pragma omp declare reduction(fun5 : long : omp_out += omp_in) 
initializer(temp)// expected-error {{only 'omp_priv' or 
'omp_orig' variables are allowed in initializer expression}}
 #pragma omp declare reduction(fun6 : long : omp_out += omp_in) 
initializer(omp_orig // expected-error {{expected ')'}} 
expected-note {{to match this '('}}
Index: cfe/trunk/test/OpenMP/openmp_check.cpp
===
--- cfe/trunk/test/OpenMP/openmp_check.cpp
+++ cfe/trunk/test/OpenMP/openmp_check.cpp
@@ -1,15 +1,35 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
+
 int nested(int a) {
 #pragma omp parallel
   ++a;
 
-  auto F = [&]() { // expected-error {{expected expression}} expected-error 
{{expected ';' at end of declaration}} expected-warning {{'auto' type specifier 
is a C++11 extension}}
+  auto F = [&]() {
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
+  // expected-error@-3 {{expected expression}}
+  // expected-error@-4 {{expected ';' at end of declaration}}
+#else
+  // expected-no-diagnostics
+#endif
+
 #pragma omp parallel
 {
 #pragma omp target
   ++a;
 }
   };
-  F(); // expected-error {{C++ requires a type specifier for all declarations}}
-  return a; // expected-error {{expected unqualified-id}}
-}// expected-error {{extraneous closing brace ('}')}}
+  F();
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{C++ requires a type specifier for all declarations}}
+#endif
+  return a;
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{expected unqualified-id}}
+#endif
+}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{extraneous closing brace ('}')}}
+#endif


Index: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
===
--- cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
+++ cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
 
 int temp; // expected-note 7 {{'temp' declared her

r294504 - [Lit Test] Make tests C++11 compatible - Parse OpenMP

2017-02-08 Thread Charles Li via cfe-commits
Author: lcharles
Date: Wed Feb  8 13:46:15 2017
New Revision: 294504

URL: http://llvm.org/viewvc/llvm-project?rev=294504&view=rev
Log:
[Lit Test] Make tests C++11 compatible - Parse OpenMP

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

Modified:
cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
cfe/trunk/test/OpenMP/openmp_check.cpp

Modified: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_reduction_messages.cpp?rev=294504&r1=294503&r2=294504&view=diff
==
--- cfe/trunk/test/OpenMP/declare_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_reduction_messages.cpp Wed Feb  8 13:46:15 
2017
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
 
 int temp; // expected-note 7 {{'temp' declared here}}
 
@@ -51,7 +53,17 @@ class Class2 : public Class1 {
 #pragma omp declare reduction(fun222 : long : omp_out += omp_in)   
 // expected-error {{redefinition of user-defined 
reduction for type 'long'}}
 #pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer 
 // expected-error {{expected '(' after 'initializer'}}
 #pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer {   
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
-#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
 // expected-error {{expected '(' after 'initializer'}} 
expected-error {{expected expression}} expected-warning {{extra tokens at the 
end of '#pragma omp declare reduction' are ignored}}
+#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
+#if __cplusplus <= 199711L
+// expected-error@-2 {{expected '(' after 'initializer'}}
+// expected-error@-3 {{expected expression}}
+// expected-warning@-4 {{extra tokens at the end of '#pragma omp declare 
reduction' are ignored}}
+#else
+// expected-error@-6 {{expected '(' after 'initializer'}}
+// expected-error@-7 {{expected variable name or 'this' in lambda capture 
list}}
+// expected-error@-8 {{expected ')'}}
+// expected-note@-9 {{to match this '('}}
+#endif
 #pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer()   
 // expected-error {{expected expression}}
 #pragma omp declare reduction(fun5 : long : omp_out += omp_in) 
initializer(temp)// expected-error {{only 'omp_priv' or 
'omp_orig' variables are allowed in initializer expression}}
 #pragma omp declare reduction(fun6 : long : omp_out += omp_in) 
initializer(omp_orig // expected-error {{expected ')'}} 
expected-note {{to match this '('}}

Modified: cfe/trunk/test/OpenMP/openmp_check.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/openmp_check.cpp?rev=294504&r1=294503&r2=294504&view=diff
==
--- cfe/trunk/test/OpenMP/openmp_check.cpp (original)
+++ cfe/trunk/test/OpenMP/openmp_check.cpp Wed Feb  8 13:46:15 2017
@@ -1,15 +1,35 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
+
 int nested(int a) {
 #pragma omp parallel
   ++a;
 
-  auto F = [&]() { // expected-error {{expected expression}} expected-error 
{{expected ';' at end of declaration}} expected-warning {{'auto' type specifier 
is a C++11 extension}}
+  auto F = [&]() {
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{'auto' type specifier is a C++11 extension}}
+  // expected-error@-3 {{expected expression}}
+  // expected-error@-4 {{expected ';' at end of declaration}}
+#else
+  // expected-no-diagnostics
+#endif
+
 #pragma omp parallel
 {
 #pragma omp target
   ++a;
 }
   };
-  F(); // expected-error {{C++ requires a type specifier for all declarations}}
-  return a; // expected-error {{expected unqualified-id}}
-}// expected-error {{extraneous closing brace ('}')}}
+  F();
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{C++ requires a type specifier for all declarations}}
+#endif
+  return a;
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{expected unqualified-id}}
+#endif
+}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{extraneous closing brace ('}')}}
+#endif


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


r294506 - Don't crash on 'decltype(auto)::'. Rather than treating it as a meaningless

2017-02-08 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Feb  8 13:58:48 2017
New Revision: 294506

URL: http://llvm.org/viewvc/llvm-project?rev=294506&view=rev
Log:
Don't crash on 'decltype(auto)::'. Rather than treating it as a meaningless
nested-name-specifier (as the standard appears to require), treat it as the
type specifier 'decltype(auto)' followed by a nested-name-specifier starting
with '::'.

Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=294506&r1=294505&r2=294506&view=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Feb  8 13:58:48 2017
@@ -216,7 +216,10 @@ bool Parser::ParseOptionalCXXScopeSpecif
 SourceLocation EndLoc  = ParseDecltypeSpecifier(DS);
 
 SourceLocation CCLoc;
-if (!TryConsumeToken(tok::coloncolon, CCLoc)) {
+// Work around a standard defect: 'decltype(auto)::' is not a
+// nested-name-specifier.
+if (DS.getTypeSpecType() == DeclSpec::TST_decltype_auto ||
+!TryConsumeToken(tok::coloncolon, CCLoc)) {
   AnnotateExistingDecltypeSpecifier(DS, DeclLoc, EndLoc);
   return false;
 }

Modified: cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp?rev=294506&r1=294505&r2=294506&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp Wed Feb  8 13:58:48 
2017
@@ -385,6 +385,18 @@ namespace MemberTemplatesWithDeduction {
 }
 }
 
+namespace NNS {
+  int n;
+  decltype(auto) i();
+  decltype(n) j();
+  struct X {
+// We resolve a wording bug here: 'decltype(auto)::' should not be parsed
+// as a nested-name-specifier.
+friend decltype(auto) ::NNS::i();
+friend decltype(n) ::NNS::j(); // expected-error {{not a class}}
+  };
+}
+
 namespace CurrentInstantiation {
   // PR16875
   template struct S {


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


[PATCH] D29726: [Clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members

2017-02-08 Thread Mads Ravn via Phabricator via cfe-commits
madsravn created this revision.

Made a small fix to readability-delete-null-pointer check such that it includes 
class members.


https://reviews.llvm.org/D29726

Files:
  clang-tidy/readability/DeleteNullPointerCheck.cpp
  clang-tidy/readability/DeleteNullPointerCheck.h
  test/clang-tidy/readability-delete-null-pointer.cpp


Index: test/clang-tidy/readability-delete-null-pointer.cpp
===
--- test/clang-tidy/readability-delete-null-pointer.cpp
+++ test/clang-tidy/readability-delete-null-pointer.cpp
@@ -59,6 +59,16 @@
   } else {
 c2 = c;
   }
+  struct A {
+void foo() {
+  if (mp)
+delete mp;
+}
+int *mp;
+  };
+  // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: 'if' statement is unnecessary; 
deleting null pointer has no effect [readability-delete-null-pointer]
+
+  // CHECK-FIXES: delete mp;
 }
 
 void g() {
Index: clang-tidy/readability/DeleteNullPointerCheck.h
===
--- clang-tidy/readability/DeleteNullPointerCheck.h
+++ clang-tidy/readability/DeleteNullPointerCheck.h
@@ -16,7 +16,8 @@
 namespace tidy {
 namespace readability {
 
-/// Check whether the 'if' statement is unnecessary before calling 'delete' on 
a pointer.
+/// Check whether the 'if' statement is unnecessary before calling 'delete' on 
a
+/// pointer.
 ///
 /// For the user-facing documentation see:
 /// 
http://clang.llvm.org/extra/clang-tidy/checks/readability-delete-null-pointer.html
Index: clang-tidy/readability/DeleteNullPointerCheck.cpp
===
--- clang-tidy/readability/DeleteNullPointerCheck.cpp
+++ clang-tidy/readability/DeleteNullPointerCheck.cpp
@@ -24,19 +24,28 @@
 to(decl(equalsBoundNode("deletedPointer"
   .bind("deleteExpr");
 
-  const auto PointerExpr =
-  ignoringImpCasts(declRefExpr(to(decl().bind("deletedPointer";
+  const auto DeleteMemberExpr =
+  cxxDeleteExpr(has(castExpr(has(memberExpr(hasDeclaration(
+
fieldDecl(equalsBoundNode("deletedMemberPointer"
+  .bind("deleteMemberExpr");
+
+  const auto PointerExpr = ignoringImpCasts(anyOf(
+  declRefExpr(to(decl().bind("deletedPointer"))),
+  memberExpr(hasDeclaration(fieldDecl().bind("deletedMemberPointer");
+
   const auto PointerCondition = castExpr(hasCastKind(CK_PointerToBoolean),
  hasSourceExpression(PointerExpr));
   const auto BinaryPointerCheckCondition =
   binaryOperator(hasEitherOperand(castExpr(hasCastKind(CK_NullToPointer))),
  hasEitherOperand(PointerExpr));
 
   Finder->addMatcher(
   ifStmt(hasCondition(anyOf(PointerCondition, 
BinaryPointerCheckCondition)),
- hasThen(anyOf(DeleteExpr,
-   compoundStmt(has(DeleteExpr), statementCountIs(1))
-   .bind("compound"
+ hasThen(anyOf(
+ DeleteExpr, DeleteMemberExpr,
+ compoundStmt(anyOf(has(DeleteExpr), has(DeleteMemberExpr)),
+  statementCountIs(1))
+ .bind("compound"
   .bind("ifWithDelete"),
   this);
 }


Index: test/clang-tidy/readability-delete-null-pointer.cpp
===
--- test/clang-tidy/readability-delete-null-pointer.cpp
+++ test/clang-tidy/readability-delete-null-pointer.cpp
@@ -59,6 +59,16 @@
   } else {
 c2 = c;
   }
+  struct A {
+void foo() {
+  if (mp)
+delete mp;
+}
+int *mp;
+  };
+  // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
+
+  // CHECK-FIXES: delete mp;
 }
 
 void g() {
Index: clang-tidy/readability/DeleteNullPointerCheck.h
===
--- clang-tidy/readability/DeleteNullPointerCheck.h
+++ clang-tidy/readability/DeleteNullPointerCheck.h
@@ -16,7 +16,8 @@
 namespace tidy {
 namespace readability {
 
-/// Check whether the 'if' statement is unnecessary before calling 'delete' on a pointer.
+/// Check whether the 'if' statement is unnecessary before calling 'delete' on a
+/// pointer.
 ///
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/readability-delete-null-pointer.html
Index: clang-tidy/readability/DeleteNullPointerCheck.cpp
===
--- clang-tidy/readability/DeleteNullPointerCheck.cpp
+++ clang-tidy/readability/DeleteNullPointerCheck.cpp
@@ -24,19 +24,28 @@
 to(decl(equalsBoundNode("deletedPointer"
   .bind("deleteExpr");
 
-  const auto PointerExpr =
-  ignoringImpCasts(declRefExpr(to(decl().bind("deletedPointer";
+  const auto DeleteMemberExpr =

r294509 - More fixes for places where 'decltype(auto)' is permitted in the C++ grammar but makes no sense.

2017-02-08 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Feb  8 14:39:08 2017
New Revision: 294509

URL: http://llvm.org/viewvc/llvm-project?rev=294509&view=rev
Log:
More fixes for places where 'decltype(auto)' is permitted in the C++ grammar 
but makes no sense.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=294509&r1=294508&r2=294509&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Feb  8 14:39:08 
2017
@@ -1944,6 +1944,8 @@ def err_auto_bitfield : Error<
   "cannot pass bit-field as __auto_type initializer in C">;
 
 // C++1y decltype(auto) type
+def err_decltype_auto_invalid : Error<
+  "'decltype(auto)' not allowed here">;
 def err_decltype_auto_cannot_be_combined : Error<
   "'decltype(auto)' cannot be combined with other type specifiers">;
 def err_decltype_auto_function_declarator_not_declaration : Error<

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=294509&r1=294508&r2=294509&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Feb  8 14:39:08 2017
@@ -4749,7 +4749,8 @@ public:
ParsedType ObjectType,
bool EnteringContext);
 
-  ParsedType getDestructorType(const DeclSpec& DS, ParsedType ObjectType);
+  ParsedType getDestructorTypeForDecltype(const DeclSpec &DS,
+  ParsedType ObjectType);
 
   // Checks that reinterpret casts don't have undefined behavior.
   void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=294509&r1=294508&r2=294509&view=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Feb  8 14:39:08 2017
@@ -2580,7 +2580,8 @@ bool Parser::ParseUnqualifiedId(CXXScope
 if (SS.isEmpty() && Tok.is(tok::kw_decltype)) {
   DeclSpec DS(AttrFactory);
   SourceLocation EndLoc = ParseDecltypeSpecifier(DS);
-  if (ParsedType Type = Actions.getDestructorType(DS, ObjectType)) {
+  if (ParsedType Type =
+  Actions.getDestructorTypeForDecltype(DS, ObjectType)) {
 Result.setDestructorName(TildeLoc, Type, EndLoc);
 return false;
   }

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=294509&r1=294508&r2=294509&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Feb  8 14:39:08 2017
@@ -3728,6 +3728,9 @@ Sema::BuildMemInitializer(Decl *Construc
 BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo);
   } else if (DS.getTypeSpecType() == TST_decltype) {
 BaseType = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
+  } else if (DS.getTypeSpecType() == TST_decltype_auto) {
+Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid);
+return true;
   } else {
 LookupResult R(*this, MemberOrBase, IdLoc, LookupOrdinaryName);
 LookupParsedName(R, S, &SS);

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=294509&r1=294508&r2=294509&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Feb  8 14:39:08 2017
@@ -323,20 +323,31 @@ ParsedType Sema::getDestructorName(Sourc
   return nullptr;
 }
 
-ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
-if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
-  return nullptr;
-assert(DS.getTypeSpecType() == DeclSpec::TST_decltype
-   && "only get destructor types from declspecs");
-QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
-QualType SearchType = GetTypeFromParser(ObjectType);
-if (SearchType->isDependentType() || 
Context.hasSameUnqualifiedType(SearchType, T)) {
-  return ParsedType::make(T);
-}
+ParsedType Sema::getDestructorTypeForDecltype(const DeclSpec &

r294512 - Initialize builtins during modular codegen

2017-02-08 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Feb  8 14:51:11 2017
New Revision: 294512

URL: http://llvm.org/viewvc/llvm-project?rev=294512&view=rev
Log:
Initialize builtins during modular codegen

Added:
cfe/trunk/test/Modules/Inputs/codegen-opt/
cfe/trunk/test/Modules/Inputs/codegen-opt/bar.h
  - copied, changed from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/bar.h
cfe/trunk/test/Modules/Inputs/codegen-opt/bar.modulemap
  - copied, changed from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap
cfe/trunk/test/Modules/Inputs/codegen-opt/foo.h
  - copied, changed from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/foo.h
cfe/trunk/test/Modules/Inputs/codegen-opt/foo.modulemap
cfe/trunk/test/Modules/Inputs/codegen-opt/use.cpp
  - copied, changed from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/use.cpp
cfe/trunk/test/Modules/codegen-opt.test
  - copied, changed from r294397, cfe/trunk/test/Modules/codegen.test
Removed:
cfe/trunk/test/Modules/Inputs/codegen/bar.h
cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap
cfe/trunk/test/Modules/Inputs/codegen/use.cpp
Modified:
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/test/Modules/Inputs/codegen/foo.h
cfe/trunk/test/Modules/codegen.test

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=294512&r1=294511&r2=294512&view=diff
==
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Wed Feb  8 14:51:11 2017
@@ -225,6 +225,9 @@ bool FrontendAction::BeginSourceFile(Com
 CI.setFileManager(&AST->getFileManager());
 CI.setSourceManager(&AST->getSourceManager());
 CI.setPreprocessor(AST->getPreprocessorPtr());
+Preprocessor &PP = CI.getPreprocessor();
+PP.getBuiltinInfo().initializeBuiltins(PP.getIdentifierTable(),
+   PP.getLangOpts());
 CI.setASTContext(&AST->getASTContext());
 
 setCurrentInput(Input, std::move(AST));

Copied: cfe/trunk/test/Modules/Inputs/codegen-opt/bar.h (from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/bar.h)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen-opt/bar.h?p2=cfe/trunk/test/Modules/Inputs/codegen-opt/bar.h&p1=cfe/trunk/test/Modules/Inputs/codegen/bar.h&r1=294397&r2=294512&rev=294512&view=diff
==
(empty)

Copied: cfe/trunk/test/Modules/Inputs/codegen-opt/bar.modulemap (from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen-opt/bar.modulemap?p2=cfe/trunk/test/Modules/Inputs/codegen-opt/bar.modulemap&p1=cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap&r1=294397&r2=294512&rev=294512&view=diff
==
(empty)

Copied: cfe/trunk/test/Modules/Inputs/codegen-opt/foo.h (from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/foo.h)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen-opt/foo.h?p2=cfe/trunk/test/Modules/Inputs/codegen-opt/foo.h&p1=cfe/trunk/test/Modules/Inputs/codegen/foo.h&r1=294397&r2=294512&rev=294512&view=diff
==
(empty)

Added: cfe/trunk/test/Modules/Inputs/codegen-opt/foo.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen-opt/foo.modulemap?rev=294512&view=auto
==
--- cfe/trunk/test/Modules/Inputs/codegen-opt/foo.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/codegen-opt/foo.modulemap Wed Feb  8 14:51:11 
2017
@@ -0,0 +1 @@
+module foo { header "foo.h" }

Copied: cfe/trunk/test/Modules/Inputs/codegen-opt/use.cpp (from r294397, 
cfe/trunk/test/Modules/Inputs/codegen/use.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen-opt/use.cpp?p2=cfe/trunk/test/Modules/Inputs/codegen-opt/use.cpp&p1=cfe/trunk/test/Modules/Inputs/codegen/use.cpp&r1=294397&r2=294512&rev=294512&view=diff
==
(empty)

Removed: cfe/trunk/test/Modules/Inputs/codegen/bar.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen/bar.h?rev=294511&view=auto
==
--- cfe/trunk/test/Modules/Inputs/codegen/bar.h (original)
+++ cfe/trunk/test/Modules/Inputs/codegen/bar.h (removed)
@@ -1,2 +0,0 @@
-#include "foo.h"
-inline void bar() { foo(); }

Removed: cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/codegen/bar.modulemap?rev=294511&

r294522 - [sancov] pc_guard_init is called at least once per DSO.

2017-02-08 Thread Mike Aizatsky via cfe-commits
Author: aizatsky
Date: Wed Feb  8 15:28:39 2017
New Revision: 294522

URL: http://llvm.org/viewvc/llvm-project?rev=294522&view=rev
Log:
[sancov] pc_guard_init is called at least once per DSO.

Summary: Documentation update for https://reviews.llvm.org/D29662

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

Modified:
cfe/trunk/docs/SanitizerCoverage.rst

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=294522&r1=294521&r2=294522&view=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Wed Feb  8 15:28:39 2017
@@ -355,7 +355,8 @@ The compler will also insert a module co
 .. code-block:: c++
 
// The guards are [start, stop).
-   // This function may be called multiple times with the same values of 
start/stop.
+   // This function will be called at least once per DSO and may be called
+   // more than once with the same values of start/stop.
__sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop);
 
 With `trace-pc-guards,indirect-calls`
@@ -373,10 +374,10 @@ Example:
   #include 
 
   // This callback is inserted by the compiler as a module constructor
-  // into every compilation unit. 'start' and 'stop' correspond to the
+  // into every DSO. 'start' and 'stop' correspond to the
   // beginning and end of the section with the guards for the entire
-  // binary (executable or DSO) and so it will be called multiple times
-  // with the same parameters.
+  // binary (executable or DSO). The callback will be called at least
+  // once per DSO and may be called multiple times with the same parameters.
   extern "C" void __sanitizer_cov_trace_pc_guard_init(uint32_t *start,
   uint32_t *stop) {
 static uint64_t N;  // Counter for the guards.


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


[PATCH] D21626: Lit C++11 Compatibility Patch #10

2017-02-08 Thread Charles Li via Phabricator via cfe-commits
tigerleapgorge updated this revision to Diff 87711.
tigerleapgorge edited the summary of this revision.
tigerleapgorge added a comment.

Remove 2 OpenMP tests reviewed via https://reviews.llvm.org/D29725


https://reviews.llvm.org/D21626

Files:
  test/Modules/Inputs/merge-using-decls/a.h
  test/Modules/Inputs/merge-using-decls/b.h
  test/Modules/merge-using-decls.cpp
  test/SemaCXX/PR9572.cpp
  test/SemaCXX/default-assignment-operator.cpp
  test/SemaCXX/default-constructor-initializers.cpp
  test/SemaCXX/format-strings.cpp
  test/SemaCXX/printf-cstr.cpp
  test/SemaCXX/warn-thread-safety-parsing.cpp

Index: test/SemaCXX/warn-thread-safety-parsing.cpp
===
--- test/SemaCXX/warn-thread-safety-parsing.cpp
+++ test/SemaCXX/warn-thread-safety-parsing.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 %s
 
 #define LOCKABLE__attribute__ ((lockable))
 #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable))
@@ -1266,8 +1268,10 @@
   void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { }
   void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu);
 
-  static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu); // \
-// expected-error {{invalid use of member 'mu' in static member function}}
+  static void foo5()EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{invalid use of member 'mu' in static member function}}
+#endif
 
   template 
   void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { }
@@ -1461,15 +1465,21 @@
   mutable Mutex mu;
   int a GUARDED_BY(mu);
 
-  static int si GUARDED_BY(mu); // \
-// expected-error {{invalid use of non-static data member 'mu'}}
+  static int si GUARDED_BY(mu);
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{invalid use of non-static data member 'mu'}}
+#endif
 
-  static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \
-// expected-error {{invalid use of member 'mu' in static member function}}
+  static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+  // expected-error@-2 {{invalid use of member 'mu' in static member function}}
+#endif
 
   friend FooStream& operator<<(FooStream& s, const Foo& f)
-EXCLUSIVE_LOCKS_REQUIRED(mu); // \
-// expected-error {{invalid use of non-static data member 'mu'}}
+EXCLUSIVE_LOCKS_REQUIRED(mu);
+#if __cplusplus <= 199711L
+// expected-error@-2 {{invalid use of non-static data member 'mu'}}
+#endif
 };
 
 
Index: test/SemaCXX/printf-cstr.cpp
===
--- test/SemaCXX/printf-cstr.cpp
+++ test/SemaCXX/printf-cstr.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -Wformat -verify %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++98 %s -Wno-error=non-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -Wformat -verify -std=c++11 %s -Wno-error=non-pod-varargs
 
 #include 
 
@@ -31,12 +33,39 @@
   int n = 10;
 
   printf("%d: %s\n", n, hcs.c_str());
-  printf("%d: %s\n", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}}
-  printf("%d: %s\n", n, hncs); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}}
-  sprintf(str, "%d: %s", n, hcs); // expected-warning{{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}} expected-note{{did you mean to call the c_str() method?}}
-
-  printf(formatString, hcs, hncs); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}} expected-warning{{cannot pass object of non-POD type 'HasNoCStr' through variadic function}}
-  printf(extstr, hcs, n); // expected-warning{{cannot pass object of non-POD type 'HasCStr' through variadic function}}
+  printf("%d: %s\n", n, hcs);
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to variadic function; expected type from format string was 'char *'}}
+  // expected-note@-3 {{did you mean to call the c_str() method?}}
+#else
+  // expected-warning@-5 {{format specifies type 'char *' but the argument has type 'HasCStr'}}
+#endif
+
+  printf("%d: %s\n", n, hncs);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{cannot pass non-POD object of type 'HasNoCStr' to variadic function; expected type from format string was 'char *'}}
+#else
+  // expected-warning@-4 {{format specifies type 'char *' but the argument has type 'HasNoCStr'}}
+#endif
+
+  sprintf(str, "%d: %s", n, hcs);
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{cannot pass non-POD object of type 'HasCStr' to var

[PATCH] D16135: Macro Debug Info support in Clang

2017-02-08 Thread Amjad Aboud via Phabricator via cfe-commits
aaboud added a comment.

> How much does the build directory grow?
>  Is there any noticeable compile time regression?

I build clang in release mode using GCC, then used that build to build clang in 
debug mode with "-fstandalone-debug" flag, one time with my changes and another 
time without my changes.

Without my changes
--

Clang executable Size: 1,565MB
Build time: 17m57.504s

Withmy changes
--

Clang executable Size: 2,043MB
Build time:  17m58.008s

Do, build time is the same, but binary size was increased about 30%.
However, remember that we are emitting macro debug info in dwarf4 format, once 
we support emitting it in dwarf5 format the size should be reduced 
significantly.

> I'm not sure it makes sense to motivate this feature with 
> "-fstandalone-debug" flag.

Is "-fmacro-debug" flag sounds good?
Should we extend DebugInfoKind enumeration to support the debug info macro? Or 
we should add a new option to CodeGenOptions?


https://reviews.llvm.org/D16135



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


Re: [PATCH] D16135: Macro Debug Info support in Clang

2017-02-08 Thread David Blaikie via cfe-commits
On Wed, Feb 8, 2017 at 2:25 PM Amjad Aboud via Phabricator <
revi...@reviews.llvm.org> wrote:

> aaboud added a comment.
>
> > How much does the build directory grow?
> >  Is there any noticeable compile time regression?
>
> I build clang in release mode using GCC, then used that build to build
> clang in debug mode with "-fstandalone-debug" flag, one time with my
> changes and another time without my changes.
>
> Without my changes
> --
>
> Clang executable Size: 1,565MB
> Build time: 17m57.504s
>
> Withmy changes
> --
>
> Clang executable Size: 2,043MB
> Build time:  17m58.008s
>
> Do, build time is the same, but binary size was increased about 30%.
> However, remember that we are emitting macro debug info in dwarf4 format,
> once we support emitting it in dwarf5 format the size should be reduced
> significantly.
>

How are you measuring the build time? Total time for, say "ninja clang"
with full parallelism? That'd be hard to measure the actual impact (since
it could be the link time or other things are dominating, etc). If you have
a reliable way to time (I'm assuming Intel has lots of tools for measuring
compiler performance) the compilation, get a sense of the variance, etc (&
link time, to get a sense of how much the larger inputs affect linker
performance) would be useful.

But I'm not too fussed if no one else is worried (not sure which, if any
platforms other than your own, are planning to turn this on by default so
people might not be too invested in it). (wouldn't mind some second
opinions, etc)


>
> > I'm not sure it makes sense to motivate this feature with
> "-fstandalone-debug" flag.
>
> Is "-fmacro-debug" flag sounds good?
>

Sounds alright to me.


> Should we extend DebugInfoKind enumeration to support the debug info
> macro? Or we should add a new option to CodeGenOptions?
>

Separate option - it should be orthogonal to standalone/no-standalone, for
example.


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


[PATCH] D29630: [libcxx] Threading support: externalize sleep_for()

2017-02-08 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg accepted this revision.
joerg added a comment.

One small issue left, otherwise LGTM.




Comment at: include/__threading_support:187
+_LIBCPP_THREAD_ABI_VISIBILITY
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
+

Drop the name here.


https://reviews.llvm.org/D29630



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


Re: [PATCH] D16135: Macro Debug Info support in Clang

2017-02-08 Thread Adrian Prantl via cfe-commits
> On Feb 8, 2017, at 2:31 PM, David Blaikie  wrote:
> 
> 
> 
> On Wed, Feb 8, 2017 at 2:25 PM Amjad Aboud via Phabricator 
> mailto:revi...@reviews.llvm.org>> wrote:
> aaboud added a comment.
> 
> > How much does the build directory grow?
> >  Is there any noticeable compile time regression?
> 
> I build clang in release mode using GCC, then used that build to build clang 
> in debug mode with "-fstandalone-debug" flag, one time with my changes and 
> another time without my changes.
> 
> Without my changes
> --
> 
> Clang executable Size: 1,565MB
> Build time: 17m57.504s
> 
> Withmy changes
> --
> 
> Clang executable Size: 2,043MB
> Build time:  17m58.008s
> 
> Do, build time is the same, but binary size was increased about 30%.
> However, remember that we are emitting macro debug info in dwarf4 format, 
> once we support emitting it in dwarf5 format the size should be reduced 
> significantly.

That sounds like we shouldn't be enabling it by default at -gdwarf-4; and we 
can revisit that decision for -gdwarf-5 whenever it is ready.

> 
> How are you measuring the build time? Total time for, say "ninja clang" with 
> full parallelism? That'd be hard to measure the actual impact (since it could 
> be the link time or other things are dominating, etc). If you have a reliable 
> way to time (I'm assuming Intel has lots of tools for measuring compiler 
> performance) the compilation, get a sense of the variance, etc (& link time, 
> to get a sense of how much the larger inputs affect linker performance) would 
> be useful.
> 
> But I'm not too fussed if no one else is worried (not sure which, if any 
> platforms other than your own, are planning to turn this on by default so 
> people might not be too invested in it). (wouldn't mind some second opinions, 
> etc)
>  
> 
> > I'm not sure it makes sense to motivate this feature with 
> > "-fstandalone-debug" flag.
> 
> Is "-fmacro-debug" flag sounds good?
> 
> Sounds alright to me.

Personally I find "-fmacro-debug-info" to be more descriptive, but 
"-fmacro-debug" mirrors "-fstandalone-debug", so I'm fine with that too. We 
could also use "-fdebug-macro" for symmetry with "-fdebug-type-section". Does 
GCC have a command line option for this that we could mirror?
Please don't forget to document the new option in the man page and user guide.

-- adrian

>  
> Should we extend DebugInfoKind enumeration to support the debug info macro? 
> Or we should add a new option to CodeGenOptions?
> 
> Separate option - it should be orthogonal to standalone/no-standalone, for 
> example.
>  
> 
> 
> https://reviews.llvm.org/D16135 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25674: [Concepts] Class template associated constraints

2017-02-08 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

Ping 2?


https://reviews.llvm.org/D25674



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


[PATCH] D29726: [Clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members

2017-02-08 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.



Comment at: clang-tidy/readability/DeleteNullPointerCheck.cpp:46
+ DeleteExpr, DeleteMemberExpr,
+ compoundStmt(anyOf(has(DeleteExpr), has(DeleteMemberExpr)),
+  statementCountIs(1))

nit: Will `has(anyOf(DeleteExpr, DeleteMemberExpr))` work?



Comment at: test/clang-tidy/readability-delete-null-pointer.cpp:69
+  };
+  // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: 'if' statement is unnecessary; 
deleting null pointer has no effect [readability-delete-null-pointer]
+

nit: I'd put this line closer to the line with the warning (or right before 
it), e.g.

// CHECK-MESSAGES: :[[@LINE+1]]:...
if (mp)
  delete mp;




Comment at: test/clang-tidy/readability-delete-null-pointer.cpp:71
+
+  // CHECK-FIXES: delete mp;
 }

This doesn't check that the `if` is deleted. It will pass if the check doesn't 
do any replacements. One way to properly check this is to add a unique comment 
after the `if` and match it with an anchor to the start of line:

  if (mp) // should be deleted 1
delete mp;
  // CHECK-FIXES: {{^   }}// should be deleted 1
  // CHECK-FIXES-NEXT: delete mp;

or alternatively:

  // next line should be deleted
  if (mp)
delete mp;
  // CHECK-FIXES: // next line should be deleted
  // CHECK-FIXES-NEXT:  {{^  }}delete mp;



https://reviews.llvm.org/D29726



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


[PATCH] D25674: [Concepts] Class template associated constraints

2017-02-08 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: include/clang/AST/DeclTemplate.h:373-391
+class TemplateDeclWithACBase {
+protected:
+  TemplateDeclWithACBase() = default;
+
+  ConstrainedTemplateDeclInfo CTDInfo;
+};
+

This mechanism seems unnecessary to me; allocating the 
`ConstrainedTemplateDeclInfo` separately seems a lot simpler. Forcing this and 
the template into a single allocation is unlikely to help anything since we use 
a slab allocator (which is going to lay the objects out the same way this 
template trick does, unless we hit the end of a slab).



Comment at: lib/Sema/SemaTemplate.cpp:1178
+  if (!(CurAC || PrevAC))
+return false; // nothing to check
+  if (CurAC && PrevAC) {

[nit] Comments should be full sentences: capitalized and ending in a period.



Comment at: lib/Sema/SemaTemplate.cpp:1299-1300
 
+  // Attach the associated constraints when the declaration will not be part of
+  // a decl chain
+  Expr *const ACtoAttach =

Is there a reason you don't want to store the associated constraints that were 
specified on a redeclaration? I'd expect that to hurt tools that want source 
fidelity (for instance, a renaming tool will want to be able to find all the 
references to a particular name, even in a //requires-clause// on a 
redeclaration of a template).


https://reviews.llvm.org/D25674



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


[PATCH] D29736: [WebAssembly] Add target specific overrides for lgamma family functions

2017-02-08 Thread Jacob Gravelle via Phabricator via cfe-commits
jgravelle-google created this revision.
Herald added a subscriber: jfb.

Current WebAssembly implementations use musl libc, which writes to
signgam in its lgamma functions. We want the rest of the builtins to be
const under -fno-math-errno, so overwrite lgamma's builtin definitions
to be never-const.


https://reviews.llvm.org/D29736

Files:
  include/clang/Basic/BuiltinsWebAssembly.def


Index: include/clang/Basic/BuiltinsWebAssembly.def
===
--- include/clang/Basic/BuiltinsWebAssembly.def
+++ include/clang/Basic/BuiltinsWebAssembly.def
@@ -16,9 +16,21 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
+#if defined(BUILTIN) && !defined(LIBBUILTIN)
+#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
 // Note that current_memory is not "c" (readnone) because it must be sequenced
 // with respect to grow_memory calls.
 BUILTIN(__builtin_wasm_current_memory, "z", "n")
 BUILTIN(__builtin_wasm_grow_memory, "zz", "n")
 
+// Redeclaring lgamma from Builtins.def as non-const to allow for POSIX
+// compatibility. Specifically lgamma writes to a user-visible global, signgam,
+// that is available in POSIX-compliant libcs.
+LIBBUILTIN(lgamma, "dd", "fn", "math.h")
+LIBBUILTIN(lgammaf, "ff", "fn", "math.h")
+LIBBUILTIN(lgammal, "LdLd", "fn", "math.h")
+
 #undef BUILTIN
+#undef LIBBUILTIN


Index: include/clang/Basic/BuiltinsWebAssembly.def
===
--- include/clang/Basic/BuiltinsWebAssembly.def
+++ include/clang/Basic/BuiltinsWebAssembly.def
@@ -16,9 +16,21 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
+#if defined(BUILTIN) && !defined(LIBBUILTIN)
+#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
 // Note that current_memory is not "c" (readnone) because it must be sequenced
 // with respect to grow_memory calls.
 BUILTIN(__builtin_wasm_current_memory, "z", "n")
 BUILTIN(__builtin_wasm_grow_memory, "zz", "n")
 
+// Redeclaring lgamma from Builtins.def as non-const to allow for POSIX
+// compatibility. Specifically lgamma writes to a user-visible global, signgam,
+// that is available in POSIX-compliant libcs.
+LIBBUILTIN(lgamma, "dd", "fn", "math.h")
+LIBBUILTIN(lgammaf, "ff", "fn", "math.h")
+LIBBUILTIN(lgammal, "LdLd", "fn", "math.h")
+
 #undef BUILTIN
+#undef LIBBUILTIN
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28543: Elliminates uninitialized warning for volitile varibles.

2017-02-08 Thread CJ DiMeglio via Phabricator via cfe-commits
lethalantidote added a comment.

Any updates on this?


https://reviews.llvm.org/D28543



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


[PATCH] D29737: Updates documentation to include command to run clang-tidy tests.

2017-02-08 Thread CJ DiMeglio via Phabricator via cfe-commits
lethalantidote created this revision.
Herald added a subscriber: JDevlieghere.

Adds the commandline need to run clang-tidy tests.


https://reviews.llvm.org/D29737

Files:
  clang-tools-extra/docs/clang-tidy/index.rst


Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -537,6 +537,12 @@
 Testing Checks
 --
 
+To run tests for :program:`clang-tidy` use the command:
+
+.. code-block:: console
+
+  $ ninja check-clang-tools
+
 :program:`clang-tidy` checks can be tested using either unit tests or
 `lit`_ tests. Unit tests may be more convenient to test complex replacements
 with strict checks. `Lit`_ tests allow using partial text matching and regular


Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -537,6 +537,12 @@
 Testing Checks
 --
 
+To run tests for :program:`clang-tidy` use the command:
+
+.. code-block:: console
+
+  $ ninja check-clang-tools
+
 :program:`clang-tidy` checks can be tested using either unit tests or
 `lit`_ tests. Unit tests may be more convenient to test complex replacements
 with strict checks. `Lit`_ tests allow using partial text matching and regular
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294534 - Add check that "#define unix 1" is present for the PS4 target.

2017-02-08 Thread Douglas Yung via cfe-commits
Author: dyung
Date: Wed Feb  8 18:07:38 2017
New Revision: 294534

URL: http://llvm.org/viewvc/llvm-project?rev=294534&view=rev
Log:
Add check that "#define unix 1" is present for the PS4 target.


Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=294534&r1=294533&r2=294534&view=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Feb  8 18:07:38 2017
@@ -8466,6 +8466,7 @@
 // PS4:#define __unix__ 1
 // PS4:#define __x86_64 1
 // PS4:#define __x86_64__ 1
+// PS4:#define unix 1
 //
 // RUN: %clang_cc1 -E -dM -triple=x86_64-pc-mingw32 < /dev/null | FileCheck 
-match-full-lines -check-prefix X86-64-DECLSPEC %s
 // RUN: %clang_cc1 -E -dM -fms-extensions -triple=x86_64-unknown-mingw32 < 
/dev/null | FileCheck -match-full-lines -check-prefix X86-64-DECLSPEC %s


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


[PATCH] D29736: [WebAssembly] Add target specific overrides for lgamma family functions

2017-02-08 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

It doesn't make sense to do this in WebAssembly-specific code; every POSIX 
platform has a signgam which behaves the same way.


https://reviews.llvm.org/D29736



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


Buildbot numbers for the last week of 01/29/2017 - 02/04/2017

2017-02-08 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 01/29/2017 -
02/04/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername |  was_red
+--
 clang-cmake-mips   | 133:43:36
 clang-cmake-mipsel | 129:53:02
 clang-native-aarch64-full  | 121:59:50
 clang-cuda-build   | 86:29:18
 llvm-mips-linux| 79:33:17
 clang-x86_64-linux-selfhost-modules| 40:31:55
 clang-x86_64-linux-selfhost-modules-2  | 40:28:13
 sanitizer-ppc64le-linux| 40:27:13
 sanitizer-x86_64-linux-bootstrap   | 31:49:39
 sanitizer-x86_64-linux-fast| 30:47:53
 lldb-windows7-android  | 21:01:39
 clang-with-thin-lto-ubuntu | 18:55:06
 clang-with-lto-ubuntu  | 18:20:40
 clang-lld-x86_64-2stage| 17:36:25
 clang-x86-windows-msvc2015 | 17:26:05
 clang-ppc64le-linux-lnt| 17:20:48
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 17:20:25
 clang-x86_64-debian-fast   | 16:39:30
 clang-ppc64be-linux-multistage | 16:23:55
 perf-x86_64-penryn-O3  | 15:37:33
 clang-bpf-build| 12:50:42
 sanitizer-x86_64-linux | 11:31:14
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions  | 10:59:14
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 10:14:35
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 09:45:59
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions  | 09:43:16
 perf-x86_64-penryn-O3-polly| 09:42:55
 perf-x86_64-penryn-O3-polly-parallel-fast  | 09:40:05
 perf-x86_64-penryn-O3-polly-unprofitable   | 09:35:55
 libcxx-libcxxabi-libunwind-arm-linux   | 08:55:15
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 08:54:58
 libcxx-libcxxabi-libunwind-aarch64-linux   | 08:54:50
 clang-cmake-armv7-a15-selfhost | 08:48:09
 perf-x86_64-penryn-O3-polly-fast   | 08:04:24
 clang-cmake-thumbv7-a15-full-sh| 06:22:11
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 05:40:43
 lld-x86_64-freebsd | 05:31:10
 lld-x86_64-darwin13| 04:48:21
 clang-cmake-aarch64-full   | 04:35:09
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 04:33:33
 clang-cmake-aarch64-lld| 04:04:59
 clang-cmake-armv7-a15-selfhost-neon| 04:03:00
 lldb-x86_64-ubuntu-14.04-buildserver   | 03:50:38
 clang-native-arm-lnt   | 03:19:27
 clang-x64-ninja-win7   | 03:12:48
 lldb-x86_64-darwin-13.4| 02:27:25
 clang-ppc64le-linux| 02:22:38
 clang-ppc64be-linux-lnt| 02:16:00
 clang-cmake-thumbv7-a15| 02:06:50
 clang-cmake-aarch64-quick  | 02:03:36
 clang-cmake-armv7-a15-full | 02:02:46
 clang-s390x-linux  | 02:02:10
 clang-atom-d525-fedora-rel | 02:00:50
 clang-ppc64be-linux| 01:59:50
 clang-cmake-aarch64-42vma  | 01:57:47
 clang-cmake-armv7-a15  | 01:57:39
 clang-cmake-aarch64-39vma  | 01:56:55
 lldb-x86_64-ubuntu-14.04-android   | 01:56:15
 clang-hexagon-elf  | 01:42:59
 lldb-amd64-ninja-ne

[libcxx] r294540 - Creating release candidate rc2 from release_400 branch

2017-02-08 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Feb  8 18:14:12 2017
New Revision: 294540

URL: http://llvm.org/viewvc/llvm-project?rev=294540&view=rev
Log:
Creating release candidate rc2 from release_400 branch

Added:
libcxx/tags/RELEASE_400/rc2/   (props changed)
  - copied from r294539, libcxx/branches/release_40/

Propchange: libcxx/tags/RELEASE_400/rc2/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Feb  8 18:14:12 2017
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:292013,292091,292607,292990,293154,293197,293581,294133,294142


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


[libcxxabi] r294541 - Creating release candidate rc2 from release_400 branch

2017-02-08 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Feb  8 18:14:16 2017
New Revision: 294541

URL: http://llvm.org/viewvc/llvm-project?rev=294541&view=rev
Log:
Creating release candidate rc2 from release_400 branch

Added:
libcxxabi/tags/RELEASE_400/rc2/   (props changed)
  - copied from r294540, libcxxabi/branches/release_40/

Propchange: libcxxabi/tags/RELEASE_400/rc2/
--
svn:mergeinfo = /libcxxabi/trunk:292135,292418,292638


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


[libunwind] r294547 - Creating release candidate rc2 from release_400 branch

2017-02-08 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Feb  8 18:14:34 2017
New Revision: 294547

URL: http://llvm.org/viewvc/llvm-project?rev=294547&view=rev
Log:
Creating release candidate rc2 from release_400 branch

Added:
libunwind/tags/RELEASE_400/rc2/   (props changed)
  - copied from r294546, libunwind/branches/release_40/

Propchange: libunwind/tags/RELEASE_400/rc2/
--
svn:mergeinfo = /libunwind/trunk:292723


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


[PATCH] D25674: [Concepts] Class template associated constraints

2017-02-08 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: include/clang/AST/DeclTemplate.h:373-391
+class TemplateDeclWithACBase {
+protected:
+  TemplateDeclWithACBase() = default;
+
+  ConstrainedTemplateDeclInfo CTDInfo;
+};
+

rsmith wrote:
> This mechanism seems unnecessary to me; allocating the 
> `ConstrainedTemplateDeclInfo` separately seems a lot simpler. Forcing this 
> and the template into a single allocation is unlikely to help anything since 
> we use a slab allocator (which is going to lay the objects out the same way 
> this template trick does, unless we hit the end of a slab).
Okay; I'll probably allocate separately in the `Create` function.



Comment at: lib/Sema/SemaTemplate.cpp:1178
+  if (!(CurAC || PrevAC))
+return false; // nothing to check
+  if (CurAC && PrevAC) {

rsmith wrote:
> [nit] Comments should be full sentences: capitalized and ending in a period.
Okay.



Comment at: lib/Sema/SemaTemplate.cpp:1299-1300
 
+  // Attach the associated constraints when the declaration will not be part of
+  // a decl chain
+  Expr *const ACtoAttach =

rsmith wrote:
> Is there a reason you don't want to store the associated constraints that 
> were specified on a redeclaration? I'd expect that to hurt tools that want 
> source fidelity (for instance, a renaming tool will want to be able to find 
> all the references to a particular name, even in a //requires-clause// on a 
> redeclaration of a template).
Associated constraints are not part of the source fidelity: the requires-clause 
on the template-parameter-list is (and later, if constraints are introduced by 
abbreviated function call syntax, etc., the function parameter list).


https://reviews.llvm.org/D25674



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


[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++

2017-02-08 Thread Charles Li via Phabricator via cfe-commits
tigerleapgorge created this revision.

I am continuing to make our Lit tests C++11 compatible.
This patch defaults five Objective-C++ tests to run under -std=gnu++98

This patch is essentially a continuation of Bug 24344 
https://llvm.org/bugs/show_bug.cgi?id=24344
Fix r289167 resolved all tests inside the Rewriter directory,
This patch resolves the remaining tests outside the Rewriter directory.


https://reviews.llvm.org/D29739

Files:
  test/CodeGenObjCXX/arc-blocks.mm
  test/CodeGenObjCXX/encode.mm
  test/CodeGenObjCXX/literals.mm
  test/SemaObjCXX/arc-system-header.mm
  test/SemaObjCXX/ivar-construct.mm


Index: test/SemaObjCXX/ivar-construct.mm
===
--- test/SemaObjCXX/ivar-construct.mm
+++ test/SemaObjCXX/ivar-construct.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -std=gnu++98 -fsyntax-only -verify -Wno-objc-root-class %s
 struct Y { 
   Y(); 
 
Index: test/SemaObjCXX/arc-system-header.mm
===
--- test/SemaObjCXX/arc-system-header.mm
+++ test/SemaObjCXX/arc-system-header.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify
+// RUN: %clang_cc1 -std=gnu++98 -fobjc-arc -isystem %S/Inputs %s -verify
 
 #include 
 
Index: test/CodeGenObjCXX/literals.mm
===
--- test/CodeGenObjCXX/literals.mm
+++ test/CodeGenObjCXX/literals.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm 
-fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions 
-fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -std=gnu++98 -I %S/Inputs -triple x86_64-apple-darwin10 
-emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions 
-fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 
-disable-llvm-passes -o - %s | FileCheck %s
 
 #include "literal-support.h"
 
Index: test/CodeGenObjCXX/encode.mm
===
--- test/CodeGenObjCXX/encode.mm
+++ test/CodeGenObjCXX/encode.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | 
FileCheck %s
+// RUN: %clang_cc1 -std=gnu++98 %s -triple=x86_64-apple-darwin10 -emit-llvm -o 
- | FileCheck %s
 
 // CHECK: v17@0:8{vector=}16
 // CHECK: {vector=}
Index: test/CodeGenObjCXX/arc-blocks.mm
===
--- test/CodeGenObjCXX/arc-blocks.mm
+++ test/CodeGenObjCXX/arc-blocks.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm 
-fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=gnu++98 -triple x86_64-apple-darwin10 -emit-llvm 
-fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s
 
 // CHECK: [[A:.*]] = type { i64, [10 x i8*] }
 


Index: test/SemaObjCXX/ivar-construct.mm
===
--- test/SemaObjCXX/ivar-construct.mm
+++ test/SemaObjCXX/ivar-construct.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -std=gnu++98 -fsyntax-only -verify -Wno-objc-root-class %s
 struct Y { 
   Y(); 
 
Index: test/SemaObjCXX/arc-system-header.mm
===
--- test/SemaObjCXX/arc-system-header.mm
+++ test/SemaObjCXX/arc-system-header.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify
+// RUN: %clang_cc1 -std=gnu++98 -fobjc-arc -isystem %S/Inputs %s -verify
 
 #include 
 
Index: test/CodeGenObjCXX/literals.mm
===
--- test/CodeGenObjCXX/literals.mm
+++ test/CodeGenObjCXX/literals.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=gnu++98 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-arc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s
 
 #include "literal-support.h"
 
Index: test/CodeGenObjCXX/encode.mm
===
--- test/CodeGenObjCXX/encode.mm
+++ test/CodeGenObjCXX/encode.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -std=gnu++98 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
 
 // CHECK: v17@0:8{vector=}16
 // CHECK: {vector=}
Index: test/CodeGenObjCXX/arc-blocks.mm
===
--- test/CodeGenObjCX

Re: [cfe-commits] r164177 - in /cfe/trunk: lib/Driver/ test/Driver/ test/Driver/Inputs/freescale_ppc_tree/ test/Driver/Inputs/freescale_ppc_tree/lib/ test/Driver/Inputs/freescale_ppc_tree/usr/ test/Dr

2017-02-08 Thread Chandler Carruth via cfe-commits
It's blast from the past time!

On Tue, Sep 18, 2012 at 3:28 PM Hal Finkel  wrote:

> Author: hfinkel
> Date: Tue Sep 18 17:25:07 2012
> New Revision: 164177
>
> URL: http://llvm.org/viewvc/llvm-project?rev=164177&view=rev
> Log:
> Add C/C++ header locations for the Freescale SDK.
>
> The Freescale SDK is based on OpenEmbedded, and this might be useful
> for other OpenEmbedded-based configurations as well.
>
> With minor modifications, patch by Tobias von Koch!
>
> Added:
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
>
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/
>
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/
>
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o
>
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/test/Driver/linux-ld.c
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=164177&r1=164176&r2=164177&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Sep 18 17:25:07 2012
> @@ -1291,6 +1291,10 @@
>  "/gcc/" + CandidateTriple.str(),
>  "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
>
> +// The Freescale PPC SDK has the gcc libraries in
> +// /usr/lib//x.y.z so have a look there as well.
> +"/" + CandidateTriple.str(),
>

So, this is really bad it turns out.

We use this directory to walk every installed GCC version. But because this
is just a normal lib directory on many systems (ever Debian and Ubuntu
system for example) this goes very badly. It goes even more badly because
of the (questionable) design of LLVM's directory iterator:

It ends up stat'ing *every single file* in /usr/lib/  =[ For
the current Ubuntu LTS for example, this causes roughly 3900 spurrious stat
syscalls for every invocation of the Clang driver.

Can we do something different here?


> +
>  // Ubuntu has a strange mis-matched pair of triples that this happens
> to
>  // match.
>  // FIXME: It may be worthwhile to generalize this and look for a
> second
> @@ -1300,6 +1304,7 @@
>const std::string InstallSuffixes[] = {
>  "/../../..",
>  "/../../../..",
> +"/../..",
>  "/../../../.."
>};
>// Only look at the final, weird Ubuntu suffix for i386-linux-gnu.
> @@ -2374,6 +2379,9 @@
>  InstallDir.str() + "/include/g++-v4",
>  // Android standalone toolchain has C++ headers in yet another place.
>  LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" +
> Version.str(),
> +// Freescale SDK C++ headers are directly in
> /usr/include/c++,
> +// without a subdirectory corresponding to the gcc version.
> +LibDir.str() + "/../include/c++",
>};
>
>for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates);
> ++i) {
>
> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep?rev=164177&view=auto
>
> ==
> (empty)
>
> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o?rev=164177&view=auto
>
> ==
> (empty)
>
> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o?rev=164177&view=auto
>
> ==
> (empty)
>
> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o?rev=164177&view=auto
>
> ==
> (empty)
>
> Added:
> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o?rev=164

[libcxxabi] r294552 - [libcxxabi][CMake] Support in-tree libunwind when building as part of runtimes

2017-02-08 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Feb  8 20:19:30 2017
New Revision: 294552

URL: http://llvm.org/viewvc/llvm-project?rev=294552&view=rev
Log:
[libcxxabi][CMake] Support in-tree libunwind when building as part of runtimes

When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_ variables
instead in that case.

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

Modified:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=294552&r1=294551&r2=294552&view=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Wed Feb  8 20:19:30 2017
@@ -131,6 +131,7 @@ option(LIBCXXABI_ENABLE_ASSERTIONS "Enab
 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
+option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." 
OFF)
 option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of 
pthread API" OFF)

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=294552&r1=294551&r2=294552&view=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Wed Feb  8 20:19:30 2017
@@ -61,9 +61,9 @@ if (LIBCXXABI_USE_LLVM_UNWINDER)
   # Prefer using the in-tree version of libunwind, either shared or static. If
   # none are found fall back to using -lunwind.
   # FIXME: Is it correct to prefer the static version of libunwind?
-  if (TARGET unwind_shared)
+  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR 
HAVE_LIBUNWIND))
 list(APPEND libraries unwind_shared)
-  elseif(TARGET unwind_static)
+  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR 
HAVE_LIBUNWIND))
 list(APPEND libraries unwind_static)
   else()
 list(APPEND libraries unwind)


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


[libcxx] r294553 - [libcxx][CMake] Support in-tree libunwind when building as part of runtimes

2017-02-08 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Feb  8 20:19:43 2017
New Revision: 294553

URL: http://llvm.org/viewvc/llvm-project?rev=294553&view=rev
Log:
[libcxx][CMake] Support in-tree libunwind when building as part of runtimes

When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_ variables
instead in that case.

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

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Wed Feb  8 20:19:43 2017
@@ -158,6 +158,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
 # Build libc++abi with libunwind. We need this option to determine whether to
 # link with libunwind or libgcc_s while running the test cases.
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
+option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." 
OFF)
 
 # Target options --
 option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Wed Feb  8 20:19:43 2017
@@ -89,9 +89,9 @@ add_library_flags_if(LIBCXX_HAVE_CXX_ATO
 
 # Add the unwinder library.
 if (LIBCXXABI_USE_LLVM_UNWINDER)
-  if (TARGET unwind_shared)
+  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR 
HAVE_LIBUNWIND))
 add_interface_library(unwind_shared)
-  elseif (TARGET unwind_static)
+  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR 
HAVE_LIBUNWIND))
 add_interface_library(unwind_static)
   else()
 add_interface_library(unwind)


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


[libunwind] r294554 - [libunwind][CMake] Use libc++ headers when available

2017-02-08 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Feb  8 20:20:25 2017
New Revision: 294554

URL: http://llvm.org/viewvc/llvm-project?rev=294554&view=rev
Log:
[libunwind][CMake] Use libc++ headers when available

libunwind depends on C++ library headers. When building libunwind
as part of LLVM and libc++ is available, use its headers.

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

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=294554&r1=294553&r2=294554&view=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Feb  8 20:20:25 2017
@@ -282,4 +282,23 @@ endif()
 
 include_directories(include)
 
+find_path(
+  LIBUNWIND_LIBCXX_INCLUDES_INTERNAL
+  __libcpp_version
+  PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
+${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
+  NO_DEFAULT_PATH
+)
+if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
+IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
+  set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT 
"${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
+endif()
+
+set(LIBUNWIND_CXX_INCLUDE_PATHS "${LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT}" CACHE 
PATH
+"Paths to C++ header directories separated by ';'.")
+
+if (NOT LIBUNWIND_CXX_INCLUDE_PATHS STREQUAL "")
+  include_directories("${LIBUNWIND_CXX_INCLUDE_PATHS}")
+endif()
+
 add_subdirectory(src)


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


[libunwind] r294556 - Revert "[libunwind][CMake] Use libc++ headers when available"

2017-02-08 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Wed Feb  8 21:56:47 2017
New Revision: 294556

URL: http://llvm.org/viewvc/llvm-project?rev=294556&view=rev
Log:
Revert "[libunwind][CMake] Use libc++ headers when available"

This is causing build failure when building libc++abi with libunwind.

This reverts commit 42bf29501dfa79f211841de060386d539933e811.

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=294556&r1=294555&r2=294556&view=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Feb  8 21:56:47 2017
@@ -282,23 +282,4 @@ endif()
 
 include_directories(include)
 
-find_path(
-  LIBUNWIND_LIBCXX_INCLUDES_INTERNAL
-  __libcpp_version
-  PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
-${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
-  NO_DEFAULT_PATH
-)
-if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
-IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
-  set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT 
"${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
-endif()
-
-set(LIBUNWIND_CXX_INCLUDE_PATHS "${LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT}" CACHE 
PATH
-"Paths to C++ header directories separated by ';'.")
-
-if (NOT LIBUNWIND_CXX_INCLUDE_PATHS STREQUAL "")
-  include_directories("${LIBUNWIND_CXX_INCLUDE_PATHS}")
-endif()
-
 add_subdirectory(src)


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


[PATCH] D28445: [Analyzer] Extend taint propagation and checking

2017-02-08 Thread Vlad Tsyrklevich via Phabricator via cfe-commits
vlad.tsyrklevich added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:442
+
+const RecordDecl *RD = RT->getDecl()->getDefinition();
+for (const auto *I : RD->fields()) {

a.sidorin wrote:
> NoQ wrote:
> > We need to be careful in the case when we don't have the definition in the 
> > current translation unit. In this case we may still have derived symbols by 
> > casting the pointer into some blindly guessed type, which may be primitive 
> > or having well-defined primitive fields.
> > 
> > By the way, in D26837 i'm suspecting that there are other errors of this 
> > kind in the checker, eg. when a function returns a void pointer, we put 
> > taint on symbols of type "void", which is weird.
> > 
> > Adding Alexey who may recall something on this topic.
> I will check the correctness of this code sample because I have some doubts 
> about it.
> The problem of casts is hard because of our approach to put taints on 0th 
> elements. We lose casts and may get some strange void symbols. However, I 
> guess this patch isn't related to this problem directly.
Not sure which form of correctness you're interested in here but I'll bring up 
one issue I'm aware of: currently this will create a new SymbolDerived for an 
LCV sub-region, but it won't be correctly matched against in `isTainted()` 
because subsequent references to the same region will have a different 
SymbolDerived. This is the FIXME I mentioned below in `taint-generic.c` I have 
some idea on how to fix this but I think it will probably require more back and 
forth, hence why I didn't include it in this change. As it stands now, the 
sub-region tainting could be removed without changing the functionality of the 
current patch.



Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:502
+RegionBindingsRef B = getRegionBindings(S);
+const MemRegion *MR  = L.getRegion()->getBaseRegion();
+if (Optional V = B.getDefaultBinding(MR))

a.sidorin wrote:
> We get the LazyCompoundVal for some region but return the symbol for its 
> base. It means that at least method name is very confusing.
I believe that default bindings are only on base regions, so if you pass a 
reference to `outer_struct.inner_struct` the default binding for that LCV will 
be over `outer_struct`. I'm basing this on other references to LCVs in 
Core/RegionStore.cpp but I could be wrong. Either way, I'd be happy to change 
the interface to have the caller pass the correct MemRegion here.


https://reviews.llvm.org/D28445



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


[PATCH] D29386: Clzero flag addition and inclusion under znver1

2017-02-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM, but i'll make some additional testing changes before committing it.

-Add __CLZERO__ checks to test/Preprocessor/predefined-arch-macros.c for znver1
-Add command line testing to test/Driver/x86-target-features.c
-Add a test to verify the generated IR.


Repository:
  rL LLVM

https://reviews.llvm.org/D29386



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


[PATCH] D29748: [cxx1z-constexpr-lambda] Implement captures - thus completing implementation of constexpr lambdas.

2017-02-08 Thread Faisal Vali via Phabricator via cfe-commits
faisalv created this revision.
faisalv added a project: clang-c.
Herald added a subscriber: EricWF.

This patch attempts to enable evaluation of all forms of captures (however 
deeply nested) within constexpr lambdas.

Appreciate the feedback.

Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D29748

Files:
  lib/AST/ExprConstant.cpp
  test/SemaCXX/cxx1z-constexpr-lambdas.cpp

Index: test/SemaCXX/cxx1z-constexpr-lambdas.cpp
===
--- test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks %s
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s 
-// RUN: %clang_cc1 -std=c++14 -verify -fsyntax-only -fblocks %s -DCPP14_AND_EARLIER
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks %s -fcxx-exceptions
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -fcxx-exceptions
+// RUN: %clang_cc1 -std=c++14 -verify -fsyntax-only -fblocks %s -DCPP14_AND_EARLIER -fcxx-exceptions
 
 
 namespace test_lambda_is_literal {
@@ -157,18 +157,111 @@
 
 } // end ns1_simple_lambda
 
-namespace ns1_unimplemented {
-namespace ns1_captures {
+namespace test_captures_1 {
+namespace ns1 {
 constexpr auto f(int i) {
-  double d = 3.14;
-  auto L = [=](auto a) { //expected-note{{coming soon}}
-int Isz = i + d;
-return sizeof(i) + sizeof(a) + sizeof(d); 
+  struct S { int x; } s = { i * 2 };
+  auto L = [=](auto a) { 
+return i + s.x + a;
   };
   return L;
 }
-constexpr auto M = f(3);  //expected-error{{constant expression}} expected-note{{in call to}}
-} // end ns1_captures
+constexpr auto M = f(3);  
+
+static_assert(M(10) == 19);
+
+} // end test_captures_1::ns1
+
+namespace ns2 {
+
+constexpr auto foo(int n) {
+  auto L = [i = n] (auto N) mutable {
+if (!N(i)) throw "error";
+return [&i] {
+  return ++i;
+};
+  };
+  auto M = L([n](int p) { return p == n; });
+  M(); M();
+  L([n](int p) { return p == n + 2; });
+  
+  return L;
+}
+
+constexpr auto L = foo(3);
+
+} // end test_captures_1::ns2
+namespace ns3 {
+
+constexpr auto foo(int n) {
+  auto L = [i = n] (auto N) mutable {
+if (!N(i)) throw "error";
+return [&i] {
+  return [i]() mutable {
+return ++i;
+  };
+};
+  };
+  auto M = L([n](int p) { return p == n; });
+  M()(); M()();
+  L([n](int p) { return p == n; });
+  
+  return L;
+}
+
+constexpr auto L = foo(3);
+} // end test_captures_1::ns3
+
+namespace ns2_capture_this_byval {
+struct S {
+  int s;
+  constexpr S(int s) : s{s} { }
+  constexpr auto f(S o) {
+return [*this,o] (auto a) { return s + o.s + a.s; };
+  }
+};
+
+constexpr auto L = S{5}.f(S{10});
+static_assert(L(S{100}) == 115);
+} // end test_captures_1::ns2_capture_this_byval
+
+namespace ns2_capture_this_byref {
+
+struct S {
+  int s;
+  constexpr S(int s) : s{s} { }
+  constexpr auto f() const {
+return [this] { return s; };
+  }
+};
+
+constexpr S SObj{5};
+constexpr auto L = SObj.f();
+constexpr int I = L();
+static_assert(I == 5);
+
+} // end ns2_capture_this_byref
+
+} // end test_captures_1
+
+namespace test_capture_array {
+namespace ns1 {
+constexpr auto f(int I) {
+  int arr[] = { I, I *2, I * 3 };
+  auto L1 = [&] (auto a) { return arr[a]; };
+  int r = L1(2);
+  struct X { int x, y; };
+  return [=](auto a) { return X{arr[a],r}; };
+}
+constexpr auto L = f(3);
+static_assert(L(0).x == 3);
+static_assert(L(0).y == 9);
+static_assert(L(1).x == 6);
+static_assert(L(1).y == 9);
+} // end ns1
+
+} // end test_capture_array
+namespace ns1_unimplemented {
 } // end ns1_unimplemented 
 
 } // end ns test_lambda_is_cce
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -425,6 +425,9 @@
 /// Index - The call index of this call.
 unsigned Index;
 
+llvm::DenseMap LambdaCaptureFields;
+FieldDecl *LambdaThisCaptureField;
+
 CallStackFrame(EvalInfo &Info, SourceLocation CallLoc,
const FunctionDecl *Callee, const LValue *This,
APValue *Arguments);
@@ -2279,6 +2282,10 @@
   return true;
 }
 
+static bool handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv,
+   QualType Type, const LValue &LVal,
+   APValue &RVal);
+
 /// Try to evaluate the initializer for a variable declaration.
 ///
 /// \param Info   Information about the ongoing evaluation.
@@ -2290,6 +2297,7 @@
 static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
 const VarDecl *VD, CallStackFrame *Frame,
 APValue *&Result) {
+
   // If this is a parameter to an active constexpr function call, perform
   // argument substitution.
   if (const ParmVarD

[PATCH] D29748: [cxx1z-constexpr-lambda] Implement captures - thus completing implementation of constexpr lambdas.

2017-02-08 Thread Faisal Vali via Phabricator via cfe-commits
faisalv added inline comments.



Comment at: lib/AST/ExprConstant.cpp:5061
+  APValue RVal;
+  // FIXME: We need to make sure we're passing the right type that
+  // maintains cv-qualifiers.

I don't think we need this fixme - the type of the expression should be correct 
- all other const checks for mutability have already been performed, right?



Comment at: lib/AST/ExprConstant.cpp:5486
+  }
+  //Info.FFDiag(E);
+  return false;

I need to delete this comment...


Repository:
  rL LLVM

https://reviews.llvm.org/D29748



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


[PATCH] D29386: Clzero flag addition and inclusion under znver1

2017-02-08 Thread Ganesh Gopalasubramanian via Phabricator via cfe-commits
GGanesh added a comment.

Thank you @craig.topper.

Just want to check if the patch can be commited to 4.0 release branch as well.
I understand that the trunk is in blocker bug-fix stage but just want to get it 
confirmed.


Repository:
  rL LLVM

https://reviews.llvm.org/D29386



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


r294559 - [X86] Clzero flag addition and inclusion under znver1

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Feb  9 00:10:14 2017
New Revision: 294559

URL: http://llvm.org/viewvc/llvm-project?rev=294559&view=rev
Log:
[X86] Clzero flag addition and inclusion under znver1

1. Adds the command line flag for clzero.
2. Includes the clzero flag under znver1.
3. Defines the macro for clzero.
4. Adds a new file which has the intrinsic definition for clzero instruction.

Patch by Ganesh Gopalasubramanian with some additional tests from me.

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

Added:
cfe/trunk/lib/Headers/clzerointrin.h
cfe/trunk/test/CodeGen/builtin-clzero.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/lib/Headers/x86intrin.h
cfe/trunk/test/CodeGen/builtin-clflushopt.c
cfe/trunk/test/CodeGen/builtins-x86.c
cfe/trunk/test/Driver/x86-target-features.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=294559&r1=294558&r2=294559&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Feb  9 00:10:14 2017
@@ -1814,6 +1814,9 @@ TARGET_BUILTIN(__builtin_ia32_selectpd_5
 TARGET_BUILTIN(__builtin_ia32_monitorx, "vv*UiUi", "", "mwaitx")
 TARGET_BUILTIN(__builtin_ia32_mwaitx, "vUiUiUi", "", "mwaitx")
 
+// CLZERO
+TARGET_BUILTIN(__builtin_ia32_clzero, "vv*", "", "clzero")
+
 // MSVC
 TARGET_HEADER_BUILTIN(_BitScanForward, "UcULi*ULi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_BitScanReverse, "UcULi*ULi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=294559&r1=294558&r2=294559&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Feb  9 00:10:14 2017
@@ -1714,6 +1714,7 @@ def mno_xsaveopt : Flag<["-"], "mno-xsav
 def mno_xsavec : Flag<["-"], "mno-xsavec">, Group;
 def mno_xsaves : Flag<["-"], "mno-xsaves">, Group;
 def mno_mwaitx : Flag<["-"], "mno-mwaitx">, Group;
+def mno_clzero : Flag<["-"], "mno-clzero">, Group;
 def mno_pku : Flag<["-"], "mno-pku">, Group;
 def mno_clflushopt : Flag<["-"], "mno-clflushopt">, 
Group;
 def mno_clwb : Flag<["-"], "mno-clwb">, Group;
@@ -1913,6 +1914,7 @@ def mxsaveopt : Flag<["-"], "mxsaveopt">
 def mxsavec : Flag<["-"], "mxsavec">, Group;
 def mxsaves : Flag<["-"], "mxsaves">, Group;
 def mmwaitx : Flag<["-"], "mmwaitx">, Group;
+def mclzero : Flag<["-"], "mclzero">, Group;
 def mclflushopt : Flag<["-"], "mclflushopt">, Group;
 def mclwb : Flag<["-"], "mclwb">, Group;
 def mmovbe : Flag<["-"], "mmovbe">, Group;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294559&r1=294558&r2=294559&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb  9 00:10:14 2017
@@ -2489,6 +2489,7 @@ class X86TargetInfo : public TargetInfo
   bool HasXSAVEC = false;
   bool HasXSAVES = false;
   bool HasMWAITX = false;
+  bool HasCLZERO = false;
   bool HasPKU = false;
   bool HasCLFLUSHOPT = false;
   bool HasCLWB = false;
@@ -3201,6 +3202,7 @@ bool X86TargetInfo::initFeatureMap(
 setFeatureEnabledImpl(Features, "bmi", true);
 setFeatureEnabledImpl(Features, "bmi2", true);
 setFeatureEnabledImpl(Features, "clflushopt", true);
+setFeatureEnabledImpl(Features, "clzero", true);
 setFeatureEnabledImpl(Features, "cx16", true);
 setFeatureEnabledImpl(Features, "f16c", true);
 setFeatureEnabledImpl(Features, "fma", true);
@@ -3560,6 +3562,8 @@ bool X86TargetInfo::handleTargetFeatures
   HasCLWB = true;
 } else if (Feature == "+prefetchwt1") {
   HasPREFETCHWT1 = true;
+} else if (Feature == "+clzero") {
+  HasCLZERO = true;
 }
 
 X86SSEEnum Level = llvm::StringSwitch(Feature)
@@ -3887,6 +3891,8 @@ void X86TargetInfo::getTargetDefines(con
 Builder.defineMacro("__SGX__");
   if (HasPREFETCHWT1)
 Builder.defineMacro("__PREFETCHWT1__");
+  if (HasCLZERO)
+Builder.defineMacro("__CLZERO__");
 
   // Each case falls through to the previous one here.
   switch (SSELevel) {
@@ -3973,6 +3979,7 @@ bool X86TargetInfo::hasFeature(StringRef
   .Case("bmi2", HasBMI2)
   .Case("clflushopt", HasCLFLUSHOPT)
   .Case("clwb", HasCLWB)
+  .Case("clzero", HasCLZERO)
   .Case("cx16", HasCX16)
   .Case("f16c", HasF

[PATCH] D29386: Clzero flag addition and inclusion under znver1

2017-02-08 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294559: [X86] Clzero flag addition and inclusion under 
znver1 (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D29386?vs=87437&id=87762#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29386

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Headers/CMakeLists.txt
  cfe/trunk/lib/Headers/clzerointrin.h
  cfe/trunk/lib/Headers/module.modulemap
  cfe/trunk/lib/Headers/x86intrin.h
  cfe/trunk/test/CodeGen/builtin-clflushopt.c
  cfe/trunk/test/CodeGen/builtin-clzero.c
  cfe/trunk/test/CodeGen/builtins-x86.c
  cfe/trunk/test/Driver/x86-target-features.c
  cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1714,6 +1714,7 @@
 def mno_xsavec : Flag<["-"], "mno-xsavec">, Group;
 def mno_xsaves : Flag<["-"], "mno-xsaves">, Group;
 def mno_mwaitx : Flag<["-"], "mno-mwaitx">, Group;
+def mno_clzero : Flag<["-"], "mno-clzero">, Group;
 def mno_pku : Flag<["-"], "mno-pku">, Group;
 def mno_clflushopt : Flag<["-"], "mno-clflushopt">, Group;
 def mno_clwb : Flag<["-"], "mno-clwb">, Group;
@@ -1913,6 +1914,7 @@
 def mxsavec : Flag<["-"], "mxsavec">, Group;
 def mxsaves : Flag<["-"], "mxsaves">, Group;
 def mmwaitx : Flag<["-"], "mmwaitx">, Group;
+def mclzero : Flag<["-"], "mclzero">, Group;
 def mclflushopt : Flag<["-"], "mclflushopt">, Group;
 def mclwb : Flag<["-"], "mclwb">, Group;
 def mmovbe : Flag<["-"], "mmovbe">, Group;
Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -1814,6 +1814,9 @@
 TARGET_BUILTIN(__builtin_ia32_monitorx, "vv*UiUi", "", "mwaitx")
 TARGET_BUILTIN(__builtin_ia32_mwaitx, "vUiUiUi", "", "mwaitx")
 
+// CLZERO
+TARGET_BUILTIN(__builtin_ia32_clzero, "vv*", "", "clzero")
+
 // MSVC
 TARGET_HEADER_BUILTIN(_BitScanForward, "UcULi*ULi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_BitScanReverse, "UcULi*ULi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
Index: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
===
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c
@@ -1883,6 +1883,7 @@
 // CHECK_ZNVER1_M32: #define __BMI2__ 1
 // CHECK_ZNVER1_M32: #define __BMI__ 1
 // CHECK_ZNVER1_M32: #define __CLFLUSHOPT__ 1
+// CHECK_ZNVER1_M32: #define __CLZERO__ 1
 // CHECK_ZNVER1_M32: #define __F16C__ 1
 // CHECK_ZNVER1_M32: #define __FMA__ 1
 // CHECK_ZNVER1_M32: #define __FSGSBASE__ 1
@@ -1924,6 +1925,7 @@
 // CHECK_ZNVER1_M64: #define __BMI2__ 1
 // CHECK_ZNVER1_M64: #define __BMI__ 1
 // CHECK_ZNVER1_M64: #define __CLFLUSHOPT__ 1
+// CHECK_ZNVER1_M64: #define __CLZERO__ 1
 // CHECK_ZNVER1_M64: #define __F16C__ 1
 // CHECK_ZNVER1_M64: #define __FMA__ 1
 // CHECK_ZNVER1_M64: #define __FSGSBASE__ 1
Index: cfe/trunk/test/CodeGen/builtin-clzero.c
===
--- cfe/trunk/test/CodeGen/builtin-clzero.c
+++ cfe/trunk/test/CodeGen/builtin-clzero.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clzero  -emit-llvm -o - -Wall -Werror | FileCheck %s
+#define __MM_MALLOC_H
+
+#include 
+void test_mm_clzero(void * __m) {
+  //CHECK-LABEL: @test_mm_clzero
+  //CHECK: @llvm.x86.clflushopt
+  _mm_clzero(__m);
+}
Index: cfe/trunk/test/CodeGen/builtins-x86.c
===
--- cfe/trunk/test/CodeGen/builtins-x86.c
+++ cfe/trunk/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 -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 -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-feature +xsavec -target-feature +mwaitx -target-feature +clzero -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 +clzero -fsyntax-only -o %t %s
 
 #ifdef USE_ALL
 #define USE_3DNOW
@@ -285,6 

r294560 - [X86] Fix copy and paste bug in clzero test from r294559.

2017-02-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Feb  9 00:22:43 2017
New Revision: 294560

URL: http://llvm.org/viewvc/llvm-project?rev=294560&view=rev
Log:
[X86] Fix copy and paste bug in clzero test from r294559.

Modified:
cfe/trunk/test/CodeGen/builtin-clzero.c

Modified: cfe/trunk/test/CodeGen/builtin-clzero.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-clzero.c?rev=294560&r1=294559&r2=294560&view=diff
==
--- cfe/trunk/test/CodeGen/builtin-clzero.c (original)
+++ cfe/trunk/test/CodeGen/builtin-clzero.c Thu Feb  9 00:22:43 2017
@@ -4,6 +4,6 @@
 #include 
 void test_mm_clzero(void * __m) {
   //CHECK-LABEL: @test_mm_clzero
-  //CHECK: @llvm.x86.clflushopt
+  //CHECK: @llvm.x86.clzero
   _mm_clzero(__m);
 }


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


[PATCH] D29750: [PPC] Enable -fomit-frame-pointer by default for PPC

2017-02-08 Thread Hiroshi Inoue via Phabricator via cfe-commits
inouehrs created this revision.

This patch enables `-fomit-frame-pointer` option by default for PowerPC if -O1 
or above optimization level is specified.
GCC already enables this option by default for -O1 or above in all of ppc32, 
ppc64 and ppc64le.
This option gives some performance improvements in many programs by reducing 
the overhead in method prologue and epilogue.


https://reviews.llvm.org/D29750

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3441,6 +3441,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3441,6 +3441,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits