[libcxx] r294727 - Revert "Split exception.cpp and new.cpp implementation into different files for different runtimes."

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Feb 10 01:43:08 2017
New Revision: 294727

URL: http://llvm.org/viewvc/llvm-project?rev=294727=rev
Log:
Revert "Split exception.cpp and new.cpp implementation into different files for 
different runtimes."

The compiler-rt CMake configuration needs some tweaking before this can land.

Removed:
libcxx/trunk/src/support/runtime/exception_fallback.ipp
libcxx/trunk/src/support/runtime/exception_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
libcxx/trunk/src/support/runtime/exception_libcxxrt.ipp
libcxx/trunk/src/support/runtime/exception_msvc.ipp
libcxx/trunk/src/support/runtime/exception_pointer_cxxabi.ipp
libcxx/trunk/src/support/runtime/exception_pointer_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_pointer_unimplemented.ipp
libcxx/trunk/src/support/runtime/new_handler_fallback.ipp
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
libcxx/trunk/include/exception
libcxx/trunk/include/new
libcxx/trunk/include/typeinfo
libcxx/trunk/src/exception.cpp
libcxx/trunk/src/new.cpp
libcxx/trunk/src/typeinfo.cpp

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294727=294726=294727=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Fri Feb 10 01:43:08 2017
@@ -125,9 +125,6 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
 if (LIBCXX_TARGETING_MSVC)
   # FIXME: Figure out how to configure the ABI library on Windows.
   set(LIBCXX_CXX_ABI_LIBNAME "vcruntime")
-elseif(APPLE)
-  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
-  set(LIBCXX_CXX_ABI_SYSTEM 1)
 else()
   set(LIBCXX_CXX_ABI_LIBNAME "default")
 endif()

Modified: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake?rev=294727=294726=294727=diff
==
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake Fri Feb 10 01:43:08 2017
@@ -103,11 +103,9 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STRE
 # Assume c++abi is installed in the system, rely on -lc++abi link flag.
 set(CXXABI_LIBNAME "c++abi")
   endif()
-  set(HEADERS "cxxabi.h;__cxxabi_config.h")
-  if (LIBCXX_CXX_ABI_SYSTEM)
-set(HEADERS "")
-  endif()
-  setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI" ${CXXABI_LIBNAME} "${HEADERS}" 
"")
+  setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI"
+${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
+)
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
   setup_abi_lib("-DLIBCXXRT"
 "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""

Modified: libcxx/trunk/include/exception
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=294727=294726=294727=diff
==
--- libcxx/trunk/include/exception (original)
+++ libcxx/trunk/include/exception Fri Feb 10 01:43:08 2017
@@ -82,10 +82,6 @@ template  void rethrow_if_neste
 #include 
 #include 
 
-#if defined(_LIBCPP_ABI_MICROSOFT)
-#include 
-#endif
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
@@ -93,7 +89,6 @@ template  void rethrow_if_neste
 namespace std  // purposefully not using versioning namespace
 {
 
-#if !defined(_LIBCPP_ABI_MICROSOFT)
 class _LIBCPP_EXCEPTION_ABI exception
 {
 public:
@@ -110,7 +105,6 @@ public:
 virtual ~bad_exception() _NOEXCEPT;
 virtual const char* what() const _NOEXCEPT;
 };
-#endif // !_LIBCPP_ABI_MICROSOFT
 
 typedef void (*unexpected_handler)();
 _LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) 
_NOEXCEPT;

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=294727=294726=294727=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Fri Feb 10 01:43:08 2017
@@ -92,10 +92,6 @@ void  operator delete[](void* ptr, void*
 #include 
 #endif
 
-#if defined(_LIBCPP_ABI_MICROSOFT)
-#include 
-#endif
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
@@ -114,10 +110,6 @@ void  operator delete[](void* ptr, void*
 namespace std  // purposefully not using versioning namespace
 {
 
-#if !defined(_LIBCPP_ABI_MICROSOFT)
-struct _LIBCPP_TYPE_VIS nothrow_t {};
-extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
-
 class _LIBCPP_EXCEPTION_ABI bad_alloc
 : public exception
 {
@@ -136,12 +128,6 @@ public:
 virtual const char* what() const _NOEXCEPT;
 };
 
-typedef void (*new_handler)();
-_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;

Re: [libcxx] r294707 - Split exception.cpp and new.cpp implementation into different files for different runtimes.

2017-02-09 Thread Vitaly Buka via cfe-commits
As I understand it's not the builder but cmake files of compiler-rt need to
be fixed, somewhere near add_custom_libcxx in tsan and msan.
Something just like this should work, but it's broken after the patch.
cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
../../llvm && ninja check-tsan check-msan

Seems reasonable thing to do is to revert and resubmit together with fixed
compiler-rt.

On Thu, Feb 9, 2017 at 10:04 PM Vitaly Buka  wrote:

Thanks.
looking...

On Thu, Feb 9, 2017 at 9:51 PM Eric Fiselier  wrote:

To all those who wander here from the sanitizer autoconf buildbot failures
.

Yes, this commit is responsible for that breakage. The buildbot in question
attempts to compile libc++ in-tree w/o libc++abi. Previously libc++
silently defaulted
to using w/e  header it found on the system. However it no longer
does this
on Linux, since the  header it finds could incorrectly belong to
libstdc++ or libcxxrt.

Instead this builder should be changed to either:

(A) build libc++abi in-tree as well.
(B) explicitly specify -DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="".

If these changes cannot be made easily and quickly then please let me know,
and I'll implement a temporary workaround in
libc++.


/Eric


On Thu, Feb 9, 2017 at 9:25 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

Author: ericwf
Date: Thu Feb  9 22:25:33 2017
New Revision: 294707

URL: http://llvm.org/viewvc/llvm-project?rev=294707=rev
Log:
Split exception.cpp and new.cpp implementation into different files for
different runtimes.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

Added:
libcxx/trunk/src/support/runtime/
libcxx/trunk/src/support/runtime/exception_fallback.ipp
libcxx/trunk/src/support/runtime/exception_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
libcxx/trunk/src/support/runtime/exception_libcxxrt.ipp
libcxx/trunk/src/support/runtime/exception_msvc.ipp
libcxx/trunk/src/support/runtime/exception_pointer_cxxabi.ipp
libcxx/trunk/src/support/runtime/exception_pointer_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_pointer_unimplemented.ipp
libcxx/trunk/src/support/runtime/new_handler_fallback.ipp
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/include/exception
libcxx/trunk/include/new
libcxx/trunk/include/typeinfo
libcxx/trunk/src/exception.cpp
libcxx/trunk/src/new.cpp
libcxx/trunk/src/typeinfo.cpp

Modified: libcxx/trunk/CMakeLists.txt
URL:
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294707=294706=294707=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Feb  9 22:25:33 2017
@@ -116,11 +116,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
 NO_DEFAULT_PATH
   )
+  find_path(
+LIBCXX_LIBCXXABI_INCLUDES_EXTERNAL
+cxxabi.h
+PATHS /usr/include
+  )
   if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
   IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_INCLUDE_PATHS
"${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_INTREE 1)
+  elseif(APPLE AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS
"${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
   else()
 if (LIBCXX_TARGETING_MSVC)
   # FIXME: Figure out how to configure the ABI library on Windows.

Modified: libcxx/trunk/include/exception
URL:
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=294707=294706=294707=diff
==
--- libcxx/trunk/include/exception (original)
+++ libcxx/trunk/include/exception Thu Feb  9 22:25:33 2017
@@ -82,6 +82,10 @@ template  void rethrow_if_neste
 #include 
 #include 

+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include 
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
@@ -89,6 +93,7 @@ template  void rethrow_if_neste
 namespace std  // purposefully not using versioning namespace
 {

+#if 

[PATCH] D28404: IRGen: Add optnone attribute on function during O0

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

Ping :)


https://reviews.llvm.org/D28404



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


Re: [libcxx] r294696 - Fully qualify (preprend ::) calls to math functions from libc

2017-02-09 Thread Eric Fiselier via cfe-commits
I'm a bit paranoid one of the names we just qualified will end up being
defined as a macro. Conceivably  could have tolerated macros for
names it uses but doesn't overload (ex, modff), however  would have
always blown up.

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


[libcxx] r294721 - Properly escape ShellTest subsitutions on Windows. Try 2

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Feb 10 00:59:07 2017
New Revision: 294721

URL: http://llvm.org/viewvc/llvm-project?rev=294721=rev
Log:
Properly escape ShellTest subsitutions on Windows. Try 2

Modified:
libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=294721=294720=294721=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Fri Feb 10 00:59:07 2017
@@ -891,8 +891,9 @@ class Configuration(object):
 
 def configure_substitutions(self):
 sub = self.config.substitutions
+cxx_path = pipes.quote(self.cxx.path)
 # Configure compiler substitutions
-sub.append(('%cxx', pipes.quote(self.cxx.path)))
+sub.append(('%cxx', cxx_path))
 # Configure flags substitutions
 flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags])
 compile_flags_str = ' '.join([pipes.quote(f) for f in 
self.cxx.compile_flags])
@@ -906,12 +907,12 @@ class Configuration(object):
 verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' '
 sub.append(('%verify', verify_str))
 # Add compile and link shortcuts
-compile_str = (self.cxx.path + ' -o %t.o %s -c ' + flags_str
+compile_str = (cxx_path + ' -o %t.o %s -c ' + flags_str
+ ' ' + compile_flags_str)
-link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str + ' '
+link_str = (cxx_path + ' -o %t.exe %t.o ' + flags_str + ' '
 + link_flags_str)
 assert type(link_str) is str
-build_str = self.cxx.path + ' -o %t.exe %s ' + all_flags
+build_str = cxx_path + ' -o %t.exe %s ' + all_flags
 if self.cxx.use_modules:
 sub.append(('%compile_module', compile_str))
 sub.append(('%build_module', build_str))
@@ -937,7 +938,7 @@ class Configuration(object):
 sub.append(('%run', exec_str + ' %t.exe'))
 # Configure not program substitutions
 not_py = os.path.join(self.libcxx_src_root, 'utils', 'not.py')
-not_str = '%s %s ' % (sys.executable, not_py)
+not_str = '%s %s ' % (pipes.quote(sys.executable), pipes.quote(not_py))
 sub.append(('not ', not_str))
 
 def configure_triple(self):


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


[libcxx] r294720 - test: XFAIL windows for non-portable test

2017-02-09 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Feb 10 00:51:21 2017
New Revision: 294720

URL: http://llvm.org/viewvc/llvm-project?rev=294720=rev
Log:
test: XFAIL windows for non-portable test

This test validates that the lock_guard is declared variadically across
C++03 and C++11.  Given the lack of stable ABI on Windows and the fact
that the RTTI encoding on Windows is different, XFAIL it on that target.

Modified:

libcxx/trunk/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp?rev=294720=294719=294720=diff
==
--- 
libcxx/trunk/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
 Fri Feb 10 00:51:21 2017
@@ -12,6 +12,7 @@
 // TODO(EricWF) Investigate why typeid(...).name() returns a different string
 // on GCC 4.9 but not newer GCCs.
 // XFAIL: gcc-4.9
+// XFAIL: windows
 
 // THIS TESTS C++03 EXTENSIONS.
 


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


[libcxx] r294719 - test: fix test under Windows

2017-02-09 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Feb 10 00:51:19 2017
New Revision: 294719

URL: http://llvm.org/viewvc/llvm-project?rev=294719=rev
Log:
test: fix test under Windows

When running the test under clang-cl, we do not report `__GNUC__`, which
is needed to supress the warnings which are being treated as errors.

Modified:
libcxx/trunk/test/libcxx/containers/associative/undef_min_max.pass.cpp

Modified: libcxx/trunk/test/libcxx/containers/associative/undef_min_max.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/associative/undef_min_max.pass.cpp?rev=294719=294718=294719=diff
==
--- libcxx/trunk/test/libcxx/containers/associative/undef_min_max.pass.cpp 
(original)
+++ libcxx/trunk/test/libcxx/containers/associative/undef_min_max.pass.cpp Fri 
Feb 10 00:51:19 2017
@@ -7,7 +7,7 @@
 //
 
//===--===//
 
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic ignored "-W#warnings"
 #endif
 


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


[libcxx] r294718 - properly escape compiler path in .sh.cpp tests

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Feb 10 00:38:02 2017
New Revision: 294718

URL: http://llvm.org/viewvc/llvm-project?rev=294718=rev
Log:
properly escape compiler path in .sh.cpp tests

Modified:
libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=294718=294717=294718=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Fri Feb 10 00:38:02 2017
@@ -892,7 +892,7 @@ class Configuration(object):
 def configure_substitutions(self):
 sub = self.config.substitutions
 # Configure compiler substitutions
-sub.append(('%cxx', self.cxx.path))
+sub.append(('%cxx', pipes.quote(self.cxx.path)))
 # Configure flags substitutions
 flags_str = ' '.join([pipes.quote(f) for f in self.cxx.flags])
 compile_flags_str = ' '.join([pipes.quote(f) for f in 
self.cxx.compile_flags])


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


[libcxx] r294716 - test: allow -target usage on Windows

2017-02-09 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Feb 10 00:24:34 2017
New Revision: 294716

URL: http://llvm.org/viewvc/llvm-project?rev=294716=rev
Log:
test: allow -target usage on Windows

When running the tests on Windows with a debug build, _DEBUG must be
added to the flags prior to the -target as the forced inclusion of a
header will prevent the compile test for the flag to fail.

Modified:
libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=294716=294715=294716=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Fri Feb 10 00:24:34 2017
@@ -462,13 +462,17 @@ class Configuration(object):
 gcc_toolchain = self.get_lit_conf('gcc_toolchain')
 if gcc_toolchain:
 self.cxx.flags += ['-gcc-toolchain', gcc_toolchain]
+# NOTE: the _DEBUG definition must preceed the triple check because for
+# the Windows build of libc++, the forced inclusion of a header 
requires
+# that _DEBUG is defined.  Incorrect ordering will result in -target
+# being elided.
+if self.is_windows and self.debug_build:
+self.cxx.compile_flags += ['-D_DEBUG']
 if self.use_target:
 if not self.cxx.addFlagIfSupported(
 ['-target', self.config.target_triple]):
 self.lit_config.warning('use_target is true but -target is '\
 'not supported by the compiler')
-if self.is_windows and self.debug_build:
-self.cxx.compile_flags += ['-D_DEBUG']
 
 def configure_compile_flags_header_includes(self):
 support_path = os.path.join(self.libcxx_src_root, 'test', 'support')


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


Re: [libcxx] r294707 - Split exception.cpp and new.cpp implementation into different files for different runtimes.

2017-02-09 Thread Vitaly Buka via cfe-commits
Thanks.
looking...

On Thu, Feb 9, 2017 at 9:51 PM Eric Fiselier  wrote:

> To all those who wander here from the sanitizer autoconf buildbot failures
> .
>
> Yes, this commit is responsible for that breakage. The buildbot in question
> attempts to compile libc++ in-tree w/o libc++abi. Previously libc++
> silently defaulted
> to using w/e  header it found on the system. However it no
> longer does this
> on Linux, since the  header it finds could incorrectly belong to
> libstdc++ or libcxxrt.
>
> Instead this builder should be changed to either:
>
> (A) build libc++abi in-tree as well.
> (B) explicitly specify -DLIBCXX_CXX_ABI=libcxxabi
> -DLIBCXX_CXX_ABI_INCLUDE_PATHS="".
>
> If these changes cannot be made easily and quickly then please let me
> know, and I'll implement a temporary workaround in
> libc++.
>
>
> /Eric
>
>
> On Thu, Feb 9, 2017 at 9:25 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: ericwf
> Date: Thu Feb  9 22:25:33 2017
> New Revision: 294707
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294707=rev
> Log:
> Split exception.cpp and new.cpp implementation into different files for
> different runtimes.
>
> exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
> each different ABI library we support, and it's getting unmaintainable.
>
> This patch breaks down exception.cpp into multiple different header files,
> roughly one per implementation. Additionally it moves the definitions of
> exceptions in new.cpp into the correct implementation header.
>
> This patch also removes an unmaintained libc++abi configuration.
> This configuration may still be used by Apple internally but there
> are no other possible users. If it turns out that Apple still uses
> this configuration internally I will re-add it in a later commit.
> See http://llvm.org/PR31904.
>
> Added:
> libcxx/trunk/src/support/runtime/
> libcxx/trunk/src/support/runtime/exception_fallback.ipp
> libcxx/trunk/src/support/runtime/exception_glibcxx.ipp
> libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
> libcxx/trunk/src/support/runtime/exception_libcxxrt.ipp
> libcxx/trunk/src/support/runtime/exception_msvc.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_cxxabi.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_glibcxx.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_unimplemented.ipp
> libcxx/trunk/src/support/runtime/new_handler_fallback.ipp
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/include/exception
> libcxx/trunk/include/new
> libcxx/trunk/include/typeinfo
> libcxx/trunk/src/exception.cpp
> libcxx/trunk/src/new.cpp
> libcxx/trunk/src/typeinfo.cpp
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294707=294706=294707=diff
>
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Thu Feb  9 22:25:33 2017
> @@ -116,11 +116,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
>${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
>  NO_DEFAULT_PATH
>)
> +  find_path(
> +LIBCXX_LIBCXXABI_INCLUDES_EXTERNAL
> +cxxabi.h
> +PATHS /usr/include
> +  )
>if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
>IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
>  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
>  set(LIBCXX_CXX_ABI_INCLUDE_PATHS
> "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
>  set(LIBCXX_CXX_ABI_INTREE 1)
> +  elseif(APPLE AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
> +set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
> +set(LIBCXX_CXX_ABI_INCLUDE_PATHS
> "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
>else()
>  if (LIBCXX_TARGETING_MSVC)
># FIXME: Figure out how to configure the ABI library on Windows.
>
> Modified: libcxx/trunk/include/exception
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=294707=294706=294707=diff
>
> ==
> --- libcxx/trunk/include/exception (original)
> +++ libcxx/trunk/include/exception Thu Feb  9 22:25:33 2017
> @@ -82,6 +82,10 @@ template  void rethrow_if_neste
>  #include 
>  #include 
>
> +#if defined(_LIBCPP_ABI_MICROSOFT)
> +#include 
> +#endif
> +
>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
>  #pragma GCC system_header
>  #endif
> @@ -89,6 +93,7 @@ template  void rethrow_if_neste
>  namespace std  // purposefully not using versioning namespace
>  {
>
> +#if !defined(_LIBCPP_ABI_MICROSOFT)
>  class _LIBCPP_EXCEPTION_ABI exception
>  {
>  public:
> @@ -105,6 +110,7 @@ public:
>  virtual ~bad_exception() _NOEXCEPT;
>  virtual const char* what() const _NOEXCEPT;
>  };
> +#endif // !_LIBCPP_ABI_MICROSOFT

Re: [libcxx] r294707 - Split exception.cpp and new.cpp implementation into different files for different runtimes.

2017-02-09 Thread Eric Fiselier via cfe-commits
To all those who wander here from the sanitizer autoconf buildbot failures
.

Yes, this commit is responsible for that breakage. The buildbot in question
attempts to compile libc++ in-tree w/o libc++abi. Previously libc++
silently defaulted
to using w/e  header it found on the system. However it no longer
does this
on Linux, since the  header it finds could incorrectly belong to
libstdc++ or libcxxrt.

Instead this builder should be changed to either:

(A) build libc++abi in-tree as well.
(B) explicitly specify -DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="".

If these changes cannot be made easily and quickly then please let me know,
and I'll implement a temporary workaround in
libc++.


/Eric


On Thu, Feb 9, 2017 at 9:25 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Thu Feb  9 22:25:33 2017
> New Revision: 294707
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294707=rev
> Log:
> Split exception.cpp and new.cpp implementation into different files for
> different runtimes.
>
> exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
> each different ABI library we support, and it's getting unmaintainable.
>
> This patch breaks down exception.cpp into multiple different header files,
> roughly one per implementation. Additionally it moves the definitions of
> exceptions in new.cpp into the correct implementation header.
>
> This patch also removes an unmaintained libc++abi configuration.
> This configuration may still be used by Apple internally but there
> are no other possible users. If it turns out that Apple still uses
> this configuration internally I will re-add it in a later commit.
> See http://llvm.org/PR31904.
>
> Added:
> libcxx/trunk/src/support/runtime/
> libcxx/trunk/src/support/runtime/exception_fallback.ipp
> libcxx/trunk/src/support/runtime/exception_glibcxx.ipp
> libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
> libcxx/trunk/src/support/runtime/exception_libcxxrt.ipp
> libcxx/trunk/src/support/runtime/exception_msvc.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_cxxabi.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_glibcxx.ipp
> libcxx/trunk/src/support/runtime/exception_pointer_unimplemented.ipp
> libcxx/trunk/src/support/runtime/new_handler_fallback.ipp
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/include/exception
> libcxx/trunk/include/new
> libcxx/trunk/include/typeinfo
> libcxx/trunk/src/exception.cpp
> libcxx/trunk/src/new.cpp
> libcxx/trunk/src/typeinfo.cpp
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/
> CMakeLists.txt?rev=294707=294706=294707=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Thu Feb  9 22:25:33 2017
> @@ -116,11 +116,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
>${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
>  NO_DEFAULT_PATH
>)
> +  find_path(
> +LIBCXX_LIBCXXABI_INCLUDES_EXTERNAL
> +cxxabi.h
> +PATHS /usr/include
> +  )
>if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
>IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
>  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
>  set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_
> INTERNAL}")
>  set(LIBCXX_CXX_ABI_INTREE 1)
> +  elseif(APPLE AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
> +set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
> +set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_
> INTERNAL}")
>else()
>  if (LIBCXX_TARGETING_MSVC)
># FIXME: Figure out how to configure the ABI library on Windows.
>
> Modified: libcxx/trunk/include/exception
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> exception?rev=294707=294706=294707=diff
> 
> ==
> --- libcxx/trunk/include/exception (original)
> +++ libcxx/trunk/include/exception Thu Feb  9 22:25:33 2017
> @@ -82,6 +82,10 @@ template  void rethrow_if_neste
>  #include 
>  #include 
>
> +#if defined(_LIBCPP_ABI_MICROSOFT)
> +#include 
> +#endif
> +
>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
>  #pragma GCC system_header
>  #endif
> @@ -89,6 +93,7 @@ template  void rethrow_if_neste
>  namespace std  // purposefully not using versioning namespace
>  {
>
> +#if !defined(_LIBCPP_ABI_MICROSOFT)
>  class _LIBCPP_EXCEPTION_ABI exception
>  {
>  public:
> @@ -105,6 +110,7 @@ public:
>  virtual ~bad_exception() _NOEXCEPT;
>  virtual const char* what() const _NOEXCEPT;
>  };
> +#endif // !_LIBCPP_ABI_MICROSOFT
>
>  typedef void (*unexpected_handler)();
>  _LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler)
> _NOEXCEPT;

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

2017-02-09 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Hmm.  Was there discussion about that?  I see no reason not to bump ObjC++.


https://reviews.llvm.org/D29739



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


[PATCH] D29812: Update template-id-expr.cpp test to work when compiler defaults to non-C++03 standard

2017-02-09 Thread Douglas Yung via Phabricator via cfe-commits
dyung created this revision.

Recently a change was made to this test in r294639 which fails because the 
compiler only generates one of the warnings when the compiler is in C++03 or 
lower mode.

This change fixes that as well as adds explicit run lines to run the test in 
C++03 and C++11 modes.


https://reviews.llvm.org/D29812

Files:
  test/SemaTemplate/template-id-expr.cpp


Index: test/SemaTemplate/template-id-expr.cpp
===
--- test/SemaTemplate/template-id-expr.cpp
+++ test/SemaTemplate/template-id-expr.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 // PR5336
 template
 struct isa_impl_cl {
@@ -104,5 +106,8 @@
   template<> class D;  // expected-error {{cannot specialize a template 
template parameter}}
   friend class D; // expected-error {{type alias template 'D' cannot be 
referenced with a class specifier}}
 };
-template using D = int; // expected-note {{declared here}} 
expected-warning {{extension}}
+#if __cplusplus <= 199711L
+// expected-warning@+2 {{extension}}
+#endif
+template using D = int; // expected-note {{declared here}} 
 E ed; // expected-note {{instantiation of}}


Index: test/SemaTemplate/template-id-expr.cpp
===
--- test/SemaTemplate/template-id-expr.cpp
+++ test/SemaTemplate/template-id-expr.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 // PR5336
 template
 struct isa_impl_cl {
@@ -104,5 +106,8 @@
   template<> class D;  // expected-error {{cannot specialize a template template parameter}}
   friend class D; // expected-error {{type alias template 'D' cannot be referenced with a class specifier}}
 };
-template using D = int; // expected-note {{declared here}} expected-warning {{extension}}
+#if __cplusplus <= 199711L
+// expected-warning@+2 {{extension}}
+#endif
+template using D = int; // expected-note {{declared here}} 
 E ed; // expected-note {{instantiation of}}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

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

In https://reviews.llvm.org/D28785#673227, @smeenai wrote:

> Still not a fan of the amount of vcruntime dependencies this is taking on, 
> but I guess that can be followed up on.


Neither am I. However this gets the debug build working, and fixes RTTI, which 
in turn gets a ton of tests passing.
Now we have regression tests for when we start removing vcruntime dependencies.

> Was the `get_new_handler`/`set_new_handler` issue resolved? (The issue being 
> that those functions are in msvcprt, which our tests were silently linking 
> against statically).

Not yet. I'll address that in another patch, and then also enable the aligned 
new/delete overloads.


https://reviews.llvm.org/D28785



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


[libcxx] r294712 - Correctly default to using the system libc++abi on Apple.

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 23:07:03 2017
New Revision: 294712

URL: http://llvm.org/viewvc/llvm-project?rev=294712=rev
Log:
Correctly default to using the system libc++abi on Apple.

This patch fixes a regression where libc++ didn't correctly
select the system libc++abi when no in-tree version was found.

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294712=294711=294712=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Feb  9 23:07:03 2017
@@ -116,23 +116,18 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
 NO_DEFAULT_PATH
   )
-  find_path(
-LIBCXX_LIBCXXABI_INCLUDES_EXTERNAL
-cxxabi.h
-PATHS /usr/include
-  )
   if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
   IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_INTREE 1)
