Re: [PATCH] D20942: [LockFileManager] Improve error output by adding error messages

2016-06-02 Thread Ben Langmuir via cfe-commits
benlangmuir accepted this revision.
benlangmuir added a comment.
This revision is now accepted and ready to land.

LGTM.  Some minor suggestions.



Comment at: include/llvm/Support/LockFileManager.h:87
@@ +86,3 @@
+
+  /// \brief Get error message
+  std::string getErrorMessage() const;

Get the error message, or "" if there is no error.


Comment at: lib/Support/LockFileManager.cpp:193
@@ -189,1 +192,3 @@
+  auto EC = make_error_code(errc::no_space_on_device);
+  setError(EC);
   sys::fs::remove(UniqueLockFileName);

"failed to write to "?


Comment at: lib/Support/LockFileManager.cpp:263
@@ +262,3 @@
+  OSS << ": " << Error->message();
+OSS.flush();
+return Str;

if you return OSS.str() you don't need the flush call


http://reviews.llvm.org/D20942



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


Re: [PATCH] D20929: [libcxx] Fix join.pass.cpp segfault after r271475

2016-06-02 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Thanks for the patch.


http://reviews.llvm.org/D20929



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


Re: [PATCH] D20909: [clang-tidy] Ignore function context in misc-unused-using-decls.

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

LG



Comment at: clang-tidy/misc/UnusedUsingDeclsCheck.cpp:109
@@ -100,1 +108,3 @@
+  // giving an incorrect message, we mark all of them as used.
   for (auto  : Contexts) {
+if (Context.UsingTargetDecls.count(D->getCanonicalDecl()) > 0)

I suspect that linear search here may be the reason for the poor performance of 
the check (on a large file it's in top 3 by time spent). This should be 
addressed separately. Maybe leave a FIXME?


http://reviews.llvm.org/D20909



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


Re: Don't pass --build-id by default.

2016-06-02 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Rafael Espíndola" 
> To: "Hal Finkel" 
> Cc: "cfe-commits cfe" 
> Sent: Thursday, June 2, 2016 7:06:26 PM
> Subject: Re: Don't pass --build-id by default.
> 
> > This is going to break a lot of my local rpm packaging scripts, and
> > I suspect the same is true for others. This is not a huge deal,
> > but I wonder if we should emulate GCC is this regard and provide
> > some CMake option to keep the current behavior?
> 
> Yes, a cmake option is probably best.
> 
> What do you think of the attached patch (still building).

Seems reasonable to me.

Thanks again,
Hal

> 
> Cheers,
> Rafael
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


cmake patch for building latest clang vs latest llvm

2016-06-02 Thread Rudolf Kastl via cfe-commits
This patch adjusts the path for the cmake directory to work properly on
systems with libsuffix=64. Not sure if it is the preferred way of fixing
that but it fixed the build for me.
--- CMakeLists.txt.old	2016-06-03 00:19:08.676041254 +0200
+++ CMakeLists.txt	2016-06-03 00:19:48.778920468 +0200
@@ -72,7 +72,7 @@
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
 NO_DEFAULT_PATH)
 
-  set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  set(LLVM_CMAKE_PATH "${LLVM_LIBRARY_DIR}/cmake/llvm")
   set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
   if(EXISTS ${LLVMCONFIG_FILE})
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-02 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel.
hfinkel added a comment.

FYI: There is now a specification, see: 
http://sourcerytools.com/pipermail/cxx-abi-dev/2016-June/002919.html


http://reviews.llvm.org/D18035



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


Re: [PATCH] D20942: [LockFileManager] Improve error output by adding error messages

2016-06-02 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a subscriber: llvm-commits.
bruno added a comment.

Adding the right list for this +llvm-commits


http://reviews.llvm.org/D20942



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


[PATCH] D20942: [LockFileManager] Improve error output by adding error messages

2016-06-02 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added a reviewer: benlangmuir.
bruno added subscribers: cfe-commits, dexonsmith.

This is currently used by clang to lock access to modules; improve the error 
message so that clang can use better output messages from locking error issues.


http://reviews.llvm.org/D20942

Files:
  include/llvm/Support/LockFileManager.h
  lib/Support/LockFileManager.cpp

Index: lib/Support/LockFileManager.cpp
===
--- lib/Support/LockFileManager.cpp
+++ lib/Support/LockFileManager.cpp
@@ -144,7 +144,9 @@
 {
   this->FileName = FileName;
   if (std::error_code EC = sys::fs::make_absolute(this->FileName)) {
-Error = EC;
+std::string S("failed to obtain absolute path for ");
+S.append(this->FileName.str());
+setError(EC, S);
 return;
   }
   LockFileName = this->FileName;
@@ -161,7 +163,9 @@
   int UniqueLockFileID;
   if (std::error_code EC = sys::fs::createUniqueFile(
   UniqueLockFileName, UniqueLockFileID, UniqueLockFileName)) {
-Error = EC;
+std::string S("failed to create unique file ");
+S.append(UniqueLockFileName.str());
+setError(EC, S);
 return;
   }
 
@@ -169,7 +173,7 @@
   {
 SmallString<256> HostID;
 if (auto EC = getHostID(HostID)) {
-  Error = EC;
+  setError(EC, "failed to get host id");
   return;
 }
 
@@ -185,7 +189,8 @@
 if (Out.has_error()) {
   // We failed to write out PID, so make up an excuse, remove the
   // unique lock file, and fail.
-  Error = make_error_code(errc::no_space_on_device);
+  auto EC = make_error_code(errc::no_space_on_device);
+  setError(EC);
   sys::fs::remove(UniqueLockFileName);
   return;
 }
@@ -205,7 +210,11 @@
 }
 
 if (EC != errc::file_exists) {
-  Error = EC;
+  std::string S("failed to create link ");
+  raw_string_ostream OSS(S);
+  OSS << LockFileName.str() << " to " << UniqueLockFileName.str();
+  OSS.flush();
+  setError(EC, S);
   return;
 }
 
@@ -226,7 +235,9 @@
 // There is a lock file that nobody owns; try to clean it up and get
 // ownership.
 if ((EC = sys::fs::remove(LockFileName))) {
-  Error = EC;
+  std::string S("failed to remove lockfile ");
+  S.append(UniqueLockFileName.str());
+  setError(EC, S);
   return;
 }
   }
@@ -242,6 +253,19 @@
   return LFS_Owned;
 }
 
+std::string LockFileManager::getErrorMessage() const {
+  if (Error) {
+std::string Str(ErrorDiagMsg);
+std::string ErrCodeMsg = Error->message();
+raw_string_ostream OSS(Str);
+if (!ErrCodeMsg.empty())
+  OSS << ": " << Error->message();
+OSS.flush();
+return Str;
+  }
+  return "";
+}
+
 LockFileManager::~LockFileManager() {
   if (getState() != LFS_Owned)
 return;
Index: include/llvm/Support/LockFileManager.h
===
--- include/llvm/Support/LockFileManager.h
+++ include/llvm/Support/LockFileManager.h
@@ -57,6 +57,7 @@
 
   Optional > Owner;
   Optional Error;
+  std::string ErrorDiagMsg;
 
   LockFileManager(const LockFileManager &) = delete;
   LockFileManager =(const LockFileManager &) = delete;
@@ -82,6 +83,15 @@
   /// \brief Remove the lock file.  This may delete a different lock file than
   /// the one previously read if there is a race.
   std::error_code unsafeRemoveLockFile();
+
+  /// \brief Get error message
+  std::string getErrorMessage() const;
+
+  /// \brief Set error and error message
+  void setError(std::error_code , StringRef ErrorMsg = "") {
+Error = EC;
+ErrorDiagMsg = ErrorMsg.str();
+  }
 };
 
 } // end namespace llvm
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Don't pass --build-id by default.

2016-06-02 Thread Rafael Espíndola via cfe-commits
On 2 June 2016 at 17:06, Rafael Espíndola  wrote:
>> This is going to break a lot of my local rpm packaging scripts, and I 
>> suspect the same is true for others. This is not a huge deal, but I wonder 
>> if we should emulate GCC is this regard and provide some CMake option to 
>> keep the current behavior?
>
> Yes, a cmake option is probably best.
>
> What do you think of the attached patch (still building).

It works :-)

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


Re: Don't pass --build-id by default.

2016-06-02 Thread Rafael Espíndola via cfe-commits
> This is going to break a lot of my local rpm packaging scripts, and I suspect 
> the same is true for others. This is not a huge deal, but I wonder if we 
> should emulate GCC is this regard and provide some CMake option to keep the 
> current behavior?

Yes, a cmake option is probably best.

What do you think of the attached patch (still building).

Cheers,
Rafael
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f84ae47..fce8229 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -197,6 +197,8 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc 
is installed." )
 set(DEFAULT_SYSROOT "" CACHE PATH
   "Default  to all compiler invocations for --sysroot=." )
 