-  elseif(APPLE AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
-set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
-set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
   else()
 if (LIBCXX_TARGETING_MSVC)
   # FIXME: Figure out how to configure the ABI library on Windows.
   set(LIBCXX_CXX_ABI_LIBNAME "vcruntime")
+elseif(APPLE)
+  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
+  set(LIBCXX_CXX_ABI_SYSTEM 1)
 else()
   set(LIBCXX_CXX_ABI_LIBNAME "default")
 endif()

Modified: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake?rev=294712=294711=294712=diff
==
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake Thu Feb  9 23:07:03 2017
@@ -103,9 +103,11 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STRE
 # Assume c++abi is installed in the system, rely on -lc++abi link flag.
 set(CXXABI_LIBNAME "c++abi")
   endif()
-  setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI"
-${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
-)
+  set(HEADERS "cxxabi.h;__cxxabi_config.h")
+  if (LIBCXX_CXX_ABI_SYSTEM)
+set(HEADERS "")
+  endif()
+  setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI" ${CXXABI_LIBNAME} "${HEADERS}" 
"")
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
   setup_abi_lib("-DLIBCXXRT"
 "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""


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


[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

2017-02-09 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Still not a fan of the amount of vcruntime dependencies this is taking on, but 
I guess that can be followed up on.

Was the `get_new_handler`/`set_new_handler` issue resolved? (The issue being 
that those functions are in msvcprt, which our tests were silently linking 
against statically).


https://reviews.llvm.org/D28785



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


[PATCH] D29655: [X86] Link safestacksepseg runtime

2017-02-09 Thread Michael LeMay via Phabricator via cfe-commits
mlemay-intel updated this revision to Diff 87959.
mlemay-intel added a comment.

Added test.


https://reviews.llvm.org/D29655

Files:
  lib/Driver/Tools.cpp
  test/Driver/sanitizer-ld.c


Index: test/Driver/sanitizer-ld.c
===
--- test/Driver/sanitizer-ld.c
+++ test/Driver/sanitizer-ld.c
@@ -420,6 +420,17 @@
 // CHECK-SAFESTACK-LINUX: "-lpthread"
 // CHECK-SAFESTACK-LINUX: "-ldl"
 
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
+// RUN: -mseparate-stack-seg --sysroot=%S/Inputs/basic_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-SAFESTACKMPX-LINUX %s
+//
+// CHECK-SAFESTACKMPX-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACKMPX-LINUX-NOT: "-lc"
+// CHECK-SAFESTACKMPX-LINUX: libclang_rt.safestacksepseg-x86_64.a"
+// CHECK-SAFESTACKMPX-LINUX: "-lpthread"
+// CHECK-SAFESTACKMPX-LINUX: "-ldl"
+
 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-unknown-linux -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3319,8 +3319,12 @@
 if (SanArgs.linkCXXRuntimes())
   StaticRuntimes.push_back("ubsan_standalone_cxx");
   }
-  if (SanArgs.needsSafeStackRt())
-StaticRuntimes.push_back("safestack");
+  if (SanArgs.needsSafeStackRt()) {
+if (Args.hasFlag(options::OPT_mseparate_stack_seg, 
options::OPT_mno_separate_stack_seg, false))
+  StaticRuntimes.push_back("safestacksepseg");
+else
+  StaticRuntimes.push_back("safestack");
+  }
   if (SanArgs.needsCfiRt())
 StaticRuntimes.push_back("cfi");
   if (SanArgs.needsCfiDiagRt()) {


Index: test/Driver/sanitizer-ld.c
===
--- test/Driver/sanitizer-ld.c
+++ test/Driver/sanitizer-ld.c
@@ -420,6 +420,17 @@
 // CHECK-SAFESTACK-LINUX: "-lpthread"
 // CHECK-SAFESTACK-LINUX: "-ldl"
 
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
+// RUN: -mseparate-stack-seg --sysroot=%S/Inputs/basic_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-SAFESTACKMPX-LINUX %s
+//
+// CHECK-SAFESTACKMPX-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACKMPX-LINUX-NOT: "-lc"
+// CHECK-SAFESTACKMPX-LINUX: libclang_rt.safestacksepseg-x86_64.a"
+// CHECK-SAFESTACKMPX-LINUX: "-lpthread"
+// CHECK-SAFESTACKMPX-LINUX: "-ldl"
+
 // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-unknown-linux -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3319,8 +3319,12 @@
 if (SanArgs.linkCXXRuntimes())
   StaticRuntimes.push_back("ubsan_standalone_cxx");
   }
-  if (SanArgs.needsSafeStackRt())
-StaticRuntimes.push_back("safestack");
+  if (SanArgs.needsSafeStackRt()) {
+if (Args.hasFlag(options::OPT_mseparate_stack_seg, options::OPT_mno_separate_stack_seg, false))
+  StaticRuntimes.push_back("safestacksepseg");
+else
+  StaticRuntimes.push_back("safestack");
+  }
   if (SanArgs.needsCfiRt())
 StaticRuntimes.push_back("cfi");
   if (SanArgs.needsCfiDiagRt()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294708 - Temporarily revert "For X86-64 linux and PPC64 linux align int128 to 16 bytes."

2017-02-09 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Thu Feb  9 22:35:21 2017
New Revision: 294708

URL: http://llvm.org/viewvc/llvm-project?rev=294708=rev
Log:
Temporarily revert "For X86-64 linux and PPC64 linux align int128 to 16 bytes."
until we can get better TargetMachine::isCompatibleDataLayout to compare - 
otherwise
we can't code generate existing bitcode without a string equality data layout.

This reverts commit r294703.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/target-data.c
cfe/trunk/test/CodeGen/thinlto-multi-module.ll
cfe/trunk/test/CodeGen/thinlto_backend.ll

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294708=294707=294708=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb  9 22:35:21 2017
@@ -1673,35 +1673,15 @@ public:
 IntMaxType = SignedLong;
 Int64Type = SignedLong;
 
-std::string Layout;
-
-// PPC64LE is little endian.
-if (Triple.getArch() == llvm::Triple::ppc64le)
-  Layout = "e";
-else
-  Layout = "E";
-
-Layout += llvm::DataLayout::getManglingComponent(Triple);
-
-Layout += "-i64:64";
-
-// 128 bit integers are always aligned to 128 bits, but only 64-bit 
matters,
-// because __int128 is only supoprted on 64-bit targets.
-// FIXME: See if this is valid on other 64-bit ppc oses.
-if (Triple.isOSLinux())
-  Layout += "-i128:128";
-
-Layout += "-n32:64";
-
-resetDataLayout(Layout);
-
-// PPC64LE started a new ABI.
-if (Triple.getArch() == llvm::Triple::ppc64le)
+if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+  resetDataLayout("e-m:e-i64:64-n32:64");
   ABI = "elfv2";
-else
+} else {
+  resetDataLayout("E-m:e-i64:64-n32:64");
   ABI = "elfv1";
+}
 
-switch (Triple.getOS()) {
+switch (getTriple().getOS()) {
 case llvm::Triple::FreeBSD:
   LongDoubleWidth = LongDoubleAlign = 64;
   LongDoubleFormat = ::APFloat::IEEEdouble();
@@ -4601,21 +4581,11 @@ public:
 Int64Type   = IsX32 ? SignedLongLong   : SignedLong;
 RegParmMax = 6;
 
-// Use 128-bit alignment for 128-bit integers in linux.
-// FIXME: Figure out if we should change this for other oses.
 // Pointers are 32-bit in x32.
-if (IsX32) {
-  if (Triple.isOSLinux())
-resetDataLayout(
-"e-m:e-p:32:32-i64:64-i128:128-f80:128-n8:16:32:64-S128");
-  else
-   resetDataLayout("e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128");
-} else if (IsWinCOFF)
-  resetDataLayout("e-m:w-i64:64-f80:128-n8:16:32:64-S128");
-else if (Triple.isOSLinux())
-  resetDataLayout("e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128");
-else
-  resetDataLayout("e-m:e-i64:64-f80:128-n8:16:32:64-S128");
+resetDataLayout(IsX32
+? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
+: IsWinCOFF ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+: "e-m:e-i64:64-f80:128-n8:16:32:64-S128");
 
 // Use fpret only for long double.
 RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=294708=294707=294708=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Thu Feb  9 22:35:21 2017
@@ -100,11 +100,11 @@
 
 // RUN: %clang_cc1 -triple powerpc64-linux -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC64-LINUX
-// PPC64-LINUX: target datalayout = "E-m:e-i64:64-i128:128-n32:64"
+// PPC64-LINUX: target datalayout = "E-m:e-i64:64-n32:64"
 
 // RUN: %clang_cc1 -triple powerpc64le-linux -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC64LE-LINUX
-// PPC64LE-LINUX: target datalayout = "e-m:e-i64:64-i128:128-n32:64"
+// PPC64LE-LINUX: target datalayout = "e-m:e-i64:64-n32:64"
 
 // RUN: %clang_cc1 -triple powerpc-darwin -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC32-DARWIN

Modified: cfe/trunk/test/CodeGen/thinlto-multi-module.ll
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-multi-module.ll?rev=294708=294707=294708=diff
==
--- cfe/trunk/test/CodeGen/thinlto-multi-module.ll (original)
+++ cfe/trunk/test/CodeGen/thinlto-multi-module.ll Thu Feb  9 22:35:21 2017
@@ -11,7 +11,7 @@
 ; CHECK-OBJ: T f1
 ; CHECK-OBJ: U f2
 
-target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 declare void @f2()

Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll
URL: 

[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

2017-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed in r294707.


https://reviews.llvm.org/D28785



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


[libcxx] r294707 - Split exception.cpp and new.cpp implementation into different files for different runtimes.

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 22:25:33 2017
New Revision: 294707

URL: http://llvm.org/viewvc/llvm-project?rev=294707=rev
Log:
Split exception.cpp and new.cpp implementation into different files for 
different runtimes.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

Added:
libcxx/trunk/src/support/runtime/
libcxx/trunk/src/support/runtime/exception_fallback.ipp
libcxx/trunk/src/support/runtime/exception_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
libcxx/trunk/src/support/runtime/exception_libcxxrt.ipp
libcxx/trunk/src/support/runtime/exception_msvc.ipp
libcxx/trunk/src/support/runtime/exception_pointer_cxxabi.ipp
libcxx/trunk/src/support/runtime/exception_pointer_glibcxx.ipp
libcxx/trunk/src/support/runtime/exception_pointer_unimplemented.ipp
libcxx/trunk/src/support/runtime/new_handler_fallback.ipp
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/include/exception
libcxx/trunk/include/new
libcxx/trunk/include/typeinfo
libcxx/trunk/src/exception.cpp
libcxx/trunk/src/new.cpp
libcxx/trunk/src/typeinfo.cpp

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294707=294706=294707=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Feb  9 22:25:33 2017
@@ -116,11 +116,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
 NO_DEFAULT_PATH
   )
+  find_path(
+LIBCXX_LIBCXXABI_INCLUDES_EXTERNAL
+cxxabi.h
+PATHS /usr/include
+  )
   if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
   IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
 set(LIBCXX_CXX_ABI_INTREE 1)
+  elseif(APPLE AND IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
   else()
 if (LIBCXX_TARGETING_MSVC)
   # FIXME: Figure out how to configure the ABI library on Windows.

Modified: libcxx/trunk/include/exception
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=294707=294706=294707=diff
==
--- libcxx/trunk/include/exception (original)
+++ libcxx/trunk/include/exception Thu Feb  9 22:25:33 2017
@@ -82,6 +82,10 @@ template  void rethrow_if_neste
 #include 
 #include 
 
+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include 
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
@@ -89,6 +93,7 @@ template  void rethrow_if_neste
 namespace std  // purposefully not using versioning namespace
 {
 
+#if !defined(_LIBCPP_ABI_MICROSOFT)
 class _LIBCPP_EXCEPTION_ABI exception
 {
 public:
@@ -105,6 +110,7 @@ public:
 virtual ~bad_exception() _NOEXCEPT;
 virtual const char* what() const _NOEXCEPT;
 };
+#endif // !_LIBCPP_ABI_MICROSOFT
 
 typedef void (*unexpected_handler)();
 _LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) 
_NOEXCEPT;

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=294707=294706=294707=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Thu Feb  9 22:25:33 2017
@@ -92,6 +92,10 @@ void  operator delete[](void* ptr, void*
 #include 
 #endif
 
+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include 
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
@@ -110,6 +114,10 @@ void  operator delete[](void* ptr, void*
 namespace std  // purposefully not using versioning namespace
 {
 
+#if !defined(_LIBCPP_ABI_MICROSOFT)
+struct _LIBCPP_TYPE_VIS nothrow_t {};
+extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
+
 class _LIBCPP_EXCEPTION_ABI bad_alloc
 : public exception
 {
@@ -128,6 +136,12 @@ public:
 virtual const char* what() const _NOEXCEPT;
 };
 
+typedef void (*new_handler)();
+_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS new_handler get_new_handler() 

[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

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

Accepting before committing.

I wasn't able to split out the MSVC only changes in a fruitful way, so I'm 
going to commit this patch as-is.


https://reviews.llvm.org/D28785



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


[PATCH] D28785: Split exception.cpp and new.cpp implementation into different files for different runtimes

2017-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 87944.
EricWF added a comment.

Merge with upstream.


https://reviews.llvm.org/D28785

Files:
  CMakeLists.txt
  include/exception
  include/new
  include/typeinfo
  src/exception.cpp
  src/new.cpp
  src/support/runtime/exception_fallback.ipp
  src/support/runtime/exception_glibcxx.ipp
  src/support/runtime/exception_libcxxabi.ipp
  src/support/runtime/exception_libcxxrt.ipp
  src/support/runtime/exception_msvc.ipp
  src/support/runtime/exception_pointer_cxxabi.ipp
  src/support/runtime/exception_pointer_glibcxx.ipp
  src/support/runtime/exception_pointer_unimplemented.ipp
  src/support/runtime/new_handler_fallback.ipp
  src/typeinfo.cpp

Index: src/typeinfo.cpp
===
--- src/typeinfo.cpp
+++ src/typeinfo.cpp
@@ -6,74 +6,11 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===--===//
-#include 
-
-#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
-(defined(__APPLE__) || defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI))
-#include 
-#endif
 
 #include "typeinfo"
 
-#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \
-defined(_LIBCPP_ABI_MICROSOFT) // FIXME: This is a temporary workaround
+#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
 std::type_info::~type_info()
 {
 }
 #endif
-
-#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
-
-std::bad_cast::bad_cast() _NOEXCEPT
-{
-}
-
-std::bad_typeid::bad_typeid() _NOEXCEPT
-{
-}
-
-#ifndef __GLIBCXX__
-
-std::bad_cast::~bad_cast() _NOEXCEPT
-{
-}
-
-const char*
-std::bad_cast::what() const _NOEXCEPT
-{
-  return "std::bad_cast";
-}
-
-std::bad_typeid::~bad_typeid() _NOEXCEPT
-{
-}
-
-const char*
-std::bad_typeid::what() const _NOEXCEPT
-{
-  return "std::bad_typeid";
-}
-
-#if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
-  // On Darwin, the cxa_bad_* functions cannot be in the lower level library
-  // because bad_cast and bad_typeid are defined in his higher level library
-  void __cxxabiv1::__cxa_bad_typeid()
-  {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_typeid();
-#else
- _VSTD::abort();
-#endif
-  }
-  void __cxxabiv1::__cxa_bad_cast()
-  {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-  throw std::bad_cast();
-#else
-  _VSTD::abort();
-#endif
-  }
-#endif
-
-#endif  // !__GLIBCXX__
-#endif  // !LIBCXXRT && !_LIBCPPABI_VERSION
Index: src/support/runtime/new_handler_fallback.ipp
===
--- /dev/null
+++ src/support/runtime/new_handler_fallback.ipp
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+namespace std {
+
+_LIBCPP_SAFE_STATIC static std::new_handler __new_handler;
+
+new_handler
+set_new_handler(new_handler handler) _NOEXCEPT
+{
+return __sync_lock_test_and_set(&__new_handler, handler);
+}
+
+new_handler
+get_new_handler() _NOEXCEPT
+{
+return __sync_fetch_and_add(&__new_handler, nullptr);
+}
+
+} // namespace std
Index: src/support/runtime/exception_pointer_unimplemented.ipp
===
--- /dev/null
+++ src/support/runtime/exception_pointer_unimplemented.ipp
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+#include 
+#include 
+
+namespace std {
+
+exception_ptr::~exception_ptr() _NOEXCEPT
+{
+#  warning exception_ptr not yet implemented
+  fprintf(stderr, "exception_ptr not yet implemented\n");
+  ::abort();
+}
+
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
+: __ptr_(other.__ptr_)
+{
+#  warning exception_ptr not yet implemented
+  fprintf(stderr, "exception_ptr not yet implemented\n");
+  ::abort();
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
+{
+#  warning exception_ptr not yet implemented
+  fprintf(stderr, "exception_ptr not yet implemented\n");
+  ::abort();
+}
+
+nested_exception::nested_exception() _NOEXCEPT
+: __ptr_(current_exception())
+{
+}
+
+#if !defined(__GLIBCXX__)
+
+nested_exception::~nested_exception() _NOEXCEPT
+{
+}
+
+#endif
+
+_LIBCPP_NORETURN
+void
+nested_exception::rethrow_nested() const
+{
+#  warning exception_ptr not yet implemented
+  fprintf(stderr, "exception_ptr not yet implemented\n");
+  ::abort();

[libcxx] r294705 - docs: add some documentation for building on Windows

2017-02-09 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Thu Feb  9 21:58:20 2017
New Revision: 294705

URL: http://llvm.org/viewvc/llvm-project?rev=294705=rev
Log:
docs: add some documentation for building on Windows

This covers how to build libc++ for Windows.  This allows others to
replicate the MS ABI style build for libc++.  It only depends on msvcrt
as it uses the Windows threading model and the Windows ABI and can serve
as an ABI compatible replacement for msvcprt.

Modified:
libcxx/trunk/docs/BuildingLibcxx.rst

Modified: libcxx/trunk/docs/BuildingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=294705=294704=294705=diff
==
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)
+++ libcxx/trunk/docs/BuildingLibcxx.rst Thu Feb  9 21:58:20 2017
@@ -92,6 +92,57 @@ build would look like this:
   $ make check-libcxx # optional
 
 
+Experimental Support for Windows
+
+
+The Windows support requires building with clang-cl as cl does not support one
+required extension: `#include_next`.  Furthermore, VS 2015 or newer (19.00) is
+required.  In the case of clang-cl, we need to specify the "MS Compatibility
+Version" as it defaults to 2014 (18.00).
+
+CMake + Visual Studio
+~
+
+Building with Visual Studio currently does not permit running tests. However,
+it is the simplest way to build.
+
+.. code-block:: batch
+
+  > cmake -G "Visual Studio 14 2015"  ^
+  -T "LLVM-vs2014"^
+  -DLIBCXX_ENABLE_SHARED=YES  ^
+  -DLIBCXX_ENABLE_STATIC=NO   ^
+  -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
+  \path\to\libcxx
+  > cmake --build .
+
+CMake + ninja
+~
+
+Building with ninja is required for development to enable tests.
+Unfortunately, doing so requires additional configuration as we cannot
+just specify a toolset.
+
+.. code-block:: batch
+
+  > cmake -G Ninja 
   ^
+  -DCMAKE_MAKE_PROGRAM=/path/to/ninja  
   ^
+  -DCMAKE_SYSTEM_NAME=Windows  
   ^
+  -DCMAKE_C_COMPILER=clang-cl  
   ^
+  -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 
--target=i686--windows"   ^
+  -DCMAKE_CXX_COMPILER=clang-c 
   ^
+  -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 
--target=i686--windows" ^
+  -DLLVM_PATH=/path/to/llvm/tree   
   ^
+  -DLIBCXX_ENABLE_SHARED=YES   
   ^
+  -DLIBCXX_ENABLE_STATIC=NO
   ^
+  -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO  
   ^
+  \path\to\libcxx
+  > /path/to/ninja cxx
+  > /path/to/ninja check-cxx
+
+Note that the paths specified with backward slashes must use the `\\` as the
+directory separator as clang-cl may otherwise parse the path as an argument.
+
 .. _`libc++abi`: http://libcxxabi.llvm.org/
 
 


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


r294703 - For X86-64 linux and PPC64 linux align int128 to 16 bytes.

2017-02-09 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Thu Feb  9 21:32:34 2017
New Revision: 294703

URL: http://llvm.org/viewvc/llvm-project?rev=294703=rev
Log:
For X86-64 linux and PPC64 linux align int128 to 16 bytes.

For other platforms we should find out what they need and likely
make the same change, however, a smaller additional change is easier
for platforms we know have it specified in the ABI.

clang support for r294702

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/target-data.c
cfe/trunk/test/CodeGen/thinlto-multi-module.ll
cfe/trunk/test/CodeGen/thinlto_backend.ll

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294703=294702=294703=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb  9 21:32:34 2017
@@ -1673,15 +1673,35 @@ public:
 IntMaxType = SignedLong;
 Int64Type = SignedLong;
 
-if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-  resetDataLayout("e-m:e-i64:64-n32:64");
+std::string Layout;
+
+// PPC64LE is little endian.
+if (Triple.getArch() == llvm::Triple::ppc64le)
+  Layout = "e";
+else
+  Layout = "E";
+
+Layout += llvm::DataLayout::getManglingComponent(Triple);
+
+Layout += "-i64:64";
+
+// 128 bit integers are always aligned to 128 bits, but only 64-bit 
matters,
+// because __int128 is only supoprted on 64-bit targets.
+// FIXME: See if this is valid on other 64-bit ppc oses.
+if (Triple.isOSLinux())
+  Layout += "-i128:128";
+
+Layout += "-n32:64";
+
+resetDataLayout(Layout);
+
+// PPC64LE started a new ABI.
+if (Triple.getArch() == llvm::Triple::ppc64le)
   ABI = "elfv2";
-} else {
-  resetDataLayout("E-m:e-i64:64-n32:64");
+else
   ABI = "elfv1";
-}
 
-switch (getTriple().getOS()) {
+switch (Triple.getOS()) {
 case llvm::Triple::FreeBSD:
   LongDoubleWidth = LongDoubleAlign = 64;
   LongDoubleFormat = ::APFloat::IEEEdouble();
@@ -4581,11 +4601,21 @@ public:
 Int64Type   = IsX32 ? SignedLongLong   : SignedLong;
 RegParmMax = 6;
 
+// Use 128-bit alignment for 128-bit integers in linux.
+// FIXME: Figure out if we should change this for other oses.
 // Pointers are 32-bit in x32.
-resetDataLayout(IsX32
-? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
-: IsWinCOFF ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
-: "e-m:e-i64:64-f80:128-n8:16:32:64-S128");
+if (IsX32) {
+  if (Triple.isOSLinux())
+resetDataLayout(
+"e-m:e-p:32:32-i64:64-i128:128-f80:128-n8:16:32:64-S128");
+  else
+   resetDataLayout("e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128");
+} else if (IsWinCOFF)
+  resetDataLayout("e-m:w-i64:64-f80:128-n8:16:32:64-S128");
+else if (Triple.isOSLinux())
+  resetDataLayout("e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128");
+else
+  resetDataLayout("e-m:e-i64:64-f80:128-n8:16:32:64-S128");
 
 // Use fpret only for long double.
 RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=294703=294702=294703=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Thu Feb  9 21:32:34 2017
@@ -100,11 +100,11 @@
 
 // RUN: %clang_cc1 -triple powerpc64-linux -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC64-LINUX
-// PPC64-LINUX: target datalayout = "E-m:e-i64:64-n32:64"
+// PPC64-LINUX: target datalayout = "E-m:e-i64:64-i128:128-n32:64"
 
 // RUN: %clang_cc1 -triple powerpc64le-linux -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC64LE-LINUX
-// PPC64LE-LINUX: target datalayout = "e-m:e-i64:64-n32:64"
+// PPC64LE-LINUX: target datalayout = "e-m:e-i64:64-i128:128-n32:64"
 
 // RUN: %clang_cc1 -triple powerpc-darwin -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC32-DARWIN

Modified: cfe/trunk/test/CodeGen/thinlto-multi-module.ll
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-multi-module.ll?rev=294703=294702=294703=diff
==
--- cfe/trunk/test/CodeGen/thinlto-multi-module.ll (original)
+++ cfe/trunk/test/CodeGen/thinlto-multi-module.ll Thu Feb  9 21:32:34 2017
@@ -11,7 +11,7 @@
 ; CHECK-OBJ: T f1
 ; CHECK-OBJ: U f2
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 declare void @f2()

Modified: cfe/trunk/test/CodeGen/thinlto_backend.ll
URL: 

r294700 - [c++1z] In class template argument deduction, all declarators must deduce the same type (just like with auto deduction).

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 21:27:13 2017
New Revision: 294700

URL: http://llvm.org/viewvc/llvm-project?rev=294700=rev
Log:
[c++1z] In class template argument deduction, all declarators must deduce the 
same type (just like with auto deduction).

Added:
cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/
cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=294700=294699=294700=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb  9 21:27:13 
2017
@@ -1923,8 +1923,9 @@ def err_auto_var_deduction_failure_from_
 def err_auto_new_deduction_failure : Error<
   "new expression for type %0 has incompatible constructor argument of type 
%1">;
 def err_auto_different_deductions : Error<
-  "'%select{auto|decltype(auto)|__auto_type}0' deduced as %1 in declaration "
-  "of %2 and deduced as %3 in declaration of %4">;
+  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
+  "deduced as %1 in declaration of %2 and "
+  "deduced as %3 in declaration of %4">;
 def err_auto_non_deduced_not_alone : Error<
   "%select{function with deduced return type|"
   "declaration with trailing return type}0 "

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294700=294699=294700=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Feb  9 21:27:13 2017
@@ -11262,18 +11262,19 @@ Sema::BuildDeclaratorGroup(MutableArrayR
   VarDecl *D = dyn_cast(Group[i]);
   if (!D || D->isInvalidDecl())
 break;
-  AutoType *AT = D->getType()->getContainedAutoType();
-  if (!AT || AT->getDeducedType().isNull())
+  DeducedType *DT = D->getType()->getContainedDeducedType();
+  if (!DT || DT->getDeducedType().isNull())
 continue;
   if (Deduced.isNull()) {
-Deduced = AT->getDeducedType();
+Deduced = DT->getDeducedType();
 DeducedDecl = D;
-  } else if (!Context.hasSameType(AT->getDeducedType(), Deduced)) {
+  } else if (!Context.hasSameType(DT->getDeducedType(), Deduced)) {
+auto *AT = dyn_cast(DT);
 Diag(D->getTypeSourceInfo()->getTypeLoc().getBeginLoc(),
  diag::err_auto_different_deductions)
-  << (unsigned)AT->getKeyword()
+  << (AT ? (unsigned)AT->getKeyword() : 3)
   << Deduced << DeducedDecl->getDeclName()
-  << AT->getDeducedType() << D->getDeclName()
+  << DT->getDeducedType() << D->getDeclName()
   << DeducedDecl->getInit()->getSourceRange()
   << D->getInit()->getSourceRange();
 D->setInvalidDecl();

Added: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp?rev=294700=auto
==
--- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp 
(added)
+++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp 
Thu Feb  9 21:27:13 2017
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++1z -verify %s
+
+template struct A { constexpr A(int = 0) {} };
+A() -> A;
+A(int) -> A;
+
+static constexpr inline const volatile A a = {}; // ok, specifiers are 
permitted
+A b; // FIXME: An initializer is required
+A c [[]] {};
+
+A d = {}, e = {};
+A f(0), g{}; // expected-error {{template arguments deduced as 'A' in 
declaration of 'f' and deduced as 'A' in declaration of 'g'}}


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


LLVM buildmaster will be updated and restarted tonight

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

LLVM buildmaster will be updated and restarted after 8 PM Pacific time
today.

Thanks

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


[libcxx] r294699 - Attempt to fix finding clang++ on Windows

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 21:20:02 2017
New Revision: 294699

URL: http://llvm.org/viewvc/llvm-project?rev=294699=rev
Log:
Attempt to fix finding clang++ on Windows

Modified:
libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=294699=294698=294699=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Thu Feb  9 21:20:02 2017
@@ -198,8 +198,10 @@ class Configuration(object):
 # If no specific cxx_under_test was given, attempt to infer it as
 # clang++.
 if cxx is None or self.cxx_is_clang_cl:
-clangxx = libcxx.util.which('clang++',
- self.config.environment['PATH'])
+search_paths = self.config.environment['PATH']
+if cxx is not None and os.path.isabs(cxx):
+search_paths = os.path.dirname(cxx)
+clangxx = libcxx.util.which('clang++', search_paths)
 if clangxx:
 cxx = clangxx
 self.lit_config.note(


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


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

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



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

faisalv wrote:
> rsmith wrote:
> > faisalv wrote:
> > > I don't think we need this fixme - the type of the expression should be 
> > > correct - all other const checks for mutability have already been 
> > > performed, right?
> > When using `handleLValueToRValueConversion` to obtain the lvalue denoted by 
> > a reference, the type you pass should be the reference type itself 
> > (`FD->getType()`). This approach will give the wrong answer when using a 
> > captured volatile object:
> > ```
> > void f() {
> >   volatile int n;
> >   constexpr volatile int *p = [&]{ return  }(); // should be accepted
> > }
> > ```
> OK - but how is the address of a local variable a constant expression?
I guess this one is safer:
```
void f() {
  volatile int n;
  constexpr volatile int *p = [&]{ return false ?  : nullptr; }();
}
```


https://reviews.llvm.org/D29748



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


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

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



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

rsmith wrote:
> faisalv wrote:
> > I don't think we need this fixme - the type of the expression should be 
> > correct - all other const checks for mutability have already been 
> > performed, right?
> When using `handleLValueToRValueConversion` to obtain the lvalue denoted by a 
> reference, the type you pass should be the reference type itself 
> (`FD->getType()`). This approach will give the wrong answer when using a 
> captured volatile object:
> ```
> void f() {
>   volatile int n;
>   constexpr volatile int *p = [&]{ return  }(); // should be accepted
> }
> ```
OK - but how is the address of a local variable a constant expression?


https://reviews.llvm.org/D29748



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


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

2017-02-09 Thread Faisal Vali via Phabricator via cfe-commits
faisalv updated this revision to Diff 87943.
faisalv marked 6 inline comments as done.
faisalv added a comment.

Incorporated Richard's feedback and added comments.


https://reviews.llvm.org/D29748

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

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

[libcxx] r294698 - __threading_support: fix windows build

2017-02-09 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Thu Feb  9 20:49:52 2017
New Revision: 294698

URL: http://llvm.org/viewvc/llvm-project?rev=294698=rev
Log:
__threading_support: fix windows build

The build was broken as there was no overload for long and
std::chrono::nanoseconds.  Add an explicit conversion to use the
operator+.

Modified:
libcxx/trunk/include/__threading_support

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=294698=294697=294698=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu Feb  9 20:49:52 2017
@@ -591,7 +591,8 @@ void __libcpp_thread_sleep_for(const chr
 {
   using namespace chrono;
   // round-up to the nearest milisecond
-  milliseconds __ms = duration_cast(__ns + 99);
+  milliseconds __ms =
+  duration_cast(__ns + chrono::nanoseconds(99));
   Sleep(__ms.count());
 }
 


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


r294697 - [Concepts] Class template associated constraints

2017-02-09 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Feb  9 20:46:19 2017
New Revision: 294697

URL: http://llvm.org/viewvc/llvm-project?rev=294697=rev
Log:
[Concepts] Class template associated constraints

Summary:
This adds associated constraints as a property of class templates.
An error is produced if redeclarations are not similarly constrained.

Reviewers: rsmith, faisalv, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits, nwilson

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

Added:
cfe/trunk/test/CXX/concepts-ts/temp/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/

cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=294697=294696=294697=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Thu Feb  9 20:46:19 2017
@@ -344,6 +344,32 @@ public:
 // Kinds of Templates
 
//===--===//
 
+/// \brief Stores the template parameter list and associated constraints for
+/// \c TemplateDecl objects that track associated constraints.
+class ConstrainedTemplateDeclInfo {
+  friend TemplateDecl;
+
+public:
+  ConstrainedTemplateDeclInfo() : TemplateParams(), AssociatedConstraints() {}
+
+  TemplateParameterList *getTemplateParameters() const {
+return TemplateParams;
+  }
+
+  Expr *getAssociatedConstraints() const { return AssociatedConstraints; }
+
+protected:
+  void setTemplateParameters(TemplateParameterList *TParams) {
+TemplateParams = TParams;
+  }
+
+  void setAssociatedConstraints(Expr *AC) { AssociatedConstraints = AC; }
+
+  TemplateParameterList *TemplateParams;
+  Expr *AssociatedConstraints;
+};
+
+
 /// \brief The base class of all kinds of template declarations (e.g.,
 /// class, function, etc.).
 ///
@@ -352,33 +378,53 @@ public:
 class TemplateDecl : public NamedDecl {
   void anchor() override;
 protected:
-  // This is probably never used.
-  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name)
+  // Construct a template decl with the given name and parameters.
+  // Used when there is no templated element (e.g., for tt-params).
+  TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
+   SourceLocation L, DeclarationName Name,
+   TemplateParameterList *Params)
   : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr, false),
-TemplateParams(nullptr) {}
+TemplateParams(CTDI) {
+this->setTemplateParameters(Params);
+  }
 
-  // Construct a template decl with the given name and parameters.
-  // Used when there is not templated element (tt-params).
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
TemplateParameterList *Params)
-  : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr, false),
-TemplateParams(Params) {}
+  : TemplateDecl(nullptr, DK, DC, L, Name, Params) {}
 
   // Construct a template decl with name, parameters, and templated element.
-  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
+  TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
+   SourceLocation L, DeclarationName Name,
TemplateParameterList *Params, NamedDecl *Decl)
   : NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl, false),
-TemplateParams(Params) {}
+TemplateParams(CTDI) {
+this->setTemplateParameters(Params);
+  }
+
+  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
+   TemplateParameterList *Params, NamedDecl *Decl)
+  : TemplateDecl(nullptr, DK, DC, L, Name, Params, Decl) {}
 
 public:
   /// Get the list of template parameters
   TemplateParameterList *getTemplateParameters() const {
-return TemplateParams;
+const auto *const CTDI =
+TemplateParams.dyn_cast();
+return CTDI ? CTDI->getTemplateParameters()
+: TemplateParams.get();
   }
 
   /// Get the constraint-expression from the associated requires-clause (if 
any)
   const Expr *getRequiresClause() const {
-return TemplateParams ? TemplateParams->getRequiresClause() : nullptr;
+const TemplateParameterList *const TP = getTemplateParameters();
+return TP ? TP->getRequiresClause() : nullptr;
+  }
+
+  Expr *getAssociatedConstraints() const {
+const TemplateDecl *const C = 

Re: [libcxx] r294696 - Fully qualify (preprend ::) calls to math functions from libc

2017-02-09 Thread Mehdi Amini via cfe-commits
Should we get this in 4.0?

— 
Mehdi


> On Feb 9, 2017, at 6:44 PM, Mehdi Amini via cfe-commits 
>  wrote:
> 
> Author: mehdi_amini
> Date: Thu Feb  9 20:44:23 2017
> New Revision: 294696
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=294696=rev
> Log:
> Fully qualify (preprend ::) calls to math functions from libc
> 
> Summary:
> This can cause a compile failure in cases like:
> 
> double log(double);
> namespace foo {
>  namespace log {}
> }
> using namespace foo;
> void bar(int i) {
>  log((double)i);
> }
> 
> Reviewers: EricWF, mclow.lists
> 
> Subscribers: cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D29804
> 
> Modified:
>libcxx/trunk/include/math.h
> 
> Modified: libcxx/trunk/include/math.h
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/math.h?rev=294696=294695=294696=diff
> ==
> --- libcxx/trunk/include/math.h (original)
> +++ libcxx/trunk/include/math.h Thu Feb  9 20:44:23 2017
> @@ -637,58 +637,58 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y)
> #if !(defined(_AIX) || defined(__sun__))
> inline _LIBCPP_INLINE_VISIBILITY
> float
> -abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
> +abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
> 
> inline _LIBCPP_INLINE_VISIBILITY
> double
> -abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
> +abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
> 
> inline _LIBCPP_INLINE_VISIBILITY
> long double
> -abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
> +abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
> #endif // !(defined(_AIX) || defined(__sun__))
> 
> // acos
> 
> #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
> -inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT  
>  {return acosf(__lcpp_x);}
> -inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) 
> _NOEXCEPT {return acosl(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT  
>  {return ::acosf(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) 
> _NOEXCEPT {return ::acosl(__lcpp_x);}
> #endif
> 
> template 
> inline _LIBCPP_INLINE_VISIBILITY
> typename std::enable_if::value, double>::type
> -acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
> +acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
> 
> // asin
> 
> #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
> -inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT  
>  {return asinf(__lcpp_x);}
> -inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) 
> _NOEXCEPT {return asinl(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT  
>  {return ::asinf(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) 
> _NOEXCEPT {return ::asinl(__lcpp_x);}
> #endif
> 
> template 
> inline _LIBCPP_INLINE_VISIBILITY
> typename std::enable_if::value, double>::type
> -asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
> +asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
> 
> // atan
> 
> #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
> -inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT  
>  {return atanf(__lcpp_x);}
> -inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) 
> _NOEXCEPT {return atanl(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT  
>  {return ::atanf(__lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) 
> _NOEXCEPT {return ::atanl(__lcpp_x);}
> #endif
> 
> template 
> inline _LIBCPP_INLINE_VISIBILITY
> typename std::enable_if::value, double>::type
> -atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
> +atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
> 
> // atan2
> 
> #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
> -inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float 
> __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
> -inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, 
> long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float 
> __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
> +inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, 
> long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
> #endif
> 
> template 
> @@ -704,86 +704,86 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXC
> typedef typename std::__promote<_A1, _A2>::type __result_type;
> 

[PATCH] D29804: Fully qualify (preprend ::) calls to math functions from libc

2017-02-09 Thread Mehdi AMINI via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294696: Fully qualify (preprend ::) calls to math functions 
from libc (authored by mehdi_amini).

Changed prior to commit:
  https://reviews.llvm.org/D29804?vs=87933=87939#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29804

Files:
  libcxx/trunk/include/math.h

Index: libcxx/trunk/include/math.h
===
--- libcxx/trunk/include/math.h
+++ libcxx/trunk/include/math.h
@@ -637,58 +637,58 @@
 #if !(defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY
 float
-abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 double
-abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
+abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 long double
-abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
 #endif // !(defined(_AIX) || defined(__sun__))
 
 // acos
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT   {return acosf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT   {return ::acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
+acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
 
 // asin
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT   {return asinf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT   {return ::asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
+asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
 
 // atan
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT   {return atanf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT   {return ::atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
+atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
 
 // atan2
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
 #endif
 
 template 
@@ -704,86 +704,86 @@
 typedef typename std::__promote<_A1, _A2>::type __result_type;
 static_assert((!(std::is_same<_A1, __result_type>::value &&
  std::is_same<_A2, __result_type>::value)), "");
-return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
+return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
 }
 
 // ceil
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   ceil(float __lcpp_x) _NOEXCEPT   {return ceilf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   ceil(float __lcpp_x) _NOEXCEPT   {return ::ceilf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) 

[libcxx] r294696 - Fully qualify (preprend ::) calls to math functions from libc

2017-02-09 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Thu Feb  9 20:44:23 2017
New Revision: 294696

URL: http://llvm.org/viewvc/llvm-project?rev=294696=rev
Log:
Fully qualify (preprend ::) calls to math functions from libc

Summary:
This can cause a compile failure in cases like:

double log(double);
namespace foo {
  namespace log {}
}
using namespace foo;
void bar(int i) {
  log((double)i);
}

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/include/math.h

Modified: libcxx/trunk/include/math.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/math.h?rev=294696=294695=294696=diff
==
--- libcxx/trunk/include/math.h (original)
+++ libcxx/trunk/include/math.h Thu Feb  9 20:44:23 2017
@@ -637,58 +637,58 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y)
 #if !(defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY
 float
-abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 double
-abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
+abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 long double
-abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
 #endif // !(defined(_AIX) || defined(__sun__))
 
 // acos
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT
   {return acosf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) 
_NOEXCEPT {return acosl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT
   {return ::acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) 
_NOEXCEPT {return ::acosl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
+acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
 
 // asin
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT
   {return asinf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) 
_NOEXCEPT {return asinl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT
   {return ::asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) 
_NOEXCEPT {return ::asinl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
+asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
 
 // atan
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT
   {return atanf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) 
_NOEXCEPT {return atanl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT
   {return ::atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) 
_NOEXCEPT {return ::atanl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
+atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
 
 // atan2
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float 
__lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long 
double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float 
__lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long 
double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
 #endif
 
 template 
@@ -704,86 +704,86 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXC
 typedef typename std::__promote<_A1, _A2>::type __result_type;
 static_assert((!(std::is_same<_A1, __result_type>::value &&
  std::is_same<_A2, __result_type>::value)), "");
-return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
+return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
 }
 
 // ceil
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || 

[PATCH] D29806: [clang-tidy] Add -path option to clang-tidy-diff.py

2017-02-09 Thread Ehsan Akhgari via Phabricator via cfe-commits
ehsan created this revision.
Herald added a subscriber: JDevlieghere.

This flag allows specifying a custom path for the compilation
database.  Unfortunately we can't use the -p flag like other
clang-tidy tools because it's already taken.


https://reviews.llvm.org/D29806

Files:
  clang-tidy/tool/clang-tidy-diff.py
  test/clang-tidy/clang-tidy-diff.cpp


Index: test/clang-tidy/clang-tidy-diff.cpp
===
--- test/clang-tidy/clang-tidy-diff.cpp
+++ test/clang-tidy/clang-tidy-diff.cpp
@@ -2,6 +2,9 @@
 // RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp -- -std=c++11 | 
FileCheck -check-prefix=CHECK-SANITY %s
 // RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff 
-checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
 // RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff 
-checks=-*,modernize-use-override -quiet -- -std=c++11 2>&1 | FileCheck 
-check-prefix=CHECK-QUIET %s
+// RUN: mkdir -p %T/compilation-database-test/
+// RUN: echo '[{"directory": "%T", "command": "clang++ -o test.o -std=c++11 
%t.cpp", "file": "%t.cpp"}]' > 
%T/compilation-database-test/compile_commands.json
+// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff 
-checks=-*,modernize-use-override -path %T/compilation-database-test 2>&1 | 
FileCheck -check-prefix=CHECK %s
 struct A {
   virtual void f() {}
   virtual void g() {}
Index: clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tidy/tool/clang-tidy-diff.py
+++ clang-tidy/tool/clang-tidy-diff.py
@@ -26,11 +26,23 @@
 
 import argparse
 import json
+import os
 import re
 import subprocess
 import sys
 
 
+def find_compilation_database(path):
+  """Adjusts the directory until a compilation database is found."""
+  result = './'
+  while not os.path.isfile(os.path.join(result, path)):
+if os.path.realpath(result) == '/':
+  print 'Error: could not find compilation database.'
+  sys.exit(1)
+result += '../'
+  return os.path.realpath(result)
+
+
 def main():
   parser = argparse.ArgumentParser(description=
'Run clang-tidy against changed files, and '
@@ -55,6 +67,8 @@
   help='checks filter, when not specified, use clang-tidy '
   'default',
   default='')
+  parser.add_argument('-path', dest='build_path',
+  help='Path used to read a compile command database.')
   parser.add_argument('-extra-arg', dest='extra_arg',
   action='append', default=[],
   help='Additional argument to append to the compiler '
@@ -73,6 +87,14 @@
 
   args = parser.parse_args(argv)
 
+  db_path = 'compile_commands.json'
+
+  if args.build_path is not None:
+build_path = args.build_path
+  else:
+# Find our database
+build_path = find_compilation_database(db_path)
+
   # Extract changed lines for each file.
   filename = None
   lines_by_file = {}
@@ -124,6 +146,7 @@
 command.append('-checks=' + quote + args.checks + quote)
   if args.quiet:
 command.append('-quiet')
+  command.append('-p=%s' % build_path)
   command.extend(lines_by_file.keys())
   for arg in args.extra_arg:
   command.append('-extra-arg=%s' % arg)


Index: test/clang-tidy/clang-tidy-diff.cpp
===
--- test/clang-tidy/clang-tidy-diff.cpp
+++ test/clang-tidy/clang-tidy-diff.cpp
@@ -2,6 +2,9 @@
 // RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
 // RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
 // RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -quiet -- -std=c++11 2>&1 | FileCheck -check-prefix=CHECK-QUIET %s
+// RUN: mkdir -p %T/compilation-database-test/
+// RUN: echo '[{"directory": "%T", "command": "clang++ -o test.o -std=c++11 %t.cpp", "file": "%t.cpp"}]' > %T/compilation-database-test/compile_commands.json
+// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -path %T/compilation-database-test 2>&1 | FileCheck -check-prefix=CHECK %s
 struct A {
   virtual void f() {}
   virtual void g() {}
Index: clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tidy/tool/clang-tidy-diff.py
+++ clang-tidy/tool/clang-tidy-diff.py
@@ -26,11 +26,23 @@
 
 import argparse
 import json
+import os
 import re
 import subprocess
 import sys
 
 
+def find_compilation_database(path):
+  """Adjusts the directory until a compilation database is found."""
+  result = './'
+  while not os.path.isfile(os.path.join(result, path)):
+if os.path.realpath(result) == '/':
+  print 'Error: could not find compilation database.'
+  sys.exit(1)
+result += '../'
+  return os.path.realpath(result)
+
+
 def main():
   parser = 

[PATCH] D29804: Fully qualify (preprend ::) calls to math functions from libc

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

This LGTM. Although IDK how far we should go to tolerate collisions with 
imported namespace names, especially since `libc` can't (since they can't add 
the ::qualifier).

I've wrote tests for this change here 
. However I 
don't think they can be applied, since libc implementations
may not tolerate them.


https://reviews.llvm.org/D29804



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


[PATCH] D29369: [ubsan] Omit superflous overflow checks for promoted arithmetic (PR20193)

2017-02-09 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

In https://reviews.llvm.org/D29369#672166, @dtzWill wrote:

> After some thought, can we discuss why this is a good idea?


The goal is to lower ubsan's compile-time + instrumentation overhead at -O0, 
since this reduces the friction of debugging a ubsan-instrumented project.

> This increases the cyclomatic complexity of code that already is difficult to 
> reason about, and seems like it's both brittle and out-of-place in 
> CGExprScalar.

Are there cleanups or ways to reorganize the code that would make this sort of 
change less complex / brittle? I'm open to taking that on.

> It really seems it would be better to let InstCombine or some other 
> analysis/transform deal with proving checks redundant instead of attempting 
> to do so on-the-fly during CodeGen.

-O1/-O2 do get rid of a lot of checks, but they also degrade the debugging 
experience, so it's not really a solution for this use case.

> Can you better motivate why this is worth these costs, or explain your use 
> case a bit more?

I have some numbers from LNT. I did a pre-patch and post-patch run at -O0 + 
-fsanitize=signed-integer-overflow,unsigned-integer-overflow. There were 4,672 
object files produced in each run. This patch brings the average object size 
down from 36,472.0 to 36,378.3 bytes (a 0.26% improvement), and the average 
number of overflow checks per object down from 66.8 to 66.2 (a 0.81% 
improvement).

I don't have reliable compile-time numbers, but not emitting IR really seems 
like a straightforward improvement over emitting/analyzing/removing it.

So, those are the benefits. IMO getting close to 1% better at reducing 
instrumentation overhead is worth the complexity cost here.


https://reviews.llvm.org/D29369



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


r294693 - [c++1z] P0512R0: support for 'explicit' specifier on deduction-guides.

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 20:19:05 2017
New Revision: 294693

URL: http://llvm.org/viewvc/llvm-project?rev=294693=rev
Log:
[c++1z] P0512R0: support for 'explicit' specifier on deduction-guides.

Added:

cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp
cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=294693=294692=294693=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb  9 20:19:05 
2017
@@ -1991,6 +1991,9 @@ def err_deduction_guide_name_not_class_t
   "template template parameter|dependent template name}0 %1">;
 def err_deduction_guide_defines_function : Error<
   "deduction guide cannot have a function definition">;
+def err_deduction_guide_explicit_mismatch : Error<
+  "deduction guide is %select{not |}0declared 'explicit' but "
+  "previous declaration was%select{ not|}0">;
 def err_deduction_guide_specialized : Error<"deduction guide cannot be "
   "%select{explicitly instantiated|explicitly specialized}0">;
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294693=294692=294693=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Feb  9 20:19:05 2017
@@ -7659,11 +7659,12 @@ static FunctionDecl* CreateNewFunctionDe
 
 // We don't need to store much extra information for a deduction guide, so
 // just model it as a plain FunctionDecl.
-// FIXME: Store IsExplicit!
-return FunctionDecl::Create(SemaRef.Context, DC,
-D.getLocStart(),
-NameInfo, R, TInfo, SC, isInline,
-true/*HasPrototype*/, isConstexpr);
+auto *FD = FunctionDecl::Create(SemaRef.Context, DC, D.getLocStart(),
+NameInfo, R, TInfo, SC, isInline,
+true /*HasPrototype*/, isConstexpr);
+if (isExplicit)
+  FD->setExplicitSpecified();
+return FD;
   } else if (DC->isRecord()) {
 // If the name of the function is the same as the name of the record,
 // then this must be an invalid constructor that has a return type.

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=294693=294692=294693=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Feb  9 20:19:05 2017
@@ -647,6 +647,16 @@ bool Sema::MergeCXXFunctionDecl(Function
 Invalid = true;
   }
 
+  // FIXME: It's not clear what should happen if multiple declarations of a
+  // deduction guide have different explicitness. For now at least we simply
+  // reject any case where the explicitness changes.
+  if (New->isDeductionGuide() &&
+  New->isExplicitSpecified() != Old->isExplicitSpecified()) {
+Diag(New->getLocation(), diag::err_deduction_guide_explicit_mismatch)
+  << New->isExplicitSpecified();
+Diag(Old->getLocation(), diag::note_previous_declaration);
+  }
+
   // C++11 [dcl.fct.default]p4: If a friend declaration specifies a default
   // argument expression, that declaration shall be a definition and shall be
   // the only declaration of the function or function template in the

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=294693=294692=294693=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Feb  9 20:19:05 2017
@@ -8324,10 +8324,13 @@ QualType Sema::DeduceTemplateSpecializat
   // C++ [over.match.copy]p1: (non-list copy-initialization from class)
   //   The converting constructors of T are candidate functions.
   if (Kind.isCopyInit() && !ListInit) {
-// FIXME: if (FD->isExplicit()) continue;
+// Only consider converting constructors.
+if (FD->isExplicit())
+  continue;
 
 // When looking for a converting constructor, deduction guides that
-// could never be called with one argument are not interesting.
+// could never be 

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

2017-02-09 Thread Charles Li via Phabricator via cfe-commits
tigerleapgorge abandoned this revision.
tigerleapgorge added a comment.

These tests were failing because I accidentally changed the Objective-C++.
Abandoning this patch.


https://reviews.llvm.org/D29739



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


[PATCH] D29804: Fully qualify (preprend ::) calls to math functions from libc

2017-02-09 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini created this revision.

This can cause a compile failure in cases like:

double log(double);
namespace foo {

  namespace log {}

}
using namespace foo;
void bar(int i) {

  log((double)i);

}


https://reviews.llvm.org/D29804

Files:
  libcxx/include/math.h

Index: libcxx/include/math.h
===
--- libcxx/include/math.h
+++ libcxx/include/math.h
@@ -637,58 +637,58 @@
 #if !(defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY
 float
-abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 double
-abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
+abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 long double
-abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
 #endif // !(defined(_AIX) || defined(__sun__))
 
 // acos
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT   {return acosf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   acos(float __lcpp_x) _NOEXCEPT   {return ::acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
+acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
 
 // asin
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT   {return asinf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   asin(float __lcpp_x) _NOEXCEPT   {return ::asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
+asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
 
 // atan
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT   {return atanf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan(float __lcpp_x) _NOEXCEPT   {return ::atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if::value, double>::type
-atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
+atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
 
 // atan2
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
 #endif
 
 template 
@@ -704,86 +704,86 @@
 typedef typename std::__promote<_A1, _A2>::type __result_type;
 static_assert((!(std::is_same<_A1, __result_type>::value &&
  std::is_same<_A2, __result_type>::value)), "");
-return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
+return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
 }
 
 // ceil
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float   ceil(float __lcpp_x) _NOEXCEPT   {return ceilf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float   ceil(float __lcpp_x) _NOEXCEPT   {return ::ceilf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
 #endif
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename 

[PATCH] D29557: [clang-tools-extra] Fix pthread link

2017-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed as r294690.


https://reviews.llvm.org/D29557



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


[clang-tools-extra] r294690 - [CMake] Fix pthread handling for out-of-tree builds

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 19:59:20 2017
New Revision: 294690

URL: http://llvm.org/viewvc/llvm-project?rev=294690=rev
Log:
[CMake] Fix pthread handling for out-of-tree builds

LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

Modified:
clang-tools-extra/trunk/include-fixer/plugin/CMakeLists.txt

Modified: clang-tools-extra/trunk/include-fixer/plugin/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/plugin/CMakeLists.txt?rev=294690=294689=294690=diff
==
--- clang-tools-extra/trunk/include-fixer/plugin/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/include-fixer/plugin/CMakeLists.txt Thu Feb  9 
19:59:20 2017
@@ -9,5 +9,5 @@ add_clang_library(clangIncludeFixerPlugi
   clangParse
   clangSema
   clangTooling
-  ${PTHREAD_LIB}
+  ${LLVM_PTHREAD_LIB}
   )


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


[PATCH] D29655: [X86] Link safestacksepseg runtime

2017-02-09 Thread Michael LeMay via Phabricator via cfe-commits
mlemay-intel updated this revision to Diff 87932.
mlemay-intel added a comment.

Only link safestacksepseg, not safestack.  I changed the build configuration 
for safestacksepseg to also include the files in safestack.


https://reviews.llvm.org/D29655

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3319,8 +3319,12 @@
 if (SanArgs.linkCXXRuntimes())
   StaticRuntimes.push_back("ubsan_standalone_cxx");
   }
-  if (SanArgs.needsSafeStackRt())
-StaticRuntimes.push_back("safestack");
+  if (SanArgs.needsSafeStackRt()) {
+if (Args.hasFlag(options::OPT_mseparate_stack_seg, 
options::OPT_mno_separate_stack_seg, false))
+  StaticRuntimes.push_back("safestacksepseg");
+else
+  StaticRuntimes.push_back("safestack");
+  }
   if (SanArgs.needsCfiRt())
 StaticRuntimes.push_back("cfi");
   if (SanArgs.needsCfiDiagRt()) {


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3319,8 +3319,12 @@
 if (SanArgs.linkCXXRuntimes())
   StaticRuntimes.push_back("ubsan_standalone_cxx");
   }
-  if (SanArgs.needsSafeStackRt())
-StaticRuntimes.push_back("safestack");
+  if (SanArgs.needsSafeStackRt()) {
+if (Args.hasFlag(options::OPT_mseparate_stack_seg, options::OPT_mno_separate_stack_seg, false))
+  StaticRuntimes.push_back("safestacksepseg");
+else
+  StaticRuntimes.push_back("safestack");
+  }
   if (SanArgs.needsCfiRt())
 StaticRuntimes.push_back("cfi");
   if (SanArgs.needsCfiDiagRt()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

These are all Objective-C++ tests, and AFAIK we don't intend to change the 
default Objective-C++ dialect when we finally do change the default C++ dialect.
So I think these tests do not need to be modified.


https://reviews.llvm.org/D29739



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


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

2017-02-09 Thread David L. Jones via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294689: Adds the commandline need to run clang-tidy tests. 
(authored by dlj).

Changed prior to commit:
  https://reviews.llvm.org/D29737?vs=87728=87930#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29737

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


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


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


[clang-tools-extra] r294689 - Adds the commandline need to run clang-tidy tests.

2017-02-09 Thread David L. Jones via cfe-commits
Author: dlj
Date: Thu Feb  9 19:48:43 2017
New Revision: 294689

URL: http://llvm.org/viewvc/llvm-project?rev=294689=rev
Log:
Adds the commandline need to run clang-tidy tests.

Patch by Jorge Gorbe (lethalantidote)

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

Modified:
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=294689=294688=294689=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Thu Feb  9 19:48:43 2017
@@ -537,6 +537,12 @@ YAML format:
 Testing Checks
 --
 
+To run tests for :program:`clang-tidy` use the command:
+
+.. code-block:: console
+
+  $ ninja check-clang-tools
+
 :program:`clang-tidy` checks can be tested using either unit tests or
 `lit`_ tests. Unit tests may be more convenient to test complex replacements
 with strict checks. `Lit`_ tests allow using partial text matching and regular


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


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

2017-02-09 Thread David L. Jones via Phabricator via cfe-commits
dlj added a comment.

LGTM. I will land shortly.


https://reviews.llvm.org/D29737



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


[PATCH] D27486: Correct class-template deprecation behavior

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



Comment at: include/clang/Basic/Attr.td:301
   bit DuplicatesAllowedWhileMerging = 0;
+  // Set to true if this attribute should apply to template declarations,
+  // remains false if this should only be applied to the definition.

erichkeane wrote:
> rsmith wrote:
> > I find this confusing -- it seems to suggest the attribute would be applied 
> > to the template declaration, not the templated declaration. I also think 
> > that the property we're modelling here is something more general than 
> > something about templates -- rather, I think the property is "is this 
> > attribute only meaningful when applied to / inherited into a defintiion?" 
> > It would also be useful to make clear that this only applies to class 
> > templates; for function templates, we always instantiate all the attributes 
> > with the declaration.
> > 
> > Looking through our current attribute set, it looks like at least `AbiTag` 
> > should also get this set, and maybe also `Visibility`. (Though I wonder if 
> > there would be any problem with always instantiating the full attribute set 
> > for a class declaration.)
> > (Though I wonder if there would be any problem with always instantiating 
> > the full attribute set for a class declaration.)
> 
> This is definitely a good point.  It seems that just about every other usage 
> of instantiating attributes happens right after creation, class template 
> specialization is the lone exception it seems.
> 
> If I were to simply revert most of this change, then alter my 
> SemaTemplate.cpp changes to just call InstantiateAttrs and presumably remove 
> the other call to InstantiateAttrs (since it results in 2 sets of 
> attributes), would you consider that to be more acceptable?
> 
> 
> 
Yes, I think we should at least try that and see if there's a reason why we 
would need the extra complexity here.


https://reviews.llvm.org/D27486



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


r294684 - Sink IsExplicitSpecified flag from CXXConstructorDecl and CXXConversionDecl

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 19:32:04 2017
New Revision: 294684

URL: http://llvm.org/viewvc/llvm-project?rev=294684=rev
Log:
Sink IsExplicitSpecified flag from CXXConstructorDecl and CXXConversionDecl
into FunctionDecl. Makes CXXConversionDecl 8 bytes smaller. No functionality
change intended.

Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=294684=294683=294684=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Feb  9 19:32:04 2017
@@ -1608,6 +1608,7 @@ private:
   unsigned SClass : 2;
   unsigned IsInline : 1;
   unsigned IsInlineSpecified : 1;
+  unsigned IsExplicitSpecified : 1;
   unsigned IsVirtualAsWritten : 1;
   unsigned IsPure : 1;
   unsigned HasInheritedPrototype : 1;
@@ -1708,8 +1709,9 @@ protected:
StartLoc),
 DeclContext(DK), redeclarable_base(C), ParamInfo(nullptr), Body(),
 SClass(S), IsInline(isInlineSpecified),
-IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false),
-IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true),
+IsInlineSpecified(isInlineSpecified), IsExplicitSpecified(false),
+IsVirtualAsWritten(false), IsPure(false),
+HasInheritedPrototype(false), HasWrittenPrototype(true),
 IsDeleted(false), IsTrivial(false), IsDefaulted(false),
 IsExplicitlyDefaulted(false), HasImplicitReturnZero(false),
 IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified),
@@ -1853,6 +1855,19 @@ public:
   bool isVirtualAsWritten() const { return IsVirtualAsWritten; }
   void setVirtualAsWritten(bool V) { IsVirtualAsWritten = V; }
 
+  /// Whether this function is marked as explicit explicitly.
+  bool isExplicitSpecified() const { return IsExplicitSpecified; }
+  void setExplicitSpecified() {
+assert((getKind() == CXXConstructor || getKind() == CXXConversion ||
+isDeductionGuide()) && "cannot be explicit");
+IsExplicitSpecified = true;
+  }
+
+  /// Whether this function is explicit.
+  bool isExplicit() const {
+return getFirstDecl()->isExplicitSpecified();
+  }
+
   /// Whether this virtual function is pure, i.e. makes the containing class
   /// abstract.
   bool isPure() const { return IsPure; }

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=294684=294683=294684=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Feb  9 19:32:04 2017
@@ -2161,13 +2161,9 @@ class CXXConstructorDecl final
   /// \{
   /// \brief The arguments used to initialize the base or member.
   LazyCXXCtorInitializersPtr CtorInitializers;
-  unsigned NumCtorInitializers : 30;
+  unsigned NumCtorInitializers : 31;
   /// \}
 
-  /// \brief Whether this constructor declaration has the \c explicit keyword
-  /// specified.
-  unsigned IsExplicitSpecified : 1;
-
   /// \brief Whether this constructor declaration is an implicitly-declared
   /// inheriting constructor.
   unsigned IsInheritingConstructor : 1;
@@ -2181,11 +2177,12 @@ class CXXConstructorDecl final
 : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
 SC_None, isInline, isConstexpr, SourceLocation()),
   CtorInitializers(nullptr), NumCtorInitializers(0),
-  IsExplicitSpecified(isExplicitSpecified),
   IsInheritingConstructor((bool)Inherited) {
 setImplicit(isImplicitlyDeclared);
 if (Inherited)
   *getTrailingObjects() = Inherited;
+if (isExplicitSpecified)
+  setExplicitSpecified();
   }
 
 public:
@@ -2198,15 +2195,6 @@ public:
  bool isConstexpr,
  InheritedConstructor Inherited = InheritedConstructor());
 
-  /// \brief Determine whether this constructor declaration has the
-  /// \c explicit keyword specified.
-  bool isExplicitSpecified() const { return IsExplicitSpecified; }
-
-  /// \brief Determine whether this constructor was marked "explicit" or not.
-  bool isExplicit() const {
-return cast(getFirstDecl())->isExplicitSpecified();
-  }
-
   /// \brief Iterates through the member/base initializer list.
   typedef CXXCtorInitializer **init_iterator;
 
@@ -2428,19 +2416,17 @@ public:
 /// \endcode
 class CXXConversionDecl : public CXXMethodDecl {
   void anchor() override;
-  /// Whether this conversion function declaration is marked
-  /// "explicit", meaning that it can only be applied when the user
-  /// explicitly wrote a cast. This is a C++11 feature.
-  bool IsExplicitSpecified : 1;
 
   

[PATCH] D22057: Prevent devirtualization of calls to un-instantiated functions.

2017-02-09 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D22057#543199, @Sunil_Srivastava wrote:

> Now: Why the InstantiationIsPending bit is not precisely tracking the 
> presence in the PendingInstantiations list?


[...]

> The instantiation loop removes items from the PendingInstantiations list and 
> instantiates them, if the body is present. In the case of Func2, the body is 
> not present, the function has already been removed from the list, yet it is 
> not isDefined().

I see, so the only case in which the list and the flag differs is when we're 
doing the final instantiation step at the end of the TU? (In all other cases, 
we'd put the function back on the list for later instantiations to retry.) That 
seems fine.


https://reviews.llvm.org/D22057



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


[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

2017-02-09 Thread David L. Jones via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294683: Check for musl-libc's max_align_t in addition to 
other variants. (authored by dlj).

Changed prior to commit:
  https://reviews.llvm.org/D28478?vs=83681=87925#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28478

Files:
  libcxx/trunk/include/cstddef
  libcxx/trunk/include/stddef.h


Index: libcxx/trunk/include/stddef.h
===
--- libcxx/trunk/include/stddef.h
+++ libcxx/trunk/include/stddef.h
@@ -53,7 +53,8 @@
 }
 
 // Re-use the compiler's  max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+!defined(__DEFINED_max_align_t)
 typedef long double max_align_t;
 #endif
 
Index: libcxx/trunk/include/cstddef
===
--- libcxx/trunk/include/cstddef
+++ libcxx/trunk/include/cstddef
@@ -48,7 +48,8 @@
 using ::ptrdiff_t;
 using ::size_t;
 
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+defined(__DEFINED_max_align_t)
 // Re-use the compiler's  max_align_t where possible.
 using ::max_align_t;
 #else


Index: libcxx/trunk/include/stddef.h
===
--- libcxx/trunk/include/stddef.h
+++ libcxx/trunk/include/stddef.h
@@ -53,7 +53,8 @@
 }
 
 // Re-use the compiler's  max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+!defined(__DEFINED_max_align_t)
 typedef long double max_align_t;
 #endif
 
Index: libcxx/trunk/include/cstddef
===
--- libcxx/trunk/include/cstddef
+++ libcxx/trunk/include/cstddef
@@ -48,7 +48,8 @@
 using ::ptrdiff_t;
 using ::size_t;
 
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+defined(__DEFINED_max_align_t)
 // Re-use the compiler's  max_align_t where possible.
 using ::max_align_t;
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r294683 - Check for musl-libc's max_align_t in addition to other variants.

2017-02-09 Thread David L. Jones via cfe-commits
Author: dlj
Date: Thu Feb  9 19:27:42 2017
New Revision: 294683

URL: http://llvm.org/viewvc/llvm-project?rev=294683=rev
Log:
Check for musl-libc's max_align_t in addition to other variants.

Summary:
Libcxx will define its own max_align_t when it is not available. However, the
availability checks today only check for Clang's definition and GCC's
definition. In particular, it does not check for musl's definition, which is the
same as GCC's but guarded with a different macro.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: chandlerc, cfe-commits

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

Modified:
libcxx/trunk/include/cstddef
libcxx/trunk/include/stddef.h

Modified: libcxx/trunk/include/cstddef
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstddef?rev=294683=294682=294683=diff
==
--- libcxx/trunk/include/cstddef (original)
+++ libcxx/trunk/include/cstddef Thu Feb  9 19:27:42 2017
@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 using ::ptrdiff_t;
 using ::size_t;
 
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+defined(__DEFINED_max_align_t)
 // Re-use the compiler's  max_align_t where possible.
 using ::max_align_t;
 #else

Modified: libcxx/trunk/include/stddef.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stddef.h?rev=294683=294682=294683=diff
==
--- libcxx/trunk/include/stddef.h (original)
+++ libcxx/trunk/include/stddef.h Thu Feb  9 19:27:42 2017
@@ -53,7 +53,8 @@ using std::nullptr_t;
 }
 
 // Re-use the compiler's  max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+!defined(__DEFINED_max_align_t)
 typedef long double max_align_t;
 #endif
 


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


[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

2017-02-09 Thread David L. Jones via Phabricator via cfe-commits
dlj added a comment.

In https://reviews.llvm.org/D28478#672959, @EricWF wrote:

> IDK how to meaningly test this though.


Heh. Well... I can tell you that with this change (and a couple of others), I'm 
able to bootstrap Clang (2-stage) using libc++ on Alpine Linux. It totally 
works, I promise! ;-)


https://reviews.llvm.org/D28478



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


[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

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

IDK how to meaningly test this though.


https://reviews.llvm.org/D28478



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


[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

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

LGTM.


https://reviews.llvm.org/D28478



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


[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

2017-02-09 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a reviewer: EricWF.
chandlerc added a comment.

This seems good to me. Check with Eric to see if we try to test this any any 
specific way?


https://reviews.llvm.org/D28478



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


Re: Patch for Bug 30413

2017-02-09 Thread Vedant Kumar via cfe-commits
Hi David,

Thanks for tracking this down.

Do you have a small reproducer to use as a test case? Ideally, you'd add a 
regression test to clang/test/CodeGenObjC, or extend an existing one.

vedant

> On Feb 7, 2017, at 6:42 PM, Lobron, David via cfe-commits 
>  wrote:
> 
> Hello clang developers,
> 
> I discovered a bug that affects Objective-C programs compiled with clang on 
> Linux.  The current code was not emitting Objective-C class name metadata, 
> which made it impossible for programs to do runtime type introspection.  I 
> opened a bug report that describes the problem and provides a test program 
> that reproduces it:
> 
> https://llvm.org/bugs/show_bug.cgi?id=30413
> 
> I've attached an svn-generated patch file: the patch changes one argument to 
> the getObjCEncodingForTypeImpl function from false to true, so that 
> Objective-C class names are encoded.  If this looks OK, it would be great if 
> it could be added to the trunk.  Once that is done, the bug can of course be 
> closed.
> 
> Thank you.
> 
> Sincerely,
> 
> David Lobron
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


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

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



Comment at: test/clang-tidy/readability-delete-null-pointer.cpp:67
+  // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: 'if' statement is 
unnecessary; deleting null pointer has no effect 
[readability-delete-null-pointer]
+  // CHECK-FIXES: {{^  }}
+  // CHECK-FIXES-NEXT: delete mp;

This should match the comment to verify the `if` is deleted.


https://reviews.llvm.org/D29726



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


Re: [libcxx] r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

2017-02-09 Thread Hans Wennborg via cfe-commits
Thanks!

On Thu, Feb 9, 2017 at 4:49 PM, Eric Fiselier  wrote:
> Looks like it is just this change. I merged it in r294681.
>
> /Eric
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

2017-02-09 Thread Eric Fiselier via cfe-commits
Looks like it is just this change. I merged it in r294681.

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


[libcxx] r294681 - Merge r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 18:37:47 2017
New Revision: 294681

URL: http://llvm.org/viewvc/llvm-project?rev=294681=rev
Log:
Merge r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue 
arguments

A static assertion was misfiring since it checked
is_callable. However
the decltype expression doesn't capture the value category as
required. This patch applies extra braces to decltype to fix
that.

Modified:
libcxx/branches/release_40/include/variant

libcxx/branches/release_40/test/std/utilities/variant/variant.visit/visit.pass.cpp

Modified: libcxx/branches/release_40/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/variant?rev=294681=294680=294681=diff
==
--- libcxx/branches/release_40/include/variant (original)
+++ libcxx/branches/release_40/include/variant Thu Feb  9 18:37:47 2017
@@ -574,7 +574,7 @@ private:
 constexpr decltype(auto) operator()(_Alts&&... __alts) const {
   __std_visit_exhaustive_visitor_check<
   _Visitor,
-  decltype(_VSTD::forward<_Alts>(__alts).__value)...>();
+  decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
   return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
 _VSTD::forward<_Alts>(__alts).__value...);
 }

Modified: 
libcxx/branches/release_40/test/std/utilities/variant/variant.visit/visit.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/test/std/utilities/variant/variant.visit/visit.pass.cpp?rev=294681=294680=294681=diff
==
--- 
libcxx/branches/release_40/test/std/utilities/variant/variant.visit/visit.pass.cpp
 (original)
+++ 
libcxx/branches/release_40/test/std/utilities/variant/variant.visit/visit.pass.cpp
 Thu Feb  9 18:37:47 2017
@@ -283,9 +283,20 @@ void test_exceptions() {
 #endif
 }
 
+// See http://llvm.org/PR31916
+void test_caller_accepts_nonconst() {
+  struct A {};
+  struct Visitor {
+void operator()(A&) {}
+  };
+  std::variant v;
+  std::visit(Visitor{}, v);
+}
+
 int main() {
   test_call_operator_forwarding();
   test_argument_forwarding();
   test_constexpr();
   test_exceptions();
+  test_caller_accepts_nonconst();
 }


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


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

2017-02-09 Thread Richard Smith via cfe-commits
On 9 February 2017 at 16:15, Hal Finkel via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 02/09/2017 04:58 PM, Chandler Carruth wrote:
>
> On Thu, Feb 9, 2017 at 2:46 PM Tobias von Koch 
> wrote:
>
>> On Wed, Feb 8, 2017 at 7:21 PM, Chandler Carruth 
>> wrote:
>>
>>
>> +// The Freescale PPC SDK has the gcc libraries in
>> +// /usr/lib//x.y.z so have a look there as well.
>> +"/" + CandidateTriple.str(),
>>
>>
>> So, this is really bad it turns out.
>>
>> We use this directory to walk every installed GCC version. But because
>> this is just a normal lib directory on many systems (ever Debian and Ubuntu
>> system for example) this goes very badly. It goes even more badly because
>> of the (questionable) design of LLVM's directory iterator:
>>
>>
>> Wow, this is pretty bad, but it really sounds like the iterator should be
>> fixed rather than trying to hack around it.
>>
>
> I mean, we should.
>
> But even then, walking the entire directory seems bad too... See below.
>
>
> Agreed. FWIW, it looks like LLVM's directory iterators stat lazily
> (although doing an equality comparison will cause them to stat). Is going
> through Clang's VFS layer causing the eager stating somehow?
>

Yes, the eager stating appears to be in the Clang VFS directory_iterator,
not the LLVM one.

> Doesn't this happen for the other directories as well (which, admittedly,
>> will have less entries)?
>>
>
> The *only* entries in the other directories are the actual installed GCC
> toolchains though, so walking them makes a lot of sense. The tricky thing
> is that this isn't a gcc-specific directory.
>
> I suspect the fix should be to not use this base path as part of the walk
> to discover GCC toolchains, and instead to hard code the specific toolchain
> patterns on this specific platform.
>
> Or we could do the walk, but only when actually on the NXP/Freescale Power
> platform where this is necessary to find GCC installations.
>
>
> Given that we don't have a platform on which to test right now, I think
> that this second option sounds best. Only add those directories to the
> search path when -fsl- is in the triple (or something like that).
>
>  -Hal
>
>
> Both of those would seem reasonable. Fixing the directory iterator would
> be icing on the cake IMO. =D
>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> 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
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294680 - Update C style comments to C++ style.

2017-02-09 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Thu Feb  9 18:20:26 2017
New Revision: 294680

URL: http://llvm.org/viewvc/llvm-project?rev=294680=rev
Log:
Update C style comments to C++ style.

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

Modified: cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp?rev=294680=294679=294680=diff
==
--- cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp (original)
+++ cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp Thu Feb  9 18:20:26 2017
@@ -61,19 +61,17 @@ void MacroPPCallbacks::writeMacroDefinit
 MacroPPCallbacks::MacroPPCallbacks(CodeGenerator *Gen, Preprocessor )
 : Gen(Gen), PP(PP), Status(NoScope) {}
 
-/*
-  This is the expected flow of enter/exit compiler and user files:
-  - Main File Enter
--  file enter
-  {Compiler macro definitions} - (Line=0, no scope)
-  - (Optional)  file enter
-  {Command line macro definitions} - (Line=0, no scope)
-  - (Optional)  file exit
-  {Command line file includes} - (Line=0, Main file scope)
-{macro definitions and file includes} - (Line!=0, Parent scope)
--  file exit
-{User code macro definitions and file includes} - (Line!=0, Parent scope)
-*/
+// This is the expected flow of enter/exit compiler and user files:
+// - Main File Enter
+//   -  file enter
+// {Compiler macro definitions} - (Line=0, no scope)
+// - (Optional)  file enter
+// {Command line macro definitions} - (Line=0, no scope)
+// - (Optional)  file exit
+// {Command line file includes} - (Line=0, Main file scope)
+//   {macro definitions and file includes} - (Line!=0, Parent scope)
+//   -  file exit
+//   {User code macro definitions and file includes} - (Line!=0, Parent scope)
 
 llvm::DIMacroFile *MacroPPCallbacks::getCurrentScope() {
   if (Status == MainFileScope || Status == CommandLineIncludeScope)


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


[PATCH] D29157: [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export members

2017-02-09 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai updated this revision to Diff 87912.
smeenai added a comment.

Rebase and ping


https://reviews.llvm.org/D29157

Files:
  include/__config
  include/locale
  include/string

Index: include/string
===
--- include/string
+++ include/string
@@ -792,6 +792,7 @@
 basic_string(const basic_string& __str, size_type __pos,
  const allocator_type& __a = allocator_type());
 template
+_LIBCPP_HIDDEN
 basic_string(const _Tp& __t, size_type __pos, size_type __n, 
  const allocator_type& __a = allocator_type(),
  typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
@@ -927,6 +928,7 @@
 basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); }
 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
 template 
+_LIBCPP_HIDDEN
 typename enable_if
 <
 __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -988,6 +990,7 @@
 #endif
 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
 template 
+_LIBCPP_HIDDEN
 typename enable_if
 <
 __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1023,6 +1026,7 @@
 _LIBCPP_INLINE_VISIBILITY
 basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
 template 
+_LIBCPP_HIDDEN
 typename enable_if
 <
 __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1037,14 +1041,16 @@
 _LIBCPP_INLINE_VISIBILITY
 iterator  insert(const_iterator __pos, size_type __n, value_type __c);
 template
+_LIBCPP_HIDDEN
 typename enable_if
 <
__is_exactly_input_iterator<_InputIterator>::value
 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
 iterator
 >::type
 insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
 template
+_LIBCPP_HIDDEN
 typename enable_if
 <
 __is_forward_iterator<_ForwardIterator>::value
@@ -1070,6 +1076,7 @@
 basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); }
 basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
 template 
+_LIBCPP_HIDDEN
 typename enable_if
 <
 __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1090,6 +1097,7 @@
 _LIBCPP_INLINE_VISIBILITY
 basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
 template
+inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
 __is_input_iterator<_InputIterator>::value,
Index: include/locale
===
--- include/locale
+++ include/locale
@@ -623,16 +623,19 @@
 ~num_get() {}
 
 template 
+_LIBCPP_HIDDEN
 iter_type __do_get_floating_point
 (iter_type __b, iter_type __e, ios_base& __iob,
  ios_base::iostate& __err, _Fp& __v) const;
 
 template 
+_LIBCPP_HIDDEN
 iter_type __do_get_signed
 (iter_type __b, iter_type __e, ios_base& __iob,
  ios_base::iostate& __err, _Signed& __v) const;
 
 template 
+_LIBCPP_HIDDEN
 iter_type __do_get_unsigned
 (iter_type __b, iter_type __e, ios_base& __iob,
  ios_base::iostate& __err, _Unsigned& __v) const;
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -669,7 +669,7 @@
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
-#define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default")))
+#define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
 #  else
 #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
 #  endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2017-02-09 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai updated this revision to Diff 87911.
smeenai added a comment.

Rebase and ping


https://reviews.llvm.org/D25208

Files:
  docs/DesignDocs/VisibilityMacros.rst
  include/__config
  include/__locale
  include/__mutex_base
  include/condition_variable
  include/future
  include/mutex
  include/thread

Index: include/thread
===
--- include/thread
+++ include/thread
@@ -300,7 +300,9 @@
  >
 explicit thread(_Fp&& __f, _Args&&... __args);
 #else  // _LIBCPP_HAS_NO_VARIADICS
-template  explicit thread(_Fp __f);
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+explicit thread(_Fp __f);
 #endif
 ~thread();
 
Index: include/mutex
===
--- include/mutex
+++ include/mutex
@@ -248,6 +248,7 @@
 bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
 {return try_lock_until(chrono::steady_clock::now() + __d);}
 template 
+_LIBCPP_HIDDEN
 bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
 void unlock() _NOEXCEPT;
 };
@@ -291,6 +292,7 @@
 bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
 {return try_lock_until(chrono::steady_clock::now() + __d);}
 template 
+_LIBCPP_HIDDEN
 bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
 void unlock() _NOEXCEPT;
 };
Index: include/future
===
--- include/future
+++ include/future
@@ -582,7 +582,7 @@
 _LIBCPP_INLINE_VISIBILITY
 wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
 template 
-future_status
+_LIBCPP_HIDDEN future_status
 wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
 
 virtual void __execute();
@@ -1674,6 +1674,7 @@
 public:
 promise();
 template 
+_LIBCPP_HIDDEN
 promise(allocator_arg_t, const _Allocator& __a);
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 _LIBCPP_INLINE_VISIBILITY
Index: include/condition_variable
===
--- include/condition_variable
+++ include/condition_variable
@@ -133,13 +133,14 @@
 void notify_all() _NOEXCEPT;
 
 template 
+_LIBCPP_HIDDEN
 void wait(_Lock& __lock);
 template 
 _LIBCPP_INLINE_VISIBILITY
 void wait(_Lock& __lock, _Predicate __pred);
 
 template 
-cv_status
+_LIBCPP_HIDDEN cv_status
 wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t);
 
Index: include/__mutex_base
===
--- include/__mutex_base
+++ include/__mutex_base
@@ -316,21 +316,22 @@
 
 void wait(unique_lock& __lk) _NOEXCEPT;
 template 
+inline _LIBCPP_INLINE_VISIBILITY
 void wait(unique_lock& __lk, _Predicate __pred);
 
 template 
-cv_status
+_LIBCPP_HIDDEN cv_status
 wait_until(unique_lock& __lk,
const chrono::time_point<_Clock, _Duration>& __t);
 
 template 
-bool
+_LIBCPP_HIDDEN bool
 wait_until(unique_lock& __lk,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
 
 template 
-cv_status
+_LIBCPP_HIDDEN cv_status
 wait_for(unique_lock& __lk,
  const chrono::duration<_Rep, _Period>& __d);
 
Index: include/__locale
===
--- include/__locale
+++ include/__locale
@@ -92,13 +92,16 @@
 
 const locale& operator=(const locale&)  _NOEXCEPT;
 
-template  locale combine(const locale&) const;
+template 
+  inline _LIBCPP_INLINE_VISIBILITY
+  locale combine(const locale&) const;
 
 // locale operations:
 string name() const;
 bool operator==(const locale&) const;
 bool operator!=(const locale& __y) const {return !(*this == __y);}
 template 
+  inline _LIBCPP_INLINE_VISIBILITY
   bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
   const basic_string<_CharT, _Traits, _Allocator>&) const;
 
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -625,18 +625,22 @@
 
 #ifndef _LIBCPP_TYPE_VIS
 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-#if __has_attribute(__type_visibility__)
-#  define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
-#else
-#  define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-#endif
+#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
 #  else
 #define _LIBCPP_TYPE_VIS
 #  endif
 #endif
 
 #ifndef _LIBCPP_TEMPLATE_VIS
-# define 

Re: [libcxx] r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

2017-02-09 Thread Eric Fiselier via cfe-commits
This change stands on it's own. But I think there were another couple of
 bug fixes in the past week.
I'm going to look into merging those as well.

/Eric

On Thu, Feb 9, 2017 at 2:56 PM, Hans Wennborg  wrote:

> Sounds good to me. You said "these changes"; are there more than this one?
>
> On Thu, Feb 9, 2017 at 11:15 AM, Eric Fiselier  wrote:
> > I'm planning to merge this fix into the 4.0 release branch.
> >
> > Although not a regression, since  is a new feature, it would
> still
> > be nice to ship without this bug.
> >
> > I'll merge these changes later today if there are no objections, and once
> > all the bots pass.
> >
> > /Eric
> >
> > On Thu, Feb 9, 2017 at 12:01 PM, Eric Fiselier via cfe-commits
> >  wrote:
> >>
> >> Author: ericwf
> >> Date: Thu Feb  9 13:01:22 2017
> >> New Revision: 294612
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=294612=rev
> >> Log:
> >> Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
> >>
> >> A static assertion was misfiring since it checked
> >> is_callable. However
> >> the decltype expression doesn't capture the value category as
> >> required. This patch applies extra braces to decltype to fix
> >> that.
> >>
> >> Modified:
> >> libcxx/trunk/include/variant
> >> libcxx/trunk/test/std/utilities/variant/variant.
> visit/visit.pass.cpp
> >>
> >> Modified: libcxx/trunk/include/variant
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> variant?rev=294612=294611=294612=diff
> >>
> >> 
> ==
> >> --- libcxx/trunk/include/variant (original)
> >> +++ libcxx/trunk/include/variant Thu Feb  9 13:01:22 2017
> >> @@ -578,7 +578,7 @@ private:
> >>  constexpr decltype(auto) operator()(_Alts&&... __alts) const {
> >>__std_visit_exhaustive_visitor_check<
> >>_Visitor,
> >> -  decltype(_VSTD::forward<_Alts>(__alts).__value)...>();
> >> +  decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
> >>return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
> >>
> >> _VSTD::forward<_Alts>(__alts).__value...);
> >>  }
> >>
> >> Modified:
> >> libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> utilities/variant/variant.visit/visit.pass.cpp?rev=
> 294612=294611=294612=diff
> >>
> >> 
> ==
> >> --- libcxx/trunk/test/std/utilities/variant/variant.
> visit/visit.pass.cpp
> >> (original)
> >> +++ libcxx/trunk/test/std/utilities/variant/variant.
> visit/visit.pass.cpp
> >> Thu Feb  9 13:01:22 2017
> >> @@ -283,9 +283,20 @@ void test_exceptions() {
> >>  #endif
> >>  }
> >>
> >> +// See http://llvm.org/PR31916
> >> +void test_caller_accepts_nonconst() {
> >> +  struct A {};
> >> +  struct Visitor {
> >> +void operator()(A&) {}
> >> +  };
> >> +  std::variant v;
> >> +  std::visit(Visitor{}, v);
> >> +}
> >> +
> >>  int main() {
> >>test_call_operator_forwarding();
> >>test_argument_forwarding();
> >>test_constexpr();
> >>test_exceptions();
> >> +  test_caller_accepts_nonconst();
> >>  }
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread David Blaikie via cfe-commits
r294676

On Thu, Feb 9, 2017 at 4:05 PM David L. Jones via Phabricator <
revi...@reviews.llvm.org> wrote:

> dlj added inline comments.
>
>
> 
> Comment at: cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp:125
> +  switch (Status) {
> +  default:
> +llvm_unreachable("Do not expect to enter a file from current scope");
> 
> As a heads up... this fails under -Werror:
>
> llvm/tools/clang/lib/CodeGen/MacroPPCallbacks.cpp:125:3: error: default
> label in switch which covers all enumeration values
> [-Werror,-Wcovered-switch-default]
>   default:
>   ^
> 1 error generated.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D16135
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294676 - Fix the -Werror build by removing an unused default in a fully covered switch

2017-02-09 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Thu Feb  9 18:06:38 2017
New Revision: 294676

URL: http://llvm.org/viewvc/llvm-project?rev=294676=rev
Log:
Fix the -Werror build by removing an unused default in a fully covered switch

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

Modified: cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp?rev=294676=294675=294676=diff
==
--- cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp (original)
+++ cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp Thu Feb  9 18:06:38 2017
@@ -122,8 +122,6 @@ void MacroPPCallbacks::updateStatusToNex
 void MacroPPCallbacks::FileEntered(SourceLocation Loc) {
   SourceLocation LineLoc = getCorrectLocation(LastHashLoc);
   switch (Status) {
-  default:
-llvm_unreachable("Do not expect to enter a file from current scope");
   case NoScope:
 updateStatusToNextScope();
 break;


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


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

2017-02-09 Thread Hal Finkel via cfe-commits


On 02/09/2017 04:58 PM, Chandler Carruth wrote:
On Thu, Feb 9, 2017 at 2:46 PM Tobias von Koch 
> wrote:


On Wed, Feb 8, 2017 at 7:21 PM, Chandler Carruth
> wrote:


+// The Freescale PPC SDK has the gcc libraries in
+// /usr/lib//x.y.z so have a look
there as well.
+"/" + CandidateTriple.str(),


So, this is really bad it turns out.

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


Wow, this is pretty bad, but it really sounds like the iterator
should be fixed rather than trying to hack around it.


I mean, we should.

But even then, walking the entire directory seems bad too... See below.


Agreed. FWIW, it looks like LLVM's directory iterators stat lazily 
(although doing an equality comparison will cause them to stat). Is 
going through Clang's VFS layer causing the eager stating somehow?



Doesn't this happen for the other directories as well (which,
admittedly, will have less entries)?


The *only* entries in the other directories are the actual installed 
GCC toolchains though, so walking them makes a lot of sense. The 
tricky thing is that this isn't a gcc-specific directory.


I suspect the fix should be to not use this base path as part of the 
walk to discover GCC toolchains, and instead to hard code the specific 
toolchain patterns on this specific platform.


Or we could do the walk, but only when actually on the NXP/Freescale 
Power platform where this is necessary to find GCC installations.


Given that we don't have a platform on which to test right now, I think 
that this second option sounds best. Only add those directories to the 
search path when -fsl- is in the triple (or something like that).


 -Hal



Both of those would seem reasonable. Fixing the directory iterator 
would be icing on the cake IMO. =D


--
Hal Finkel
Lead, Compiler Technology and Programming Languages
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


[libcxx] r294673 - Add missing libc++ import

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 18:01:01 2017
New Revision: 294673

URL: http://llvm.org/viewvc/llvm-project?rev=294673=rev
Log:
Add missing libc++ import

Modified:
libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=294673=294672=294673=diff
==
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Thu Feb  9 18:01:01 2017
@@ -21,6 +21,7 @@ from libcxx.compiler import CXXCompiler
 from libcxx.test.target_info import make_target_info
 from libcxx.test.executor import *
 from libcxx.test.tracing import *
+import libcxx.util
 
 def loadSiteConfig(lit_config, config, param_name, env_name):
 # We haven't loaded the site specific configuration (the user is


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


[libcxxabi] r294671 - Fix path to libc++'s python test module

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 17:58:54 2017
New Revision: 294671

URL: http://llvm.org/viewvc/llvm-project?rev=294671=rev
Log:
Fix path to libc++'s python test module

Modified:
libcxxabi/trunk/test/lit.cfg

Modified: libcxxabi/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.cfg?rev=294671=294670=294671=diff
==
--- libcxxabi/trunk/test/lit.cfg (original)
+++ libcxxabi/trunk/test/lit.cfg Thu Feb  9 17:58:54 2017
@@ -29,7 +29,7 @@ config.test_source_root = os.path.dirnam
 libcxx_src_root = getattr(config, 'libcxx_src_root', None)
 if not libcxx_src_root:
 libcxx_src_root = os.path.join(config.test_source_root, '../../libcxx')
-libcxx_test_src_root = os.path.join(libcxx_src_root, 'test')
+libcxx_test_src_root = os.path.join(libcxx_src_root, 'utils')
 if os.path.isfile(os.path.join(libcxx_test_src_root, 'libcxx', '__init__.py')):
 site.addsitedir(libcxx_test_src_root)
 else:


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


[PATCH] D16135: Macro Debug Info support in Clang

2017-02-09 Thread David L. Jones via Phabricator via cfe-commits
dlj added inline comments.



Comment at: cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp:125
+  switch (Status) {
+  default:
+llvm_unreachable("Do not expect to enter a file from current scope");

As a heads up... this fails under -Werror:

llvm/tools/clang/lib/CodeGen/MacroPPCallbacks.cpp:125:3: error: default label 
in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
1 error generated.


Repository:
  rL LLVM

https://reviews.llvm.org/D16135



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


[PATCH] D29770: [Assembler] Inline assembly diagnostics test.

2017-02-09 Thread Eric Christopher via Phabricator via cfe-commits
echristo added a comment.

Can we not get llc to use the diags interfaces here?


https://reviews.llvm.org/D29770



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


r294662 - Add support for armv7ve flag in clang (PR31358).

2017-02-09 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Thu Feb  9 17:30:10 2017
New Revision: 294662

URL: http://llvm.org/viewvc/llvm-project?rev=294662=rev
Log:
Add support for armv7ve flag in clang (PR31358).

This is a followup change to add v7ve support to clang for gcc
compatibility. Please see r294661.

Patch by Manoj Gupta.

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/arm-acle-6.4.c
cfe/trunk/test/Preprocessor/arm-acle-6.5.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=294662=294661=294662=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb  9 17:30:10 2017
@@ -5063,6 +5063,8 @@ class ARMTargetInfo : public TargetInfo
   return "7M";
 case llvm::ARM::AK_ARMV7EM:
   return "7EM";
+case llvm::ARM::AK_ARMV7VE:
+  return "7VE";
 case llvm::ARM::AK_ARMV8A:
   return "8A";
 case llvm::ARM::AK_ARMV8_1A:

Modified: cfe/trunk/test/Preprocessor/arm-acle-6.4.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-acle-6.4.c?rev=294662=294661=294662=diff
==
--- cfe/trunk/test/Preprocessor/arm-acle-6.4.c (original)
+++ cfe/trunk/test/Preprocessor/arm-acle-6.4.c Thu Feb  9 17:30:10 2017
@@ -120,6 +120,21 @@
 
 // CHECK-V7A-NO-IDIV-NOT: __ARM_FEATURE_IDIV
 
+// RUN: %clang -target arm-none-linux-eabi -march=armv7ve -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V7VE
+
+// CHECK-V7VE: __ARM_ARCH 7
+// CHECK-V7VE: __ARM_ARCH_ISA_ARM 1
+// CHECK-V7VE: __ARM_ARCH_ISA_THUMB 2
+// CHECK-V7VE: __ARM_ARCH_PROFILE 'A'
+// CHECK-V7VE: __ARM_FEATURE_CLZ 1
+// CHECK-V7VE: __ARM_FEATURE_DSP 1
+// CHECK-V7VE: __ARM_FEATURE_IDIV 1
+// CHECK-V7VE: __ARM_FEATURE_LDREX 0xF
+// CHECK-V7VE: __ARM_FEATURE_QBIT 1
+// CHECK-V7VE: __ARM_FEATURE_SAT 1
+// CHECK-V7VE: __ARM_FEATURE_SIMD32 1
+// CHECK-V7VE: __ARM_FEATURE_UNALIGNED 1
+
 // RUN: %clang -target arm-none-linux-eabi -march=armv7-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V7R
 
 // CHECK-V7R: __ARM_ARCH 7

Modified: cfe/trunk/test/Preprocessor/arm-acle-6.5.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-acle-6.5.c?rev=294662=294661=294662=diff
==
--- cfe/trunk/test/Preprocessor/arm-acle-6.5.c (original)
+++ cfe/trunk/test/Preprocessor/arm-acle-6.5.c Thu Feb  9 17:30:10 2017
@@ -24,6 +24,7 @@
 // RUN: %clang -target arm-eabi -mfpu=neon -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 // RUN: %clang -target armv6-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
+// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 
 // CHECK-SP-DP: __ARM_FP 0xC
 
@@ -51,6 +52,8 @@
 
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
 // RUN: %clang -target armv7a-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck 
%s -check-prefix CHECK-FMA
+// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
+// RUN: %clang -target armv7ve-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-FMA
 // RUN: %clang -target armv7r-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
 // RUN: %clang -target armv7r-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck 
%s -check-prefix CHECK-FMA
 // RUN: %clang -target armv7em-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-FMA

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=294662=294661=294662=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Thu Feb  9 17:30:10 2017
@@ -27,6 +27,13 @@
 // CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
 // CHECK-V7: #define __ARM_FP 0xC
 
+// RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V7VE %s
+// CHECK-V7VE: #define __ARMEL__ 1
+// CHECK-V7VE: #define __ARM_ARCH 7
+// CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
+// CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
+// CHECK-V7VE: #define __ARM_FP 0xC
+
 // RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o 
- | FileCheck -match-full-lines --check-prefix=CHECK-V7S %s
 // CHECK-V7S: #define __ARMEL__ 1
 // CHECK-V7S: #define __ARM_ARCH 7



[PATCH] D29773: Add support for armv7ve flag in clang (PR31358).

2017-02-09 Thread George Burgess IV via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294662: Add support for armv7ve flag in clang (PR31358). 
(authored by gbiv).

Changed prior to commit:
  https://reviews.llvm.org/D29773?vs=87831=87899#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29773

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/Preprocessor/arm-acle-6.4.c
  cfe/trunk/test/Preprocessor/arm-acle-6.5.c
  cfe/trunk/test/Preprocessor/arm-target-features.c


Index: cfe/trunk/test/Preprocessor/arm-acle-6.5.c
===
--- cfe/trunk/test/Preprocessor/arm-acle-6.5.c
+++ cfe/trunk/test/Preprocessor/arm-acle-6.5.c
@@ -24,6 +24,7 @@
 // RUN: %clang -target arm-eabi -mfpu=neon -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 // RUN: %clang -target armv6-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
+// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-SP-DP
 
 // CHECK-SP-DP: __ARM_FP 0xC
 
@@ -51,6 +52,8 @@
 
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
 // RUN: %clang -target armv7a-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck 
%s -check-prefix CHECK-FMA
+// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
+// RUN: %clang -target armv7ve-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | 
FileCheck %s -check-prefix CHECK-FMA
 // RUN: %clang -target armv7r-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-NO-FMA
 // RUN: %clang -target armv7r-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck 
%s -check-prefix CHECK-FMA
 // RUN: %clang -target armv7em-eabi -x c -E -dM %s -o - | FileCheck %s 
-check-prefix CHECK-FMA
Index: cfe/trunk/test/Preprocessor/arm-target-features.c
===
--- cfe/trunk/test/Preprocessor/arm-target-features.c
+++ cfe/trunk/test/Preprocessor/arm-target-features.c
@@ -27,6 +27,13 @@
 // CHECK-V7-NOT: __ARM_FEATURE_DIRECTED_ROUNDING
 // CHECK-V7: #define __ARM_FP 0xC
 
+// RUN: %clang -target armv7ve-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V7VE %s
+// CHECK-V7VE: #define __ARMEL__ 1
+// CHECK-V7VE: #define __ARM_ARCH 7
+// CHECK-V7VE: #define __ARM_ARCH_7VE__ 1
+// CHECK-V7VE: #define __ARM_ARCH_EXT_IDIV__ 1
+// CHECK-V7VE: #define __ARM_FP 0xC
+
 // RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o 
- | FileCheck -match-full-lines --check-prefix=CHECK-V7S %s
 // CHECK-V7S: #define __ARMEL__ 1
 // CHECK-V7S: #define __ARM_ARCH 7
Index: cfe/trunk/test/Preprocessor/arm-acle-6.4.c
===
--- cfe/trunk/test/Preprocessor/arm-acle-6.4.c
+++ cfe/trunk/test/Preprocessor/arm-acle-6.4.c
@@ -120,6 +120,21 @@
 
 // CHECK-V7A-NO-IDIV-NOT: __ARM_FEATURE_IDIV
 
+// RUN: %clang -target arm-none-linux-eabi -march=armv7ve -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V7VE
+
+// CHECK-V7VE: __ARM_ARCH 7
+// CHECK-V7VE: __ARM_ARCH_ISA_ARM 1
+// CHECK-V7VE: __ARM_ARCH_ISA_THUMB 2
+// CHECK-V7VE: __ARM_ARCH_PROFILE 'A'
+// CHECK-V7VE: __ARM_FEATURE_CLZ 1
+// CHECK-V7VE: __ARM_FEATURE_DSP 1
+// CHECK-V7VE: __ARM_FEATURE_IDIV 1
+// CHECK-V7VE: __ARM_FEATURE_LDREX 0xF
+// CHECK-V7VE: __ARM_FEATURE_QBIT 1
+// CHECK-V7VE: __ARM_FEATURE_SAT 1
+// CHECK-V7VE: __ARM_FEATURE_SIMD32 1
+// CHECK-V7VE: __ARM_FEATURE_UNALIGNED 1
+
 // RUN: %clang -target arm-none-linux-eabi -march=armv7-r -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V7R
 
 // CHECK-V7R: __ARM_ARCH 7
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -5063,6 +5063,8 @@
   return "7M";
 case llvm::ARM::AK_ARMV7EM:
   return "7EM";
+case llvm::ARM::AK_ARMV7VE:
+  return "7VE";
 case llvm::ARM::AK_ARMV8A:
   return "8A";
 case llvm::ARM::AK_ARMV8_1A:


Index: cfe/trunk/test/Preprocessor/arm-acle-6.5.c
===
--- cfe/trunk/test/Preprocessor/arm-acle-6.5.c
+++ cfe/trunk/test/Preprocessor/arm-acle-6.5.c
@@ -24,6 +24,7 @@
 // RUN: %clang -target arm-eabi -mfpu=neon -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target armv6-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
+// RUN: %clang -target armv7ve-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 
 // CHECK-SP-DP: __ARM_FP 0xC
 
@@ -51,6 +52,8 @@
 
 // RUN: %clang -target armv7a-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-NO-FMA
 // RUN: %clang -target 

[libcxx] r294660 - add missing python import

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 17:29:08 2017
New Revision: 294660

URL: http://llvm.org/viewvc/llvm-project?rev=294660=rev
Log:
add missing python import

Modified:
libcxx/trunk/utils/libcxx/util.py

Modified: libcxx/trunk/utils/libcxx/util.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/util.py?rev=294660=294659=294660=diff
==
--- libcxx/trunk/utils/libcxx/util.py (original)
+++ libcxx/trunk/utils/libcxx/util.py Thu Feb  9 17:29:08 2017
@@ -8,13 +8,14 @@
 #===--===##
 
 from contextlib import contextmanager
+import errno
 import os
 import platform
 import signal
 import subprocess
 import sys
 import tempfile
-
+import threading
 
 
 # FIXME: Most of these functions are cribbed from LIT


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


r294658 - Don't try to link to the 4.0 release notes

2017-02-09 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Feb  9 17:26:34 2017
New Revision: 294658

URL: http://llvm.org/viewvc/llvm-project?rev=294658=rev
Log:
Don't try to link to the 4.0 release notes

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=294658=294657=294658=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Thu Feb  9 17:26:34 2017
@@ -10,9 +10,9 @@ Written by the `LLVM Team `_.
+   These are in-progress notes for the upcoming Clang 5 release.
+   Release notes for previous releases can be found on
+   `the Download Page `_.
 
 Introduction
 


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


[clang-tools-extra] r294657 - Don't try to link to the 4.0 release notes

2017-02-09 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Feb  9 17:25:52 2017
New Revision: 294657

URL: http://llvm.org/viewvc/llvm-project?rev=294657=rev
Log:
Don't try to link to the 4.0 release notes

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=294657=294656=294657=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Thu Feb  9 17:25:52 2017
@@ -11,8 +11,8 @@ Written by the `LLVM Team `_.
+   Release notes for previous releases can be found on
+   `the Download Page `_.
 
 Introduction
 


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


[libcxx] r294644 - Start libc++ python cleanup and consolidation.

2017-02-09 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Feb  9 16:53:14 2017
New Revision: 294644

URL: http://llvm.org/viewvc/llvm-project?rev=294644=rev
Log:
Start libc++ python cleanup and consolidation.

Libc++ frequently creates and uses utilities written in python.
Currently there are python modules under both libcxx/test and
libcxx/util. My goal with these changes is to consolidate them
into a single package under libcxx/utils/libcxx.

Added:
libcxx/trunk/utils/gen_link_script.py
  - copied, changed from r294612, 
libcxx/trunk/utils/gen_link_script/gen_link_script.py
libcxx/trunk/utils/libcxx/
libcxx/trunk/utils/libcxx/__init__.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/__init__.py
libcxx/trunk/utils/libcxx/sym_check/
libcxx/trunk/utils/libcxx/sym_check/__init__.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/__init__.py
libcxx/trunk/utils/libcxx/sym_check/diff.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/diff.py
libcxx/trunk/utils/libcxx/sym_check/extract.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/extract.py
libcxx/trunk/utils/libcxx/sym_check/match.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/match.py
libcxx/trunk/utils/libcxx/sym_check/util.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_check/util.py
libcxx/trunk/utils/not.py
  - copied, changed from r294612, libcxx/trunk/utils/not/not.py
libcxx/trunk/utils/sym_diff.py
  - copied, changed from r294612, libcxx/trunk/utils/sym_check/sym_diff.py
libcxx/trunk/utils/sym_extract.py
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/sym_extract.py
libcxx/trunk/utils/sym_match.py
  - copied, changed from r294612, libcxx/trunk/utils/sym_check/sym_match.py
libcxx/trunk/utils/symcheck-blacklists/
libcxx/trunk/utils/symcheck-blacklists/linux_blacklist.txt
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/linux_blacklist.txt
libcxx/trunk/utils/symcheck-blacklists/osx_blacklist.txt
  - copied, changed from r294612, 
libcxx/trunk/utils/sym_check/osx_blacklist.txt
Removed:
libcxx/trunk/utils/gen_link_script/gen_link_script.py
libcxx/trunk/utils/not/not.py
libcxx/trunk/utils/sym_check/linux_blacklist.txt
libcxx/trunk/utils/sym_check/osx_blacklist.txt
libcxx/trunk/utils/sym_check/sym_check/__init__.py
libcxx/trunk/utils/sym_check/sym_check/diff.py
libcxx/trunk/utils/sym_check/sym_check/extract.py
libcxx/trunk/utils/sym_check/sym_check/match.py
libcxx/trunk/utils/sym_check/sym_check/util.py
libcxx/trunk/utils/sym_check/sym_diff.py
libcxx/trunk/utils/sym_check/sym_extract.py
libcxx/trunk/utils/sym_check/sym_match.py
Modified:
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/lib/abi/CMakeLists.txt
libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=294644=294643=294644=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu Feb  9 16:53:14 2017
@@ -332,7 +332,7 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENAB
   # after cxx builds.
   add_custom_command(TARGET cxx_shared POST_BUILD
 COMMAND
-  ${PYTHON_EXECUTABLE} 
${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py
+  ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py
 ARGS
   "$"
   ${LIBCXX_INTERFACE_LIBRARY_NAMES}

Modified: libcxx/trunk/lib/abi/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CMakeLists.txt?rev=294644=294643=294644=diff
==
--- libcxx/trunk/lib/abi/CMakeLists.txt (original)
+++ libcxx/trunk/lib/abi/CMakeLists.txt Thu Feb  9 16:53:14 2017
@@ -27,7 +27,7 @@ endif()
 
 if (LIBCXX_HAS_ABILIST_CONFIGURATION)
 set(ABILIST_FILE 
"${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.abilist")
-set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_check/sym_diff.py")
+set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py")
 add_custom_target(check-cxx-abilist
 ${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE}
 $

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=294644=294643=294644=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Thu Feb  9 16:53:14 2017
@@ -932,7 +932,7 @@ class Configuration(object):
 # Configure run shortcut
 sub.append(('%run', exec_str + ' %t.exe'))
 # Configure not program 

r294641 - Disallow explicit instantiation and explicit specialization for deduction guides.

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 16:47:51 2017
New Revision: 294641

URL: http://llvm.org/viewvc/llvm-project?rev=294641=rev
Log:
Disallow explicit instantiation and explicit specialization for deduction 
guides.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/temp/temp.deduct.guide/p1.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=294641=294640=294641=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb  9 16:47:51 
2017
@@ -1991,6 +1991,8 @@ def err_deduction_guide_name_not_class_t
   "template template parameter|dependent template name}0 %1">;
 def err_deduction_guide_defines_function : Error<
   "deduction guide cannot have a function definition">;
+def err_deduction_guide_specialized : Error<"deduction guide cannot be "
+  "%select{explicitly instantiated|explicitly specialized}0">;
 
 // C++1y deduced return types
 def err_auto_fn_deduction_failure : Error<

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294641=294640=294641=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Feb  9 16:47:51 2017
@@ -7657,8 +7657,9 @@ static FunctionDecl* CreateNewFunctionDe
   } else if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) {
 SemaRef.CheckDeductionGuideDeclarator(D, R, SC);
 
-// We don't need to store any extra information for a deduction guide, so
+// We don't need to store much extra information for a deduction guide, so
 // just model it as a plain FunctionDecl.
+// FIXME: Store IsExplicit!
 return FunctionDecl::Create(SemaRef.Context, DC,
 D.getLocStart(),
 NameInfo, R, TInfo, SC, isInline,
@@ -9149,6 +9150,13 @@ bool Sema::CheckFunctionDeclaration(Scop
 } else if (CXXConversionDecl *Conversion
= dyn_cast(NewFD)) {
   ActOnConversionDeclarator(Conversion);
+} else if (NewFD->isDeductionGuide() &&
+   NewFD->getTemplateSpecializationKind() ==
+   TSK_ExplicitSpecialization) {
+  // A deduction guide is not on the list of entities that can be
+  // explicitly specialized.
+  Diag(NewFD->getLocStart(), diag::err_deduction_guide_specialized)
+<< /*explicit specialization*/ 1;
 }
 
 // Find any virtual functions that this function overrides.

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=294641=294640=294641=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Feb  9 16:47:51 2017
@@ -8187,6 +8187,14 @@ DeclResult Sema::ActOnExplicitInstantiat
 return true;
   }
 
+  // A deduction guide is not on the list of entities that can be explicitly
+  // instantiated.
+  if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) {
+Diag(D.getDeclSpec().getLocStart(), diag::err_deduction_guide_specialized)
+  << /*explicit instantiation*/ 0;
+return true;
+  }
+
   // C++0x [temp.explicit]p2:
   //   There are two forms of explicit instantiation: an explicit instantiation
   //   definition and an explicit instantiation declaration. An explicit

Modified: cfe/trunk/test/CXX/temp/temp.deduct.guide/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.deduct.guide/p1.cpp?rev=294641=294640=294641=diff
==
--- cfe/trunk/test/CXX/temp/temp.deduct.guide/p1.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.deduct.guide/p1.cpp Thu Feb  9 16:47:51 2017
@@ -86,3 +86,23 @@ A(int(&)[43]) -> A try {} catch (..
 #ifdef CLASS
 };
 #endif
+
+namespace ExplicitInst {
+  // Explicit instantiation / specialization is not permitted.
+  template struct B {};
+  template B(T) -> B;
+  template<> B(int) -> B; // expected-error {{deduction guide cannot be 
explicitly specialized}}
+  extern template B(float) -> B; // expected-error {{deduction guide 
cannot be explicitly instantiated}}
+  template B(char) -> B; // expected-error {{deduction guide cannot be 
explicitly instantiated}}
+
+  // An attempt at partial specialization doesn't even parse as a 
deduction-guide.
+  template B(T*) -> B; // expected-error 1+{{}} 
expected-note 0+{{}}
+
+  struct X {
+template struct C {};
+template C(T) -> C;
+   

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

2017-02-09 Thread Chandler Carruth via cfe-commits
On Thu, Feb 9, 2017 at 2:46 PM Tobias von Koch 
wrote:

> On Wed, Feb 8, 2017 at 7:21 PM, Chandler Carruth 
> wrote:
>
>
> +// The Freescale PPC SDK has the gcc libraries in
> +// /usr/lib//x.y.z so have a look there as well.
> +"/" + CandidateTriple.str(),
>
>
> So, this is really bad it turns out.
>
> We use this directory to walk every installed GCC version. But because
> this is just a normal lib directory on many systems (ever Debian and Ubuntu
> system for example) this goes very badly. It goes even more badly because
> of the (questionable) design of LLVM's directory iterator:
>
>
> Wow, this is pretty bad, but it really sounds like the iterator should be
> fixed rather than trying to hack around it.
>

I mean, we should.

But even then, walking the entire directory seems bad too... See below.


> Doesn't this happen for the other directories as well (which, admittedly,
> will have less entries)?
>

The *only* entries in the other directories are the actual installed GCC
toolchains though, so walking them makes a lot of sense. The tricky thing
is that this isn't a gcc-specific directory.

I suspect the fix should be to not use this base path as part of the walk
to discover GCC toolchains, and instead to hard code the specific toolchain
patterns on this specific platform.

Or we could do the walk, but only when actually on the NXP/Freescale Power
platform where this is necessary to find GCC installations.

Both of those would seem reasonable. Fixing the directory iterator would be
icing on the cake IMO. =D
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Tobias von Koch via cfe-commits
On Wed, Feb 8, 2017 at 7:21 PM, Chandler Carruth 
wrote:

>
>> +// The Freescale PPC SDK has the gcc libraries in
>> +// /usr/lib//x.y.z so have a look there as well.
>> +"/" + CandidateTriple.str(),
>>
>
> So, this is really bad it turns out.
>
> We use this directory to walk every installed GCC version. But because
> this is just a normal lib directory on many systems (ever Debian and Ubuntu
> system for example) this goes very badly. It goes even more badly because
> of the (questionable) design of LLVM's directory iterator:
>

Wow, this is pretty bad, but it really sounds like the iterator should be
fixed rather than trying to hack around it. Doesn't this happen for the
other directories as well (which, admittedly, will have less entries)?

FWIW, I am not aware of anyone at NXP/Freescale or elsewhere actually using
LLVM on NXP Power platforms these days. The team I was a part of back then
doesn't exist anymore, so I'm not even sure who to ask. I may get more
insight into this once a certain proposed acquisition by my current
employer completes ;) but for now I wouldn't be opposed if you just want to
remove this.

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


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

2017-02-09 Thread Richard Smith via cfe-commits
On 9 February 2017 at 14:33, Hal Finkel via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 02/08/2017 07:21 PM, Chandler Carruth wrote:
>
> It's blast from the past time!
>
> On Tue, Sep 18, 2012 at 3:28 PM Hal Finkel  wrote:
>
>> Author: hfinkel
>> Date: Tue Sep 18 17:25:07 2012
>> New Revision: 164177
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=164177=rev
>> Log:
>> Add C/C++ header locations for the Freescale SDK.
>>
>> The Freescale SDK is based on OpenEmbedded, and this might be useful
>> for other OpenEmbedded-based configurations as well.
>>
>> With minor modifications, patch by Tobias von Koch!
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
>> powerpc-fsl-linux/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
>> powerpc-fsl-linux/4.6.2/
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
>> powerpc-fsl-linux/4.6.2/crtbegin.o
>> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
>> powerpc-fsl-linux/4.6.2/crtend.o
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains.cpp
>> cfe/trunk/test/Driver/linux-ld.c
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
>> ToolChains.cpp?rev=164177=164176=164177=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Sep 18 17:25:07 2012
>> @@ -1291,6 +1291,10 @@
>>  "/gcc/" + CandidateTriple.str(),
>>  "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
>>
>> +// The Freescale PPC SDK has the gcc libraries in
>> +// /usr/lib//x.y.z so have a look there as well.
>> +"/" + CandidateTriple.str(),
>>
>
> So, this is really bad it turns out.
>
> We use this directory to walk every installed GCC version. But because
> this is just a normal lib directory on many systems (ever Debian and Ubuntu
> system for example) this goes very badly. It goes even more badly because
> of the (questionable) design of LLVM's directory iterator:
>
> It ends up stat'ing *every single file* in /usr/lib/  =[ For
> the current Ubuntu LTS for example, this causes roughly 3900 spurrious stat
> syscalls for every invocation of the Clang driver.
>
> Can we do something different here?
>
>
> Wow. Hrmm, okay. Why are we stating every file?
>

That mistake seems to be baked into the design of llvm's
directory_iterator. =(

In any case, are we just searching for a directory with the right triple?
> Or are we searching for the version-number directory and doing that by
> looking at every entry?
>

The latter.


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

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

2017-02-09 Thread Hal Finkel via cfe-commits


On 02/08/2017 07:21 PM, Chandler Carruth wrote:

It's blast from the past time!

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


Author: hfinkel
Date: Tue Sep 18 17:25:07 2012
New Revision: 164177

URL: http://llvm.org/viewvc/llvm-project?rev=164177=rev
Log:
Add C/C++ header locations for the Freescale SDK.

The Freescale SDK is based on OpenEmbedded, and this might be useful
for other OpenEmbedded-based configurations as well.

With minor modifications, patch by Tobias von Koch!

Added:
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/

cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/

cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o

cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=164177=164176=164177=diff

==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Sep 18 17:25:07 2012
@@ -1291,6 +1291,10 @@
 "/gcc/" + CandidateTriple.str(),
 "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),

+// The Freescale PPC SDK has the gcc libraries in
+// /usr/lib//x.y.z so have a look there as well.
+"/" + CandidateTriple.str(),


So, this is really bad it turns out.

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


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


Can we do something different here?


Wow. Hrmm, okay. Why are we stating every file? In any case, are we just 
searching for a directory with the right triple? Or are we searching for 
the version-number directory and doing that by looking at every entry?


 -Hal


+
 // Ubuntu has a strange mis-matched pair of triples that this
happens to
 // match.
 // FIXME: It may be worthwhile to generalize this and look
for a second
@@ -1300,6 +1304,7 @@
   const std::string InstallSuffixes[] = {
 "/../../..",
 "/../../../..",
+"/../..",
 "/../../../.."
   };
   // Only look at the final, weird Ubuntu suffix for i386-linux-gnu.
@@ -2374,6 +2379,9 @@
 InstallDir.str() + "/include/g++-v4",
 // Android standalone toolchain has C++ headers in yet
another place.
 LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" +
Version.str(),
+// Freescale SDK C++ headers are directly in
/usr/include/c++,
+// without a subdirectory corresponding to the gcc version.
+LibDir.str() + "/../include/c++",
   };

   for (unsigned i = 0; i <
llvm::array_lengthof(IncludePathCandidates); ++i) {

Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep?rev=164177=auto

==
(empty)

Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o?rev=164177=auto

==
(empty)

Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o?rev=164177=auto

==
(empty)

Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
URL:


r294639 - Diagnose attempts to explicitly instantiate a template at class scope. Previously Clang would simply ignore the 'template' keyword in this case.

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 16:14:25 2017
New Revision: 294639

URL: http://llvm.org/viewvc/llvm-project?rev=294639=rev
Log:
Diagnose attempts to explicitly instantiate a template at class scope. 
Previously Clang would simply ignore the 'template' keyword in this case.

Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx-template-decl.cpp
cfe/trunk/test/Parser/eof.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp
cfe/trunk/test/SemaTemplate/template-id-expr.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=294639=294638=294639=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu Feb  9 16:14:25 2017
@@ -2459,9 +2459,10 @@ Parser::ParseCXXClassMemberDeclaration(A
   if (Tok.is(tok::kw_template)) {
 assert(!TemplateInfo.TemplateParams &&
"Nested template improperly parsed?");
+ObjCDeclContextSwitch ObjCDC(*this);
 SourceLocation DeclEnd;
 return DeclGroupPtrTy::make(
-DeclGroupRef(ParseDeclarationStartingWithTemplate(
+DeclGroupRef(ParseTemplateDeclarationOrSpecialization(
 Declarator::MemberContext, DeclEnd, AS, AccessAttrs)));
   }
 

Modified: cfe/trunk/test/Parser/cxx-template-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-template-decl.cpp?rev=294639=294638=294639=diff
==
--- cfe/trunk/test/Parser/cxx-template-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-template-decl.cpp Thu Feb  9 16:14:25 2017
@@ -238,3 +238,13 @@ struct t2 : base&1 | FileCheck %s
 
-// CHECK: error: expected member name or ';' after declaration specifiers
+// CHECK: error: expected '<' after 'template'
 // CHECK: error: expected '}'
 // CHECK: note: to match this '{'
 // CHECK: error: expected ';' after class

Modified: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp?rev=294639=294638=294639=diff
==
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_in_class.cpp Thu Feb  9 
16:14:25 2017
@@ -17,8 +17,7 @@ class A {
   template CONST float right = 5;  // expected-error 
{{member 'right' declared as a template}}
   template<> static CONST int right = 7;   // expected-error 
{{explicit specialization of 'right' in class scope}}
   template<> static CONST float right;   // expected-error 
{{explicit specialization of 'right' in class scope}}
-  template static CONST int right; // expected-error {{template 
specialization requires 'template<>'}} \
-// expected-error {{explicit 
specialization of 'right' in class scope}}
+  template static CONST int right; // expected-error {{expected 
'<' after 'template'}}
 };
 
 namespace out_of_line {
@@ -166,8 +165,7 @@ namespace constexpred {
 template constexpr float right = 5;  // 
expected-error {{non-static data member cannot be constexpr; did you intend to 
make it static?}}
 template<> static constexpr int right = 7;   // 
expected-error {{explicit specialization of 'right' in class scope}}
 template<> static constexpr float right;   // 
expected-error {{explicit specialization of 'right' in class scope}}
-template static constexpr int right; // expected-error 
{{template specialization requires 'template<>'}} \
-  // expected-error {{explicit 
specialization of 'right' in class scope}}
+template static constexpr int right; // expected-error 
{{expected '<' after 'template'}}
   };
 }
 #endif

Modified: 

[PATCH] D16135: Macro Debug Info support in Clang

2017-02-09 Thread Amjad Aboud via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294637: [DebugInfo] Added support to Clang FE for generating 
debug info for… (authored by aaboud).

Changed prior to commit:
  https://reviews.llvm.org/D16135?vs=87819=87881#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D16135

Files:
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/lib/CodeGen/CGDebugInfo.h
  cfe/trunk/lib/CodeGen/CMakeLists.txt
  cfe/trunk/lib/CodeGen/CodeGenAction.cpp
  cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
  cfe/trunk/lib/CodeGen/MacroPPCallbacks.h
  cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/debug-info-macro.c
  cfe/trunk/test/CodeGen/include/debug-info-macro.h
  cfe/trunk/test/Driver/debug-options.c

Index: cfe/trunk/lib/CodeGen/CGDebugInfo.h
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h
@@ -413,6 +413,16 @@
 
   void completeTemplateDefinition(const ClassTemplateSpecializationDecl );
 
+  /// Create debug info for a macro defined by a #define directive or a macro
+  /// undefined by a #undef directive.
+  llvm::DIMacro *CreateMacro(llvm::DIMacroFile *Parent, unsigned MType,
+ SourceLocation LineLoc, StringRef Name,
+ StringRef Value);
+
+  /// Create debug info for a file referenced by an #include directive.
+  llvm::DIMacroFile *CreateTempMacroFile(llvm::DIMacroFile *Parent,
+ SourceLocation LineLoc,
+ SourceLocation FileLoc);
 private:
   /// Emit call to llvm.dbg.declare for a variable declaration.
   void EmitDeclare(const VarDecl *decl, llvm::Value *AI,
Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -10,6 +10,7 @@
 #include "clang/CodeGen/CodeGenAction.h"
 #include "CodeGenModule.h"
 #include "CoverageMappingGen.h"
+#include "MacroPPCallbacks.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
@@ -97,6 +98,8 @@
   return std::unique_ptr(Gen->ReleaseModule());
 }
 
+CodeGenerator *getCodeGenerator() { return Gen.get(); }
+
 void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override {
   Gen->HandleCXXStaticMemberVarInstantiation(VD);
 }
@@ -830,6 +833,17 @@
   CI.getLangOpts(), CI.getFrontendOpts().ShowTimers, InFile,
   std::move(LinkModules), std::move(OS), *VMContext, CoverageInfo));
   BEConsumer = Result.get();
+
+  // Enable generating macro debug info only when debug info is not disabled and
+  // also macro debug info is enabled.
+  if (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
+  CI.getCodeGenOpts().MacroDebugInfo) {
+std::unique_ptr Callbacks =
+llvm::make_unique(BEConsumer->getCodeGenerator(),
+CI.getPreprocessor());
+CI.getPreprocessor().addPPCallbacks(std::move(Callbacks));
+  }
+
   return std::move(Result);
 }
 
Index: cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
===
--- cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
+++ cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
@@ -0,0 +1,211 @@
+//===--- MacroPPCallbacks.cpp -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file contains implementation for the macro preprocessors callbacks.
+//
+//===--===//
+
+#include "MacroPPCallbacks.h"
+#include "CGDebugInfo.h"
+#include "clang/CodeGen/ModuleBuilder.h"
+#include "clang/Parse/Parser.h"
+
+using namespace clang;
+
+void MacroPPCallbacks::writeMacroDefinition(const IdentifierInfo ,
+const MacroInfo ,
+Preprocessor , raw_ostream ,
+raw_ostream ) {
+  Name << II.getName();
+
+  if (MI.isFunctionLike()) {
+Name << '(';
+if (!MI.arg_empty()) {
+  MacroInfo::arg_iterator AI = MI.arg_begin(), E = MI.arg_end();
+  for (; AI + 1 != E; ++AI) {
+Name << (*AI)->getName();
+Name << ',';
+  }
+
+  // Last argument.
+   

r294637 - [DebugInfo] Added support to Clang FE for generating debug info for preprocessor macros.

2017-02-09 Thread Amjad Aboud via cfe-commits
Author: aaboud
Date: Thu Feb  9 16:07:24 2017
New Revision: 294637

URL: http://llvm.org/viewvc/llvm-project?rev=294637=rev
Log:
[DebugInfo] Added support to Clang FE for generating debug info for 
preprocessor macros.

Added "-fdebug-macro" flag (and "-fno-debug-macro" flag) to enable (and to 
disable) emitting macro debug info.
Added CC1 "-debug-info-macro" flag that enables emitting macro debug info.

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

Added:
cfe/trunk/lib/CodeGen/MacroPPCallbacks.cpp
cfe/trunk/lib/CodeGen/MacroPPCallbacks.h
cfe/trunk/test/CodeGen/debug-info-macro.c
cfe/trunk/test/CodeGen/include/debug-info-macro.h
Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CMakeLists.txt
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/debug-options.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=294637=294636=294637=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Thu Feb  9 16:07:24 2017
@@ -1696,6 +1696,22 @@ below. If multiple flags are present, th
 
   Generate complete debug info.
 
+Controlling Macro Debug Info Generation
+^^^
+
+Debug info for C preprocessor macros increases the size of debug information in
+the binary. Macro debug info generated by Clang can be controlled by the flags
+listed below.
+
+.. option:: -fdebug-macro
+
+  Generate debug info for preprocessor macros. This flag is discarded when
+  **-g0** is enabled.
+
+.. option:: -fno-debug-macro
+
+  Do not generate debug info for preprocessor macros (default).
+
 Controlling Debugger "Tuning"
 ^
 

Modified: cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/ModuleBuilder.h?rev=294637=294636=294637=diff
==
--- cfe/trunk/include/clang/CodeGen/ModuleBuilder.h (original)
+++ cfe/trunk/include/clang/CodeGen/ModuleBuilder.h Thu Feb  9 16:07:24 2017
@@ -35,6 +35,7 @@ namespace clang {
 
 namespace CodeGen {
   class CodeGenModule;
+  class CGDebugInfo;
 }
 
 /// The primary public interface to the Clang code generator.
@@ -65,6 +66,9 @@ public:
   /// CodeGenerator after releasing its module.
   llvm::Module *ReleaseModule();
 
+  /// Return debug info code generator.
+  CodeGen::CGDebugInfo *getCGDebugInfo();
+
   /// Given a mangled name, return a declaration which mangles that way
   /// which has been added to this code generator via a Handle method.
   ///

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=294637=294636=294637=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Feb  9 16:07:24 2017
@@ -136,6 +136,8 @@ def migrator_no_finalize_removal : Flag<
 let Flags = [CC1Option, CC1AsOption, NoDriverOption] in {
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
+def debug_info_macro : Flag<["-"], "debug-info-macro">,
+  HelpText<"Emit macro debug information">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
 def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=294637=294636=294637=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Feb  9 16:07:24 2017
@@ -1322,6 +1322,10 @@ def fno_standalone_debug : Flag<["-"], "
   HelpText<"Limit debug information produced to reduce size of debug binary">;
 def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Flags<[CoreOption]>, 
Alias;
 def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, 
Flags<[CoreOption]>, Alias;
+def fdebug_macro : Flag<["-"], "fdebug-macro">, Group, 
Flags<[CoreOption]>,
+  HelpText<"Emit macro debug information">;
+def fno_debug_macro : Flag<["-"], "fno-debug-macro">, Group, 
Flags<[CoreOption]>,
+  HelpText<"Do not emit macro debug information">;
 def fstrict_aliasing 

[PATCH] D29621: Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

2017-02-09 Thread Julian Bangert via Phabricator via cfe-commits
jbangert updated this revision to Diff 87879.
jbangert added a comment.

- fix test


https://reviews.llvm.org/D29621

Files:
  include/clang/Tooling/RefactoringCallbacks.h
  lib/Tooling/RefactoringCallbacks.cpp
  unittests/Tooling/RefactoringCallbacksTest.cpp

Index: unittests/Tooling/RefactoringCallbacksTest.cpp
===
--- unittests/Tooling/RefactoringCallbacksTest.cpp
+++ unittests/Tooling/RefactoringCallbacksTest.cpp
@@ -7,31 +7,30 @@
 //
 //===--===//
 
-#include "clang/Tooling/RefactoringCallbacks.h"
 #include "RewriterTestContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Tooling/RefactoringCallbacks.h"
 #include "gtest/gtest.h"
 
 namespace clang {
 namespace tooling {
 
 using namespace ast_matchers;
 
 template 
-void expectRewritten(const std::string ,
- const std::string ,
- const T ,
- RefactoringCallback ) {
-  MatchFinder Finder;
+void expectRewritten(const std::string , const std::string ,
+ const T , RefactoringCallback ) {
+  std::map FileToReplace;
+  ASTMatchRefactorer Finder(FileToReplace);
   Finder.addMatcher(AMatcher, );
   std::unique_ptr Factory(
   tooling::newFrontendActionFactory());
   ASSERT_TRUE(tooling::runToolOnCode(Factory->create(), Code))
   << "Parsing error in \"" << Code << "\"";
   RewriterTestContext Context;
   FileID ID = Context.createInMemoryFile("input.cc", Code);
-  EXPECT_TRUE(tooling::applyAllReplacements(Callback.getReplacements(),
+  EXPECT_TRUE(tooling::applyAllReplacements(FileToReplace["input.cc"],
 Context.Rewrite));
   EXPECT_EQ(Expected, Context.getRewrittenText(ID));
 }
@@ -61,39 +60,68 @@
   std::string Code = "void f() { int i = 1; }";
   std::string Expected = "void f() { int i = 2; }";
   ReplaceStmtWithText Callback("id", "2");
-  expectRewritten(Code, Expected, id("id", expr(integerLiteral())),
-  Callback);
+  expectRewritten(Code, Expected, id("id", expr(integerLiteral())), Callback);
 }
 
 TEST(RefactoringCallbacksTest, ReplacesStmtWithStmt) {
   std::string Code = "void f() { int i = false ? 1 : i * 2; }";
   std::string Expected = "void f() { int i = i * 2; }";
   ReplaceStmtWithStmt Callback("always-false", "should-be");
-  expectRewritten(Code, Expected,
-  id("always-false", conditionalOperator(
-  hasCondition(cxxBoolLiteral(equals(false))),
-  hasFalseExpression(id("should-be", expr(),
+  expectRewritten(
+  Code, Expected,
+  id("always-false",
+ conditionalOperator(hasCondition(cxxBoolLiteral(equals(false))),
+ hasFalseExpression(id("should-be", expr(),
   Callback);
 }
 
 TEST(RefactoringCallbacksTest, ReplacesIfStmt) {
   std::string Code = "bool a; void f() { if (a) f(); else a = true; }";
   std::string Expected = "bool a; void f() { f(); }";
   ReplaceIfStmtWithItsBody Callback("id", true);
-  expectRewritten(Code, Expected,
-  id("id", ifStmt(
-  hasCondition(implicitCastExpr(hasSourceExpression(
-  declRefExpr(to(varDecl(hasName("a"),
+  expectRewritten(
+  Code, Expected,
+  id("id", ifStmt(hasCondition(implicitCastExpr(hasSourceExpression(
+   declRefExpr(to(varDecl(hasName("a"),
   Callback);
 }
 
 TEST(RefactoringCallbacksTest, RemovesEntireIfOnEmptyElse) {
   std::string Code = "void f() { if (false) int i = 0; }";
   std::string Expected = "void f() {  }";
   ReplaceIfStmtWithItsBody Callback("id", false);
   expectRewritten(Code, Expected,
-  id("id", ifStmt(hasCondition(cxxBoolLiteral(equals(false),
-  Callback);
+  id("id", ifStmt(hasCondition(cxxBoolLiteral(equals(false),
+  Callback);
+}
+
+TEST(RefactoringCallbacksTest, TemplateJustText) {
+  std::string Code = "void f() { int i = 1; }";
+  std::string Expected = "void f() { FOO }";
+  auto Callback = ReplaceNodeWithTemplate::create("id", "FOO");
+  EXPECT_FALSE(Callback.takeError());
+  expectRewritten(Code, Expected, id("id", declStmt()), **Callback);
+}
+
+TEST(RefactoringCallbacksTest, TemplateSimpleSubst) {
+  std::string Code = "void f() { int i = 1; }";
+  std::string Expected = "void f() { long x = 1; }";
+  auto Callback = ReplaceNodeWithTemplate::create("decl", "long x = ${init}");
+  EXPECT_FALSE(Callback.takeError());
+  expectRewritten(Code, Expected,
+  id("decl", varDecl(hasInitializer(id("init", expr(),
+  **Callback);
+}
+
+TEST(RefactoringCallbacksTest, TemplateLiteral) {
+  std::string Code = "void f() { int i = 1; }";
+  std::string Expected = "void f() { string x = \"$-1\"; }";
+  auto Callback = ReplaceNodeWithTemplate::create("decl",
+

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

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



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

faisalv wrote:
> I don't think we need this fixme - the type of the expression should be 
> correct - all other const checks for mutability have already been performed, 
> right?
When using `handleLValueToRValueConversion` to obtain the lvalue denoted by a 
reference, the type you pass should be the reference type itself 
(`FD->getType()`). This approach will give the wrong answer when using a 
captured volatile object:
```
void f() {
  volatile int n;
  constexpr volatile int *p = [&]{ return  }(); // should be accepted
}
```



Comment at: lib/AST/ExprConstant.cpp:5066-5068
+  assert(RVal.isLValue() && "Reference captures through their "
+"corresponding field members must refer to 
"
+"lvalues (VarDecls or FieldDecls)");

I don't see why this assert is correct. If we initialize a reference with a 
(constant-folded) dereferenced integer cast to pointer type, the value will 
have integer representation. Just remove the assert?



Comment at: lib/AST/ExprConstant.cpp:5473-5474
+  
+  if (HandleLValueMember(Info, E, Result,
+ Info.CurrentCall->LambdaThisCaptureField)) {
+if (Info.CurrentCall->LambdaThisCaptureField->getType()

Please use early-exit style (`if (!HandleLValueMember(...)) return false;`) 
here to reduce indentation and make it clearer that you only return false if a 
diagnostic has already been produced.



Comment at: lib/AST/ExprConstant.cpp:6338-6339
+// occurred.
+if (!CurFieldInit)
+  return false;
+

Returning `false` without producing a diagnostic (for the VLA case) is not OK. 
You should at least produce the basic "not a constant expression" note here.


Repository:
  rL LLVM

https://reviews.llvm.org/D29748



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


[PATCH] D29621: Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

2017-02-09 Thread Julian Bangert via Phabricator via cfe-commits
jbangert marked 2 inline comments as done.
jbangert added a comment.

Fixed the test -- I am still getting used to the different ninja test targets.




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

ioeric wrote:
> Is this covered in the test?
Now it is. 


https://reviews.llvm.org/D29621



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


Re: [libcxx] r294612 - Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

2017-02-09 Thread Hans Wennborg via cfe-commits
Sounds good to me. You said "these changes"; are there more than this one?

On Thu, Feb 9, 2017 at 11:15 AM, Eric Fiselier  wrote:
> I'm planning to merge this fix into the 4.0 release branch.
>
> Although not a regression, since  is a new feature, it would still
> be nice to ship without this bug.
>
> I'll merge these changes later today if there are no objections, and once
> all the bots pass.
>
> /Eric
>
> On Thu, Feb 9, 2017 at 12:01 PM, Eric Fiselier via cfe-commits
>  wrote:
>>
>> Author: ericwf
>> Date: Thu Feb  9 13:01:22 2017
>> New Revision: 294612
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=294612=rev
>> Log:
>> Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
>>
>> A static assertion was misfiring since it checked
>> is_callable. However
>> the decltype expression doesn't capture the value category as
>> required. This patch applies extra braces to decltype to fix
>> that.
>>
>> Modified:
>> libcxx/trunk/include/variant
>> libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
>>
>> Modified: libcxx/trunk/include/variant
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=294612=294611=294612=diff
>>
>> ==
>> --- libcxx/trunk/include/variant (original)
>> +++ libcxx/trunk/include/variant Thu Feb  9 13:01:22 2017
>> @@ -578,7 +578,7 @@ private:
>>  constexpr decltype(auto) operator()(_Alts&&... __alts) const {
>>__std_visit_exhaustive_visitor_check<
>>_Visitor,
>> -  decltype(_VSTD::forward<_Alts>(__alts).__value)...>();
>> +  decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
>>return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
>>
>> _VSTD::forward<_Alts>(__alts).__value...);
>>  }
>>
>> Modified:
>> libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp?rev=294612=294611=294612=diff
>>
>> ==
>> --- libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
>> (original)
>> +++ libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
>> Thu Feb  9 13:01:22 2017
>> @@ -283,9 +283,20 @@ void test_exceptions() {
>>  #endif
>>  }
>>
>> +// See http://llvm.org/PR31916
>> +void test_caller_accepts_nonconst() {
>> +  struct A {};
>> +  struct Visitor {
>> +void operator()(A&) {}
>> +  };
>> +  std::variant v;
>> +  std::visit(Visitor{}, v);
>> +}
>> +
>>  int main() {
>>test_call_operator_forwarding();
>>test_argument_forwarding();
>>test_constexpr();
>>test_exceptions();
>> +  test_caller_accepts_nonconst();
>>  }
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29753: [PCH] Avoid early VarDecl emission attempt if no owning module avaiable

2017-02-09 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

I'm not comfortable signing off on this, but it seems like this should be set 
up as a blocker for LLVM 4.0 if it isn't already.




Comment at: lib/Serialization/ASTReaderDecl.cpp:2518-2523
   // An ImportDecl or VarDecl imported from a module will get emitted when
   // we import the relevant module.
-  if ((isa(D) || isa(D)) && Ctx.DeclMustBeEmitted(D) &&
-  D->getImportedOwningModule())
+  if ((isa(D) || isa(D)) && D->getImportedOwningModule() 
&&
+  Ctx.DeclMustBeEmitted(D))
 return false;
 

It's not locally obvious why the order matters.  Can you add a comment 
explaining why you need to check getImportedOwningModule first?  It might be 
worth splitting Ctx.DeclMustBeEmitted into its own; e.g.,
```
// An ImportDecl or VarDecl imported from a module will get emitted when
// we import the relevant module.
if ((isa(D) || isa(D)) && D->getImportedOwningModule())
  // Only check DeclMustBeEmitted if D has been fully imported, since it may
  // emit D as a side effect.
  if (Ctx.DeclMustBeEmitted(D))
return false;
```
but anything that prevents someone from swapping the conditions when they 
refactor this would be good enough I think.


https://reviews.llvm.org/D29753



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


r294626 - [docs] coverage: Clarify which flags enable gcov-style profiling (NFC)

2017-02-09 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Thu Feb  9 15:33:21 2017
New Revision: 294626

URL: http://llvm.org/viewvc/llvm-project?rev=294626=rev
Log:
[docs] coverage: Clarify which flags enable gcov-style profiling (NFC)

Point out that --coverage and -ftest-coverage, which is what most people
are used to, do not enable clang's frontend based coverage pass.

Suggested by Benn Bolay!

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=294626=294625=294626=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Thu Feb  9 15:33:21 2017
@@ -18,6 +18,7 @@ Clang ships two other code coverage impl
   various sanitizers. It can provide up to edge-level coverage.
 
 * gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
+  This is enabled by ``-ftest-coverage`` or ``--coverage``.
 
 From this point onwards "code coverage" will refer to the source-based kind.
 


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


r294623 - [CodeGen] Remove unneeded `private`. NFCI.

2017-02-09 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Feb  9 15:19:51 2017
New Revision: 294623

URL: http://llvm.org/viewvc/llvm-project?rev=294623=rev
Log:
[CodeGen] Remove unneeded `private`. NFCI.

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=294623=294622=294623=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Feb  9 15:19:51 2017
@@ -73,7 +73,6 @@ class EmitAssemblyHelper {
 
   std::unique_ptr OS;
 
-private:
   TargetIRAnalysis getTargetIRAnalysis() const {
 if (TM)
   return TM->getTargetIRAnalysis();


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


r294622 - Rename IsExplicitSpecialization -> IsMemberSpecialization when we're talking

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 15:04:43 2017
New Revision: 294622

URL: http://llvm.org/viewvc/llvm-project?rev=294622=rev
Log:
Rename IsExplicitSpecialization -> IsMemberSpecialization when we're talking
about member specializations to avoid ambiguous and confusing terminology.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=294622=294621=294622=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Feb  9 15:04:43 2017
@@ -1784,7 +1784,7 @@ public:
   // Returns true if the function declaration is a redeclaration
   bool CheckFunctionDeclaration(Scope *S,
 FunctionDecl *NewFD, LookupResult ,
-bool IsExplicitSpecialization);
+bool IsMemberSpecialization);
   bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl);
   void CheckMain(FunctionDecl *FD, const DeclSpec );
   void CheckMSVCRTEntryPoint(FunctionDecl *FD);
@@ -5918,7 +5918,7 @@ public:
   SourceLocation DeclStartLoc, SourceLocation DeclLoc,
   const CXXScopeSpec , TemplateIdAnnotation *TemplateId,
   ArrayRef ParamLists,
-  bool IsFriend, bool , bool );
+  bool IsFriend, bool , bool );
 
   DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
 SourceLocation KWLoc, CXXScopeSpec ,

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294622=294621=294622=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Feb  9 15:04:43 2017
@@ -6108,7 +6108,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
 }
   }
 
-  bool IsExplicitSpecialization = false;
+  bool IsMemberSpecialization = false;
   bool IsVariableTemplateSpecialization = false;
   bool IsPartialSpecialization = false;
   bool IsVariableTemplate = false;
@@ -6186,7 +6186,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
 ? D.getName().TemplateId
 : nullptr,
 TemplateParamLists,
-/*never a friend*/ false, IsExplicitSpecialization, Invalid);
+/*never a friend*/ false, IsMemberSpecialization, Invalid);
 
 if (TemplateParams) {
   if (!TemplateParams->size() &&
@@ -6412,7 +6412,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
   << (IsPartialSpecialization ? 1 : 0)
   << FixItHint::CreateRemoval(
  D.getDeclSpec().getModulePrivateSpecLoc());
-else if (IsExplicitSpecialization)
+else if (IsMemberSpecialization)
   Diag(NewVD->getLocation(), diag::err_module_private_specialization)
 << 2
 << FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
@@ -6527,7 +6527,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
   // declaration has linkage).
   FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewVD),
D.getCXXScopeSpec().isNotEmpty() ||
-   IsExplicitSpecialization ||
+   IsMemberSpecialization ||
IsVariableTemplateSpecialization);
 
   // Check whether the previous declaration is in the same block scope. This
@@ -6542,7 +6542,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
 D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
   } else {
 // If this is an explicit specialization of a static data member, check it.
-if (IsExplicitSpecialization && !NewVD->isInvalidDecl() &&
+if (IsMemberSpecialization && !NewVD->isInvalidDecl() &&
 CheckMemberSpecialization(NewVD, Previous))
   NewVD->setInvalidDecl();
 
@@ -6657,7 +6657,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
   if (D.isRedeclaration() && !Previous.empty()) {
 checkDLLAttributeRedeclaration(
 *this, dyn_cast(Previous.getRepresentativeDecl()), NewVD,
-IsExplicitSpecialization, D.isFunctionDefinition());
+IsMemberSpecialization, D.isFunctionDefinition());
   }
 
   if (NewTemplate) {
@@ -7936,7 +7936,7 @@ Sema::ActOnFunctionDeclarator(Scope *S,
 
   bool isFriend = false;
   FunctionTemplateDecl *FunctionTemplate = nullptr;
-  bool isExplicitSpecialization = false;
+  bool isMemberSpecialization = false;
   bool isFunctionTemplateSpecialization = false;
 
   bool isDependentClassScopeExplicitSpecialization = false;
@@ -7992,7 +7992,7 @@ Sema::ActOnFunctionDeclarator(Scope *S,
 }
 
 SetNestedNameSpecifier(NewFD, D);
-isExplicitSpecialization = false;
+isMemberSpecialization = false;
 isFunctionTemplateSpecialization = 

[PATCH] D29464: [MinGWToolChain] Don't use GCC headers on Win32

2017-02-09 Thread Mateusz Mikuła via Phabricator via cfe-commits
mati865 added a comment.

omp.h on Linux is supported by OpenMP package 
https://www.archlinux.org/packages/extra/x86_64/openmp/files/
I haven't tried to build it on win32 yet but since my examination session at 
college is over I'll try it in following days.

I'm not sure but openacc.h probably doesn't work on Linux with Clang


https://reviews.llvm.org/D29464



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


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

2017-02-09 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast updated this revision to Diff 87855.
hubert.reinterpretcast added a comment.

Address review comments; update to revision 294580

Allocate ConstrainedTemplateDeclInfo separately

Update comments to be sentences; NFC


https://reviews.llvm.org/D25674

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Serialization/ASTReaderDecl.cpp
  test/CXX/concepts-ts/temp/
  test/CXX/concepts-ts/temp/temp.constr/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp

Index: test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
===
--- /dev/null
+++ test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+
+namespace nodiag {
+
+template  requires bool(T())
+struct A;
+template  requires bool(U())
+struct A;
+
+} // end namespace nodiag
+
+namespace diag {
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct A;
+template  struct A; // expected-error{{associated constraints differ in template redeclaration}}
+
+template  struct B; // expected-note{{previous template declaration is here}}
+template  requires true // expected-error{{associated constraints differ in template redeclaration}}
+struct B;
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct C;
+template  requires !0 // expected-error{{associated constraints differ in template redeclaration}}
+struct C;
+
+} // end namespace diag
+
+namespace nodiag {
+
+struct AA {
+  template  requires someFunc(T())
+  struct A;
+};
+
+template  requires someFunc(T())
+struct AA::A { };
+
+struct AAF {
+  template  requires someFunc(T())
+  friend struct AA::A;
+};
+
+} // end namespace nodiag
+
+namespace diag {
+
+template 
+struct TA {
+  template  class TT> requires TT::happy // expected-note 2{{previous template declaration is here}}
+  struct A;
+
+  struct AF;
+};
+
+template 
+template  class TT> struct TA::A { }; // expected-error{{associated constraints differ in template redeclaration}}
+
+template 
+struct TA::AF {
+  template  class TT> requires TT::happy // expected-error{{associated constraints differ in template redeclaration}}
+  friend struct TA::A;
+};
+
+} // end namespace diag
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -1878,6 +1878,7 @@
   DeclID PatternID = ReadDeclID();
   NamedDecl *TemplatedDecl = cast_or_null(Reader.GetDecl(PatternID));
   TemplateParameterList *TemplateParams = Record.readTemplateParameterList();
+  // FIXME handle associated constraints
   D->init(TemplatedDecl, TemplateParams);
 
   return PatternID;
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -45,6 +45,26 @@
   return SourceRange(Ps[0]->getTemplateLoc(), Ps[N-1]->getRAngleLoc());
 }
 
+namespace clang {
+/// \brief [temp.constr.decl]p2: A template's associated constraints are
+/// defined as a single constraint-expression derived from the introduced
+/// constraint-expressions [ ... ].
+///
+/// \param Params The template parameter list and optional requires-clause.
+///
+/// \param FD The underlying templated function declaration for a function
+/// template.
+static Expr *formAssociatedConstraints(TemplateParameterList *Params,
+   FunctionDecl *FD);
+}
+
+static Expr *clang::formAssociatedConstraints(TemplateParameterList *Params,
+  FunctionDecl *FD) {
+  // FIXME: Concepts: collect additional introduced constraint-expressions
+  assert(!FD && "Cannot collect constraints from function declaration yet.");
+  return Params->getRequiresClause();
+}
+
 /// \brief Determine whether the declaration found is acceptable as the name
 /// of a template and, if so, return that template declaration. Otherwise,
 /// returns NULL.
@@ -1137,6 +1157,9 @@
 }
   }
 
+  // TODO Memory management; associated constraints are not always stored.
+  Expr *const CurAC = formAssociatedConstraints(TemplateParams, nullptr);
+
   if (PrevClassTemplate) {
 // Ensure that the template parameter lists are compatible. Skip this check
 // for a friend in a dependent context: the template parameter list itself
@@ -1148,6 +1171,29 @@
 TPL_TemplateMatch))
   return true;
 
+// Check for matching associated constraints on redeclarations.
+const Expr *const PrevAC = PrevClassTemplate->getAssociatedConstraints();
+const bool 

[PATCH] D29464: [MinGWToolChain] Don't use GCC headers on Win32

2017-02-09 Thread Yaron Keren via Phabricator via cfe-commits
yaron.keren added a comment.

What about omp.h and openacc.h ? many programs are using OpenMP.

You raised real issues which should certainly be solved with clang mingw 
support.
Removing the gcc dirs from include path will break any program that currently 
uses or depends in any way on any header from that location. This is really bad.

Fixing the specific clang includes is much safer.


https://reviews.llvm.org/D29464



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


[PATCH] D29773: Add support for armv7ve flag in clang (PR31358).

2017-02-09 Thread Richard Barton via Phabricator via cfe-commits
richard.barton.arm accepted this revision.
richard.barton.arm added a comment.
This revision is now accepted and ready to land.

This all LGTM. If I can assume I am allow to approve, then I approve.




Comment at: test/Preprocessor/arm-acle-6.4.c:136
+// CHECK-V7VE: __ARM_FEATURE_SIMD32 1
+// CHECK-V7VE: __ARM_FEATURE_UNALIGNED 1
+

Seems like we could check for __ARM_FEATURE_IDIV here too since we know it must 
be there.

Oh - I see it is tested in another test, in which case fine. 

I guess these test files are a bit of a mess already.


https://reviews.llvm.org/D29773



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


  1   2   >