+set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
+
 set(CLANG_DEFAULT_CXX_STDLIB "" CACHE STRING
   "Default C++ stdlib to use (empty for architecture default, \"libstdc++\" or 
\"libc++\"")
 if (NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
diff --git a/include/clang/Config/config.h.cmake 
b/include/clang/Config/config.h.cmake
index 8917065..09f5e4b 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -38,4 +38,7 @@
 /* Linker version detected at compile time. */
 #cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}"
 
+/* pass --build-id to ld */
+#cmakedefine ENABLE_LINKER_BUILD_ID
+
 #endif
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 8242b96..eec4174 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3978,10 +3978,9 @@ Linux::Linux(const Driver , const llvm::Triple 
, const ArgList )
   if (IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6)
 ExtraOpts.push_back("--no-add-needed");
 
-  if ((IsDebian(Distro) && Distro >= DebianSqueeze) || IsOpenSUSE(Distro) ||
-  (IsRedhat(Distro) && Distro != RHEL5) ||
-  (IsUbuntu(Distro) && Distro >= UbuntuKarmic))
-ExtraOpts.push_back("--build-id");
+#ifdef ENABLE_LINKER_BUILD_ID
+  ExtraOpts.push_back("--build-id");
+#endif
 
   if (IsOpenSUSE(Distro))
 ExtraOpts.push_back("--enable-new-dtags");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271609 - Delete configure left over.

2016-06-02 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Thu Jun  2 18:45:37 2016
New Revision: 271609

URL: http://llvm.org/viewvc/llvm-project?rev=271609=rev
Log:
Delete configure left over.

Removed:
cfe/trunk/include/clang/Config/config.h.in

Removed: cfe/trunk/include/clang/Config/config.h.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Config/config.h.in?rev=271608=auto
==
--- cfe/trunk/include/clang/Config/config.h.in (original)
+++ cfe/trunk/include/clang/Config/config.h.in (removed)
@@ -1,43 +0,0 @@
-/* This generated file is for internal use. Do not include it from headers. */
-
-#ifdef CLANG_CONFIG_H
-#error config.h can only be included once
-#else
-#define CLANG_CONFIG_H
-
-/* Bug report URL. */
-#undef BUG_REPORT_URL
-
-/* Default C++ stdlib to use. */
-#undef CLANG_DEFAULT_CXX_STDLIB
-
-/* Default OpenMP runtime used by -fopenmp. */
-#undef CLANG_DEFAULT_OPENMP_RUNTIME
-
-/* Multilib suffix for libdir. */
-#undef CLANG_LIBDIR_SUFFIX
-
-/* Relative directory for resource files */
-#undef CLANG_RESOURCE_DIR
-
-/* Directories clang will search for headers */
-#undef C_INCLUDE_DIRS
-
-/* Default  to all compiler invocations for --sysroot=. */
-#undef DEFAULT_SYSROOT
-
-/* Directory where gcc is installed. */
-#undef GCC_INSTALL_PREFIX
-
-/* Define if we have libxml2 */
-#undef CLANG_HAVE_LIBXML
-
-#undef PACKAGE_STRING
-
-/* The LLVM product name and version */
-#define BACKEND_PACKAGE_STRING PACKAGE_STRING
-
-/* Linker version detected at compile time. */
-#undef HOST_LINK_VERSION
-
-#endif


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


[PATCH] D20939: Update for DiagnosticInfoStackSize changes

2016-06-02 Thread Matt Arsenault via cfe-commits
arsenm created this revision.
arsenm added a subscriber: cfe-commits.

http://reviews.llvm.org/D20939

Files:
  lib/CodeGen/CodeGenAction.cpp
  test/Misc/backend-resource-limit-diagnostics.cl

Index: test/Misc/backend-resource-limit-diagnostics.cl
===
--- /dev/null
+++ test/Misc/backend-resource-limit-diagnostics.cl
@@ -0,0 +1,10 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: not %clang_cc1 -emit-codegen-only -triple=amdgcn-- %s 2>&1 | FileCheck 
%s
+
+
+// CHECK: error: local memory limit exceeded (48) in use_huge_lds
+kernel void use_huge_lds()
+{
+volatile local int huge[12];
+huge[0] = 2;
+}
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -415,9 +415,10 @@
 return false;
 
   if (const Decl *ND = Gen->GetDeclForMangledName(D.getFunction().getName())) {
+// FIXME: Shouldn't need to truncate to uint32_t
 Diags.Report(ND->getASTContext().getFullLoc(ND->getLocation()),
  diag::warn_fe_frame_larger_than)
-<< D.getStackSize() << Decl::castToDeclContext(ND);
+  << static_cast(D.getStackSize()) << 
Decl::castToDeclContext(ND);
 return true;
   }
 


Index: test/Misc/backend-resource-limit-diagnostics.cl
===
--- /dev/null
+++ test/Misc/backend-resource-limit-diagnostics.cl
@@ -0,0 +1,10 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: not %clang_cc1 -emit-codegen-only -triple=amdgcn-- %s 2>&1 | FileCheck %s
+
+
+// CHECK: error: local memory limit exceeded (48) in use_huge_lds
+kernel void use_huge_lds()
+{
+volatile local int huge[12];
+huge[0] = 2;
+}
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -415,9 +415,10 @@
 return false;
 
   if (const Decl *ND = Gen->GetDeclForMangledName(D.getFunction().getName())) {
+// FIXME: Shouldn't need to truncate to uint32_t
 Diags.Report(ND->getASTContext().getFullLoc(ND->getLocation()),
  diag::warn_fe_frame_larger_than)
-<< D.getStackSize() << Decl::castToDeclContext(ND);
+  << static_cast(D.getStackSize()) << Decl::castToDeclContext(ND);
 return true;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20903: Make system_error::message() thread safe. Fixes PR25598.

2016-06-02 Thread Erik Kessler via cfe-commits
erik65536 added a subscriber: erik65536.
erik65536 added a comment.

The C++ spec states that `error_category::message()` shall not change the value 
of `errno` (See section 19.5). So `errno` will have to be saved and restored if 
`strerror_r()` fails.

The POSIX version of `strerror_r()` returns 0 on success, and any other value 
indicates an error (Reference 
).

The function may return uninitialized memory if `std::snprintf()` fails.

You may want to a version for Windows that calls `strerror_s()`.


http://reviews.llvm.org/D20903



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


Re: Don't pass --build-id by default.

2016-06-02 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Rafael Espíndola via cfe-commits" 
> To: "cfe-commits cfe" 
> Sent: Thursday, June 2, 2016 5:55:25 PM
> Subject: Don't pass --build-id by default.
> 
> We do it just because gcc in some distributions do it.
> 
> I can see why --build-id is useful for distributions, but given the
> cost on day to day edit+build cycles, any distro using clang should
> really just pass -Wl,--build-id in rpmbuild (or corresponding tool).
> 
> Even upstream gcc is not as aggressive as current clang. It has a
> --enable-linker-build-id configure option and it defaults to false.

This is going to break a lot of my local rpm packaging scripts, and I suspect 
the same is true for others. This is not a huge deal, but I wonder if we should 
emulate GCC is this regard and provide some CMake option to keep the current 
behavior?

Thanks again,
Hal

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

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Don't pass --build-id by default.

2016-06-02 Thread Rui Ueyama via cfe-commits
I'm not a person who can sign it off, but it looks good to me.

On Thu, Jun 2, 2016 at 3:55 PM, Rafael Espíndola  wrote:

> We do it just because gcc in some distributions do it.
>
> I can see why --build-id is useful for distributions, but given the
> cost on day to day edit+build cycles, any distro using clang should
> really just pass -Wl,--build-id in rpmbuild (or corresponding tool).
>
> Even upstream gcc is not as aggressive as current clang. It has a
> --enable-linker-build-id configure option and it defaults to false.
>
> Cheers,
> Rafael
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-02 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Does FoldingSet already have reserve? (I do not see it.)

My understanding is that you propose to allocate all the nodes that would be 
required to store the maximum number of nodes we allow, lowering the malloc 
traffic. The current implementation just doubles the size. Is this correct?

Maybe we should just set a higher initial size, instead of going all the way to 
the max?


http://reviews.llvm.org/D20933



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


Don't pass --build-id by default.

2016-06-02 Thread Rafael Espíndola via cfe-commits
We do it just because gcc in some distributions do it.

I can see why --build-id is useful for distributions, but given the
cost on day to day edit+build cycles, any distro using clang should
really just pass -Wl,--build-id in rpmbuild (or corresponding tool).

Even upstream gcc is not as aggressive as current clang. It has a
--enable-linker-build-id configure option and it defaults to false.

Cheers,
Rafael
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index a26ca08..9b79bf9 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3928,11 +3928,6 @@ Linux::Linux(const Driver , const llvm::Triple 
, const ArgList )
   if (IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6)
 ExtraOpts.push_back("--no-add-needed");
 
-  if ((IsDebian(Distro) && Distro >= DebianSqueeze) || IsOpenSUSE(Distro) ||
-  (IsRedhat(Distro) && Distro != RHEL5) ||
-  (IsUbuntu(Distro) && Distro >= UbuntuKarmic))
-ExtraOpts.push_back("--build-id");
-
   if (IsOpenSUSE(Distro))
 ExtraOpts.push_back("--enable-new-dtags");
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20929: [libcxx] Fix join.pass.cpp segfault after r271475

2016-06-02 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

Will commit tomorrow if there are no objections.

Feel free to commit if it looks all right.

/ Asiri


http://reviews.llvm.org/D20929



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


[PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-02 Thread Ben Craig via cfe-commits
bcraig created this revision.
bcraig added reviewers: zaks.anna, krememek, jordan_rose.
bcraig added a subscriber: cfe-commits.

This depends on http://reviews.llvm.org/D20930

Rehashing the ExplodedNode table is very expensive.  The hashing itself is 
expensive, and the general activity of iterating over the hash table is highly 
cache unfriendly.  Instead, we guess at the eventual size by using the maximum 
number of steps allowed.  This generally avoids a rehash.  It is possible that 
we still need to rehash if the backlog of work that is added to the worklist 
significantly exceeds the number of work items that we process.  Even if we do 
need to rehash in that scenario, this change is still a win, as we still have 
fewer rehashes that we would have prior to this change.

For small work loads, this will increase the memory used.  For large work 
loads, it will somewhat reduce the memory used.  Speed is significantly 
increased.  A large .C file took 3m53.812s to analyze prior to this change.  
Now it takes 3m38.976s, for a ~6% improvement.

http://reviews.llvm.org/D20933

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp

Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -208,6 +208,8 @@
 
   // Check if we have a steps limit
   bool UnlimitedSteps = Steps == 0;
+  if(!UnlimitedSteps)
+G.reserve(Steps);
 
   while (WList->hasWork()) {
 if (!UnlimitedSteps) {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -321,6 +321,8 @@
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
+  void reserve(unsigned NodeCount) { Nodes.reserve(NodeCount); }
+
   // Iterators.
   typedef ExplodedNodeNodeTy;
   typedef llvm::FoldingSet  AllNodesTy;


Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -208,6 +208,8 @@
 
   // Check if we have a steps limit
   bool UnlimitedSteps = Steps == 0;
+  if(!UnlimitedSteps)
+G.reserve(Steps);
 
   while (WList->hasWork()) {
 if (!UnlimitedSteps) {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -321,6 +321,8 @@
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
+  void reserve(unsigned NodeCount) { Nodes.reserve(NodeCount); }
+
   // Iterators.
   typedef ExplodedNodeNodeTy;
   typedef llvm::FoldingSet  AllNodesTy;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-02 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: include/__threading_support:201
@@ +200,3 @@
+#  if !defined(__has_include) || __has_include(<__static_threading>)
+#include<__static_threading>
+#  else

This #include deserves a comment.  Some perplexed developer is going to come 
along later and wonder where __static_threading is supposed to come from.


http://reviews.llvm.org/D20328



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


Re: [PATCH] D20874: [libcxx] Two more threading dependencies

2016-06-02 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: include/__threading_support:187
@@ +186,3 @@
+{
+std::terminate();
+}

rmaprath wrote:
> bcraig wrote:
> > Why does this need to go in threading_support?  Seems like this is mostly 
> > orthogonal to threading.  libcxxabi seems like the better place to hold 
> > changes to terminate anyway.
> I can clearly see the argument against it, was bit unsure of it myself.
> 
> Now, the reason I want this the most is because of the externally threaded 
> API, where I need to do some cleanup of the storage allocated in 
> `__libcpp_thread_create()`. See the change I had to do in D20328 (thread.cpp) 
> where I introduced a `__libcpp_thread_finalize()` function just for the 
> cleanup. Thought it would be much cleaner to bundle up the two together so 
> that I can avoid an explicit `#ifdef` in the sources.
> 
> Is that enough of a justification? Or should I stick to the explicit `#ifdef` 
> in the externally-threaded variant? I don't have a strong opinion here, 
> either way is fine, this version is slightly more preferred.
I guess this is fine.  I just need to tell myself (and maybe it should be 
commented in the code?) that this isn't trying to replace std::terminate, it's 
trying to replace a chunk of the std::thread dtor.  Having a custom hook for 
the std::thread dtor is reasonable, and this is a reasonable default 
implementation.

Note that you only get a chance to do things here when a user does naughty 
things and lets a joinable thread reach the std::thread dtor.


http://reviews.llvm.org/D20874



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


[PATCH] D20929: [libcxx] Fix join.pass.cpp segfault after r271475

2016-06-02 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added a reviewer: EricWF.
rmaprath added a subscriber: cfe-commits.

After r271475 [1], I'm seeing a segfault in `join.pass.cpp` on my system.

The test calls `std::thread::join()` twice and expects it to throw a 
system_error. It looks like my pthread implementation does not like being 
called {{pthread_join}} with the pthread_t argument set to zero, and decides to 
segfault. There are few easy ways to fix this, I've gone with the approach 
taken in `std::thread::deatch()` so there's more consistency.

[1] 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp?r1=271475=271474=271475

http://reviews.llvm.org/D20929

Files:
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -46,14 +46,17 @@
 void
 thread::join()
 {
-int ec = __libcpp_thread_join(&__t_);
+int ec = EINVAL;
+if (__t_ != 0)
+{
+ec = __libcpp_thread_join(&__t_);
+if (ec == 0)
+__t_ = 0;
+}
 #ifndef _LIBCPP_NO_EXCEPTIONS
 if (ec)
 throw system_error(error_code(ec, system_category()), "thread::join 
failed");
-#else
-(void)ec;
 #endif  // _LIBCPP_NO_EXCEPTIONS
-__t_ = 0;
 }
 
 void


Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -46,14 +46,17 @@
 void
 thread::join()
 {
-int ec = __libcpp_thread_join(&__t_);
+int ec = EINVAL;
+if (__t_ != 0)
+{
+ec = __libcpp_thread_join(&__t_);
+if (ec == 0)
+__t_ = 0;
+}
 #ifndef _LIBCPP_NO_EXCEPTIONS
 if (ec)
 throw system_error(error_code(ec, system_category()), "thread::join failed");
-#else
-(void)ec;
 #endif  // _LIBCPP_NO_EXCEPTIONS
-__t_ = 0;
 }
 
 void
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20883: [cmake] Fix builds with LLVM_ENABLE_PIC=0

2016-06-02 Thread NAKAMURA Takumi via cfe-commits
chapuni added a subscriber: chapuni.
chapuni added a comment.

Have you tested if it might work? In fact, it didn't work.



Comment at: cfe/trunk/test/CMakeLists.txt:78
@@ +77,3 @@
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)

llvm-lto was not processed before clang. Fixed in r271585.


Comment at: cfe/trunk/test/CMakeLists.txt:83
@@ +82,3 @@
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()

It would be redundant unless libLTO.so were actually used in tests.


Repository:
  rL LLVM

http://reviews.llvm.org/D20883



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


RE: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-06-02 Thread Liu, Yaxun (Sam) via cfe-commits
Sorry for the delay.

In ParsePragma.cpp:

void Parser::HandlePragmaOpenCLExtension() {
  assert(Tok.is(tok::annot_pragma_opencl_extension));
  OpenCLExtData data =
  OpenCLExtData::getFromOpaqueValue(Tok.getAnnotationValue());
  unsigned state = data.getInt();
  IdentifierInfo *ename = data.getPointer();
  SourceLocation NameLoc = Tok.getLocation();
  ConsumeToken(); // The annotation token.

  OpenCLOptions  = Actions.getOpenCLOptions();
  auto CLVer = getLangOpts().OpenCLVersion;
  auto  = getTargetInfo().getSupportedOpenCLOpts();
  // OpenCL 1.1 9.1: "The all variant sets the behavior for all extensions,
  // overriding all previously issued extension directives, but only if the
  // behavior is set to disable."
  if (state == 0 && ename->isStr("all")) {
#define OPENCLEXT(nm) \
if (Supp.is_##nm##_supported_extension(CLVer)) \
  f.nm = 0;
#include "clang/Basic/OpenCLExtensions.def"
  }
#define OPENCLEXT(nm) else if (ename->isStr(#nm)) \
   if (Supp.is_##nm##_supported_extension(CLVer)) \
 f.nm = state; \
   else if (Supp.is_##nm##_supported_core(CLVer)) \
 PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << ename; \
   else \
 PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << ename;
#include "clang/Basic/OpenCLExtensions.def"
  else {
PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename;
return;
  }
}

Whether an extension is supported is represented by 
getTargetInfo().getSupportedOpenCLOpts(), which does not change with pragma.

Whether an extension is enabled is reprented by Actions.getOpenCLOptions(), 
which changes with pragma.

test/SemaOpenCL/extensions.cl contains examples of unsupported extensions.

Sam

-Original Message-
From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
Sent: Tuesday, May 31, 2016 6:07 PM
To: Liu, Yaxun (Sam) 
Cc: Anastasia Stulova ; Clang Commits 
; nd 
Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

Hi Sam,

> This commit does not change the initial state of the extensions. An extension 
> is supported is not the same as enabled. At the beginning all extensions are 
> disabled.

I do not see this reflected in the code at all. Could you please:

a. Point me to the location where this distinction is made.

b. Convince me that I cannot enable an extension for a target if that target 
does not support the extension?

Jeroen

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


r271579 - clangFrontend: Make intrinsics_gen optional for standalone build.

2016-06-02 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Jun  2 15:24:07 2016
New Revision: 271579

URL: http://llvm.org/viewvc/llvm-project?rev=271579=rev
Log:
clangFrontend: Make intrinsics_gen optional for standalone build.

FIXME: intrinsics_gen may be exported from llvm.

Modified:
cfe/trunk/lib/Frontend/CMakeLists.txt

Modified: cfe/trunk/lib/Frontend/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CMakeLists.txt?rev=271579=271578=271579=diff
==
--- cfe/trunk/lib/Frontend/CMakeLists.txt (original)
+++ cfe/trunk/lib/Frontend/CMakeLists.txt Thu Jun  2 15:24:07 2016
@@ -7,6 +7,11 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
+set(optional_deps intrinsics_gen)
+if (CLANG_BUILT_STANDALONE)
+  set(optional_deps)
+endif()
+
 add_clang_library(clangFrontend
   ASTConsumers.cpp
   ASTMerge.cpp
@@ -44,7 +49,7 @@ add_clang_library(clangFrontend
 
   DEPENDS
   ClangDriverOptions
-  intrinsics_gen
+  ${optional_deps}
 
   LINK_LIBS
   clangAST


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


Re: [PATCH] D20635: clang-rename: fix renaming heap allocations

2016-06-02 Thread Miklos Vajna via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271572: clang-rename: fix renaming heap allocations 
(authored by vmiklos).

Changed prior to commit:
  http://reviews.llvm.org/D20635?vs=58467=59447#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20635

Files:
  clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
  clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp

Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -112,6 +112,17 @@
 return true;
   }
 
+  bool VisitCXXConstructExpr(const CXXConstructExpr *Expr) {
+CXXConstructorDecl *Decl = Expr->getConstructor();
+
+if (getUSRForDecl(Decl) == USR) {
+  // This takes care of 'new ' expressions.
+  LocationsFound.push_back(Expr->getLocation());
+}
+
+return true;
+  }
+
   // Non-visitors:
 
   // \brief Returns a list of unique locations. Duplicate or overlapping
Index: clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
@@ -0,0 +1,14 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla
+{
+};
+
+int main()
+{
+  Cla *C = new Cla(); // CHECK: D *C = new D();
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.


Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -112,6 +112,17 @@
 return true;
   }
 
+  bool VisitCXXConstructExpr(const CXXConstructExpr *Expr) {
+CXXConstructorDecl *Decl = Expr->getConstructor();
+
+if (getUSRForDecl(Decl) == USR) {
+  // This takes care of 'new ' expressions.
+  LocationsFound.push_back(Expr->getLocation());
+}
+
+return true;
+  }
+
   // Non-visitors:
 
   // \brief Returns a list of unique locations. Duplicate or overlapping
Index: clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
@@ -0,0 +1,14 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla
+{
+};
+
+int main()
+{
+  Cla *C = new Cla(); // CHECK: D *C = new D();
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r271572 - clang-rename: fix renaming heap allocations

2016-06-02 Thread Miklos Vajna via cfe-commits
Author: vmiklos
Date: Thu Jun  2 15:00:22 2016
New Revision: 271572

URL: http://llvm.org/viewvc/llvm-project?rev=271572=rev
Log:
clang-rename: fix renaming heap allocations

The check failed, 'Cla *C = new Cla();' was renamed to 'D *C = new Cla();'.

Reviewers: klimek

Differential Revision: http://reviews.llvm.org/D20635

Added:
clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
Modified:
clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp

Modified: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp?rev=271572=271571=271572=diff
==
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp Thu Jun  2 15:00:22 
2016
@@ -112,6 +112,17 @@ public:
 return true;
   }
 
+  bool VisitCXXConstructExpr(const CXXConstructExpr *Expr) {
+CXXConstructorDecl *Decl = Expr->getConstructor();
+
+if (getUSRForDecl(Decl) == USR) {
+  // This takes care of 'new ' expressions.
+  LocationsFound.push_back(Expr->getLocation());
+}
+
+return true;
+  }
+
   // Non-visitors:
 
   // \brief Returns a list of unique locations. Duplicate or overlapping

Added: clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp?rev=271572=auto
==
--- clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp (added)
+++ clang-tools-extra/trunk/test/clang-rename/ConstructExpr.cpp Thu Jun  2 
15:00:22 2016
@@ -0,0 +1,14 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla
+{
+};
+
+int main()
+{
+  Cla *C = new Cla(); // CHECK: D *C = new D();
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.


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


Re: [PATCH] D20053: [clang-tidy] Add misc-unnecessary-mutable check.

2016-06-02 Thread Marek Sokołowski via cfe-commits
mnbvmar marked 14 inline comments as done.
mnbvmar added a comment.

http://reviews.llvm.org/D20053



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


Re: [PATCH] D20053: [clang-tidy] Add misc-unnecessary-mutable check.

2016-06-02 Thread Marek Sokołowski via cfe-commits
mnbvmar added inline comments.


Comment at: clang-tidy/misc/UnnecessaryMutableCheck.cpp:47
@@ +46,3 @@
+
+  void RunSearch(const Decl *Declaration) {
+auto *Body = Declaration->getBody();

Unless I miss something, the moment we set FoundNonConstUse to true, we stop 
recurring both in FieldUseVisitor and ClassMethodVisitor.


http://reviews.llvm.org/D20053



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


Re: [PATCH] D20053: [clang-tidy] Add misc-unnecessary-mutable check.

2016-06-02 Thread Marek Sokołowski via cfe-commits
mnbvmar updated this revision to Diff 59445.
mnbvmar added a comment.

Fixes done.
Added macro test.
Docs should be working now.
Updated docs.


http://reviews.llvm.org/D20053

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/UnnecessaryMutableCheck.cpp
  clang-tidy/misc/UnnecessaryMutableCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-unnecessary-mutable.rst
  test/clang-tidy/misc-unnecessary-mutable.cpp

Index: test/clang-tidy/misc-unnecessary-mutable.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-unnecessary-mutable.cpp
@@ -0,0 +1,377 @@
+// RUN: %check_clang_tidy %s misc-unnecessary-mutable %t
+
+struct NothingMutable {
+  int field1;
+  unsigned field2;
+  const int field3;
+  volatile float field4;
+
+  NothingMutable(int a1, unsigned a2, int a3, float a4) : field1(a1), field2(a2), field3(a3), field4(a4) {}
+
+  void doSomething() {
+field1 = 1;
+field2 = 2;
+field4 = 4;
+  }
+};
+
+struct NoMethods {
+  int field1;
+  mutable unsigned field2; // These cannot be fixed; they're public
+  const int field3;
+  mutable volatile NothingMutable field4;
+};
+
+class NoMethodsClass {
+public:
+  int field1;
+  mutable unsigned field2;
+
+private:
+  const int field3;
+  mutable volatile NothingMutable field4;
+  // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: 'mutable' modifier is unnecessary for field 'field4' [misc-unnecessary-mutable]
+  // CHECK-FIXES: {{^  }}volatile NothingMutable field4;
+};
+
+struct PrivateInStruct {
+private:
+  mutable volatile unsigned long long blah;
+  // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: 'mutable' modifier is unnecessary for field 'blah' {{..}}
+  // CHECK-FIXES: {{^  }}volatile unsigned long long blah;
+};
+
+union PrivateInUnion {
+public:
+  int someField;
+
+private:
+  mutable char otherField;
+};
+
+class UnusedVar {
+private:
+  mutable int x __attribute__((unused));
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'mutable' modifier is unnecessary for field 'x' {{..}}
+  // CHECK-FIXES: {{^  }}int x __attribute__((unused));
+};
+
+class NoConstMethodsClass {
+public:
+  int field1;
+  mutable unsigned field2;
+
+  NoConstMethodsClass() : field2(42), field3(9), field4(NothingMutable(1, 2, 3, 4)) {}
+
+  void doSomething() {
+field2 = 8;
+field1 = 99;
+field4.doSomething();
+  }
+
+private:
+  const int field3;
+  mutable NothingMutable field4;
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: 'mutable' modifier is unnecessary for field 'field4' {{..}}
+  // CHECK-FIXES: {{^  }}NothingMutable field4;
+};
+
+class ConstMethods {
+private:
+  mutable int field1, field2;
+  // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: 'mutable' modifier is unnecessary for field 'field2' {{..}}
+  mutable int incr, decr, set, mul, constArg1, constArg2, constRef, ref1, ref2;
+  // CHECK-MESSAGES: :[[@LINE-1]]:37: warning: 'mutable' modifier is unnecessary for field 'constArg1' {{..}}
+  // CHECK-MESSAGES: :[[@LINE-2]]:48: warning: 'mutable' modifier is unnecessary for field 'constArg2' {{..}}
+  // CHECK-MESSAGES: :[[@LINE-3]]:59: warning: 'mutable' modifier is unnecessary for field 'constRef' {{..}}
+
+  void takeArg(int x) const { x *= 4; }
+  int takeConstRef(const int ) const { return x + 99; }
+  void takeRef(int &) const {}
+
+  template 
+  void takeArgs(Args... args) const {}
+  template 
+  void takeArgRefs(Args &... args) const {}
+
+public:
+  void doSomething() const {
+field1 = field2;
+  }
+
+  void doOtherThing() const {
+incr++;
+decr--;
+set = 42;
+mul *= 3;
+takeArg(constArg1);
+takeConstRef(constRef);
+takeRef(ref1);
+takeArgs(constArg1, constArg2);
+takeArgRefs(ref1, ref2);
+  }
+};
+
+class NonFinalClass {
+public:
+  mutable int fPublic;
+
+protected:
+  mutable int fProtected;
+
+private:
+  mutable int fPrivate;
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'mutable' modifier is unnecessary for field 'fPrivate' {{..}}
+  // CHECK-FIXES: {{^  }}int fPrivate;
+};
+
+class FinalClass final {
+public:
+  mutable int fPublic;
+
+protected:
+  mutable int fProtected;
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'mutable' modifier is unnecessary for field 'fProtected' {{..}}
+  // CHECK-FIXES: {{^  }}int fProtected;
+
+private:
+  mutable int fPrivate;
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'mutable' modifier is unnecessary for field 'fPrivate' {{..}}
+  // CHECK-FIXES: {{^  }}int fPrivate;
+};
+
+class NotAllFuncsKnown {
+  void doSomething();
+  void doSomethingConst() const {}
+
+private:
+  mutable int field;
+  // Can't be fixed. We don't know if doSomething() doesn't declare a *const* NotAllFuncsKnown instance
+  // and then modify 'field' field.
+};
+
+class NotAllConstFuncsKnown {
+  void doSomething() {}
+  void doSomethingConst() const;
+  void doOtherConst() const {}
+
+private:
+  mutable int field;
+};
+
+class ConstFuncOutside 

Re: [PATCH] D20908: Add a few missing Clang regression tests

2016-06-02 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


http://reviews.llvm.org/D20908



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


r271565 - [cmake] Fix-up r271533

2016-06-02 Thread Pavel Labath via cfe-commits
Author: labath
Date: Thu Jun  2 13:49:42 2016
New Revision: 271565

URL: http://llvm.org/viewvc/llvm-project?rev=271565=rev
Log:
[cmake] Fix-up r271533

I was appending to the wrong variable (over-zealous copy-paste from llvm on my 
part).

Modified:
cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=271565=271564=271565=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Thu Jun  2 13:49:42 2016
@@ -76,11 +76,11 @@ if( NOT CLANG_BUILT_STANDALONE )
 )
 
   if(TARGET llvm-lto)
-set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+list(APPEND CLANG_TEST_DEPS llvm-lto)
   endif()
 
   if(TARGET LTO)
-set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+list(APPEND CLANG_TEST_DEPS LTO)
   endif()
 endif()
 


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


Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-02 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

Can you add tests for the existing _mm512_setzero_* intrinsics as well please?


http://reviews.llvm.org/D20871



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-02 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 59431.
yaxunl added a comment.

Improve diag msg for fblocks.


http://reviews.llvm.org/D20444

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CompilerInvocation.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Headers/module.modulemap
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  test/Frontend/opencl-blocks.cl
  test/Headers/opencl-c-header.cl

Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,33 +1,84 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple 

r271544 - [docs] Add a limitations section to SourceBasedCodeCoverage.rst

2016-06-02 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Thu Jun  2 12:19:45 2016
New Revision: 271544

URL: http://llvm.org/viewvc/llvm-project?rev=271544=rev
Log:
[docs] Add a limitations section to SourceBasedCodeCoverage.rst

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=271544=271543=271544=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Thu Jun  2 12:19:45 2016
@@ -165,9 +165,9 @@ A few final notes:
   indexed profiles. To combine profiling data from multiple runs of a program,
   try e.g:
 
-.. code-block:: console
+  .. code-block:: console
 
-% llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata
+  % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata
 
 Format compatibility guarantees
 ===
@@ -184,3 +184,20 @@ Format compatibility guarantees
 * There is a third format in play: the format of the coverage mappings emitted
   into instrumented binaries. Tools must retain **backwards** compatibility
   with these formats. These formats are not forwards-compatible.
+
+Drawbacks and limitations
+=
+
+* Code coverage does not handle stack unwinding in the presence of uncaught
+  exceptions precisely. Consider the following function:
+
+  .. code-block:: cpp
+
+  int f() {
+may_throw();
+return 0;
+  }
+
+  If the function ``may_throw()`` propagates an exception into ``f``, the code
+  coverage tool may mark the ``return`` statement as executed even though it is
+  not.


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


Re: [PATCH] D20917: [clang-tidy] Add RemoveStars option to the modernize-use-auto check

2016-06-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.


Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:155
@@ +154,3 @@
+--
+If the option is set to non-zero (default is ``0``), the check will remove 
stars
+from the non-typedef pointer types when replacing type names with ``auto``.

Please highlight 0 with `. It's not language construct.


http://reviews.llvm.org/D20917



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


Re: r271427 - [driver][arm] add armv7 and thumb include and lib paths

2016-06-02 Thread Chih-hung Hsieh via cfe-commits
Ismail,
I saw that android-ndk-standalone.cpp has already -stdlib=libstdc++.
Could you tell me or just go ahead and make the necessary change?
Thanks.


On Thu, Jun 2, 2016 at 9:52 AM, Ismail Donmez  wrote:

> Hi,
>
> On Wed, Jun 1, 2016 at 11:48 PM, Chih-Hung Hsieh via cfe-commits
>  wrote:
> > Author: chh
> > Date: Wed Jun  1 15:48:46 2016
> > New Revision: 271427
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=271427=rev
> > Log:
> > [driver][arm] add armv7 and thumb include and lib paths
> >
> > Add a new test android-ndk-standalone.cpp
> > with new Android NDK release tree structure.
> > Detect armv7 sub architecture and thumb mode,
> > to add system include and link search paths.
> >
> > Differential Revision: http://reviews.llvm.org/D20600
> >
>
> android-ndk-standalone.cpp needs -stdlib=libstdc++ to fix test on
> libc++ default systems.
>
> ismail
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

I think single check will be better from user's point of view.



Comment at: docs/clang-tidy/checks/modernize-explicit-operator-bool.rst:12
@@ +11,3 @@
+have no ``operator ==`` overloads, an implicit ``operator bool`` would allow
+``a == b`` to compile because both a and b can be implictly converted to
+``bool``.

a == b should not be highlighted, or highlighted with ` (as not language 
constructs). If highlighted with `, same should be done with a, b.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20490: [Parser] Fix a crash on invalid where a delayed TypoExpr was corrected twice

2016-06-02 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Ping!!


http://reviews.llvm.org/D20490



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


[PATCH] D20923: [Sema] Fix a crash on invalid where invalid defaulted function is called

2016-06-02 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision.
erik.pilkington added a reviewer: rsmith.
erik.pilkington added a subscriber: cfe-commits.

Previously, clang would crash on the test case below, because it misinterprets 
the `operator=(bool)` call as a move assignment operator.


http://reviews.llvm.org/D20923

Files:
  lib/Sema/SemaExpr.cpp
  test/SemaCXX/cxx0x-defaulted-functions.cpp

Index: test/SemaCXX/cxx0x-defaulted-functions.cpp
===
--- test/SemaCXX/cxx0x-defaulted-functions.cpp
+++ test/SemaCXX/cxx0x-defaulted-functions.cpp
@@ -196,3 +196,15 @@
   A a;
   B b; // expected-note {{here}}
 }
+
+namespace PR27941 {
+struct ExplicitBool {
+  ExplicitBool =(bool) = default; // expected-error{{only special 
member functions may be defaulted}}
+  int member;
+};
+
+int fn() {
+  ExplicitBool t;
+  t = true;
+}
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -13005,7 +13005,7 @@
   if (MethodDecl->isDefaulted() && !MethodDecl->isDeleted()) {
 if (MethodDecl->isCopyAssignmentOperator())
   DefineImplicitCopyAssignment(Loc, MethodDecl);
-else
+else if (MethodDecl->isMoveAssignmentOperator())
   DefineImplicitMoveAssignment(Loc, MethodDecl);
   }
 } else if (isa(MethodDecl) &&


Index: test/SemaCXX/cxx0x-defaulted-functions.cpp
===
--- test/SemaCXX/cxx0x-defaulted-functions.cpp
+++ test/SemaCXX/cxx0x-defaulted-functions.cpp
@@ -196,3 +196,15 @@
   A a;
   B b; // expected-note {{here}}
 }
+
+namespace PR27941 {
+struct ExplicitBool {
+  ExplicitBool =(bool) = default; // expected-error{{only special member functions may be defaulted}}
+  int member;
+};
+
+int fn() {
+  ExplicitBool t;
+  t = true;
+}
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -13005,7 +13005,7 @@
   if (MethodDecl->isDefaulted() && !MethodDecl->isDeleted()) {
 if (MethodDecl->isCopyAssignmentOperator())
   DefineImplicitCopyAssignment(Loc, MethodDecl);
-else
+else if (MethodDecl->isMoveAssignmentOperator())
   DefineImplicitMoveAssignment(Loc, MethodDecl);
   }
 } else if (isa(MethodDecl) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r271427 - [driver][arm] add armv7 and thumb include and lib paths

2016-06-02 Thread Ismail Donmez via cfe-commits
Hi,

On Wed, Jun 1, 2016 at 11:48 PM, Chih-Hung Hsieh via cfe-commits
 wrote:
> Author: chh
> Date: Wed Jun  1 15:48:46 2016
> New Revision: 271427
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271427=rev
> Log:
> [driver][arm] add armv7 and thumb include and lib paths
>
> Add a new test android-ndk-standalone.cpp
> with new Android NDK release tree structure.
> Detect armv7 sub architecture and thumb mode,
> to add system include and link search paths.
>
> Differential Revision: http://reviews.llvm.org/D20600
>

android-ndk-standalone.cpp needs -stdlib=libstdc++ to fix test on
libc++ default systems.

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


Re: [PATCH] D20902: [include-fixer] added GNU symbols hardcoded header mapping.

2016-06-02 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 59411.
ioeric added a comment.

- Addressed reviewer's comment.


http://reviews.llvm.org/D20902

Files:
  include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp

Index: include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
===
--- include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
+++ include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
@@ -77,9 +77,6 @@
   {"include/xsavesintrin.h", ""},
   {"include/xtestintrin.h", ""},
   {"include/_G_config.h", ""},
-  {"include/alloca.h", ""},
-  {"include/asm-generic/errno-base.h", ""},
-  {"include/asm-generic/errno.h", ""},
   {"include/assert.h", ""},
   {"algorithm", ""},
   {"array", ""},
@@ -269,33 +266,23 @@
   {"vector", ""},
   {"include/complex.h", ""},
   {"include/ctype.h", ""},
-  {"include/endian.h", ""},
   {"include/errno.h", ""},
-  {"include/features.h", ""},
   {"include/fenv.h", ""},
   {"include/inttypes.h", ""},
-  {"include/libintl.h", ""},
   {"include/libio.h", ""},
   {"include/limits.h", ""},
-  {"include/linux/limits.h", ""},
   {"include/locale.h", ""},
   {"include/math.h", ""},
-  {"include/pthread.h", ""},
-  {"include/sched.h", ""},
   {"include/setjmp.h", ""},
   {"include/signal.h", ""},
-  {"include/stdc-predef.h", ""},
   {"include/stdint.h", ""},
   {"include/stdio.h", ""},
   {"include/stdlib.h", ""},
   {"include/string.h", ""},
   {"include/time.h", ""},
   {"include/wchar.h", ""},
   {"include/wctype.h", ""},
-  {"bits/byteswap-16.h", ""},
-  {"bits/byteswap.h", ""},
   {"bits/cmathcalls.h", ""},
-  {"bits/endian.h", ""},
   {"bits/errno.h", ""},
   {"bits/fenv.h", ""},
   {"bits/huge_val.h", ""},
@@ -309,34 +296,21 @@
   {"bits/nan.h", ""},
   {"bits/posix1_lim.h", ""},
   {"bits/posix2_lim.h", ""},
-  {"bits/pthreadtypes.h", ""},
-  {"bits/sched.h", ""},
-  {"bits/select.h", ""},
   {"bits/setjmp.h", ""},
   {"bits/sigaction.h", ""},
   {"bits/sigcontext.h", ""},
   {"bits/siginfo.h", ""},
   {"bits/signum.h", ""},
   {"bits/sigset.h", ""},
   {"bits/sigstack.h", ""},
-  {"bits/sigthread.h", ""},
   {"bits/stdio_lim.h", ""},
   {"bits/sys_errlist.h", ""},
   {"bits/time.h", ""},
   {"bits/timex.h", ""},
-  {"bits/types.h", ""},
   {"bits/typesizes.h", ""},
-  {"bits/waitflags.h", ""},
-  {"bits/waitstatus.h", ""},
   {"bits/wchar.h", ""},
   {"bits/wordsize.h", ""},
   {"bits/xopen_lim.h", ""},
-  {"gnu/stubs-64.h", ""},
-  {"sys/cdefs.h", ""},
-  {"sys/select.h", ""},
-  {"sys/sysmacros.h", ""},
-  {"sys/types.h", ""},
-  {"sys/ucontext.h", ""},
   {"include/xlocale.h", ""},
   {"bits/atomic_word.h", ""},
   {"bits/basic_file.h", ""},
@@ -352,6 +326,356 @@
   {"bits/gthr.h", ""},
   {"bits/opt_random.h", ""},
   {"bits/os_defines.h", ""},
+  // GNU C headers
+  {"include/aio.h", ""},
+  {"include/aliases.h", ""},
+  {"include/alloca.h", ""},
+  {"include/ar.h", ""},
+  {"include/argp.h", ""},
+  {"include/argz.h", ""},
+  {"include/arpa/nameser.h", ""},
+  {"include/arpa/nameser_compat.h", ""},
+  {"include/autosprintf.h", ""},
+  {"include/byteswap.h", ""},
+  {"include/clif.h", ""},
+  {"include/com_err.h", ""},
+  {"include/cpio.h", ""},
+  {"include/crypt.h", ""},
+  {"include/curses.h", ""},
+  {"include/cursesapp.h", ""},
+  {"include/cursesf.h", ""},
+  {"include/cursesm.h", ""},
+  {"include/cursesp.h", ""},
+  {"include/cursesw.h", ""},
+  {"include/cursslk.h", ""},
+  {"include/dialog.h", ""},
+  {"include/dirent.h", ""},
+  {"include/dlfcn.h", ""},
+  {"include/dlg_colors.h", ""},
+  {"include/dlg_config.h", ""},
+  {"include/dlg_keys.h", ""},
+  {"include/elf.h", ""},
+  {"include/endian.h", ""},
+  {"include/envz.h", ""},
+  {"include/err.h", ""},
+  {"include/error.h", ""},
+  {"include/et/com_err.h", ""},
+  {"include/eti.h", ""},
+  {"include/etip.h", ""},
+  {"include/execinfo.h", ""},
+  {"include/expat.h", ""},
+  {"include/expat_external.h", ""},
+  {"include/fcntl.h", ""},
+  {"include/features.h", ""},
+  {"include/fenv.h", ""},
+  {"include/fmtmsg.h", ""},
+  {"include/fnmatch.h", ""},
+  {"include/form.h", ""},
+  {"include/fstab.h", ""},
+  {"include/fts.h", ""},
+  {"include/ftw.h", ""},
+  {"include/gconv.h", ""},
+  {"include/getopt.h", ""},
+  {"include/gettext-po.h", ""},
+  {"include/glob.h", ""},
+  {"include/grp.h", ""},
+  {"include/gshadow.h", ""},
+  {"include/gssapi/gssapi.h", ""},
+  {"include/iconv.h", ""},
+  {"include/ifaddrs.h", ""},
+  

[PATCH] D20922: [libcxx] [test] Rename global "x" to "testcases" in complex.number/cases.h and make it const for safety.

2016-06-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Rename global "x" to "testcases" in complex.number/cases.h and make it const 
for safety.

Fixes MSVC warning C4459 "declaration of 'x' hides global declaration".

NOTE: As the addition of const is a semantic change, please double-check that 
the tests are passing. With MSVC I observe that this fixes the compiler 
warnings, but I still have unrelated runtime failures.

http://reviews.llvm.org/D20922

Files:
  test/std/numerics/complex.number/cases.h
  test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp
  test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
  
test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
  
test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
  
test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
  test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
  test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp
  test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp
  test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
  test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
  test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp

Index: test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
===
--- test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
+++ test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
@@ -37,26 +37,26 @@
 
 void test_edges()
 {
-const unsigned N = sizeof(x) / sizeof(x[0]);
+const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
 for (unsigned i = 0; i < N; ++i)
 {
-std::complex r = proj(x[i]);
-switch (classify(x[i]))
+std::complex r = proj(testcases[i]);
+switch (classify(testcases[i]))
 {
 case zero:
 case non_zero:
-assert(r == x[i]);
-assert(std::signbit(real(r)) == std::signbit(real(x[i])));
-assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+assert(r == testcases[i]);
+assert(std::signbit(real(r)) == std::signbit(real(testcases[i])));
+assert(std::signbit(imag(r)) == std::signbit(imag(testcases[i])));
 break;
 case inf:
 assert(std::isinf(real(r)) && real(r) > 0);
 assert(imag(r) == 0);
-assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+assert(std::signbit(imag(r)) == std::signbit(imag(testcases[i])));
 break;
 case NaN:
 case non_zero_nan:
-assert(classify(r) == classify(x[i]));
+assert(classify(r) == classify(testcases[i]));
 break;
 }
 }
Index: test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
===
--- test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
+++ test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
@@ -46,11 +46,11 @@
 
 void test_edges()
 {
-const unsigned N = sizeof(x) / sizeof(x[0]);
+const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
 for (unsigned i = 0; i < N; ++i)
 {
-double r = real(x[i]);
-double theta = imag(x[i]);
+double r = real(testcases[i]);
+double theta = imag(testcases[i]);
 std::complex z = std::polar(r, theta);
 switch (classify(r))
 {
Index: test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
===
--- 

Re: [PATCH] D20917: [clang-tidy] Add RemoveStars option to the modernize-use-auto check

2016-06-02 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

The description threw me for a loop, but the behavior described in the 
documentation and tested by the tests matches what I would expect. LGTM!


http://reviews.llvm.org/D20917



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


[PATCH] D20920: [libcxx] [test] Rename d to dbl in order to avoid shadowing distributions named d.

2016-06-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Rename d to dbl in order to avoid shadowing distributions named d.

This was almost always declared as double d, except in rand.dist.uni.real where 
it was D::result_type d (still of type double).

Fixes MSVC warning C4456 "declaration of 'd' hides previous local declaration".

http://reviews.llvm.org/D20920

Files:
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
  test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp

Index: test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
===
--- test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
+++ test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
@@ -51,10 +51,10 @@
 D::result_type kurtosis = 0;
 for (int i = 0; i < u.size(); ++i)
 {
-D::result_type d = (u[i] - mean);
-D::result_type d2 = sqr(d);
+D::result_type dbl = (u[i] - mean);
+D::result_type d2 = sqr(dbl);
 var += d2;
-skew += d * d2;
+skew += dbl * d2;
 kurtosis += d2 * d2;
 }
 var /= u.size();
Index: test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
===
--- test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
+++ test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
@@ -51,10 +51,10 @@
 D::result_type kurtosis = 0;
 for (int i = 0; i < u.size(); ++i)
 {
-D::result_type d = (u[i] - mean);
-D::result_type d2 = sqr(d);
+D::result_type dbl = (u[i] - mean);
+D::result_type d2 = sqr(dbl);
 var += d2;
-skew += d * d2;
+skew += dbl * d2;
 kurtosis += d2 * d2;
 }
 var /= u.size();
@@ -91,10 +91,10 @@
 D::result_type kurtosis = 0;
 for (int i = 0; i < u.size(); ++i)
 {
-D::result_type d = (u[i] - mean);
-D::result_type d2 

Re: [PATCH] D20883: [cmake] Fix builds with LLVM_ENABLE_PIC=0

2016-06-02 Thread Pavel Labath via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271533: [cmake] Fix builds with LLVM_ENABLE_PIC=0 (authored 
by labath).

Changed prior to commit:
  http://reviews.llvm.org/D20883?vs=59293=59405#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20883

Files:
  cfe/trunk/test/CMakeLists.txt

Index: cfe/trunk/test/CMakeLists.txt
===
--- cfe/trunk/test/CMakeLists.txt
+++ cfe/trunk/test/CMakeLists.txt
@@ -68,14 +68,20 @@
 FileCheck count not
 llc
 llvm-bcanalyzer
-llvm-lto
 llvm-objdump
 llvm-profdata
 llvm-readobj
 llvm-symbolizer
-LTO
 opt
 )
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+  endif()
+
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})


Index: cfe/trunk/test/CMakeLists.txt
===
--- cfe/trunk/test/CMakeLists.txt
+++ cfe/trunk/test/CMakeLists.txt
@@ -68,14 +68,20 @@
 FileCheck count not
 llc
 llvm-bcanalyzer
-llvm-lto
 llvm-objdump
 llvm-profdata
 llvm-readobj
 llvm-symbolizer
-LTO
 opt
 )
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+  endif()
+
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271533 - [cmake] Fix builds with LLVM_ENABLE_PIC=0

2016-06-02 Thread Pavel Labath via cfe-commits
Author: labath
Date: Thu Jun  2 11:35:24 2016
New Revision: 271533

URL: http://llvm.org/viewvc/llvm-project?rev=271533=rev
Log:
[cmake] Fix builds with LLVM_ENABLE_PIC=0

Summary:
When this flag is specified, the target llvm-lto is not built, but is still
used as a dependency of the test targets. cmake 2.8 silently ignored this
situation, but with cmake_minimum_required(3.4) it becomes an error. Fix this
by avoiding the inclusion the target as a dependency.

Reviewers: beanz

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20883

Modified:
cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=271533=271532=271533=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Thu Jun  2 11:35:24 2016
@@ -68,14 +68,20 @@ if( NOT CLANG_BUILT_STANDALONE )
 FileCheck count not
 llc
 llvm-bcanalyzer
-llvm-lto
 llvm-objdump
 llvm-profdata
 llvm-readobj
 llvm-symbolizer
-LTO
 opt
 )
+
+  if(TARGET llvm-lto)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
+  endif()
+
+  if(TARGET LTO)
+set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
+  endif()
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})


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


Re: [PATCH] D20898: [clang-format] skip empty lines and comments in the top of the code when inserting new headers.

2016-06-02 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Could we very easily use the FormatTokenLexer for this? I.e. find the first 
non-comment token an start from there?


http://reviews.llvm.org/D20898



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


[PATCH] D20919: [libcxx] [test] Rename b to b2 in order to avoid shadowing between nested catch blocks.

2016-06-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Rename b to b2 in order to avoid shadowing between nested catch blocks.

Fixes MSVC warning C6246 "Local declaration of 'b' hides declaration of the 
same name in outer scope."

http://reviews.llvm.org/D20919

Files:
  
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp

Index: 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
===
--- 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ 
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -76,9 +76,9 @@
 std::rethrow_if_nested(a);
 assert(false);
 }
-catch (const B& b)
+catch (const B& b2)
 {
-assert(b == B(5));
+assert(b2 == B(5));
 }
 }
 }


Index: test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
===
--- test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -76,9 +76,9 @@
 std::rethrow_if_nested(a);
 assert(false);
 }
-catch (const B& b)
+catch (const B& b2)
 {
-assert(b == B(5));
+assert(b2 == B(5));
 }
 }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-02 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/Frontend/opencl-blocks.cl:11
@@ +10,3 @@
+#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(BLOCKS)
+  // expected-error@-2{{blocks support disabled - compile with -fblocks or 
pick a deployment target that supports them}}
+#else

This is not part of this change, but I was just wondering whether it would make 
sense to update the message to refer to OpenCL version that allows blocks 
(similarly to other cases).

We might need to create different diagnostic or use select option?


http://reviews.llvm.org/D20444



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


[PATCH] D20918: [libcxx] [test] Silence more "unreferenced local variable" warnings.

2016-06-02 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Silence more "unreferenced local variable" warnings.

http://reviews.llvm.org/D20918

Files:
  test/std/depr/depr.c.headers/wchar_h.pass.cpp

Index: test/std/depr/depr.c.headers/wchar_h.pass.cpp
===
--- test/std/depr/depr.c.headers/wchar_h.pass.cpp
+++ test/std/depr/depr.c.headers/wchar_h.pass.cpp
@@ -43,6 +43,14 @@
 ::va_list va;
 char* ns = 0;
 wchar_t* ws = 0;
+((void)mb); // Prevent unused warning
+((void)s); // Prevent unused warning
+((void)tm); // Prevent unused warning
+((void)w); // Prevent unused warning
+((void)fp); // Prevent unused warning
+((void)va); // Prevent unused warning
+((void)ns); // Prevent unused warning
+((void)ws); // Prevent unused warning
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");


Index: test/std/depr/depr.c.headers/wchar_h.pass.cpp
===
--- test/std/depr/depr.c.headers/wchar_h.pass.cpp
+++ test/std/depr/depr.c.headers/wchar_h.pass.cpp
@@ -43,6 +43,14 @@
 ::va_list va;
 char* ns = 0;
 wchar_t* ws = 0;
+((void)mb); // Prevent unused warning
+((void)s); // Prevent unused warning
+((void)tm); // Prevent unused warning
+((void)w); // Prevent unused warning
+((void)fp); // Prevent unused warning
+((void)va); // Prevent unused warning
+((void)ns); // Prevent unused warning
+((void)ws); // Prevent unused warning
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-02 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/Headers/opencl-c-header.cl:53-54
@@ +52,4 @@
+
+// ===
+// Compile for OpenCL 2.0 for the first time. The module should change.
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck 
--check-prefix=CHECK20 %s

We can discuss that as the next step for improving the header.


http://reviews.llvm.org/D20444



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


Re: [PATCH] D20917: [clang-tidy] Add RemoveStars option to the modernize-use-auto check

2016-06-02 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

Is it a typo in the description when it says that when RemoveStar is on we will 
write 'auto*' instead if 'auto'?


http://reviews.llvm.org/D20917



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


Re: [PATCH] D20898: [clang-format] skip empty lines and comments in the top of the code when inserting new headers.

2016-06-02 Thread Eric Liu via cfe-commits
ioeric added a subscriber: ioeric.
ioeric added a comment.

ping


http://reviews.llvm.org/D20898



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


Re: [PATCH] D20883: [cmake] Fix builds with LLVM_ENABLE_PIC=0

2016-06-02 Thread Chris Bieneman via cfe-commits
beanz accepted this revision.
beanz added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D20883



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-02 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 59398.
yaxunl marked an inline comment as done.
yaxunl added a comment.

Add a test for -fblocks as Anastasia suggested.


http://reviews.llvm.org/D20444

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CompilerInvocation.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Headers/module.modulemap
  test/Frontend/opencl-blocks.cl
  test/Headers/opencl-c-header.cl

Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,33 +1,84 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 

[PATCH] D20917: [clang-tidy] Add RemoveStars option to the modernize-use-auto check

2016-06-02 Thread Alexander Kornienko via cfe-commits
alexfh created this revision.
alexfh added reviewers: sbenza, aaron.ballman.
alexfh added a subscriber: cfe-commits.

Add RemoveStars option to the modernize-use-auto check. With the new option
turned on (by default) the check will change `MyType *t = new MyType;` to
`auto *t = new MyType;` instead of `auto t = new MyType;`, thus achieving more
consistency with the recommendations to use `auto *` for iterating over pointers
in range-based for loops:
http://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto

http://reviews.llvm.org/D20917

Files:
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/modernize/UseAutoCheck.h
  docs/clang-tidy/checks/modernize-use-auto.rst
  test/clang-tidy/modernize-use-auto-new-remove-stars.cpp
  test/clang-tidy/modernize-use-auto-new.cpp

Index: test/clang-tidy/modernize-use-auto-new.cpp
===
--- test/clang-tidy/modernize-use-auto-new.cpp
+++ test/clang-tidy/modernize-use-auto-new.cpp
@@ -9,11 +9,11 @@
 void auto_new() {
   MyType *a_new = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto a_new = new MyType();
+  // CHECK-FIXES: auto *a_new = new MyType();
 
   static MyType *a_static = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
-  // CHECK-FIXES: static auto a_static = new MyType();
+  // CHECK-FIXES: static auto *a_static = new MyType();
 
   MyType *derived = new MyDerivedType();
 
@@ -27,42 +27,42 @@
   // not "MyType * const".
   static MyType * const d_static = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
-  // CHECK-FIXES: static auto  const d_static = new MyType();
+  // CHECK-FIXES: static auto * const d_static = new MyType();
 
   MyType * const a_const = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto  const a_const = new MyType();
+  // CHECK-FIXES: auto * const a_const = new MyType();
 
   MyType * volatile vol = new MyType();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto  volatile vol = new MyType();
+  // CHECK-FIXES: auto * volatile vol = new MyType();
 
   struct SType {} *stype = new SType;
 
   int (**func)(int, int) = new (int(*[5])(int,int));
 
   int *array = new int[5];
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto array = new int[5];
+  // CHECK-FIXES: auto *array = new int[5];
 
   MyType *ptr(new MyType);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
-  // CHECK-FIXES: auto ptr(new MyType);
+  // CHECK-FIXES: auto *ptr(new MyType);
 
   MyType *ptr2{new MyType};
 
   {
 // Test for declaration lists.
 MyType *a = new MyType(), *b = new MyType(), *c = new MyType();
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto a = new MyType(), b = new MyType(), c = new MyType();
+// CHECK-FIXES: auto *a = new MyType(), *b = new MyType(), *c = new MyType();
 
 // Non-initialized declaration should not be transformed.
 MyType *d = new MyType(), *e;
 
 MyType **f = new MyType*(), **g = new MyType*();
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto f = new MyType*(), g = new MyType*();
+// CHECK-FIXES: auto **f = new MyType*(), **g = new MyType*();
 
 // Mismatching types in declaration lists should not be transformed.
 MyType *h = new MyType(), **i = new MyType*();
@@ -75,25 +75,26 @@
   {
 // Test for typedefs.
 typedef int * int_p;
+// CHECK-FIXES: typedef int * int_p;
 
 int_p a = new int;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto  a = new int;
+// CHECK-FIXES: auto a = new int;
 int_p *b = new int*;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto b = new int*;
+// CHECK-FIXES: auto *b = new int*;
 
 // Test for typedefs in declarations lists.
 int_p c = new int, d = new int;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto  c = new int, d = new int;
+// CHECK-FIXES: auto c = new int, d = new int;
 
 // Different types should not be transformed.
 int_p e = new int, *f = new int_p;
 
 int_p *g = new int*, *h = new int_p;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use auto when initializing with new
-// CHECK-FIXES: auto g = new int*, h = new int_p;
+// CHECK-FIXES: auto *g = new int*, *h = new int_p;
   }
 
   // Don't warn when 'auto' is already being used.
Index: test/clang-tidy/modernize-use-auto-new-remove-stars.cpp

Re: [PATCH] D20878: [Coverage] Do not push a new region after a CXXTryStmt

2016-06-02 Thread Vedant Kumar via cfe-commits
vsk added a comment.

In http://reviews.llvm.org/D20878#446690, @ikudrin wrote:

> Is there a case where this patch makes things better than they were before? 
> Is it possible to improve handling of exceptions instead?


This patch removes something which doesn't appear to serve a useful purpose. In 
general, I don't see a way to handle stack unwinding well. Consider:

  1| void f() {
  2|  may_throw();
  3|  may_throw();
  4|  return;
  5|}

It would be prohibitively expensive to create separate regions and counters for 
lines 3 and 4, and after every callsite of `f`, and all its callsites, etc. We 
could improve the situation slightly by (1) documenting that stack unwinding is 
not handled precisely, and/or (2) emitting a diagnostic if the TU contains a 
`throw` statement. This would make the resulting coverage reports less 
surprising to users.


http://reviews.llvm.org/D20878



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


Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-02 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 59389.

http://reviews.llvm.org/D20871

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -7266,3 +7266,17 @@
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
\ No newline at end of file
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -164,6 +164,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -268,6 +270,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {


Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -7266,3 +7266,17 @@
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
\ No newline at end of file
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -164,6 +164,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -268,6 +270,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-02 Thread michael zuckerman via cfe-commits
m_zuckerman added a comment.

Yes its API


http://reviews.llvm.org/D20871



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


Re: [PATCH] D20903: Make system_error::message() thread safe. Fixes PR25598.

2016-06-02 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

In general, I'm OK with this - but I'm concerned about that there's not really 
any provision for the case where `strerror_r` does not exist.

Also, there's no reason to have a thread local static array here, if you're 
going to immediately copy it into a `std::string`.


http://reviews.llvm.org/D20903



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-02 Thread Alexey Bader via cfe-commits
bader accepted this revision.


Comment at: test/Headers/opencl-c-header.cl:30-31
@@ +29,4 @@
+
+// ===
+// Compile for OpenCL 2.0 for the first time. The module should change.
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck 
--check-prefix=CHECK20 %s

It would be nice to re-use that part of module that agnostic to OpenCL version. 
Most of the OpenCL 2.0 declarations are already in the module for OpenCL 1.0.
Pointer/size_t arguments could another reason to re-parse the header.

Just FYI: at the moment we use chained PCHes to reduce the footprint of the 
PCHes we ship with OpenCL implementation.
The chain looks like:  +  + , where 60% is occupied by , which is shared across 
all possible compilations.



http://reviews.llvm.org/D20444



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


Re: [PATCH] D20635: clang-rename: fix renaming heap allocations

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

LG


http://reviews.llvm.org/D20635



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


Re: [PATCH] D20866: [Clang][AVX512]Adding set4 intrinsics

2016-06-02 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 59379.

http://reviews.llvm.org/D20866

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -6236,6 +6236,62 @@
   return _mm512_set1_epi16(d);
 }
 
+__m512i test_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi32 
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_set4_epi32 (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_set4_epi64 (long long __A, long long __B, long long __C, long long __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi64 
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_set4_epi64 (__A,__B,__C,__D);
+}
+
+__m512d test_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_pd 
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_set4_pd (__A,__B,__C,__D);
+}
+
+__m512 test_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_ps 
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_set4_ps (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_setr4_epi32(int e0, int e1, int e2, int e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi32
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_setr4_epi32(e0, e1, e2, e3);
+}
+
+ __m512i test_mm512_setr4_epi64(long long e0, long long e1, long long e2, long long e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi64
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_setr4_epi64(e0, e1, e2, e3);
+}
+
+__m512i test_mm512_setr4_pd(double e0, double e1, double e2, double e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_pd
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_setr4_pd(e0,e1,e2,e3);
+}
+
+ __m512i test_mm512_setr4_ps(float e0, float e1, float e2, float e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_ps
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_setr4_ps(e0,e1,e2,e3);
+}
+
 __m512d test_mm512_castpd256_pd512(__m256d a)
 {
   // CHECK-LABEL: @test_mm512_castpd256_pd512
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -332,6 +332,49 @@
 __f, __f, __f, __f };
 }
 
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  return  (__m512i)(__v16si)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi64 (long long __A, long long __B, long long __C,
+   long long __D)
+{
+  return  (__m512i) (__v8di)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  return  (__m512d)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  return  (__m512)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+#define _mm512_setr4_epi32(e0,e1,e2,e3)   \
+  _mm512_set4_epi32(e3,e2,e1,e0)
+
+#define _mm512_setr4_epi64(e0,e1,e2,e3)   \
+  _mm512_set4_epi64(e3,e2,e1,e0)
+
+#define _mm512_setr4_pd(e0,e1,e2,e3)\
+  _mm512_set4_pd(e3,e2,e1,e0)
+
+#define _mm512_setr4_ps(e0,e1,e2,e3)\
+  _mm512_set4_ps(e3,e2,e1,e0)
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_broadcastsd_pd(__m128d __X)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Etienne Bergeron via cfe-commits
etienneb added inline comments.


Comment at: test/clang-tidy/modernize-operator-void-pointer.cpp:39
@@ +38,3 @@
+class SomethingGoodNonConstVoidPtr {
+  // A non-const void* is unlikely to to be meant as operator bool before C++11
+  // let us use explicit.

You know you can add test for C++11 specifically.

```
readability-redundant-string-cstr.cpp:// RUN: %check_clang_tidy %s 
readability-redundant-string-cstr %t -- -- -std=c++11
```


http://reviews.llvm.org/D20857



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


[PATCH] D20909: [clang-tidy] Ignore function context in misc-unused-using-decls.

2016-06-02 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: alexfh.
hokein added a subscriber: cfe-commits.

Make the check's behavior more correct when handling using-decls in multiple 
scopes.

http://reviews.llvm.org/D20909

Files:
  clang-tidy/misc/UnusedUsingDeclsCheck.cpp
  clang-tidy/misc/UnusedUsingDeclsCheck.h
  test/clang-tidy/misc-unused-using-decls.cpp

Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -17,6 +17,8 @@
   static int ii;
 };
 template  class J {};
+class G;
+class H;
 
 class Base {
  public:
@@ -99,6 +101,24 @@
 USING_FUNC
 #undef USING_FUNC
 
+namespace N1 {
+// n::G is used in namespace N2.
+// Currently, the check doesn't support multiple scopes. All the relevant
+// using-decls will be marked as used once we see an usage even the usage is in
+// other scope.
+using n::G;
+}
+
+namespace N2 {
+using n::G;
+void f(G g);
+}
+
+void IgnoreFunctionScope() {
+// Using-decls defined in function scope will be ignored.
+using n::H;
+}
+
 // - Usages -
 void f(B b);
 void g() {
@@ -112,4 +132,3 @@
   UsedTemplateFunc();
   cout << endl;
 }
-
Index: clang-tidy/misc/UnusedUsingDeclsCheck.h
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.h
+++ clang-tidy/misc/UnusedUsingDeclsCheck.h
@@ -36,9 +36,15 @@
   struct UsingDeclContext {
 explicit UsingDeclContext(const UsingDecl *FoundUsingDecl)
 : FoundUsingDecl(FoundUsingDecl), IsUsed(false) {}
+// A set saves all UsingShadowDecls introduced by a UsingDecl. A UsingDecl
+// can introduce multiple UsingShadowDecls in some cases (such as
+// overloaded functions).
 llvm::SmallPtrSet UsingTargetDecls;
+// The original UsingDecl.
 const UsingDecl *FoundUsingDecl;
+// The source range of the UsingDecl.
 CharSourceRange UsingDeclRange;
+// Whether the UsingDecl is used.
 bool IsUsed;
   };
 
Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -41,11 +41,17 @@
   if (const auto *Using = Result.Nodes.getNodeAs("using")) {
 // Ignores using-declarations defined in macros.
 if (Using->getLocation().isMacroID())
-  return ;
+  return;
 
 // Ignores using-declarations defined in class definition.
 if (isa(Using->getDeclContext()))
-  return ;
+  return;
+
+// FIXME: We ignore using-decls defined in function definitions at the
+// moment because of false positives caused by ADL and different function
+// scopes.
+if (isa(Using->getDeclContext()))
+  return;
 
 UsingDeclContext Context(Using);
 Context.UsingDeclRange = CharSourceRange::getCharRange(
@@ -97,11 +103,12 @@
 }
 
 void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {
+  // FIXME: Currently, we don't handle the using-decls being used in different
+  // scopes (such as different namespaces, different functions). Instead of
+  // giving an incorrect message, we mark all of them as used.
   for (auto  : Contexts) {
-if (Context.UsingTargetDecls.count(D->getCanonicalDecl()) > 0) {
+if (Context.UsingTargetDecls.count(D->getCanonicalDecl()) > 0)
   Context.IsUsed = true;
-  break;
-}
   }
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-format] recursive alignment

2016-06-02 Thread Ben Harper via cfe-commits
I'm calling this "recursive alignment", but what it really fixes is issues
with AlignConsecutiveAssignments and AlignConsecutiveDeclarations such as
this:

OLD:
  int fun1(int a);
  double fun2(int b);

NEW
  intfun1(int a);
  double fun2(int b);

Also...

OLD:
  void fun(int x = 1) {
  int y  = 2;
  }

NEW:
  void fun(int x = 1) {
  int y = 2;
  }

The old alignment function was incapable of maintaining alignment whenever
the scope changed. To illustrate - in the first example mentioned, the
alignment of fun1 is lost by entering the nested scope of (int a).
This would cause the alignment to give up, and cause fun2 to start from a
blank slate. It would also cause false alignment, which is illustrated in
the second example above.

This modification changes the alignment function so that it calls itself
recursively, at each change in scope depth. This allows it to maintain state
across different scope depths.

There are some new test cases which stress this functionality. In addition,
there were two historical test cases marked as "FIX ME", which now work as
intended.

In order to sense check, I have run this new implementation against the
Clang
source code, with AlignConsecutiveAssignments:true and
AlignConsecutiveDeclarations:true. I then compared the old output with those
settings, vs the new output, with the same settings. All changes that I
observed are explainable by the new logic, and IMO the formatted code looks
better with the new method.

Regards,
Ben


FormatRecursiveAlignment.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20908: Add a few missing Clang regression tests

2016-06-02 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added a reviewer: rengolin.
SjoerdMeijer added a subscriber: cfe-commits.

Add a few missing Clang regression tests for Cortex-A53, Cortex-A57, Cortex-A72

http://reviews.llvm.org/D20908

Files:
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex 
implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-02 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 marked an inline comment as done.
rogfer01 added a comment.

http://reviews.llvm.org/D20561



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-02 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

I think the patch LGTM (with a minor formatting nit). @rsmith, what are your 
thoughts?



Comment at: test/SemaCXX/address-packed.cpp:92
@@ +91,3 @@
+void g1()
+{
+S s1;

Formatting (may want to clang-format one last time before committing).


http://reviews.llvm.org/D20561



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20857#446784, @murrayc wrote:

> In http://reviews.llvm.org/D20857#446732, @etienneb wrote:
>
> > Enabling/disabling can be done with options (see SizeofExpressionCheck).
>
>
> Thanks. Am I being asked to combine the checks?


I would prefer they be combined as well given how closely related the two 
checks are.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Murray Cumming via cfe-commits
murrayc added inline comments.


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:27
@@ +26,3 @@
+  Finder->addMatcher(cxxConversionDecl(returns(pointerType(pointee(
+   isConstQualified(), voidType(,
+   unless(isExplicit()))

etienneb wrote:
> I'm curious, why: isConstQualified() ?
> I'm probably missing something.
This is a workaround for the lack of explicit operator bool before C++:
  operator const void*() const;
but this would be unlikely to be meant the same way, partly because the 
constness would be awkward:
  operator void*() const;




Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:40
@@ +39,3 @@
+
+  // FIXME: This tries to change the type and add explicit, but
+  // MatchedDecl->getTypeSpecStartLoc() gets the start of void, not the start

etienneb wrote:
> The FIXME only apply to the fixtit statements.
>   << FIxItHint(...)
> 
> you can still output a diag message.
Yes. I do that in the previous lines.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-02 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

@rsmith: Ping


http://reviews.llvm.org/D20428



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20857#446784, @murrayc wrote:

> In http://reviews.llvm.org/D20857#446732, @etienneb wrote:
>
> > Enabling/disabling can be done with options (see SizeofExpressionCheck).
>
>
> Thanks. Am I being asked to combine the checks?


I'll let alexfh@ take decision. He will maintain this code.
It's a matter of preference, and not a blocker to me.

I can still help you to make it conform to the coding style.



Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:27
@@ +26,3 @@
+  Finder->addMatcher(cxxConversionDecl(returns(pointerType(pointee(
+   isConstQualified(), voidType(,
+   unless(isExplicit()))

I'm curious, why: isConstQualified() ?
I'm probably missing something.


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:40
@@ +39,3 @@
+
+  // FIXME: This tries to change the type and add explicit, but
+  // MatchedDecl->getTypeSpecStartLoc() gets the start of void, not the start

The FIXME only apply to the fixtit statements.
  << FIxItHint(...)

you can still output a diag message.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Murray Cumming via cfe-commits
murrayc added a comment.

In http://reviews.llvm.org/D20857#446732, @etienneb wrote:

> Enabling/disabling can be done with options (see SizeofExpressionCheck).


Thanks. Am I being asked to combine the checks?


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Murray Cumming via cfe-commits
murrayc updated this revision to Diff 59367.
murrayc added a comment.

With suggested changes. Ran clang-format (LLVM style). Used voidType() matcher.


http://reviews.llvm.org/D20857

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp
  clang-tidy/modernize/ExplicitOperatorBoolCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/OperatorVoidPointerCheck.cpp
  clang-tidy/modernize/OperatorVoidPointerCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
  docs/clang-tidy/checks/modernize-operator-void-pointer.rst
  test/clang-tidy/modernize-explicit-operator-bool.cpp
  test/clang-tidy/modernize-operator-void-pointer.cpp

Index: test/clang-tidy/modernize-operator-void-pointer.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-operator-void-pointer.cpp
@@ -0,0 +1,46 @@
+// RUN: %check_clang_tidy %s modernize-operator-void-pointer %t
+
+// This should trigger the check:
+class SomethingBad {
+  operator const void *() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: implicit operator void* declaration should probably be explicit operator bool [modernize-operator-void-pointer]
+return reinterpret_cast(something != 0);
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  //Note: Use modernize-explicit-operator-bool to check for implicit operator bool.
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodExplicitConstVoidPtr {
+  explicit operator const void *() const {
+return 
+  }
+
+  const int something = 0;
+};
+
+class SomethingGoodExplicitNonConstVoidPtr {
+  explicit operator void *() {
+return 
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodNonConstVoidPtr {
+  // A non-const void* is unlikely to to be meant as operator bool before C++11
+  // let us use explicit.
+  operator void *() {
+return 
+  }
+
+  int something = 0;
+};
Index: test/clang-tidy/modernize-explicit-operator-bool.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-explicit-operator-bool.cpp
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s modernize-explicit-operator-bool %t
+
+// This should trigger the check:
+class SomethingBad {
+  operator bool() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator bool declaration is not explicit [modernize-explicit-operator-bool]
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
Index: docs/clang-tidy/checks/modernize-operator-void-pointer.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-operator-void-pointer.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - modernize-operator-void-pointer
+
+modernize-operator-void-pointer
+
+
+This check finds implicit ``operator void*`` overloads and replaces them with
+``explicit operator bool`` overloads, available since C++11.
+
+Implicit ``operator void*`` overloads were often used before C++11 to avoid
+implicit conversions to ``bool`` when providing an ``operator bool`` overload,
+but C++11 provides the ``explicit`` keyword.
+
+See also the modernize-implicit-operator-bool check.
+
+.. code-block:: c++
+
+  operator void* () const;
+
+  // becomes
+
+  explicit operator bool () const;
Index: docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - modernize-explicit-operator-bool
+
+modernize-explicit-operator-bool
+
+
+This check finds implicit ``operator bool`` overloads and inserts the
+``explicit`` keyword, which is available since C++11.
+
+Without the ``explicit`` keyword, the implicit ``bool`` overload can allow
+objects to be compared accidentally. For instance, even when objects a and b
+have no ``operator ==`` overloads, an implicit ``operator bool`` would allow
+``a == b`` to compile because both a and b can be implictly converted to
+``bool``.
+
+.. code-block:: c++
+
+  operator bool () const;
+
+  // becomes
+
+  explicit operator bool () const;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -93,6 +93,7 @@
misc-virtual-near-miss
modernize-avoid-bind
modernize-deprecated-headers
+   modernize-explicit-operator-bool
modernize-loop-convert
modernize-make-shared
modernize-make-unique
@@ -106,6 +107,7 @@
modernize-use-default

Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-02 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 59363.
rmaprath added a comment.

Addressed review comments from @bcraig.

@EricWF: Gentle ping.


http://reviews.llvm.org/D20328

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__dynamic_threading
  include/__threading_support
  include/thread
  lib/CMakeLists.txt
  src/algorithm.cpp
  src/memory.cpp
  src/mutex.cpp
  src/thread.cpp
  test/CMakeLists.txt
  test/libcxx/test/config.py
  test/lit.site.cfg.in
  
test/std/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
  
test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
  
test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
  
test/std/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
  test/std/thread/thread.threads/thread.thread.class/types.pass.cpp
  test/support/external_threads.cpp

Index: test/support/external_threads.cpp
===
--- /dev/null
+++ test/support/external_threads.cpp
@@ -0,0 +1,340 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef SUPPORT_EXTERNAL_THREADS
+#define SUPPORT_EXTERNAL_THREADS
+
+#include <__threading_support>
+
+// Only define these symbols if using the __dynamic_threading header
+#if defined(_LIBCPP_DYNAMIC_THREADING)
+
+#include 
+#include 
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+/* In the pthread-based (or statically-threaded) libc++ variant, pthread
+   primitives (like pthread_mutex_t) become part of the internal states of the
+   corresponding C++ constructs (e.g. C++ mutex class holds an internal
+   pthread_mutex_t object). In contrast, in the externally-threaded libc++
+   variant, C++ constructs hold (opaque) pointers to the underlying platform-
+   defined threading primitives. The following macros are used to convert the
+   opaque pointer types held within the C++ constructs and cast them as pointers
+   to the appropriate platform-defined thread primitive type (in this case,
+   pthread types again).
+*/
+#define AS_PTHREAD_MUTPTR(x) reinterpret_cast(x)
+#define AS_PTHREAD_CONDPTR(x) reinterpret_cast(x)
+#define AS_PTHREAD_TPTR(x) reinterpret_cast(x)
+#define AS_PTHREAD_KPTR(x) reinterpret_cast(x)
+
+//-- Mutex --//
+
+/* This method is invoked from within the std::recursive_mutex constructor, as
+   such, it does not need to be thread-safe when initializing the *__m pointer.
+*/
+int __libcpp_recursive_mutex_init(__libcpp_mutex_t* __m)
+{
+// Populate the internal opaque pointer *__m
+pthread_mutex_t *mut = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
+if (mut == nullptr)
+return -1;
+*__m = reinterpret_cast<__libcpp_mutex_t> (mut);
+
+// Initialize the allocated pthread_mutex_t object as a recursive mutex
+pthread_mutexattr_t attr;
+int __ec = pthread_mutexattr_init();
+if (__ec)
+  goto fail;
+
+__ec = pthread_mutexattr_settype(, PTHREAD_MUTEX_RECURSIVE);
+if (__ec)
+{
+pthread_mutexattr_destroy();
+goto fail;
+}
+
+__ec = pthread_mutex_init(AS_PTHREAD_MUTPTR(*__m), );
+if (__ec)
+{
+pthread_mutexattr_destroy();
+goto fail;
+}
+
+__ec = pthread_mutexattr_destroy();
+if (__ec)
+{
+pthread_mutex_destroy(AS_PTHREAD_MUTPTR(*__m));
+goto fail;
+}
+
+return 0;
+
+fail:
+free(*__m);
+return __ec;
+}
+
+/* C++11 standard requires mutex and condition_variable constructors to be
+   constexpr qualifying. This prohibits any prospects of calling a runtime
+   initialization routine from within mutex / condition_varialbe constructors.
+   For this reason, the external thread API must adopt an initialize-on-first-
+   use policy for mutexes and condition variables. With this strategy, we need
+   to be especially careful when initializing the internal opaque pointer *__m,
+   as multiple threads could attempt to lock the same mutex at once. In the
+   following routine, I've used a plain pthread mutex to make this initialization
+   thread-safe. It's also possible to use atomic compare-exchange builtins (where
+   available) to achieve the same goal.
+*/
+pthread_mutex_t mutex_init_access = PTHREAD_MUTEX_INITIALIZER;
+
+int mutex_safe_init(volatile __libcpp_mutex_t* __m) {
+pthread_mutex_lock(_init_access);
+if (*__m == nullptr) {
+pthread_mutex_t *mut = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
+if (mut == 

Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20857#446654, @murrayc wrote:

> In http://reviews.llvm.org/D20857#446101, @etienneb wrote:
>
> > I wonder if these two checks should not be merge in one checker.
>
>
> Personally I find it cleaner to keep them separate, but I would be happy to 
> combine them if that's wanted. I guessed that it would be easier to accept 
> the explicit bool check than the operator void pointer check, and didn't want 
> to make acceptance harder. I can also imagine someone wanting to disable one 
> but not the other.


Enabling/disabling can be done with options (see SizeofExpressionCheck).

  WarnOnSizeOfConstant(Options.get("WarnOnSizeOfConstant", 1) != 0),
  WarnOnSizeOfThis(Options.get("WarnOnSizeOfThis", 1) != 0),
  WarnOnSizeOfCompareToConstant(
  Options.get("WarnOnSizeOfCompareToConstant", 1) != 0) {}



Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:20
@@ +19,3 @@
+
+AST_MATCHER(QualType, isVoid) {
+return Node->isVoidType();

this matcher exists? ***voidType***

```
Matches type void.

Given
 struct S { void func(); };
functionDecl(returns(voidType()))
  matches "void func();"
```


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:21
@@ +20,3 @@
+AST_MATCHER(QualType, isVoid) {
+return Node->isVoidType();
+}

nit: indent + 2


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:31
@@ +30,3 @@
+  cxxConversionDecl(
+  returns(pointerType(pointee(isConstQualified(), isVoid(, 
   
unless(isExplicit())).bind("operator-void-pointer"), this);
+}

indentation is wrong.
Run clang-format over it

% clang-format -style=file  -i


Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:35
@@ +34,3 @@
+void OperatorVoidPointerCheck::check(const MatchFinder::MatchResult ) {
+  const auto* MatchedDecl =
+  Result.Nodes.getNodeAs("operator-void-pointer");

pointer lean to right:

```
const auto* MatchedDecl
  -->
const auto *MatchedDecl
```


http://reviews.llvm.org/D20857



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


Re: [clang-tools-extra] r261991 - [clang-tidy] Fix a crash issue when clang-tidy runs with compilation database.

2016-06-02 Thread Alexander Kornienko via cfe-commits
Thank you, Tom. I'm not very familiar with the release process and it will
indeed be better, if you merge the patch.

On Thu, Jun 2, 2016 at 3:27 AM, Tom Stellard  wrote:

> On Wed, Jun 01, 2016 at 11:19:44PM +0200, Edoardo P. wrote:
> > Ping.
> >
> > Deadline to merge the changes to the 3.8 branch is today.
> >
>
> I will make sure to merge this before -rc1.  Thanks for reminding me.
>
> -Tom
>
> > Cheers,
> > Edward-san
> >
> > 2016-05-24 20:25 GMT+02:00 Edoardo P. :
> > > Ping,
> > >
> > > who's going to merge? I have no commit access.
> > >
> > > Cheers,
> > > Edward-san
> > >
> > >
> > > 2016-05-20 18:34 GMT+02:00 Tom Stellard :
> > >> Hi,
> > >>
> > >> This looks fine to me, go ahead and merge.
> > >>
> > >> -Tom
> > >>
> > >> On Thu, May 19, 2016 at 08:29:14PM +0200, Alexander Kornienko wrote:
> > >>> On Thu, May 19, 2016 at 4:45 PM, Hans Wennborg 
> wrote:
> > >>>
> > >>> > +Tom who manages 3.8.1
> > >>> > +Alex who's owner of clang-tidy: is this ok for 3.8.1?
> > >>> >
> > >>>
> > >>> Yes, would be nice to have this in 3.8.1. This fixes a rather
> annoying
> > >>> problem.
> > >>>
> > >>>
> > >>> >
> > >>> > On Thu, May 19, 2016 at 1:56 AM, Edoardo P. via cfe-commits
> > >>> >  wrote:
> > >>> > > Is it possible to port this commit to 3.8.1?
> > >>> > >
> > >>> > > Cheers,
> > >>> > > Edward-san
> > >>> > >
> > >>> > > 2016-02-26 10:19 GMT+01:00 Haojian Wu via cfe-commits
> > >>> > > :
> > >>> > >> Author: hokein
> > >>> > >> Date: Fri Feb 26 03:19:33 2016
> > >>> > >> New Revision: 261991
> > >>> > >>
> > >>> > >> URL: http://llvm.org/viewvc/llvm-project?rev=261991=rev
> > >>> > >> Log:
> > >>> > >> [clang-tidy] Fix a crash issue when clang-tidy runs with
> compilation
> > >>> > database.
> > >>> > >>
> > >>> > >> Summary:
> > >>> > >> The clang-tidy will trigger an assertion if it's not in the
> building
> > >>> > directory.
> > >>> > >>
> > >>> > >> TEST:
> > >>> > >> cd /
> > >>> > >> ./build/bin/clang-tidy --checks=-*,modernize-use-nullptr -p
> build
> > >>> > tools/clang/tools/extra/clang-tidy/ClangTidy.cpp
> > >>> > >>
> > >>> > >> The crash issue is gone after applying this patch.
> > >>> > >>
> > >>> > >> Fixes PR24834, PR26241
> > >>> > >>
> > >>> > >> Reviewers: bkramer, alexfh
> > >>> > >>
> > >>> > >> Subscribers: rizsotto.mailinglist, cfe-commits
> > >>> > >>
> > >>> > >> Differential Revision: http://reviews.llvm.org/D17335
> > >>> > >>
> > >>> > >> Added:
> > >>> > >>
>  clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/
> > >>> > >>
> > >>> >
> clang-tools-extra/trunk/test/clang-tidy/Inputs/compilation-database/template.json
> > >>> > >>
> > >>> >
> clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp
> > >>> > >> Modified:
> > >>> > >> clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> > >>> > >>
>  clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
> > >>> > >>
>  clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
> > >>> > >>
> > >>> > >> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> > >>> > >> URL:
> > >>> >
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=261991=261990=261991=diff
> > >>> > >>
> > >>> >
> ==
> > >>> > >> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
> > >>> > >> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Feb 26
> > >>> > 03:19:33 2016
> > >>> > >> @@ -107,6 +107,10 @@ public:
> > >>> > >>  DiagPrinter->BeginSourceFile(LangOpts);
> > >>> > >>}
> > >>> > >>
> > >>> > >> +  SourceManager& getSourceManager() {
> > >>> > >> +return SourceMgr;
> > >>> > >> +  }
> > >>> > >> +
> > >>> > >>void reportDiagnostic(const ClangTidyError ) {
> > >>> > >>  const ClangTidyMessage  = Error.Message;
> > >>> > >>  SourceLocation Loc = getLocation(Message.FilePath,
> > >>> > Message.FileOffset);
> > >>> > >> @@ -124,7 +128,10 @@ public:
> > >>> > >>auto Diag = Diags.Report(Loc,
> Diags.getCustomDiagID(Level, "%0
> > >>> > [%1]"))
> > >>> > >><< Message.Message << Name;
> > >>> > >>for (const tooling::Replacement  : Error.Fix) {
> > >>> > >> -SourceLocation FixLoc = getLocation(Fix.getFilePath(),
> > >>> > Fix.getOffset());
> > >>> > >> +SmallString<128> FixAbsoluteFilePath =
> Fix.getFilePath();
> > >>> > >> +Files.makeAbsolutePath(FixAbsoluteFilePath);
> > >>> > >> +SourceLocation FixLoc =
> > >>> > >> +getLocation(FixAbsoluteFilePath, Fix.getOffset());
> > >>> > >>  SourceLocation FixEndLoc =
> > >>> > FixLoc.getLocWithOffset(Fix.getLength());
> > >>> > >>  Diag <<
> FixItHint::CreateReplacement(SourceRange(FixLoc,
> > >>> > FixEndLoc),
> > >>> > >>
>  Fix.getReplacementText());
> > >>> > >> 

r271509 - Suppress clang/test/CodeGen/lifetime-asan.c for targeting mingw.

2016-06-02 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Jun  2 05:54:45 2016
New Revision: 271509

URL: http://llvm.org/viewvc/llvm-project?rev=271509=rev
Log:
Suppress clang/test/CodeGen/lifetime-asan.c for targeting mingw.

  clang.EXE: error: unsupported option '-fsanitize=address' for target 
'x86_64-w64-windows-gnu'

Modified:
cfe/trunk/test/CodeGen/lifetime-asan.c

Modified: cfe/trunk/test/CodeGen/lifetime-asan.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/lifetime-asan.c?rev=271509=271508=271509=diff
==
--- cfe/trunk/test/CodeGen/lifetime-asan.c (original)
+++ cfe/trunk/test/CodeGen/lifetime-asan.c Thu Jun  2 05:54:45 2016
@@ -2,6 +2,7 @@
 // RUN: %clang -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
+// UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);
 


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


Re: [PATCH] D20864: Adding support for Cortex-A73

2016-06-02 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271507: This adds target support and tests for Cortex-A73 
(authored by SjoerdMeijer).

Changed prior to commit:
  http://reviews.llvm.org/D20864?vs=59219=59357#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20864

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/CodeGen/arm-target-features.c
  cfe/trunk/test/Driver/aarch64-cpus.c
  cfe/trunk/test/Driver/arm-cortex-cpus.c
  cfe/trunk/test/Preprocessor/aarch64-target-features.c
  cfe/trunk/test/Preprocessor/arm-target-features.c

Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -468,57 +468,74 @@
 // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}
 
 // RUN: %clang -target armeb -mcpu=cortex-a32 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
+// RUN: %clang -target armeb -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}
 
 // RUN: %clang -target arm -mcpu=cortex-a32 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: 

r271507 - This adds target support and tests for Cortex-A73

2016-06-02 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Jun  2 05:48:37 2016
New Revision: 271507

URL: http://llvm.org/viewvc/llvm-project?rev=271507=rev
Log:
This adds target support and tests for Cortex-A73

Differential Revision: http://reviews.llvm.org/D20864

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/arm-target-features.c
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Preprocessor/aarch64-target-features.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271507=271506=271507=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Jun  2 05:48:37 2016
@@ -5669,6 +5669,7 @@ public:
 .Case("generic", true)
 .Cases("cortex-a53", "cortex-a57", "cortex-a72",
"cortex-a35", "exynos-m1", true)
+.Case("cortex-a73", true)
 .Case("cyclone", true)
 .Case("kryo", true)
 .Default(false);

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271507=271506=271507=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jun  2 05:48:37 2016
@@ -2307,7 +2307,7 @@ static bool DecodeAArch64Mcpu(const Driv
   CPU = Split.first;
   if (CPU == "cortex-a53" || CPU == "cortex-a57" ||
   CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" ||
-  CPU == "kryo") {
+  CPU == "kryo"   || CPU == "cortex-a73") {
 Features.push_back("+neon");
 Features.push_back("+crc");
 Features.push_back("+crypto");

Modified: cfe/trunk/test/CodeGen/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=271507=271506=271507=diff
==
--- cfe/trunk/test/CodeGen/arm-target-features.c (original)
+++ cfe/trunk/test/CodeGen/arm-target-features.c Thu Jun  2 05:48:37 2016
@@ -27,6 +27,7 @@
 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
+// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a73 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu exynos-m1 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+dsp,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
 

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=271507=271506=271507=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu Jun  2 05:48:37 2016
@@ -74,6 +74,20 @@
 // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CA72 %s
 // ARM64-CA72: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a72"
 
+// RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"cortex-a73"
+
+// RUN: %clang -target arm64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mlittle-endian 

Re: [PATCH] D20902: [include-fixer] added GNU symbols hardcoded header mapping.

2016-06-02 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

Can we limit this to actual glibc headers, i.e. the output of `dpkg-query -L 
libc6-dev` on Debian/Ubuntu? There are some unrelated headers in there, I don't 
think we should have them in this list.


http://reviews.llvm.org/D20902



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


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-02 Thread pierre gousseau via cfe-commits
pgousseau added inline comments.


Comment at: test/PCH/include-timestamp.cpp:8
@@ +7,3 @@
+// RUN: sleep 1
+// RUN: not %clang_cc1 -include-pch %t %s 2>&1 | FileCheck 
-check-prefix=CHECK-TIMESTAMP %s
+

Without the sleep the test fails for me, as it seems the call to touch does not 
have time to take effect. It might be something specific to gnuwin32 tools on 
Windows I am not sure.


http://reviews.llvm.org/D20867



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


[PATCH] D20903: Make system_error::message() thread safe. Fixes PR25598.

2016-06-02 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: mclow.lists, majnemer.
EricWF added a subscriber: cfe-commits.
Herald added a subscriber: emaste.

system_error::message() uses `strerror` for the generic and system categories. 
This function is not thread safe.

The fix is to use `strerror_r`. It has been available since 2001 for GNU libc 
and since BSD 4.4 on FreeBSD/OS X.
On platforms with GNU libc the extended version is used which always returns a 
valid string, even if an error occurs.

In single-threaded builds `strerror` is still used.

See https://llvm.org/bugs/show_bug.cgi?id=25598

http://reviews.llvm.org/D20903

Files:
  src/system_error.cpp

Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -13,8 +13,13 @@
 #include "system_error"
 
 #include "include/config_elast.h"
+#include "cerrno"
 #include "cstring"
+#include "cstdio"
+#include "cstdlib"
+#include "cassert"
 #include "string"
+#include "string.h"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -46,10 +51,48 @@
 return *this == code.category() && code.value() == condition;
 }
 
+namespace {
+
+
+string do_strerror_r(int ev);
+
+#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC)
+// GNU Extended version
+string do_strerror_r(int ev) {
+static thread_local char buffer[1024];
+char* ret = ::strerror_r(ev, buffer, 1024);
+return string(ret);
+}
+#else
+// POSIX version
+string do_strerror_r(int ev) {
+static thread_local char buffer[1024];
+if (::strerror_r(ev, buffer, 1024) == -1) {
+if (errno == EINVAL) {
+std::snprintf(buffer, 1024, "Unknown error %d", ev);
+return string(buffer);
+} else {
+assert(errno == ERANGE);
+// FIXME maybe? 1024 is likely to exceed the maximum error
+// size so ERANGE shouldn't be returned. GLIBC also uses 1024
+// as the maximum buffer size internally.
+std::abort();
+}
+}
+return string(buffer);
+}
+#endif
+
+} // end namespace
+
 string
 __do_message::message(int ev) const
 {
-return string(strerror(ev));
+#if defined(_LIBCPP_HAS_NO_THREADS)
+return string(::strerror(ev));
+#else
+return do_strerror_r(ev);
+#endif
 }
 
 class _LIBCPP_HIDDEN __generic_error_category


Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -13,8 +13,13 @@
 #include "system_error"
 
 #include "include/config_elast.h"
+#include "cerrno"
 #include "cstring"
+#include "cstdio"
+#include "cstdlib"
+#include "cassert"
 #include "string"
+#include "string.h"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -46,10 +51,48 @@
 return *this == code.category() && code.value() == condition;
 }
 
+namespace {
+
+
+string do_strerror_r(int ev);
+
+#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC)
+// GNU Extended version
+string do_strerror_r(int ev) {
+static thread_local char buffer[1024];
+char* ret = ::strerror_r(ev, buffer, 1024);
+return string(ret);
+}
+#else
+// POSIX version
+string do_strerror_r(int ev) {
+static thread_local char buffer[1024];
+if (::strerror_r(ev, buffer, 1024) == -1) {
+if (errno == EINVAL) {
+std::snprintf(buffer, 1024, "Unknown error %d", ev);
+return string(buffer);
+} else {
+assert(errno == ERANGE);
+// FIXME maybe? 1024 is likely to exceed the maximum error
+// size so ERANGE shouldn't be returned. GLIBC also uses 1024
+// as the maximum buffer size internally.
+std::abort();
+}
+}
+return string(buffer);
+}
+#endif
+
+} // end namespace
+
 string
 __do_message::message(int ev) const
 {
-return string(strerror(ev));
+#if defined(_LIBCPP_HAS_NO_THREADS)
+return string(::strerror(ev));
+#else
+return do_strerror_r(ev);
+#endif
 }
 
 class _LIBCPP_HIDDEN __generic_error_category
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-02 Thread pierre gousseau via cfe-commits
pgousseau updated this revision to Diff 59355.
pgousseau added a comment.

Following Bruno's comments:

- Update input files' name to match http://reviews.llvm.org/D20243 review.
- Add llvm-bcanalyzer checks


http://reviews.llvm.org/D20867

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Serialization/ASTReader.cpp
  test/PCH/Inputs/pragma-once2-pch.h
  test/PCH/Inputs/pragma-once2.h
  test/PCH/include-timestamp.cpp

Index: test/PCH/include-timestamp.cpp
===
--- /dev/null
+++ test/PCH/include-timestamp.cpp
@@ -0,0 +1,29 @@
+// Test that the timestamp is not included in the produced pch file with
+// -fno-pch-timestamp.
+
+// Check timestamp is included by default.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h
+// RUN: touch %S/Inputs/pragma-once2.h
+// RUN: sleep 1
+// RUN: not %clang_cc1 -include-pch %t %s 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s
+
+// Check bitcode output as well.
+// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s
+
+// Check timestamp inclusion is disabled by -fno-pch-timestamp.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h -fno-pch-timestamp
+// RUN: touch %S/Inputs/pragma-once2.h
+// RUN: sleep 1
+// RUN: %clang_cc1 -include-pch %t %s 2>&1
+
+// Check bitcode output as well.
+// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s
+
+#include "Inputs/pragma-once2.h"
+
+void g() { f(); }
+
+// CHECK-BITCODE-TIMESTAMP-ON: getSize() ||
-#if defined(LLVM_ON_WIN32)
-   false
-#else
-   // In our regression testing, the Windows file system seems to
-   // have inconsistent modification times that sometimes
-   // erroneously trigger this error-handling path.
-   //
-   // FIXME: This probably also breaks HeaderFileInfo lookups on Windows.
(StoredTime && StoredTime != File->getModificationTime() &&
 !DisableValidation)
-#endif
)) {
 if (Complain) {
   // Build a list of the PCH imports that got us here (in reverse).
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -92,7 +92,10 @@
   std::vector Consumers;
   Consumers.push_back(llvm::make_unique(
 CI.getPreprocessor(), OutputFile, nullptr, Sysroot,
-Buffer, CI.getFrontendOpts().ModuleFileExtensions));
+Buffer, CI.getFrontendOpts().ModuleFileExtensions,
+/*AllowASTWithErrors*/false,
+/*IncludeTimestamps*/
+  +CI.getFrontendOpts().IncludeTimestamps));
   Consumers.push_back(CI.getPCHContainerWriter().CreatePCHContainerGenerator(
   CI, InFile, OutputFile, OS, Buffer));
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1144,6 +1144,7 @@
   Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
   Opts.ModulesEmbedFiles = Args.getAllArgValues(OPT_fmodules_embed_file_EQ);
   Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files);
+  Opts.IncludeTimestamps = !Args.hasArg(OPT_fno_pch_timestamp);
 
   Opts.CodeCompleteOpts.IncludeMacros
 = Args.hasArg(OPT_code_completion_macros);
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -153,6 +153,8 @@
///< implicit module build.
   unsigned ModulesEmbedAllFiles : 1;   ///< Whether we should embed all used
///< files into the PCM file.
+  unsigned IncludeTimestamps : 1;  ///< Whether timestamps should be
+   ///< written to the produced PCH file.
 
   CodeCompleteOptions CodeCompleteOpts;
 
@@ -277,8 +279,8 @@
 SkipFunctionBodies(false), UseGlobalModuleIndex(true),
 GenerateGlobalModuleIndex(true), ASTDumpDecls(false), ASTDumpLookups(false),
 BuildingImplicitModule(false), ModulesEmbedAllFiles(false),
-ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None),
-ProgramAction(frontend::ParseSyntaxOnly)
+IncludeTimestamps(true), ARCMTAction(ARCMT_None),
+ObjCMTAction(ObjCMT_None), ProgramAction(frontend::ParseSyntaxOnly)
   {}
 
   /// getInputKindForExtension - Return the appropriate input kind for a file
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td

[PATCH] D20902: [include-fixer] added GNU symbols hardcoded header mapping.

2016-06-02 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: bkramer, klimek.
ioeric added subscribers: hokein, cfe-commits.

[include-fixer] added GNU symbols hardcoded header mapping.

http://reviews.llvm.org/D20902

Files:
  include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp

Index: include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
===
--- include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
+++ include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
@@ -77,7 +77,6 @@
   {"include/xsavesintrin.h", ""},
   {"include/xtestintrin.h", ""},
   {"include/_G_config.h", ""},
-  {"include/alloca.h", ""},
   {"include/asm-generic/errno-base.h", ""},
   {"include/asm-generic/errno.h", ""},
   {"include/assert.h", ""},
@@ -269,33 +268,23 @@
   {"vector", ""},
   {"include/complex.h", ""},
   {"include/ctype.h", ""},
-  {"include/endian.h", ""},
   {"include/errno.h", ""},
-  {"include/features.h", ""},
   {"include/fenv.h", ""},
   {"include/inttypes.h", ""},
-  {"include/libintl.h", ""},
   {"include/libio.h", ""},
   {"include/limits.h", ""},
-  {"include/linux/limits.h", ""},
   {"include/locale.h", ""},
   {"include/math.h", ""},
-  {"include/pthread.h", ""},
-  {"include/sched.h", ""},
   {"include/setjmp.h", ""},
   {"include/signal.h", ""},
-  {"include/stdc-predef.h", ""},
   {"include/stdint.h", ""},
   {"include/stdio.h", ""},
   {"include/stdlib.h", ""},
   {"include/string.h", ""},
   {"include/time.h", ""},
   {"include/wchar.h", ""},
   {"include/wctype.h", ""},
-  {"bits/byteswap-16.h", ""},
-  {"bits/byteswap.h", ""},
   {"bits/cmathcalls.h", ""},
-  {"bits/endian.h", ""},
   {"bits/errno.h", ""},
   {"bits/fenv.h", ""},
   {"bits/huge_val.h", ""},
@@ -309,34 +298,21 @@
   {"bits/nan.h", ""},
   {"bits/posix1_lim.h", ""},
   {"bits/posix2_lim.h", ""},
-  {"bits/pthreadtypes.h", ""},
-  {"bits/sched.h", ""},
-  {"bits/select.h", ""},
   {"bits/setjmp.h", ""},
   {"bits/sigaction.h", ""},
   {"bits/sigcontext.h", ""},
   {"bits/siginfo.h", ""},
   {"bits/signum.h", ""},
   {"bits/sigset.h", ""},
   {"bits/sigstack.h", ""},
-  {"bits/sigthread.h", ""},
   {"bits/stdio_lim.h", ""},
   {"bits/sys_errlist.h", ""},
   {"bits/time.h", ""},
   {"bits/timex.h", ""},
-  {"bits/types.h", ""},
   {"bits/typesizes.h", ""},
-  {"bits/waitflags.h", ""},
-  {"bits/waitstatus.h", ""},
   {"bits/wchar.h", ""},
   {"bits/wordsize.h", ""},
   {"bits/xopen_lim.h", ""},
-  {"gnu/stubs-64.h", ""},
-  {"sys/cdefs.h", ""},
-  {"sys/select.h", ""},
-  {"sys/sysmacros.h", ""},
-  {"sys/types.h", ""},
-  {"sys/ucontext.h", ""},
   {"include/xlocale.h", ""},
   {"bits/atomic_word.h", ""},
   {"bits/basic_file.h", ""},
@@ -352,6 +328,244 @@
   {"bits/gthr.h", ""},
   {"bits/opt_random.h", ""},
   {"bits/os_defines.h", ""},
+  // GNU headers
+  {"include/aio.h", ""},
+  {"include/aliases.h", ""},
+  {"include/alloca.h", ""},
+  {"include/ar.h", ""},
+  {"include/argp.h", ""},
+  {"include/argz.h", ""},
+  {"include/arpa/nameser.h", ""},
+  {"include/arpa/nameser_compat.h", ""},
+  {"include/asm-generic/errno-base.h", ""},
+  {"include/asm-generic/errno.h", ""},
+  {"include/asm-generic/ioctl.h", ""},
+  {"include/asm-generic/ioctls.h", ""},
+  {"include/asm-generic/param.h", ""},
+  {"include/asm-generic/socket.h", ""},
+  {"include/asm-generic/sockios.h", ""},
+  {"include/autosprintf.h", ""},
+  {"include/byteswap.h", ""},
+  {"include/clif.h", ""},
+  {"include/com_err.h", ""},
+  {"include/cpio.h", ""},
+  {"include/crypt.h", ""},
+  {"include/curses.h", ""},
+  {"include/cursesapp.h", ""},
+  {"include/cursesf.h", ""},
+  {"include/cursesm.h", ""},
+  {"include/cursesp.h", ""},
+  {"include/cursesw.h", ""},
+  {"include/cursslk.h", ""},
+  {"include/dialog.h", ""},
+  {"include/dirent.h", ""},
+  {"include/dlfcn.h", ""},
+  {"include/dlg_colors.h", ""},
+  {"include/dlg_config.h", ""},
+  {"include/dlg_keys.h", ""},
+  {"include/elf.h", ""},
+  {"include/endian.h", ""},
+  {"include/envz.h", ""},
+  {"include/err.h", ""},
+  {"include/error.h", ""},
+  {"include/et/com_err.h", ""},
+  {"include/eti.h", ""},
+  {"include/etip.h", ""},
+  {"include/execinfo.h", ""},
+  {"include/expat.h", ""},
+  {"include/expat_external.h", ""},
+  {"include/fcntl.h", ""},
+  {"include/features.h", ""},
+  {"include/fenv.h", ""},
+  {"include/fmtmsg.h", ""},
+  {"include/fnmatch.h", ""},
+  {"include/form.h", ""},
+  {"include/fstab.h", ""},
+  {"include/fts.h", 

Re: [PATCH] D20878: [Coverage] Do not push a new region after a CXXTryStmt

2016-06-02 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

So, our tool isn't accurate in the case of throwing an exception. Is there a 
case where this patch makes things better than they were before? Is it possible 
to improve handling of exceptions instead?


http://reviews.llvm.org/D20878



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


[libcxx] r271502 - Add not_fn test for throwing operator!

2016-06-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jun  2 03:37:00 2016
New Revision: 271502

URL: http://llvm.org/viewvc/llvm-project?rev=271502=rev
Log:
Add not_fn test for throwing operator!

Modified:
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp?rev=271502=271501=271502=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp 
Thu Jun  2 03:37:00 2016
@@ -519,6 +519,14 @@ void call_operator_noexcept_test()
 static_assert(noexcept(cret()), "call should be noexcept");
 }
 {
+using T = NoExceptCallable;
+T value(true);
+auto ret = std::not_fn(value);
+static_assert(noexcept(ret()), "call should not be noexcept");
+auto const& cret = ret;
+static_assert(noexcept(cret()), "call should not be noexcept");
+}
+{
 using T = NoExceptCallable;
 T value(true);
 auto ret = std::not_fn(value);


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


Re: [PATCH] D20635: clang-rename: fix renaming heap allocations

2016-06-02 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

Can I help anything with reviewing this, please?


http://reviews.llvm.org/D20635



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


[libcxx] r271501 - Fix TEST_HAS_NO_EXCEPTIONS misspelling in the test suite.

2016-06-02 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jun  2 03:19:02 2016
New Revision: 271501

URL: http://llvm.org/viewvc/llvm-project?rev=271501=rev
Log:
Fix TEST_HAS_NO_EXCEPTIONS misspelling in the test suite.

Modified:

libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp

Modified: 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp?rev=271501=271500=271501=diff
==
--- 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
 Thu Jun  2 03:19:02 2016
@@ -75,7 +75,7 @@ int main()
 assert(G::n_alive == 1);
 }
 assert(G::n_alive == 0);
-#ifndef TEST_HAS_NO_EXCEPTION
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 std::thread t0(foo);
 assert(t0.joinable());


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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Murray Cumming via cfe-commits
murrayc added a comment.

In http://reviews.llvm.org/D20857#446101, @etienneb wrote:

> I wonder if these two checks should not be merge in one checker.


Personally I find it cleaner to keep them separate, but I would be happy to 
combine them if that's wanted. I guessed that it would be easier to accept the 
explicit bool check than the operator void pointer check, and didn't want to 
make acceptance harder. I can also imagine someone wanting to disable one but 
not the other.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-02 Thread Murray Cumming via cfe-commits
murrayc updated this revision to Diff 59346.
murrayc added a comment.

These are the commits amended with the suggested changes.
Many thanks for the suggestions.

(I'm not quite sure what arcanist will do, so hopefully this will not create a 
mess.)


http://reviews.llvm.org/D20857

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp
  clang-tidy/modernize/ExplicitOperatorBoolCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/OperatorVoidPointerCheck.cpp
  clang-tidy/modernize/OperatorVoidPointerCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
  docs/clang-tidy/checks/modernize-operator-void-pointer.rst
  test/clang-tidy/modernize-explicit-operator-bool.cpp
  test/clang-tidy/modernize-operator-void-pointer.cpp

Index: test/clang-tidy/modernize-operator-void-pointer.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-operator-void-pointer.cpp
@@ -0,0 +1,46 @@
+// RUN: %check_clang_tidy %s modernize-operator-void-pointer %t
+
+// This should trigger the check:
+class SomethingBad {
+  operator const void *() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: implicit operator void* declaration should probably be explicit operator bool [modernize-operator-void-pointer]
+return reinterpret_cast(something != 0);
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  //Note: Use modernize-explicit-operator-bool to check for implicit operator bool.
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodExplicitConstVoidPtr {
+  explicit operator const void *() const {
+return 
+  }
+
+  const int something = 0;
+};
+
+class SomethingGoodExplicitNonConstVoidPtr {
+  explicit operator void *() {
+return 
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodNonConstVoidPtr {
+  // A non-const void* is unlikely to to be meant as operator bool before C++11
+  // let us use explicit.
+  operator void *() {
+return 
+  }
+
+  int something = 0;
+};
Index: test/clang-tidy/modernize-explicit-operator-bool.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-explicit-operator-bool.cpp
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s modernize-explicit-operator-bool %t
+
+// This should trigger the check:
+class SomethingBad {
+  operator bool() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator bool declaration is not explicit [modernize-explicit-operator-bool]
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
Index: docs/clang-tidy/checks/modernize-operator-void-pointer.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-operator-void-pointer.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - modernize-operator-void-pointer
+
+modernize-operator-void-pointer
+
+
+This check finds implicit ``operator void*`` overloads and replaces them with
+``explicit operator bool`` overloads, available since C++11.
+
+Implicit ``operator void*`` overloads were often used before C++11 to avoid
+implicit conversions to ``bool`` when providing an ``operator bool`` overload,
+but C++11 provides the ``explicit`` keyword.
+
+See also the modernize-implicit-operator-bool check.
+
+.. code-block:: c++
+
+  operator void* () const;
+
+  // becomes
+
+  explicit operator bool () const;
Index: docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - modernize-explicit-operator-bool
+
+modernize-explicit-operator-bool
+
+
+This check finds implicit ``operator bool`` overloads and inserts the
+``explicit`` keyword, which is available since C++11.
+
+Without the ``explicit`` keyword, the implicit ``bool`` overload can allow
+objects to be compared accidentally. For instance, even when objects a and b
+have no ``operator ==`` overloads, an implicit ``operator bool`` would allow
+``a == b`` to compile because both a and b can be implictly converted to
+``bool``.
+
+.. code-block:: c++
+
+  operator bool () const;
+
+  // becomes
+
+  explicit operator bool () const;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -93,6 +93,7 @@
misc-virtual-near-miss
modernize-avoid-bind
modernize-deprecated-headers
+   modernize-explicit-operator-bool
modernize-loop-convert

Re: [PATCH] D20861: [AVX512] add missing integer to float conversion

2016-06-02 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271499: [X86][AVX512] add intrinsics of Scalar FP to integer 
(authored by abadouh).

Changed prior to commit:
  http://reviews.llvm.org/D20861?vs=59210=59348#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20861

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -7266,3 +7266,80 @@
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+int test_mm_cvtss_i32(__m128 A) {
+  // CHECK-LABEL: test_mm_cvtss_i32
+  // CHECK: call i32 @llvm.x86.sse.cvtss2si(<4 x float> %{{.*}})
+  return _mm_cvtss_i32(A);
+}
+
+long long test_mm_cvtss_i64(__m128 A) {
+  // CHECK-LABEL: test_mm_cvtss_i64
+  // CHECK: call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %{{.*}})
+  return _mm_cvtss_i64(A);
+}
+
+__m128d test_mm_cvti32_sd(__m128d A, int B) {
+  // CHECK-LABEL: test_mm_cvti32_sd
+  // CHECK: sitofp i32 %{{.*}} to double
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+  return _mm_cvti32_sd(A, B);
+}
+
+__m128d test_mm_cvti64_sd(__m128d A, long long B) {
+  // CHECK-LABEL: test_mm_cvti64_sd
+  // CHECK: sitofp i64 %{{.*}} to double
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+  return _mm_cvti64_sd(A, B);
+}
+
+__m128 test_mm_cvti32_ss(__m128 A, int B) {
+  // CHECK-LABEL: test_mm_cvti32_ss
+  // CHECK: sitofp i32 %{{.*}} to float
+  // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+  return _mm_cvti32_ss(A, B);
+}
+
+__m128 test_mm_cvti64_ss(__m128 A, long long B) {
+  // CHECK-LABEL: test_mm_cvti64_ss
+  // CHECK: sitofp i64 %{{.*}} to float
+  // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+  return _mm_cvti64_ss(A, B);
+}
+
+int test_mm_cvtsd_i32(__m128d A) {
+  // CHECK-LABEL: test_mm_cvtsd_i32
+  // CHECK: call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %{{.*}})
+  return _mm_cvtsd_i32(A);
+}
+
+long long test_mm_cvtsd_i64(__m128d A) {
+  // CHECK-LABEL: test_mm_cvtsd_i64
+  // CHECK: call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %{{.*}})
+  return _mm_cvtsd_i64(A);
+}
+
+__m128d test_mm_mask_cvtss_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_mask_cvtss_sd
+  // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+  return _mm_mask_cvtss_sd(__W, __U, __A, __B); 
+}
+
+__m128d test_mm_maskz_cvtss_sd( __mmask8 __U, __m128d __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_maskz_cvtss_sd
+  // CHECK: @llvm.x86.avx512.mask.cvtss2sd.round
+  return _mm_maskz_cvtss_sd( __U, __A, __B); 
+}
+
+__m128 test_mm_mask_cvtsd_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_mask_cvtsd_ss
+  // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+  return _mm_mask_cvtsd_ss(__W, __U, __A, __B); 
+}
+
+__m128 test_mm_maskz_cvtsd_ss(__mmask8 __U, __m128 __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_maskz_cvtsd_ss
+  // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round
+  return _mm_maskz_cvtsd_ss(__U, __A, __B); 
+}
+
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -9331,6 +9331,33 @@
  (__v4sf)_mm_setzero_ps(), \
  (__mmask8)(U), (int)(R)); })
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_cvtsd_ss (__m128 W, __mmask8 U, __m128 A, __m128d B)
+{
+  return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)(W), 
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_cvtsd_ss (__mmask8 U, __m128 A, __m128d B)
+{
+  return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)_mm_setzero_ps(), 
+ (__mmask8)(U), _MM_FROUND_CUR_DIRECTION);
+}
+
+#define _mm_cvtss_i32 _mm_cvtss_si32
+#define _mm_cvtss_i64 _mm_cvtss_si64
+#define _mm_cvtsd_i32 _mm_cvtsd_si32
+#define _mm_cvtsd_i64 _mm_cvtsd_si64
+#define _mm_cvti32_sd _mm_cvtsi32_sd
+#define _mm_cvti64_sd _mm_cvtsi64_sd
+#define _mm_cvti32_ss _mm_cvtsi32_ss
+#define _mm_cvti64_ss _mm_cvtsi64_ss
+
 #define _mm_cvt_roundi64_sd(A, B, R) __extension__ ({ \
   (__m128d)__builtin_ia32_cvtsi2sd64((__v2df)(__m128d)(A), (long long)(B), \
  (int)(R)); })
@@ -9372,6 +9399,24 @@
  

r271499 - [X86][AVX512] add intrinsics of Scalar FP to integer

2016-06-02 Thread Asaf Badouh via cfe-commits
Author: abadouh
Date: Thu Jun  2 03:11:35 2016
New Revision: 271499

URL: http://llvm.org/viewvc/llvm-project?rev=271499=rev
Log:
[X86][AVX512] add intrinsics of Scalar FP to integer

Differential Revision: http://reviews.llvm.org/D20861

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

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271499=271498=271499=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu Jun  2 03:11:35 2016
@@ -9331,6 +9331,33 @@ _mm512_mask_compressstoreu_epi32 (void *
  (__v4sf)_mm_setzero_ps(), \
  (__mmask8)(U), (int)(R)); })
 
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_mask_cvtsd_ss (__m128 W, __mmask8 U, __m128 A, __m128d B)
+{
+  return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)(W), 
+ (__mmask8)(U), 
_MM_FROUND_CUR_DIRECTION);
+}
+
+static __inline__ __m128 __DEFAULT_FN_ATTRS
+_mm_maskz_cvtsd_ss (__mmask8 U, __m128 A, __m128d B)
+{
+  return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(A),
+ (__v2df)(B),
+ (__v4sf)_mm_setzero_ps(), 
+ (__mmask8)(U), 
_MM_FROUND_CUR_DIRECTION);
+}
+
+#define _mm_cvtss_i32 _mm_cvtss_si32
+#define _mm_cvtss_i64 _mm_cvtss_si64
+#define _mm_cvtsd_i32 _mm_cvtsd_si32
+#define _mm_cvtsd_i64 _mm_cvtsd_si64
+#define _mm_cvti32_sd _mm_cvtsi32_sd
+#define _mm_cvti64_sd _mm_cvtsi64_sd
+#define _mm_cvti32_ss _mm_cvtsi32_ss
+#define _mm_cvti64_ss _mm_cvtsi64_ss
+
 #define _mm_cvt_roundi64_sd(A, B, R) __extension__ ({ \
   (__m128d)__builtin_ia32_cvtsi2sd64((__v2df)(__m128d)(A), (long long)(B), \
  (int)(R)); })
@@ -9372,6 +9399,24 @@ _mm512_mask_compressstoreu_epi32 (void *
   (__mmask8)(U), (int)(R)); })
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_cvtss_sd (__m128d W, __mmask8 U, __m128d A, __m128 B)
+{
+  return __builtin_ia32_cvtss2sd_round_mask((__v2df)(A),
+  (__v4sf)(B),
+  (__v2df)(W),
+  (__mmask8)(U), 
_MM_FROUND_CUR_DIRECTION); 
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_cvtss_sd (__mmask8 U, __m128d A, __m128 B)
+{
+  return __builtin_ia32_cvtss2sd_round_mask((__v2df)(A),
+  (__v4sf)(B),
+  (__v2df)_mm_setzero_pd(), 
+  (__mmask8)(U), 
_MM_FROUND_CUR_DIRECTION); 
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
 _mm_cvtu32_sd (__m128d __A, unsigned __B)
 {
   return (__m128d) __builtin_ia32_cvtusi2sd32 ((__v2df) __A, __B);

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=271499=271498=271499=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu Jun  2 03:11:35 2016
@@ -7266,3 +7266,80 @@ __m512 test_mm512_setr_ps (float __A, fl
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+int test_mm_cvtss_i32(__m128 A) {
+  // CHECK-LABEL: test_mm_cvtss_i32
+  // CHECK: call i32 @llvm.x86.sse.cvtss2si(<4 x float> %{{.*}})
+  return _mm_cvtss_i32(A);
+}
+
+long long test_mm_cvtss_i64(__m128 A) {
+  // CHECK-LABEL: test_mm_cvtss_i64
+  // CHECK: call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %{{.*}})
+  return _mm_cvtss_i64(A);
+}
+
+__m128d test_mm_cvti32_sd(__m128d A, int B) {
+  // CHECK-LABEL: test_mm_cvti32_sd
+  // CHECK: sitofp i32 %{{.*}} to double
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+  return _mm_cvti32_sd(A, B);
+}
+
+__m128d test_mm_cvti64_sd(__m128d A, long long B) {
+  // CHECK-LABEL: test_mm_cvti64_sd
+  // CHECK: sitofp i64 %{{.*}} to double
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
+  return _mm_cvti64_sd(A, B);
+}
+
+__m128 test_mm_cvti32_ss(__m128 A, int B) {
+  // CHECK-LABEL: test_mm_cvti32_ss
+  // CHECK: sitofp i32 %{{.*}} to float
+  // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+  return _mm_cvti32_ss(A, B);
+}
+
+__m128 test_mm_cvti64_ss(__m128 A, long long B) {
+  // CHECK-LABEL: test_mm_cvti64_ss
+  // CHECK: sitofp i64 

Re: [PATCH] D20811: [analyzer] Model some library functions

2016-06-02 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

Yeah, good point, the "Std" part should definitely appear in the name, not sure 
about the "C" thing, as we could probably expand this checker to model some 
simple C++ functions as well (and then we'd make a separate checker section to 
move from unix. to cplusplus. or something like that, not sure maybe we'd need 
to reside in core. anyway).


http://reviews.llvm.org/D20811



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


r271498 - [Clang][AVX512][INTRINSICS] adding round cvt and fix regular cvtps_ph

2016-06-02 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Jun  2 02:44:08 2016
New Revision: 271498

URL: http://llvm.org/viewvc/llvm-project?rev=271498=rev
Log:
[Clang][AVX512][INTRINSICS] adding round cvt and fix regular cvtps_ph


Differential Revision: http://reviews.llvm.org/D20870

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

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=271498=271497=271498=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Thu Jun  2 02:44:08 2016
@@ -9383,26 +9383,58 @@ _mm256_maskz_cvtph_ps (__mmask8 __U, __m
 (__mmask8) __U);
 }
 
-#define _mm_mask_cvtps_ph(W, U, A, I) __extension__ ({ \
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm_mask_cvtps_ph (__m128i __W, __mmask8 __U, __m128 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph_mask ((__v4sf) __A, 
_MM_FROUND_CUR_DIRECTION,
+  (__v8hi) __W,
+  (__mmask8) __U);
+}
+
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm_maskz_cvtps_ph (__mmask8 __U, __m128 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph_mask ((__v4sf) __A, 
_MM_FROUND_CUR_DIRECTION,
+  (__v8hi) _mm_setzero_si128 
(),
+  (__mmask8) __U);
+}
+
+#define _mm_mask_cvt_roundps_ph(W, U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph_mask((__v4sf)(__m128)(A), (int)(I), \
  (__v8hi)(__m128i)(W), \
  (__mmask8)(U)); })
 
-#define _mm_maskz_cvtps_ph(U, A, I) __extension__ ({ \
+#define _mm_maskz_cvt_roundps_ph(U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph_mask((__v4sf)(__m128)(A), (int)(I), \
  (__v8hi)_mm_setzero_si128(), \
  (__mmask8)(U)); })
 
-#define _mm256_mask_cvtps_ph(W, U, A, I) __extension__ ({ \
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm256_mask_cvtps_ph (__m128i __W, __mmask8 __U, __m256 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph256_mask ((__v8sf) __A, 
_MM_FROUND_CUR_DIRECTION,
+  (__v8hi) __W,
+  (__mmask8) __U);
+}
+
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm256_maskz_cvtps_ph ( __mmask8 __U, __m256 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph256_mask ((__v8sf) __A, 
_MM_FROUND_CUR_DIRECTION,
+  (__v8hi) 
_mm_setzero_si128(),
+  (__mmask8) __U);
+}
+#define _mm256_mask_cvt_roundps_ph(W, U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph256_mask((__v8sf)(__m256)(A), (int)(I), \
 (__v8hi)(__m128i)(W), \
 (__mmask8)(U)); })
 
-#define _mm256_maskz_cvtps_ph(U, A, I) __extension__ ({ \
+#define _mm256_maskz_cvt_roundps_ph(U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph256_mask((__v8sf)(__m256)(A), (int)(I), \
 (__v8hi)_mm_setzero_si128(), \
 (__mmask8)(U)); })
 
+
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_BOTH
 

Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vl-builtins.c?rev=271498=271497=271498=diff
==
--- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Thu Jun  2 02:44:08 2016
@@ -6726,24 +6726,47 @@ __m256 test_mm256_maskz_cvtph_ps(__mmask
 __m128i test_mm_mask_cvtps_ph(__m128i __W, __mmask8 __U, __m128 __A) {
   // CHECK-LABEL: @test_mm_mask_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
-  return _mm_mask_cvtps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm_mask_cvtps_ph(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_cvtps_ph(__mmask8 __U, __m128 __A) {
   // CHECK-LABEL: @test_mm_maskz_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
-  return _mm_maskz_cvtps_ph(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm_maskz_cvtps_ph(__U, __A); 
 }
 
 __m128i test_mm256_mask_cvtps_ph(__m128i __W, __mmask8 __U, __m256 __A) {
   // CHECK-LABEL: @test_mm256_mask_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.256
-  return _mm256_mask_cvtps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm256_mask_cvtps_ph(__W, __U, __A); 
 }
 
 __m128i test_mm256_maskz_cvtps_ph(__mmask8 __U, __m256 __A) {
   // CHECK-LABEL: 

Re: [PATCH] D20870: [Clang][AVX512][INTRINSICS] adding round cvt and fix regular cvtps_ph

2016-06-02 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271498: [Clang][AVX512][INTRINSICS] adding round cvt and fix 
regular cvtps_ph (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D20870?vs=59232=59345#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20870

Files:
  cfe/trunk/lib/Headers/avx512vlintrin.h
  cfe/trunk/test/CodeGen/avx512vl-builtins.c

Index: cfe/trunk/test/CodeGen/avx512vl-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512vl-builtins.c
+++ cfe/trunk/test/CodeGen/avx512vl-builtins.c
@@ -6726,24 +6726,47 @@
 __m128i test_mm_mask_cvtps_ph(__m128i __W, __mmask8 __U, __m128 __A) {
   // CHECK-LABEL: @test_mm_mask_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
-  return _mm_mask_cvtps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm_mask_cvtps_ph(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_cvtps_ph(__mmask8 __U, __m128 __A) {
   // CHECK-LABEL: @test_mm_maskz_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
-  return _mm_maskz_cvtps_ph(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm_maskz_cvtps_ph(__U, __A); 
 }
 
 __m128i test_mm256_mask_cvtps_ph(__m128i __W, __mmask8 __U, __m256 __A) {
   // CHECK-LABEL: @test_mm256_mask_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.256
-  return _mm256_mask_cvtps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm256_mask_cvtps_ph(__W, __U, __A); 
 }
 
 __m128i test_mm256_maskz_cvtps_ph(__mmask8 __U, __m256 __A) {
   // CHECK-LABEL: @test_mm256_maskz_cvtps_ph
   // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.256
-  return _mm256_maskz_cvtps_ph(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+  return _mm256_maskz_cvtps_ph(__U, __A);
 }
 
+__m128i test_mm_mask_cvt_roundps_ph(__m128i __W, __mmask8 __U, __m128 __A) {
+  // CHECK-LABEL: @test_mm_mask_cvt_roundps_ph
+  // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
+  return _mm_mask_cvt_roundps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m128i test_mm_maskz_cvt_roundps_ph(__mmask8 __U, __m128 __A) {
+  // CHECK-LABEL: @test_mm_maskz_cvt_roundps_ph
+  // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.128
+  return _mm_maskz_cvt_roundps_ph(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m128i test_mm256_mask_cvt_roundps_ph(__m128i __W, __mmask8 __U, __m256 __A) {
+  // CHECK-LABEL: @test_mm256_mask_cvt_roundps_ph
+  // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.256
+  return _mm256_mask_cvt_roundps_ph(__W, __U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
+
+__m128i test_mm256_maskz_cvt_roundps_ph(__mmask8 __U, __m256 __A) {
+  // CHECK-LABEL: @test_mm256_maskz_cvt_roundps_ph
+  // CHECK: @llvm.x86.avx512.mask.vcvtps2ph.256
+  return _mm256_maskz_cvt_roundps_ph(__U, __A, _MM_FROUND_CUR_DIRECTION); 
+}
Index: cfe/trunk/lib/Headers/avx512vlintrin.h
===
--- cfe/trunk/lib/Headers/avx512vlintrin.h
+++ cfe/trunk/lib/Headers/avx512vlintrin.h
@@ -9383,26 +9383,58 @@
 (__mmask8) __U);
 }
 
-#define _mm_mask_cvtps_ph(W, U, A, I) __extension__ ({ \
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm_mask_cvtps_ph (__m128i __W, __mmask8 __U, __m128 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph_mask ((__v4sf) __A, _MM_FROUND_CUR_DIRECTION,
+  (__v8hi) __W,
+  (__mmask8) __U);
+}
+
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm_maskz_cvtps_ph (__mmask8 __U, __m128 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph_mask ((__v4sf) __A, _MM_FROUND_CUR_DIRECTION,
+  (__v8hi) _mm_setzero_si128 (),
+  (__mmask8) __U);
+}
+
+#define _mm_mask_cvt_roundps_ph(W, U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph_mask((__v4sf)(__m128)(A), (int)(I), \
  (__v8hi)(__m128i)(W), \
  (__mmask8)(U)); })
 
-#define _mm_maskz_cvtps_ph(U, A, I) __extension__ ({ \
+#define _mm_maskz_cvt_roundps_ph(U, A, I) __extension__ ({ \
   (__m128i)__builtin_ia32_vcvtps2ph_mask((__v4sf)(__m128)(A), (int)(I), \
  (__v8hi)_mm_setzero_si128(), \
  (__mmask8)(U)); })
 
-#define _mm256_mask_cvtps_ph(W, U, A, I) __extension__ ({ \
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm256_mask_cvtps_ph (__m128i __W, __mmask8 __U, __m256 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph256_mask ((__v8sf) __A, _MM_FROUND_CUR_DIRECTION,
+  (__v8hi) __W,
+  (__mmask8) __U);
+}
+
+static __inline __m128i __DEFAULT_FN_ATTRS
+_mm256_maskz_cvtps_ph ( __mmask8 __U, __m256 __A)
+{
+  return (__m128i) __builtin_ia32_vcvtps2ph256_mask ((__v8sf) __A, _MM_FROUND_CUR_DIRECTION,
+

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-02 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 updated this revision to Diff 59342.
rogfer01 marked 3 inline comments as done.
rogfer01 added a comment.

Remove fix-it as it is not suitable for this diagnostic.


http://reviews.llvm.org/D20561

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  test/Sema/address-packed.c
  test/SemaCXX/address-packed.cpp

Index: test/SemaCXX/address-packed.cpp
===
--- /dev/null
+++ test/SemaCXX/address-packed.cpp
@@ -0,0 +1,101 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+extern void f1(int *);
+extern void f2(char *);
+
+struct __attribute__((packed)) Arguable {
+  int x;
+  char c;
+  static void foo();
+};
+
+extern void f3(void());
+
+namespace Foo {
+struct __attribute__((packed)) Arguable {
+  char c;
+  int x;
+  static void foo();
+};
+}
+
+struct Arguable *get_arguable();
+
+void g0() {
+  {
+Foo::Arguable arguable;
+f1();   // expected-warning {{packed member 'x' of class or structure 'Foo::Arguable'}}
+f2();   // no-warning
+f3(); // no-warning
+  }
+  {
+Arguable arguable1;
+Arguable (arguable1);
+f1();   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2();   // no-warning
+f3(); // no-warning
+  }
+  {
+Arguable *arguable1;
+Arguable *(arguable1);
+f1(>x);   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(>c);   // no-warning
+f3(>foo); // no-warning
+  }
+}
+
+struct __attribute__((packed)) A {
+  int x;
+  char c;
+
+  int *f0() {
+return >x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g0() {
+return  // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h0() {
+return  // no-warning
+  }
+};
+
+struct B : A {
+  int *f1() {
+return >x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g1() {
+return  // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h1() {
+return  // no-warning
+  }
+};
+
+template 
+class __attribute__((packed)) S {
+  Ty X;
+
+public:
+  const Ty *get() const {
+return  // expected-warning {{packed member 'X' of class or structure 'S'}}
+   // expected-warning@-1 {{packed member 'X' of class or structure 'S'}}
+  }
+};
+
+template 
+void h(Ty*);
+
+void g1()
+{
+S s1;
+s1.get(); // expected-note {{in instantiation of member function 'S::get'}}
+
+S s2;
+s2.get();
+
+S s3;
+s3.get(); // expected-note {{in instantiation of member function 'S::get'}}
+}
Index: test/Sema/address-packed.c
===
--- /dev/null
+++ test/Sema/address-packed.c
@@ -0,0 +1,126 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+extern void f1(int *);
+extern void f2(char *);
+
+struct Ok {
+  char c;
+  int x;
+};
+
+struct __attribute__((packed)) Arguable {
+  char c0;
+  int x;
+  char c1;
+};
+
+union __attribute__((packed)) UnionArguable {
+  char c;
+  int x;
+};
+
+typedef struct Arguable ArguableT;
+
+struct Arguable *get_arguable();
+
+void g0(void) {
+  {
+struct Ok ok;
+f1(); // no-warning
+f2(); // no-warning
+  }
+  {
+struct Arguable arguable;
+f2(); // no-warning
+f1();  // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(); // no-warning
+  }
+  {
+union UnionArguable arguable;
+f2(); // no-warning
+f1(); // expected-warning {{packed member 'x' of class or structure 'UnionArguable'}}
+  }
+  {
+ArguableT arguable;
+f2(); // no-warning
+f1();  // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(); // no-warning
+  }
+  {
+struct Arguable *arguable = get_arguable();
+// These do not produce any warning because of the parentheses.
+f2(&(arguable->c0)); // no-warning
+f1(&(arguable->x));  // no-warning
+f2(&(arguable->c1)); // no-warning
+  }
+  {
+ArguableT *arguable = get_arguable();
+// These do not produce any warning because of the parentheses.
+f2(&(arguable->c0)); // no-warning
+f1(&(arguable->x));  // no-warning
+f2(&(arguable->c1)); // no-warning
+  }
+}
+
+struct S1 {
+  char c;
+  int i __attribute__((packed));
+};
+
+int *g1(struct S1 *s1) {
+  return >i; // expected-warning {{packed member 'i' of class or structure 'S1'}}
+}
+
+struct S2_i {
+  int i;
+};
+struct __attribute__((packed)) S2 {
+  char c;
+  struct S2_i inner;
+};
+
+int *g2(struct S2 *s2) {
+  return >inner.i; // expected-warning {{packed member 'inner' of class or structure 'S2'}}
+}
+
+struct S2_a {
+  char c;
+  struct S2_i inner __attribute__((packed));
+};
+
+int *g2_a(struct S2_a *s2_a) {
+  return _a->inner.i; // expected-warning {{packed member 'inner' of class or structure 'S2_a'}}
+}
+
+struct __attribute__((packed)) S3 {
+  char c;
+  struct {
+int i;
+  } inner;
+};
+
+int *g3(struct S3 *s3) {
+  

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-02 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 marked 3 inline comments as done.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5392
@@ -5388,1 +5391,3 @@
+def note_address_of_packed_member_silence : Note<
+  "place parentheses around the '%0' expression to silence this warning">;
 

aaron.ballman wrote:
> I don't think this note adds value. Placing parens around the expression does 
> silence the warning for false-positives, but that seems more like a 
> documentation issue than a diagnostic.
Ditto.


Comment at: lib/Sema/SemaExpr.cpp:10537-10538
@@ +10536,4 @@
+  Diag(rhs->getLocStart(), diag::note_address_of_packed_member_silence)
+  << rhs << FixItHint::CreateInsertion(rhs->getLocStart(), "(")
+  << FixItHint::CreateInsertion(rhs->getLocEnd(), ")");
+  break;

aaron.ballman wrote:
> I do not think this diagnostic should have a FixIt hint. This isn't actually 
> *fixing* the problem, it is simply a way to silence the diagnostic while 
> retaining the same behavior.
OK. I will remove it.


Comment at: test/SemaCXX/address-packed.cpp:92-93
@@ +91,4 @@
+   // expected-warning@-1 {{packed member 'X' of class or structure 
'S'}}
+   // expected-note@-2 {{place parentheses around the 'this->X'}}
+   // expected-note@-3 {{place parentheses around the 'this->X'}}
+  }

aaron.ballman wrote:
> Why `this->X` in the diagnostic when that's not what the user wrote?
Probably clang introduces it internally when parsing an id-expression that 
happens to be a nonstatic data member because the diagnostic does include it.

That said this is going away as I'm removing the fix-it.


http://reviews.llvm.org/D20561



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


  1   2   >