[PATCH] D29704: [XRay] [clang] Allow logging the first argument of a function call.

2017-02-09 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris accepted this revision.
dberris added a comment.
This revision is now accepted and ready to land.

Just a minor comment -- I suspect you're going to wait until the patch to LLVM 
lands?




Comment at: lib/Sema/SemaDeclAttr.cpp:4407
+
+  // It isn't a parameter index [0;n), it's a count [1;n] - hence the + 1.
+  D->addAttr(::new (S.Context)

What is "It" referring to here? The argument?


https://reviews.llvm.org/D29704



___
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 Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno created this revision.

This fixes PR31863, a regression introduced in r276159.

Consider this snippet:

struct FVector;
struct FVector {};
struct FBox {

  FVector Min;
  FBox(int);

};
namespace {
FBox InvalidBoundingBox(0);
}

While parsing the DECL_VAR for 'struct FBox', clang recursively read all the
dep decls until it finds the DECL_CXX_RECORD forward declaration for 'struct
FVector'. Then, it resumes all the way up back to DECL_VAR handling in
`ReadDeclRecord`, where it checks if `isConsumerInterestedIn` for the decl.

One of the condition for `isConsumerInterestedIn` to return false is if the
VarDecl is imported from a module `D->getImportedOwningModule()`, because it
will get emitted when we import the relevant module. However, before checking
if it comes from a module, clang checks if `Ctx.DeclMustBeEmitted(D)`, which
triggers the emission of 'struct FBox'. Since one of its fields is still
incomplete, it crashes.

Instead, check if `D->getImportedOwningModule()` is true before calling
`Ctx.DeclMustBeEmitted(D)`.


https://reviews.llvm.org/D29753

Files:
  lib/Serialization/ASTReaderDecl.cpp
  test/PCH/empty-def-fwd-struct.h


Index: test/PCH/empty-def-fwd-struct.h
===
--- /dev/null
+++ test/PCH/empty-def-fwd-struct.h
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-pch -x c++-header %s -std=c++14 -o %t.pch
+// RUN: %clang_cc1 -emit-llvm -x c++ /dev/null -std=c++14 -include-pch %t.pch 
-o %t.o
+struct FVector;
+struct FVector {};
+struct FBox {
+  FVector Min;
+  FBox(int);
+};
+namespace {
+FBox InvalidBoundingBox(0);
+}
+
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -2517,8 +2517,8 @@
 
   // 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;
 
   if (isa(D) || 


Index: test/PCH/empty-def-fwd-struct.h
===
--- /dev/null
+++ test/PCH/empty-def-fwd-struct.h
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-pch -x c++-header %s -std=c++14 -o %t.pch
+// RUN: %clang_cc1 -emit-llvm -x c++ /dev/null -std=c++14 -include-pch %t.pch -o %t.o
+struct FVector;
+struct FVector {};
+struct FBox {
+  FVector Min;
+  FBox(int);
+};
+namespace {
+FBox InvalidBoundingBox(0);
+}
+
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -2517,8 +2517,8 @@
 
   // 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;
 
   if (isa(D) || 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Asiri Rathnayake via cfe-commits
Hi Petr,

This is breaking static builds of the libraries, cmake complaints with:

"CMake Error at projects/libcxxabi/src/CMakeLists.txt:134
(target_link_libraries):
  Target "unwind" of type UTILITY may not be linked into another target.
One
  may link only to STATIC or SHARED libraries, or to executables with the
  ENABLE_EXPORTS property set."

Our build config is:

 -DLLVM_ENABLE_ASSERTIONS=ON -DLIBCXX_ENABLE_ASSERTIONS=ON
-DLIBCXXABI_USE_LLVM_UNWINDER=ON  -DLIBCXX_ENABLE_SHARED=OFF
-DLIBCXXABI_ENABLE_SHARED=OFF -DLIBUNWIND_ENABLE_SHARED=OFF

/ Asiri


On Thu, Feb 9, 2017 at 2:19 AM, Petr Hosek via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: phosek
> Date: Wed Feb  8 20:19:43 2017
> New Revision: 294553
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294553&view=rev
> Log:
> [libcxx][CMake] Support in-tree libunwind when building as part of runtimes
>
> When building as part of runtimes, there is no predefined order in
> which the runtimes are loaded, so the targets from other projects
> might not be available. We need to rely on HAVE_ variables
> instead in that case.
>
> Differential Revision: https://reviews.llvm.org/D29575
>
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/lib/CMakeLists.txt
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/
> CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Wed Feb  8 20:19:43 2017
> @@ -158,6 +158,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
>  # Build libc++abi with libunwind. We need this option to determine
> whether to
>  # link with libunwind or libgcc_s while running the test cases.
>  option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder."
> OFF)
> +option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM
> unwinder." OFF)
>
>  # Target options --
> 
>  option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
>
> Modified: libcxx/trunk/lib/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/
> CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff
> 
> ==
> --- libcxx/trunk/lib/CMakeLists.txt (original)
> +++ libcxx/trunk/lib/CMakeLists.txt Wed Feb  8 20:19:43 2017
> @@ -89,9 +89,9 @@ add_library_flags_if(LIBCXX_HAVE_CXX_ATO
>
>  # Add the unwinder library.
>  if (LIBCXXABI_USE_LLVM_UNWINDER)
> -  if (TARGET unwind_shared)
> +  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR
> HAVE_LIBUNWIND))
>  add_interface_library(unwind_shared)
> -  elseif (TARGET unwind_static)
> +  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR
> HAVE_LIBUNWIND))
>  add_interface_library(unwind_static)
>else()
>  add_interface_library(unwind)
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294570 - [clang-format] Fix typo in comment.

2017-02-09 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Thu Feb  9 03:02:13 2017
New Revision: 294570

URL: http://llvm.org/viewvc/llvm-project?rev=294570&view=rev
Log:
[clang-format] Fix typo in comment.

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.h?rev=294570&r1=294569&r2=294570&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.h (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.h Thu Feb  9 03:02:13 2017
@@ -122,7 +122,7 @@ public:
   /// input ranges.
   bool LeadingEmptyLinesAffected;
 
-  /// \c True if a one of this line's children intersects with an input range.
+  /// \c True if one of this line's children intersects with an input range.
   bool ChildrenAffected;
 
 private:


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


[libcxx] r294573 - Threading support: externalize sleep_for() function.

2017-02-09 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Thu Feb  9 03:31:41 2017
New Revision: 294573

URL: http://llvm.org/viewvc/llvm-project?rev=294573&view=rev
Log:
Threading support: externalize sleep_for() function.

Different platforms implement the wait/sleep functions in difrerent ways.
It makes sense to externalize this into the threading API.

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

Reviewers: EricWF, joerg

Modified:
libcxx/trunk/include/__threading_support
libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=294573&r1=294572&r2=294573&view=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu Feb  9 03:31:41 2017
@@ -12,6 +12,8 @@
 #define _LIBCPP_THREADING_SUPPORT
 
 #include <__config>
+#include 
+#include 
 
 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #pragma GCC system_header
@@ -28,8 +30,6 @@
 #include 
 #include 
 #include 
-
-#include 
 #endif
 
 #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
@@ -183,6 +183,9 @@ int __libcpp_thread_detach(__libcpp_thre
 _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_yield();
 
+_LIBCPP_THREAD_ABI_VISIBILITY
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
+
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -345,6 +348,28 @@ void __libcpp_thread_yield()
   sched_yield();
 }
 
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+   using namespace chrono;
+   seconds __s = duration_cast(__ns);
+   timespec __ts;
+   typedef decltype(__ts.tv_sec) ts_sec;
+   _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits::max();
+
+   if (__s.count() < __ts_sec_max)
+   {
+ __ts.tv_sec = static_cast(__s.count());
+ __ts.tv_nsec = static_cast((__ns - __s).count());
+   }
+   else
+   {
+ __ts.tv_sec = __ts_sec_max;
+ __ts.tv_nsec = 9; // (10^9 - 1)
+   }
+
+   while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
+}
+
 // Thread local storage
 int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
 {
@@ -562,6 +587,14 @@ void __libcpp_thread_yield()
   SwitchToThread();
 }
 
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+  using namespace chrono;
+  // round-up to the nearest milisecond
+  milliseconds __ms = duration_cast(__ns + 99);
+  Sleep(__ms.count());
+}
+
 // Thread Local Storage
 int __libcpp_tls_create(__libcpp_tls_key* __key,
 void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))

Modified: libcxx/trunk/src/thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=294573&r1=294572&r2=294573&view=diff
==
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Thu Feb  9 03:31:41 2017
@@ -114,33 +114,9 @@ namespace this_thread
 void
 sleep_for(const chrono::nanoseconds& ns)
 {
-using namespace chrono;
-if (ns > nanoseconds::zero())
+if (ns > chrono::nanoseconds::zero())
 {
-#if defined(_LIBCPP_WIN32API)
-milliseconds ms = duration_cast(ns);
-if (ms.count() == 0 || ns > duration_cast(ms))
-  ++ms;
-Sleep(ms.count());
-#else
-seconds s = duration_cast(ns);
-timespec ts;
-typedef decltype(ts.tv_sec) ts_sec;
-_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max();
-if (s.count() < ts_sec_max)
-{
-ts.tv_sec = static_cast(s.count());
-ts.tv_nsec = static_cast((ns-s).count());
-}
-else
-{
-ts.tv_sec = ts_sec_max;
-ts.tv_nsec = giga::num - 1;
-}
-
-while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
-;
-#endif
+__libcpp_thread_sleep_for(ns);
 }
 }
 


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


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

2017-02-09 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294573: Threading support: externalize sleep_for() function. 
(authored by asiri).

Changed prior to commit:
  https://reviews.llvm.org/D29630?vs=87669&id=8#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29630

Files:
  libcxx/trunk/include/__threading_support
  libcxx/trunk/src/thread.cpp

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


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

2017-02-09 Thread Asiri Rathnayake via cfe-commits
Ah, ignore me please.

I should've read the patch.

/ Asiri

On Thu, Feb 9, 2017 at 9:13 AM, Asiri Rathnayake  wrote:

> Hi Petr,
>
> This is breaking static builds of the libraries, cmake complaints with:
>
> "CMake Error at projects/libcxxabi/src/CMakeLists.txt:134
> (target_link_libraries):
>   Target "unwind" of type UTILITY may not be linked into another target.
> One
>   may link only to STATIC or SHARED libraries, or to executables with the
>   ENABLE_EXPORTS property set."
>
> Our build config is:
>
>  -DLLVM_ENABLE_ASSERTIONS=ON -DLIBCXX_ENABLE_ASSERTIONS=ON
> -DLIBCXXABI_USE_LLVM_UNWINDER=ON  -DLIBCXX_ENABLE_SHARED=OFF
> -DLIBCXXABI_ENABLE_SHARED=OFF -DLIBUNWIND_ENABLE_SHARED=OFF
>
> / Asiri
>
>
> On Thu, Feb 9, 2017 at 2:19 AM, Petr Hosek via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: phosek
>> Date: Wed Feb  8 20:19:43 2017
>> New Revision: 294553
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=294553&view=rev
>> Log:
>> [libcxx][CMake] Support in-tree libunwind when building as part of
>> runtimes
>>
>> When building as part of runtimes, there is no predefined order in
>> which the runtimes are loaded, so the targets from other projects
>> might not be available. We need to rely on HAVE_ variables
>> instead in that case.
>>
>> Differential Revision: https://reviews.llvm.org/D29575
>>
>> Modified:
>> libcxx/trunk/CMakeLists.txt
>> libcxx/trunk/lib/CMakeLists.txt
>>
>> Modified: libcxx/trunk/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
>> txt?rev=294553&r1=294552&r2=294553&view=diff
>> 
>> ==
>> --- libcxx/trunk/CMakeLists.txt (original)
>> +++ libcxx/trunk/CMakeLists.txt Wed Feb  8 20:19:43 2017
>> @@ -158,6 +158,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
>>  # Build libc++abi with libunwind. We need this option to determine
>> whether to
>>  # link with libunwind or libgcc_s while running the test cases.
>>  option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder."
>> OFF)
>> +option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM
>> unwinder." OFF)
>>
>>  # Target options --
>> 
>>  option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
>>
>> Modified: libcxx/trunk/lib/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLi
>> sts.txt?rev=294553&r1=294552&r2=294553&view=diff
>> 
>> ==
>> --- libcxx/trunk/lib/CMakeLists.txt (original)
>> +++ libcxx/trunk/lib/CMakeLists.txt Wed Feb  8 20:19:43 2017
>> @@ -89,9 +89,9 @@ add_library_flags_if(LIBCXX_HAVE_CXX_ATO
>>
>>  # Add the unwinder library.
>>  if (LIBCXXABI_USE_LLVM_UNWINDER)
>> -  if (TARGET unwind_shared)
>> +  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR
>> HAVE_LIBUNWIND))
>>  add_interface_library(unwind_shared)
>> -  elseif (TARGET unwind_static)
>> +  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR
>> HAVE_LIBUNWIND))
>>  add_interface_library(unwind_static)
>>else()
>>  add_interface_library(unwind)
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29755: Cache FileID when translating diagnostics in PCH files

2017-02-09 Thread Erik Verbruggen via Phabricator via cfe-commits
erikjv created this revision.

Modules/preambles/PCH files can contain diagnostics, which, when used,
are added to the current ASTUnit. For that to work, they are translated
to use the current FileManager's FileIDs. When the entry is not the
main file, all local source locations will be checked by a linear
search. Now this is a problem, when there are lots of diagnostics (say,

25000. and lots of local source locations (say, 44), and end up

taking seconds when using such a preamble.

The fix is to cache the last FileID, because many subsequent diagnostics
refer to the same file. This reduces the time spent in
ASTUnit::TranslateStoredDiagnostics from seconds to a few milliseconds
for files with many slocs/diagnostics.

This fixes PR31353.


https://reviews.llvm.org/D29755

Files:
  lib/Frontend/ASTUnit.cpp


Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -2539,14 +2539,22 @@
 
   SmallVector Result;
   Result.reserve(Diags.size());
+  const FileEntry *CachedFE = nullptr;
+  FileID CachedFID;
   for (const StandaloneDiagnostic &SD : Diags) {
 // Rebuild the StoredDiagnostic.
 if (SD.Filename.empty())
   continue;
 const FileEntry *FE = FileMgr.getFile(SD.Filename);
 if (!FE)
   continue;
-FileID FID = SrcMgr.translateFile(FE);
+FileID FID;
+if (FE == CachedFE) {
+  FID = CachedFID;
+} else {
+  CachedFID = FID = SrcMgr.translateFile(FE);
+  CachedFE = FE;
+}
 SourceLocation FileLoc = SrcMgr.getLocForStartOfFile(FID);
 if (FileLoc.isInvalid())
   continue;


Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -2539,14 +2539,22 @@
 
   SmallVector Result;
   Result.reserve(Diags.size());
+  const FileEntry *CachedFE = nullptr;
+  FileID CachedFID;
   for (const StandaloneDiagnostic &SD : Diags) {
 // Rebuild the StoredDiagnostic.
 if (SD.Filename.empty())
   continue;
 const FileEntry *FE = FileMgr.getFile(SD.Filename);
 if (!FE)
   continue;
-FileID FID = SrcMgr.translateFile(FE);
+FileID FID;
+if (FE == CachedFE) {
+  FID = CachedFID;
+} else {
+  CachedFID = FID = SrcMgr.translateFile(FE);
+  CachedFE = FE;
+}
 SourceLocation FileLoc = SrcMgr.getLocForStartOfFile(FID);
 if (FileLoc.isInvalid())
   continue;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r294578 - [clang-tidy] Fix misc-unused-using-decls false positives in presence of compile errors

2017-02-09 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Feb  9 04:41:27 2017
New Revision: 294578

URL: http://llvm.org/viewvc/llvm-project?rev=294578&view=rev
Log:
[clang-tidy] Fix misc-unused-using-decls false positives in presence of compile 
errors

Added:
clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls-errors.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp?rev=294578&r1=294577&r2=294578&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp Thu Feb  
9 04:41:27 2017
@@ -48,6 +48,9 @@ void UnusedUsingDeclsCheck::registerMatc
 }
 
 void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
+return;
+
   if (const auto *Using = Result.Nodes.getNodeAs("using")) {
 // Ignores using-declarations defined in macros.
 if (Using->getLocation().isMacroID())

Added: 
clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls-errors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls-errors.cpp?rev=294578&view=auto
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls-errors.cpp 
(added)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls-errors.cpp 
Thu Feb  9 04:41:27 2017
@@ -0,0 +1,12 @@
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t
+
+namespace n {
+class C;
+}
+
+using n::C;
+
+void f() {
+  for (C *p : unknown()) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 
'unknown' [clang-diagnostic-error]
+}


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


[PATCH] D29757: Threading support: Externalize hardware_concurrency()

2017-02-09 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath created this revision.

Another one of those platform-dependent methods which should live behind the 
threading API.


https://reviews.llvm.org/D29757

Files:
  include/__threading_support
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -15,26 +15,6 @@
 #include "vector"
 #include "future"
 #include "limits"
-#include 
-
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-# include 
-# if defined(BSD)
-#   include 
-# endif // defined(BSD)
-#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-# include 
-#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-
-#if defined(__NetBSD__)
-#pragma weak pthread_create // Do not create libpthread dependency
-#endif
-
-#if defined(_LIBCPP_WIN32API)
-#include 
-#endif // defined(_LIBCPP_WIN32API)
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -77,35 +57,13 @@
 unsigned
 thread::hardware_concurrency() _NOEXCEPT
 {
-#if defined(CTL_HW) && defined(HW_NCPU)
-unsigned n;
-int mib[2] = {CTL_HW, HW_NCPU};
-std::size_t s = sizeof(n);
-sysctl(mib, 2, &n, &s, 0, 0);
-return n;
-#elif defined(_SC_NPROCESSORS_ONLN)
-long result = sysconf(_SC_NPROCESSORS_ONLN);
-// sysconf returns -1 if the name is invalid, the option does not exist or
-// does not have a definite limit.
-// if sysconf returns some other negative number, we have no idea
-// what is going on. Default to something safe.
+int result = __libcpp_thread_hw_concurrency();
+
+// Treat negative values as errors. Use a safe default value.
 if (result < 0)
 return 0;
-return static_cast(result);
-#elif defined(_LIBCPP_WIN32API)
-SYSTEM_INFO info;
-GetSystemInfo(&info);
-return info.dwNumberOfProcessors;
-#else  // defined(CTL_HW) && defined(HW_NCPU)
-// TODO: grovel through /proc or check cpuid on x86 and similar
-// instructions on other architectures.
-#   if defined(_LIBCPP_MSVC)
-_LIBCPP_WARNING("hardware_concurrency not yet implemented")
-#   else
-#   warning hardware_concurrency not yet implemented
-#   endif
-return 0;  // Means not computable [thread.thread.static]
-#endif  // defined(CTL_HW) && defined(HW_NCPU)
+
+return result;
 }
 
 namespace this_thread
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -26,6 +26,19 @@
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 # include 
 # include 
+
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+# include 
+# if defined(BSD)
+#   include 
+# endif // defined(BSD)
+# include 
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+
+#if defined(__NetBSD__)
+#pragma weak pthread_create // Do not create libpthread dependency
+#endif
+
 #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
 #include 
 #include 
@@ -186,6 +199,9 @@
 _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
 
+_LIBCPP_THREAD_ABI_VISIBILITY
+int __libcpp_thread_hw_concurrency();
+
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -370,6 +386,28 @@
while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
 }
 
+int __libcpp_thread_hw_concurrency()
+{
+#if defined(CTL_HW) && defined(HW_NCPU)
+  int __n;
+  int __mib[2] = {CTL_HW, HW_NCPU};
+  std::size_t __sz = sizeof(__n);
+  sysctl(__mib, 2, &__n, &__sz, 0, 0);
+  return __n;
+#elif defined(_SC_NPROCESSORS_ONLN)
+  return sysconf(_SC_NPROCESSORS_ONLN);
+#else  // !(defined(CTL_HW) && defined(HW_NCPU))
+  // TODO: grovel through /proc or check cpuid on x86 and similar
+  // instructions on other architectures.
+# if defined(_LIBCPP_MSVC)
+_LIBCPP_WARNING("hardware_concurrency not yet implemented")
+# else
+#   warning hardware_concurrency not yet implemented
+# endif
+  return 0;  // Means not computable [thread.thread.static]
+#endif  // defined(CTL_HW) && defined(HW_NCPU
+}
+
 // Thread local storage
 int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
 {
@@ -595,6 +633,13 @@
   Sleep(__ms.count());
 }
 
+int __libcpp_thread_hw_concurrency()
+{
+  SYSTEM_INFO __info;
+  GetSystemInfo(&__info);
+  return __info.dwNumberOfProcessors;
+}
+
 // Thread Local Storage
 int __libcpp_tls_create(__libcpp_tls_key* __key,
 void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D15994: Allow for unfinished #if blocks in preambles.

2017-02-09 Thread Erik Verbruggen via Phabricator via cfe-commits
erikjv updated this revision to Diff 87792.

https://reviews.llvm.org/D15994

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Lex/PreprocessorLexer.h
  include/clang/Lex/PreprocessorOptions.h
  include/clang/Serialization/ASTBitCodes.h
  lib/Frontend/ASTUnit.cpp
  lib/Lex/Lexer.cpp
  lib/Lex/PPLexerChange.cpp
  lib/Lex/Preprocessor.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/Lexer/preamble.c
  test/Lexer/preamble2.c

Index: test/Lexer/preamble2.c
===
--- /dev/null
+++ test/Lexer/preamble2.c
@@ -0,0 +1,19 @@
+// Preamble detection test: header with an include guard.
+#ifndef HEADER_H
+#define HEADER_H
+#include "foo"
+int bar;
+#endif
+
+// This test checks for detection of the preamble of a file, which
+// includes all of the starting comments and #includes.
+
+// RUN: %clang_cc1 -print-preamble %s > %t
+// RUN: echo END. >> %t
+// RUN: FileCheck < %t %s
+
+// CHECK: // Preamble detection test: header with an include guard.
+// CHECK-NEXT: #ifndef HEADER_H
+// CHECK-NEXT: #define HEADER_H
+// CHECK-NEXT: #include "foo"
+// CHECK-NEXT: END.
Index: test/Lexer/preamble.c
===
--- test/Lexer/preamble.c
+++ test/Lexer/preamble.c
@@ -9,15 +9,12 @@
 #pragma unknown
 #endif
 #ifdef WIBBLE
-#include "honk"
-#else
-int foo();
+#include "foo"
+int bar;
 #endif
 
 // This test checks for detection of the preamble of a file, which
-// includes all of the starting comments and #includes. Note that any
-// changes to the preamble part of this file must be mirrored in
-// Inputs/preamble.txt, since we diff against it.
+// includes all of the starting comments and #includes.
 
 // RUN: %clang_cc1 -print-preamble %s > %t
 // RUN: echo END. >> %t
@@ -33,4 +30,6 @@
 // CHECK-NEXT: #endif
 // CHECK-NEXT: #pragma unknown
 // CHECK-NEXT: #endif
+// CHECK-NEXT: #ifdef WIBBLE
+// CHECK-NEXT: #include "foo"
 // CHECK-NEXT: END.
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -1090,6 +1090,7 @@
   RECORD(UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES);
   RECORD(DELETE_EXPRS_TO_ANALYZE);
   RECORD(CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH);
+  RECORD(PP_CONDITIONAL_STACK);
 
   // SourceManager Block.
   BLOCK(SOURCE_MANAGER_BLOCK);
@@ -2264,6 +2265,17 @@
 Stream.EmitRecord(PP_COUNTER_VALUE, Record);
   }
 
+  if (PP.isRecordingPreamble() && PP.hasRecordedPreamble()) {
+for (const auto &Cond : PP.getPreambleConditionalStack()) {
+  AddSourceLocation(Cond.IfLoc, Record);
+  Record.push_back(Cond.WasSkipping);
+  Record.push_back(Cond.FoundNonSkip);
+  Record.push_back(Cond.FoundElse);
+}
+Stream.EmitRecord(PP_CONDITIONAL_STACK, Record);
+Record.clear();
+  }
+
   // Enter the preprocessor block.
   Stream.EnterSubblock(PREPROCESSOR_BLOCK_ID, 3);
 
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -2889,6 +2889,20 @@
   }
   break;
 
+case PP_CONDITIONAL_STACK:
+  if (!Record.empty()) {
+SmallVector ConditionalStack;
+for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) {
+  auto loc = ReadSourceLocation(F, Record, Idx);
+  bool WasSkipping = Record[Idx++];
+  bool FoundNonSkip = Record[Idx++];
+  bool FoundElse = Record[Idx++];
+  ConditionalStack.push_back({ loc, WasSkipping, FoundNonSkip, FoundElse });
+}
+PP.setReplayablePreambleConditionalStack(ConditionalStack);
+  }
+  break;
+
 case PP_COUNTER_VALUE:
   if (!Record.empty() && Listener)
 Listener->ReadCounter(F, Record[0]);
Index: lib/Lex/Preprocessor.cpp
===
--- lib/Lex/Preprocessor.cpp
+++ lib/Lex/Preprocessor.cpp
@@ -150,6 +150,9 @@
 Ident_GetExceptionInfo = Ident_GetExceptionCode = nullptr;
 Ident_AbnormalTermination = nullptr;
   }
+
+  if (this->PPOpts->GeneratePreamble)
+PreambleConditionalStack.startRecording();
 }
 
 Preprocessor::~Preprocessor() {
@@ -537,6 +540,12 @@
 
   // Start parsing the predefines.
   EnterSourceFile(FID, nullptr, SourceLocation());
+
+  // Restore the conditional stack from the preamble, if there is one.
+  if (PreambleConditionalStack.isReplaying()) {
+CurPPLexer->setConditionalLevels(PreambleConditionalStack.getStack());
+PreambleConditionalStack.doneReplaying();
+  }
 }
 
 void Preprocessor::EndSourceFile() {
Index: lib/Lex/PPLexerChange.cpp
===
--- lib/Lex/PPLexerChange.cpp
+++ lib/Lex/PPLexerChange.cpp
@@ -46,6 +46,12 @@
   });
 }
 
+bool Preprocessor::isInPreamble() const {
+  if (IsFileLexer())
+return IncludeMa

[PATCH] D29530: [ubsan] Reduce null checking of C++ object pointers (PR27581)

2017-02-09 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Thanks!

I guess for the sake of completeness it might be useful for handle 'this' in 
parens as well, since it could up in macros:

  #define MEMBER(x) (x)->y
  ...
  MEMBER(this)
  ...

Btw, I was curious if we could do a similar optimization in Objective-C, but 
'self' can be set to null there inside the body of a method. I guess maybe it 
would be possible to avoid the null check on self if we can prove it wasn't 
modified, but that's out of scope of this patch.




Comment at: lib/CodeGen/CGExprCXX.cpp:294
+  bool SkipNullCheck = false;
+  if (const auto *CMCE = dyn_cast(CE)) {
+SkipNullCheck =

You can avoid the '{' '}' here.


https://reviews.llvm.org/D29530



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


[PATCH] D29530: [ubsan] Reduce null checking of C++ object pointers (PR27581)

2017-02-09 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Btw, you mentioned that 'this' must have been null-checked before the method is 
called. But what if it's called from some part of code that was compiled 
without `-fsanitize=null`? Wouldn't we still want at least one check to see if 
'this' is null in a method?


https://reviews.llvm.org/D29530



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


Re: [PATCH] Improved plugin/tool support by expanding an existing attribute

2017-02-09 Thread Marcwell Helpdesk via cfe-commits
Friendly ping.

> On 4 feb 2017, at 14:26, Marcwell Helpdesk  wrote:
> 
> Many plugins/tools could benefit from having a generic way for communicating 
> control directives directly from the source code to itself (via the AST) when 
> acting, for example, as source code transformers, generators, collectors and 
> the like. Attributes are a suitable way of doing this but most available 
> attributes have predefined functionality and modifying the compiler for every 
> plugin/tool is obviously not an option. There is however one undocumented but 
> existing attribute that could be used for a generic solution if it was 
> slightly modified and expanded - the annotate attribute.
> 
> The current functionality of the annotate attribute encompass annotating 
> declarations with arbitrary strings using the GNU spelling. The attached 
> patch expands on this functionality by adding annotation of statements, C++11 
> spelling and documentation. With the patch applied most of the code could be 
> annotated for the use by any Clang plugin or tool. For a more detailed 
> description of the updated attribute, see patch for "AttrDocs.td".
> 
> An example demonstratiing the use and syntax of the updated attribute:
> 
>  class [[annotate("plain")]] Object
>  { . . . };
> 
>  int main(int argc, char* argv[]) __attribute((annotate("entry-point")))
>  {
>[[annotate("local_var")]]   // Decl annotation
>int n = 1 ;
> 
>// Multiple Stmt annotations
>[[annotate("group-A"), annotate("opt-1:2")]]
>switch(n)
>{ . . . }
>return 0;
>  }
> 
> Cheers,
> Chris
> 
> Modified:
>  include/clang/Basic/Attr.td
>  include/clang/Basic/AttrDocs.td
>  lib/Sema/SemaStmtAttr.cpp
> Added:
>  test/SemaCXX/attr-annotate.cpp
> 


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


[PATCH] D28771: [Analyzer] Various fixes for the IteratorPastEnd checker

2017-02-09 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+  auto value = RVal;
+  if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);

baloghadamsoftware wrote:
> NoQ wrote:
> > Is there a test case for this hack?
> > 
> > I'd also consider inspecting the AST (probably before passing the values to 
> > `handleRandomIncrOrDecr()`) and making the decision based on that. Because 
> > even though this pattern ("if a value is a loc and we expect a nonloc, do 
> > an extra dereference") is present in many places in the analyzer, in most 
> > of these places it doesn't work correctly (what if we try to discriminate 
> > between `int*` and `int*&`?).
> I just want to get the sign of the integer value (if it is available). It 
> turned out that I cannot do comparison between loc and nonloc. (Strange, 
> because I can do anything else). After I created this hack, the Analyzer did 
> not crash anymore on the llvm/clang code.
> 
> I do not fully understand what I should fix here and how? In this particular 
> place we expect some integer, thus no int* or int*&.
Loc value, essentially, *is* a pointer or reference value. If you're getting a 
Loc, then your expectations of an integer are not met in the actual code. In 
this case you *want* to know why they are not met, otherwise you may avoid the 
crash, but do incorrect things and run into false positives. So i'd rather have 
this investigated carefully.

You say that you are crashing otherwise - and then it should be trivial for you 
to attach a debugger and `dump()` the expression for which you expect to take 
the integer value, and see why it suddenly has a pointer type in a particular 
case. From that you'd easily see what to do.

Also, crashes are often easy to auto-reduce using tools like `creduce`. Unlike 
false positives, which may turn into true positives during reduction.

If you still don't see the reason why your workaround is necessary and what 
exactly it does, could you attach a preprocessed file and an analyzer runline 
for the crash, so that we could have a look together?



Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:553
+
+  // When increasing by positive or decreasing by negative an iterator past its
+  // end, then it is a bug. We check for bugs before the operator call.

baloghadamsoftware wrote:
> NoQ wrote:
> > I think incrementing `end()` by `0` is not a bug (?)
> I think it is not a bug, but how to solve it properly? If I chose just 
> greaterThanZero, then we have the same problem for decrementing end() by 0. 
> Is it worth to create three states here?
Yep, i believe that indeed, we need three states here. There are three possible 
cases.


https://reviews.llvm.org/D28771



___
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 Amjad Aboud via Phabricator via cfe-commits
aaboud updated this revision to Diff 87796.
aaboud added a comment.

Added flag to control macro debug info generation:

1. -fdebug-macro (-fno-debug-macro) for Clang driver
2. -debug-info-macro for Clang compiler (-cc1)

Also, made sure FE will discard this flag when debug info is not required, i.e. 
with -g0.
Should we discard the macro debug info when "-gline-tables-only" is used? or it 
is up to the user not to use "-fdebug-macro" in this case?

I also extended the test to check all combinations of using -debug-info-macro 
flag with -debug-info-kind flag.


https://reviews.llvm.org/D16135

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

Index: lib/CodeGen/ModuleBuilder.cpp
===
--- lib/CodeGen/ModuleBuilder.cpp
+++ lib/CodeGen/ModuleBuilder.cpp
@@ -92,6 +92,10 @@
   return M.get();
 }
 
+CGDebugInfo *getCGDebugInfo() {
+  return Builder->getModuleDebugInfo();
+}
+
 llvm::Module *ReleaseModule() {
   return M.release();
 }
@@ -299,6 +303,10 @@
   return static_cast(this)->ReleaseModule();
 }
 
+CGDebugInfo *CodeGenerator::getCGDebugInfo() {
+  return static_cast(this)->getCGDebugInfo();
+}
+
 const Decl *CodeGenerator::GetDeclForMangledName(llvm::StringRef name) {
   return static_cast(this)->GetDeclForMangledName(name);
 }
Index: lib/CodeGen/MacroPPCallbacks.h
===
--- lib/CodeGen/MacroPPCallbacks.h
+++ lib/CodeGen/MacroPPCallbacks.h
@@ -0,0 +1,118 @@
+//===--- MacroPPCallbacks.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file defines implementation for the macro preprocessors callbacks.
+//
+//===--===//
+
+#include "clang/Lex/PPCallbacks.h"
+
+namespace llvm {
+class DIMacroFile;
+class DIMacroNode;
+}
+namespace clang {
+class Preprocessor;
+class MacroInfo;
+class CodeGenerator;
+
+class MacroPPCallbacks : public PPCallbacks {
+  /// A pointer to code generator, where debug info generator can be found.
+  CodeGenerator *Gen;
+
+  /// Preprocessor.
+  Preprocessor &PP;
+
+  /// Location of recent included file, used for line number.
+  SourceLocation LastHashLoc;
+
+  /// Counts current number of command line included files, which were entered
+  /// and were not exited yet.
+  int EnteredCommandLineIncludeFiles = 0;
+
+  enum FileScopeStatus {
+NoScope = 0,  // Scope is not initialized yet.
+InitializedScope, // Main file scope is initialized but not set yet.
+BuiltinScope, //  and  file scopes.
+CommandLineIncludeScope,  // Included file, from  file, scope.
+MainFileScope // Main file scope.
+  };
+  FileScopeStatus Status;
+
+  /// Parent contains all entered files that were not exited yet according to
+  /// the inclusion order.
+  llvm::SmallVector Scopes;
+
+  /// Get current DIMacroFile scope.
+  /// \return current DIMacroFile scope or nullptr if there is no such scope.
+  llvm::DIMacroFile *getCurrentScope();
+
+  /// Get current line location or invalid location.
+  /// \param Loc current line location.
+  /// \return current line location \p `Loc`, or invalid location if it's in a
+  /// skipped file scope.
+  SourceLocation getCorrectLocation(SourceLocation Loc);
+
+  /// Use the passed preprocessor to write the macro name and value from the
+  /// given macro info and identifier info into the given \p `Name` and \p
+  /// `Value` output streams.
+  ///
+  /// \param II Identifier info, used to get the Macro name.
+  /// \param MI Macro info, used to get the Macro argumets and values.
+  /// \param PP Preprocessor.
+  /// \param [out] Name Place holder for returned macro name and arguments.
+  /// \param [out] Value Place holder for returned macro value.
+  static void writeMacroDefinition(const IdentifierInfo &II,
+   const MacroInfo &MI, Preprocessor &PP,
+   raw_ostream &Name, raw_ostream &Value);
+
+  /// Update current file scope status to next file scope.
+  void updateStatusToNextScope();
+
+  /// Handle the case when entering a file.
+  ///
+  /// \param 

[PATCH] D29419: [Analyzer] Checker for mismatched iterators

2017-02-09 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Hello, thanks for another useful checker! I make quite a few of these mistakes 
regularly.

This one looks similar to the `IteratorPastEnd` checker, so much that i'd 
definitely advice re-using some code. At the very least, functions like 
`isIterator()` should definitely deserve a header somewhere in 
`include/clang/StaticAnalyzer/Checkers`.

Also, did you consider merging these checkers together into one file? Just 
because they have so much in common.

The usual stuff: do you already have any quality statistics, eg. how many 
warnings did you see emitted by this checker, how many of them are true/false 
positives. With that, better warning messages, and a bug reporter visitor to 
highlight the origin of the misplaced iterator, i think this checker should be 
enabled by default (go out of alpha).




Comment at: lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp:311
+
+void MismatchedIteratorChecker::checkPostStmt(const DeclStmt *DS,
+  CheckerContext &C) const {

Hmm. Now i suspect that the `checkBind()` callback should have covered this, 
both here and in the previous checker. Did you try using that instead, and see 
if other callbacks are covered by `checkBind()` as well?



Comment at: lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp:356
+  for (auto I = SymbolMap.begin(), E = SymbolMap.end(); I != E; ++I) {
+if (SR.isDead(I->first)) {
+  State = State->remove(I->first);

I'd consider `!isLive()` here due to, uhm, //subtle differences// we currently 
have between these two (there's a hard-to-fix bug that causes some symbols to 
never make it to the dead set, see D18860).


https://reviews.llvm.org/D29419



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


[PATCH] D29262: Fixes to modernize-use-using

2017-02-09 Thread Krystyna via Phabricator via cfe-commits
krystyna added a comment.

ping


https://reviews.llvm.org/D29262



___
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 Amjad Aboud via Phabricator via cfe-commits
aaboud added a comment.

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

I did a manual measurement, but I believe it is representative.
I used "time" tool to measure the whole time of the build (compile + link).

- time make -j8

Also, notice that I limited the targets to X86 only, so it was not a full build 
of LLVM.

- -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD="X86" 
-DCMAKE_CXX_FLAGS="-fstandalone-debug" -DCMAKE_C_FLAGS="-fstandalone-debug"

However, as I already said, it should answer the time change and size question 
fairly enough.

> Does GCC have a command line option for this that we could mirror?

GCC emits macro debug info when when build with -g3.


https://reviews.llvm.org/D16135



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


Re: [PATCH] Improved plugin/tool support by expanding an existing attribute

2017-02-09 Thread Aaron Ballman via cfe-commits
On Sat, Feb 4, 2017 at 8:26 AM, Marcwell Helpdesk via cfe-commits
 wrote:
> Many plugins/tools could benefit from having a generic way for communicating 
> control directives directly from the source code to itself (via the AST) when 
> acting, for example, as source code transformers, generators, collectors and 
> the like. Attributes are a suitable way of doing this but most available 
> attributes have predefined functionality and modifying the compiler for every 
> plugin/tool is obviously not an option. There is however one undocumented but 
> existing attribute that could be used for a generic solution if it was 
> slightly modified and expanded - the annotate attribute.
>
> The current functionality of the annotate attribute encompass annotating 
> declarations with arbitrary strings using the GNU spelling. The attached 
> patch expands on this functionality by adding annotation of statements, C++11 
> spelling and documentation. With the patch applied most of the code could be 
> annotated for the use by any Clang plugin or tool. For a more detailed 
> description of the updated attribute, see patch for "AttrDocs.td".

I definitely agree with the premise for this work -- having a generic
way for Clang to pass attributed information down to LLVM IR is
desirable. However, I'm not convinced that the annotate attribute is
the correct approach over something like pluggable attributes. My
primary concerns stem from the fact that the annotate attribute has no
safe guards for feature collisions (you have to pick a unique string,
or else you collide with someone else's string, but there's nothing
that forces you to do this), has no mechanisms for accepting arguments
in a consistent fashion, and provides no way to check the semantics of
the attribute. It's basically a minimum viable option for lowering
attributed information down to LLVM IR, which is fine for things that
aren't in the user's face, but isn't a good general-purpose solution.

I do not have a problem with adding a C++11 spelling to the annotate
attribute for the cases we already support, and I definitely think we
should document the attribute. But I don't think it makes sense to add
it as a statement attribute (and the current patch also leaves out
type attributes).

Some quick thoughts on the patch:

> Index: include/clang/Basic/Attr.td
> ===
> --- include/clang/Basic/Attr.td (revision 293612)
> +++ include/clang/Basic/Attr.td (working copy)
> @@ -462,9 +462,10 @@
>  }
>
>  def Annotate : InheritableParamAttr {
> -  let Spellings = [GNU<"annotate">];
> +  let Spellings = [GNU<"annotate">,
> +   CXX11<"", "annotate", 201612>];

This should be in the clang namespace and should not be given a third
argument (it's not a standards-based attribute).

>let Args = [StringArgument<"Annotation">];
> -  let Documentation = [Undocumented];
> +  let Documentation = [AnnotateDocs];
>  }
>
>  def ARMInterrupt : InheritableAttr, TargetSpecificAttr {
> Index: lib/Sema/SemaStmtAttr.cpp
> ===
> --- lib/Sema/SemaStmtAttr.cpp (revision 293612)
> +++ lib/Sema/SemaStmtAttr.cpp (working copy)
> @@ -23,6 +23,24 @@
>  using namespace clang;
>  using namespace sema;
>
> +static Attr *handleAnnotateAttr(Sema &S, Stmt *St, const AttributeList &A,
> +SourceRange Range) {
> +  // Assert string literal as the annotation's argument.
> +  StringRef Str;
> +  if (!S.checkStringLiteralArgumentAttr(A, 0, Str))
> +return nullptr;
> +
> +  // Assert single argument
> +  if (A.getNumArgs() > 1) {
> +S.Diag(A.getLoc(), diag::err_attribute_wrong_number_arguments)
> +   << A.getName() << 1;
> +return nullptr;
> +  }
> +
> +  return ::new (S.Context) AnnotateAttr(A.getRange(), S.Context, Str,
> +A.getAttributeSpellingListIndex());
> +}
> +
>  static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const AttributeList &A,
> SourceRange Range) {
>FallThroughAttr Attr(A.getRange(), S.Context,
> @@ -273,6 +291,8 @@
> diag::warn_unhandled_ms_attribute_ignored :
> diag::warn_unknown_attribute_ignored) << A.getName();
>  return nullptr;
> +  case AttributeList::AT_Annotate:
> +return handleAnnotateAttr(S, St, A, Range);
>case AttributeList::AT_FallThrough:
>  return handleFallThroughAttr(S, St, A, Range);
>case AttributeList::AT_LoopHint:
> Index: test/SemaCXX/attr-annotate.cpp
> ===
> --- test/SemaCXX/attr-annotate.cpp (nonexistent)
> +++ test/SemaCXX/attr-annotate.cpp (working copy)
> @@ -0,0 +1,17 @@
> +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
> +
> +[[annotate("foo")]] void foo() {
> +  // C++11 decl annotations
> +  [[annotate("bar")]] int x;
> +  [[annotate(1)]] int y; // expected-error {{'annot

[libcxx] r294585 - Use protected name for the prototype arguments.

2017-02-09 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Feb  9 08:12:29 2017
New Revision: 294585

URL: http://llvm.org/viewvc/llvm-project?rev=294585&view=rev
Log:
Use protected name for the prototype arguments.

Modified:
libcxx/trunk/include/__threading_support
libcxx/trunk/include/thread

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=294585&r1=294584&r2=294585&view=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu Feb  9 08:12:29 2017
@@ -184,7 +184,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_yield();
 
 _LIBCPP_THREAD_ABI_VISIBILITY
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
 
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY

Modified: libcxx/trunk/include/thread
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=294585&r1=294584&r2=294585&view=diff
==
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Thu Feb  9 08:12:29 2017
@@ -424,7 +424,7 @@ void swap(thread& __x, thread& __y) _NOE
 namespace this_thread
 {
 
-_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
+_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
 
 template 
 void


___
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 Filipe Cabecinhas via Phabricator via cfe-commits
filcab added a comment.

Minor nits, now.
LGTM, but having someone more familiar with clang chime in would be great.




Comment at: lib/CodeGen/CGExprScalar.cpp:1700
   case LangOptions::SOB_Trapping:
+if (getUnwidenedIntegerType(CGF.getContext(), E->getSubExpr()).hasValue())
+  return Builder.CreateNSWAdd(InVal, Amount, Name);

Maybe a helper `IsWidenedIntegerOp(...)` (or `IsOpWiderThanBaseType`or 
something) would make this (and others, like the first return of 
`getUnwidenedIntegerType`) easier to read?



Comment at: test/CodeGen/ubsan-promoted-arith.cpp:90
+
+// Note: -INT_MIN / -1 can overflow.
+//

Extra `-`. `INT_MIN/-1` is what you want. You already have a test above for 
`-INT_MIN` (which would overflow before the division.


https://reviews.llvm.org/D29369



___
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 John Regehr via Phabricator via cfe-commits
regehr added a comment.

Paging @dtzWill


https://reviews.llvm.org/D29369



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


[PATCH] D28771: [Analyzer] Various fixes for the IteratorPastEnd checker

2017-02-09 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+  auto value = RVal;
+  if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);

NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
> > > Is there a test case for this hack?
> > > 
> > > I'd also consider inspecting the AST (probably before passing the values 
> > > to `handleRandomIncrOrDecr()`) and making the decision based on that. 
> > > Because even though this pattern ("if a value is a loc and we expect a 
> > > nonloc, do an extra dereference") is present in many places in the 
> > > analyzer, in most of these places it doesn't work correctly (what if we 
> > > try to discriminate between `int*` and `int*&`?).
> > I just want to get the sign of the integer value (if it is available). It 
> > turned out that I cannot do comparison between loc and nonloc. (Strange, 
> > because I can do anything else). After I created this hack, the Analyzer 
> > did not crash anymore on the llvm/clang code.
> > 
> > I do not fully understand what I should fix here and how? In this 
> > particular place we expect some integer, thus no int* or int*&.
> Loc value, essentially, *is* a pointer or reference value. If you're getting 
> a Loc, then your expectations of an integer are not met in the actual code. 
> In this case you *want* to know why they are not met, otherwise you may avoid 
> the crash, but do incorrect things and run into false positives. So i'd 
> rather have this investigated carefully.
> 
> You say that you are crashing otherwise - and then it should be trivial for 
> you to attach a debugger and `dump()` the expression for which you expect to 
> take the integer value, and see why it suddenly has a pointer type in a 
> particular case. From that you'd easily see what to do.
> 
> Also, crashes are often easy to auto-reduce using tools like `creduce`. 
> Unlike false positives, which may turn into true positives during reduction.
> 
> If you still don't see the reason why your workaround is necessary and what 
> exactly it does, could you attach a preprocessed file and an analyzer runline 
> for the crash, so that we could have a look together?
Just to be clear: I know why it crashes without the hack: I simply cannot 
compare loc and nonloc. Since concrete 0 is nonloc I need another nonloc. I 
suppose this happens if an integer reference is passed to the operator +, +=, - 
or -=. So I thought that dereferencing it by getting the raw SVal is the 
correct thing to do.



Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:553
+
+  // When increasing by positive or decreasing by negative an iterator past its
+  // end, then it is a bug. We check for bugs before the operator call.

NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
> > > I think incrementing `end()` by `0` is not a bug (?)
> > I think it is not a bug, but how to solve it properly? If I chose just 
> > greaterThanZero, then we have the same problem for decrementing end() by 0. 
> > Is it worth to create three states here?
> Yep, i believe that indeed, we need three states here. There are three 
> possible cases.
OK, I will do it.


https://reviews.llvm.org/D28771



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


[PATCH] D29758: [OpenMP] Parallel reduction on the NVPTX device.

2017-02-09 Thread Arpith Jacob via Phabricator via cfe-commits
arpith-jacob created this revision.
Herald added a subscriber: jholewinski.

This patch implements codegen for the reduction clause on
any parallel construct for elementary data types.  An efficient
implementation requires hierarchical reduction within a
warp and a threadblock.  It is complicated by the fact that
variables declared in the stack of a CUDA thread cannot be
shared with other threads.

The patch creates a struct to hold reduction variables and
a number of helper functions.  The OpenMP runtime on the GPU
implements reduction algorithms that uses these helper
functions to perform reductions within a team.  Variables are
shared between CUDA threads using shuffle intrinsics.

An implementation of reductions on the NVPTX device is
substantially different to that of CPUs.  However, this patch
is written so that there are minimal changes to the rest of
OpenMP codegen.

The implemented design allows the compiler and runtime to be
decoupled, i.e., the runtime does not need to know of the
reduction operation(s), the type of the reduction variable(s),
or the number of reductions.  The design also allows reuse of
host codegen, with appropriate specialization for the NVPTX
device.

While the patch does introduce a number of abstractions, the
expected use case calls for inlining of the GPU OpenMP runtime.
After inlining and optimizations in LLVM, these abstractions
are unwound and performance of OpenMP reductions is comparable
to CUDA-canonical code.

Patch by Tian Jin in collaboration with Arpith Jacob


https://reviews.llvm.org/D29758

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  lib/CodeGen/CGOpenMPRuntimeNVPTX.h
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp

Index: test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp
@@ -0,0 +1,830 @@
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+// RUN: %clang_cc1 -verify -fopenmp -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+// Check for the data transfer medium in shared memory to transfer the reduction list to the first warp.
+// CHECK-DAG: [[TRANSFER_STORAGE:@.+]] = common addrspace([[SHARED_ADDRSPACE:[0-9]+]]) global [32 x i64]
+
+// Check that the execution mode of all 3 target regions is set to Spmd Mode.
+// CHECK-DAG: {{@__omp_offloading_.+l27}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l32}}_exec_mode = weak constant i8 0
+// CHECK-DAG: {{@__omp_offloading_.+l38}}_exec_mode = weak constant i8 0
+
+template
+tx ftemplate(int n) {
+  int a;
+  short b;
+  tx c;
+  float d;
+  double e;
+
+  #pragma omp target parallel reduction(+: e) map(tofrom: e)
+  {
+e += 5;
+  }
+
+  #pragma omp target parallel reduction(^: c) reduction(*: d) map(tofrom: c,d)
+  {
+c ^= 2;
+d *= 33;
+  }
+
+  #pragma omp target parallel reduction(|: a) reduction(max: b) map(tofrom: a,b)
+  {
+a |= 1;
+b = 99 > b ? 99 : b;
+  }
+
+  return a+b+c+d+e;
+}
+
+int bar(int n){
+  int a = 0;
+
+  a += ftemplate(n);
+
+  return a;
+}
+
+  // CHECK: define {{.*}}void {{@__omp_offloading_.+template.+l27}}(
+  //
+  // CHECK: call void @__kmpc_spmd_kernel_init(
+  // CHECK: br label {{%?}}[[EXECUTE:.+]]
+  //
+  // CHECK: [[EXECUTE]]
+  // CHECK: {{call|invoke}} void [[PFN:@.+]](i32*
+  // CHECK: call void @__kmpc_spmd_kernel_deinit()
+  //
+  //
+  // define internal void [[PFN]](
+  // CHECK: store double {{[0\.e\+]+}}, double* [[E:%.+]], align
+  // CHECK: [[EV:%.+]] = load double, double* [[E]], align
+  // CHECK: [[ADD:%.+]] = fadd double [[EV]], 5
+  // CHECK: store double [[ADD]], double* [[E]], align
+  // CHECK: [[PTR1:%.+]] = getelementptr inbounds [[RLT:.+]], [1 x i8*]* [[RL:%.+]], i{{32|64}} 0, i{{32|64}} 

[PATCH] D29419: [Analyzer] Checker for mismatched iterators

2017-02-09 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

In https://reviews.llvm.org/D29419#671839, @NoQ wrote:

> This one looks similar to the `IteratorPastEnd` checker, so much that i'd 
> definitely advice re-using some code. At the very least, functions like 
> `isIterator()` should definitely deserve a header somewhere in 
> `include/clang/StaticAnalyzer/Checkers`.
>
> Also, did you consider merging these checkers together into one file? Just 
> because they have so much in common.


Yes. Actually these two checkers served for me as prototypes, but it turned out 
quite early that if I want to implement the most important iterator checker, 
thus the checker for invalidated iterators it requires a tracker structure that 
includes all the data we need for these two checkers. So it would be a wast of 
resources to duplicate these data. So now I am also working on the merged 
version.


https://reviews.llvm.org/D29419



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


[PATCH] D29506: [OpenMP] Teams reduction on the NVPTX device.

2017-02-09 Thread Arpith Jacob via Phabricator via cfe-commits
arpith-jacob marked 2 inline comments as done.
arpith-jacob added a comment.

In https://reviews.llvm.org/D29506#669542, @ABataev wrote:

> The patch is too big and quite hard to review? Could you split it into 
> several smaller parts?


Alexey, thank you for your time.  I have addressed your comments and split the 
patch into a smaller one, which I will post shortly.

The new patch is to implement parallel reductions on the GPU.  This is the 
smallest patch I can get such that the codegen is correct and fully functional 
(runs correctly on the GPU).

Thanks,
Arpith




Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:4280-4282
+  // We don't need debug information in this function as nothing here refers to
+  // user source code.
+  CGF.disableDebugInfo();

ABataev wrote:
> It is not quite so, at least we have a reference in a list of reductions in 
> `reduction` clause, which may be considered a debug position
Ok, removed.



Comment at: lib/CodeGen/CGOpenMPRuntime.h:524
+
+  static bool classof(const CGOpenMPRuntime *RT) {
+return RT->getKind() == RK_HOST;

ABataev wrote:
> arpith-jacob wrote:
> > This is required to cast to the NVPTX runtime in a static function as 
> > follows;
> > 
> > CGOpenMPRuntimeNVPTX &RT = 
> > cast(CGM.getOpenMPRuntime());
> Are you going to make calls to `isa()`, `dyn_cast()` functions? If not, just 
> use `static_cast<>()` instead.
Yes, I will use a static_cast and remove the OpenMPRuntimeKind functionality.



Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:972-973
+  auto CastTy = Size <= 4 ? CGM.Int32Ty : CGM.Int64Ty;
+  auto *ElemCast = Bld.CreateSExtOrBitCast(Elem, CastTy);
+  auto *WarpSize = Bld.CreateTruncOrBitCast(getNVPTXWarpSize(CGF), 
CGM.Int16Ty);
+

ABataev wrote:
> I'd prefer you to use `CGF.EmitScalarConversion()` rather than Builder casts.
Ok.  I have used CGF.EmitScalarConversion() when I can, for example for 
WarpSize.  In other cases I want simple bitcasts and truncs so I have used the 
Builder.



Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:975-978
+  llvm::SmallVector Args;
+  Args.push_back(ElemCast);
+  Args.push_back(Offset);
+  Args.push_back(WarpSize);

ABataev wrote:
> Do you really need a SmallVector<> or you can use just an array here?
Used an array here and other places.



Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2249
+ ? OMPD_parallel_for_simd
+ : OMPD_parallel);
   // Emit post-update of the reduction variables if IsLastIter != 0.

ABataev wrote:
> OMPD_parallel or OMPD_parallel_for?
OMPD_parallel is fine.  I just need to know that it is a 'parallel' type 
reduction.



Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2424
 CGF.OMPCancelStack.emitExit(CGF, S.getDirectiveKind(), CodeGen);
-CGF.EmitOMPReductionClauseFinal(S);
+CGF.EmitOMPReductionClauseFinal(S, OMPD_parallel);
 // Emit post-update of the reduction variables if IsLastIter != 0.

ABataev wrote:
> OMPD_parallel_for?
This is the reduction codegen for the 'sections' directive.  So a reduction 
type of 'OMPD_parallel' works well.


https://reviews.llvm.org/D29506



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


[PATCH] D28772: [Preprocessor] Fix incorrect token caching that occurs when lexing _Pragma in macro argument pre-expansion mode when skipping a function body

2017-02-09 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 87801.
arphaman added a comment.

Sorry about the delay.
As per Richard's suggestion, the updated patch now makes the `_Pragma` parser 
responsible for initiating the removal of cached tokens.


Repository:
  rL LLVM

https://reviews.llvm.org/D28772

Files:
  include/clang/Lex/Preprocessor.h
  lib/Lex/PPCaching.cpp
  lib/Lex/Pragma.cpp
  test/CodeCompletion/pragma-macro-token-caching.c

Index: test/CodeCompletion/pragma-macro-token-caching.c
===
--- /dev/null
+++ test/CodeCompletion/pragma-macro-token-caching.c
@@ -0,0 +1,18 @@
+
+#define Outer(action) action
+
+void completeParam(int param) {
+;
+Outer(__extension__({ _Pragma("clang diagnostic push") }));
+param;
+}
+
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:1 %s | FileCheck %s
+// CHECK: param : [#int#]param
+
+void completeParamPragmaError(int param) {
+Outer(__extension__({ _Pragma(2) })); // expected-error {{_Pragma takes a parenthesized string literal}}
+param;
+}
+
+// RUN: %clang_cc1 -fsyntax-only -verify -code-completion-at=%s:16:1 %s | FileCheck %s
Index: lib/Lex/Pragma.cpp
===
--- lib/Lex/Pragma.cpp
+++ lib/Lex/Pragma.cpp
@@ -160,12 +160,23 @@
 
   ~LexingFor_PragmaRAII() {
 if (InMacroArgPreExpansion) {
+  // When committing/backtracking the cached pragma tokens in a macro
+  // argument pre-expansion we want to ensure that either the tokens which
+  // have been committed will be removed from the cache or that the tokens
+  // over which we just backtracked won't remain in the cache after they're
+  // consumed and that the caching will stop after consuming them.
+  // Otherwise the caching will interfere with the way macro expansion
+  // works, because we will continue to cache tokens after consuming the
+  // backtracked tokens, which shouldn't happen when we're dealing with
+  // macro argument pre-expansion.
+  auto CachedTokenRange = PP.LastCachedTokenRange();
   if (Failed) {
 PP.CommitBacktrackedTokens();
   } else {
 PP.Backtrack();
 OutTok = PragmaTok;
   }
+  PP.EraseCachedTokens(CachedTokenRange);
 }
   }
 
Index: lib/Lex/PPCaching.cpp
===
--- lib/Lex/PPCaching.cpp
+++ lib/Lex/PPCaching.cpp
@@ -35,6 +35,29 @@
   BacktrackPositions.pop_back();
 }
 
+Preprocessor::CachedTokensRange Preprocessor::LastCachedTokenRange() {
+  assert(isBacktrackEnabled());
+  auto PrevCachedLexPos = BacktrackPositions.back();
+  return CachedTokensRange{PrevCachedLexPos, CachedLexPos};
+}
+
+void Preprocessor::EraseCachedTokens(CachedTokensRange TokenRange) {
+  assert(TokenRange.Begin <= TokenRange.End);
+  if (CachedLexPos == TokenRange.Begin && TokenRange.Begin != TokenRange.End) {
+// We have backtracked to the start of the token range as we want to consume
+// them again. Erase the tokens only after consuming then.
+assert(!CachedTokenRangeToErase);
+CachedTokenRangeToErase = TokenRange;
+return;
+  }
+  // The cached tokens were committed, so they should be erased now.
+  assert(TokenRange.End == CachedLexPos);
+  CachedTokens.erase(CachedTokens.begin() + TokenRange.Begin,
+ CachedTokens.begin() + TokenRange.End);
+  CachedLexPos = TokenRange.Begin;
+  ExitCachingLexMode();
+}
+
 // Make Preprocessor re-lex the tokens that were lexed since
 // EnableBacktrackAtThisPos() was previously called.
 void Preprocessor::Backtrack() {
@@ -51,6 +74,13 @@
 
   if (CachedLexPos < CachedTokens.size()) {
 Result = CachedTokens[CachedLexPos++];
+// Erase the some of the cached tokens after they are consumed when
+// asked to do so.
+if (CachedTokenRangeToErase &&
+CachedTokenRangeToErase->End == CachedLexPos) {
+  EraseCachedTokens(*CachedTokenRangeToErase);
+  CachedTokenRangeToErase = None;
+}
 return;
   }
 
Index: include/clang/Lex/Preprocessor.h
===
--- include/clang/Lex/Preprocessor.h
+++ include/clang/Lex/Preprocessor.h
@@ -1077,6 +1077,24 @@
   /// \brief Disable the last EnableBacktrackAtThisPos call.
   void CommitBacktrackedTokens();
 
+  struct CachedTokensRange {
+CachedTokensTy::size_type Begin, End;
+  };
+
+private:
+  /// \brief A range of cached tokens that should be erased after lexing
+  /// when backtracking requires the erasure of such cached tokens.
+  Optional CachedTokenRangeToErase;
+
+public:
+  /// \brief Returns the range of cached tokens that were lexed since
+  /// EnableBacktrackAtThisPos() was previously called.
+  CachedTokensRange LastCachedTokenRange();
+
+  /// \brief Erase the range of cached tokens that were lexed since
+  /// EnableBacktrackAtThisPos() was previously called.
+  void EraseCachedTokens(CachedTokensRange TokenRange

[PATCH] D28771: [Analyzer] Various fixes for the IteratorPastEnd checker

2017-02-09 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+  auto value = RVal;
+  if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);

baloghadamsoftware wrote:
> NoQ wrote:
> > baloghadamsoftware wrote:
> > > NoQ wrote:
> > > > Is there a test case for this hack?
> > > > 
> > > > I'd also consider inspecting the AST (probably before passing the 
> > > > values to `handleRandomIncrOrDecr()`) and making the decision based on 
> > > > that. Because even though this pattern ("if a value is a loc and we 
> > > > expect a nonloc, do an extra dereference") is present in many places in 
> > > > the analyzer, in most of these places it doesn't work correctly (what 
> > > > if we try to discriminate between `int*` and `int*&`?).
> > > I just want to get the sign of the integer value (if it is available). It 
> > > turned out that I cannot do comparison between loc and nonloc. (Strange, 
> > > because I can do anything else). After I created this hack, the Analyzer 
> > > did not crash anymore on the llvm/clang code.
> > > 
> > > I do not fully understand what I should fix here and how? In this 
> > > particular place we expect some integer, thus no int* or int*&.
> > Loc value, essentially, *is* a pointer or reference value. If you're 
> > getting a Loc, then your expectations of an integer are not met in the 
> > actual code. In this case you *want* to know why they are not met, 
> > otherwise you may avoid the crash, but do incorrect things and run into 
> > false positives. So i'd rather have this investigated carefully.
> > 
> > You say that you are crashing otherwise - and then it should be trivial for 
> > you to attach a debugger and `dump()` the expression for which you expect 
> > to take the integer value, and see why it suddenly has a pointer type in a 
> > particular case. From that you'd easily see what to do.
> > 
> > Also, crashes are often easy to auto-reduce using tools like `creduce`. 
> > Unlike false positives, which may turn into true positives during reduction.
> > 
> > If you still don't see the reason why your workaround is necessary and what 
> > exactly it does, could you attach a preprocessed file and an analyzer 
> > runline for the crash, so that we could have a look together?
> Just to be clear: I know why it crashes without the hack: I simply cannot 
> compare loc and nonloc. Since concrete 0 is nonloc I need another nonloc. I 
> suppose this happens if an integer reference is passed to the operator +, +=, 
> - or -=. So I thought that dereferencing it by getting the raw SVal is the 
> correct thing to do.
Yep, in this case the correct thing to do would be to check AST types rather 
than SVal types. Eg.,
```
if (Arg->getType()->isReferenceType())
 value = State->getRawSVal(*loc);
```

(you might need to do it in the caller function, which still has access to the 
expressions)

It is better this way because expectations are explicitly stated, and the 
assertion would still catch the situation when expectations are not met.

Also, please still add a test case to cover this branch :)


https://reviews.llvm.org/D28771



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


[clang-format] patch for bug 26125

2017-02-09 Thread Wei Mao via cfe-commits
https://llvm.org/bugs/show_bug.cgi?id=26125. The proposed patch is in the
bug attachment

Bug 26125 - Clang format creates unwanted temporary files when batching
processing on windows

# Summary
A file mapping object prevents the temp file from being deleted. This is a
100% repro on Windows.

# Details
When formatting a file in place, the original file is mapped into memory
for reading.

Later when trying to overwrite the changed file, kernel!ReplaceFile()
renames the original file to ~RF.TMP, creates a new file with
, copies formatted content to it, and finally deletes
~RF.TMP. Because there is still a open file mapping section
to the original file (now with new file name ~RF.TMP), delete
fails with 0xc121 - STATUS_CANNOT_DELETE, leaving the temp file
untouched after the clang-format operation.

# Fix
Releasing the file mapping object early allows deletefile to proceed
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

What's the motivation for this? The placement of a local volatile variable is 
still under the compiler's direction, and unless the address escapes, we still 
assume we can reason about its aliasing (and, thus, whether or not it is 
initialized).


https://reviews.llvm.org/D28543



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


[PATCH] D27710: [analyzer] Prohibit ExplodedGraph's edges duplicating

2017-02-09 Thread Ilya Palachev via Phabricator via cfe-commits
ilya-palachev abandoned this revision.
ilya-palachev added a comment.

Ok, then, if you see no problem in dual edges, I'm abandoning this revision.


Repository:
  rL LLVM

https://reviews.llvm.org/D27710



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


[PATCH] D29764: [OpenCL] Blocks cannot capture/reference another block

2017-02-09 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Herald added a subscriber: yaxunl.

Adding the last restriction from s6.12.5 OpenCL C v2.0.

"A Block cannot reference or capture another Block variable declared in the 
outer scope".


https://reviews.llvm.org/D29764

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  test/SemaOpenCL/invalid-block.cl


Index: test/SemaOpenCL/invalid-block.cl
===
--- test/SemaOpenCL/invalid-block.cl
+++ test/SemaOpenCL/invalid-block.cl
@@ -66,3 +66,19 @@
   *bl;  // expected-error {{invalid argument type 'bl2_t' (aka 'int 
(__generic ^const)(int)') to unary expression}}
   &bl;  // expected-error {{invalid argument type 'bl2_t' (aka 'int 
(__generic ^const)(int)') to unary expression}}
 }
+// A block can't reference another block
+kernel void foobars() {
+  int v0;
+  bl2_t bl1 = ^(int i) {
+return 1;
+  };
+  void (^bl2)(void) = ^{
+int i = bl1(1); // expected-error {{cannot refer to a block inside block}}
+  };
+  void (^bl3)(void) = ^{
+  };
+  void (^bl4)(void) = ^{
+bl3(); // expected-error {{cannot refer to a block inside block}}
+  };
+  return;
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -13583,6 +13583,13 @@
 }
 return false;
   }
+  // OpenCL v2.0 s6.12.5: Blocks cannot reference/capture other blocks
+  if (S.getLangOpts().OpenCL && IsBlock &&
+  Var->getType()->isBlockPointerType()) {
+if (Diagnose)
+  S.Diag(Loc, diag::err_opencl_block_ref_block);
+return false;
+  }
 
   return true;
 }
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -8231,6 +8231,8 @@
   "invalid block variable declaration - must be %select{const 
qualified|initialized}0">;
 def err_opencl_extern_block_declaration : Error<
   "invalid block variable declaration - using 'extern' storage class is 
disallowed">;
+def err_opencl_block_ref_block : Error<
+  "cannot refer to a block inside block">;
 
 // OpenCL v2.0 s6.13.9 - Address space qualifier functions. 
 def err_opencl_builtin_to_addr_arg_num : Error<


Index: test/SemaOpenCL/invalid-block.cl
===
--- test/SemaOpenCL/invalid-block.cl
+++ test/SemaOpenCL/invalid-block.cl
@@ -66,3 +66,19 @@
   *bl;  // expected-error {{invalid argument type 'bl2_t' (aka 'int (__generic ^const)(int)') to unary expression}}
   &bl;  // expected-error {{invalid argument type 'bl2_t' (aka 'int (__generic ^const)(int)') to unary expression}}
 }
+// A block can't reference another block
+kernel void foobars() {
+  int v0;
+  bl2_t bl1 = ^(int i) {
+return 1;
+  };
+  void (^bl2)(void) = ^{
+int i = bl1(1); // expected-error {{cannot refer to a block inside block}}
+  };
+  void (^bl3)(void) = ^{
+  };
+  void (^bl4)(void) = ^{
+bl3(); // expected-error {{cannot refer to a block inside block}}
+  };
+  return;
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -13583,6 +13583,13 @@
 }
 return false;
   }
+  // OpenCL v2.0 s6.12.5: Blocks cannot reference/capture other blocks
+  if (S.getLangOpts().OpenCL && IsBlock &&
+  Var->getType()->isBlockPointerType()) {
+if (Diagnose)
+  S.Diag(Loc, diag::err_opencl_block_ref_block);
+return false;
+  }
 
   return true;
 }
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -8231,6 +8231,8 @@
   "invalid block variable declaration - must be %select{const qualified|initialized}0">;
 def err_opencl_extern_block_declaration : Error<
   "invalid block variable declaration - using 'extern' storage class is disallowed">;
+def err_opencl_block_ref_block : Error<
+  "cannot refer to a block inside block">;
 
 // OpenCL v2.0 s6.13.9 - Address space qualifier functions. 
 def err_opencl_builtin_to_addr_arg_num : Error<
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

We should have regression tests for this. Maybe update 
test/Driver/frame-pointer-elim.c?


https://reviews.llvm.org/D29750



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


[PATCH] D29262: Fixes to modernize-use-using

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

LG with a few comments.




Comment at: clang-tidy/modernize/UseUsingCheck.h:24
 class UseUsingCheck : public ClangTidyCheck {
+
 public:

nit: empty line



Comment at: clang-tidy/modernize/UseUsingCheck.h:32
+private:
+  const bool MacroWarning;
 };

nit: `MacroWarning` doesn't sound right to me. Maybe `WarnInMacros` or even 
`IgnoreMacros` (defaulting to `true`)?



Comment at: test/clang-tidy/modernize-use-using.cpp:154
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using FuncType = my_cclass
+}

Why no trailing semicolon?


https://reviews.llvm.org/D29262



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


[PATCH] D28768: [clang-tidy] Add check 'modernize-return-braced-init-list'

2017-02-09 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

Please mark all addressed comments "Done".




Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:60
+  // Make sure that the return type matches the constructed type.
+  const QualType returnType =
+  MatchedFunctionDecl->getReturnType().getCanonicalType();

Please follow LLVM naming conventions (variables should StartWithUpperCase).



Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:72
+  for (Decl *D :
+   MatchedConstructExpr->getConstructor()->getAsFunction()->decls()) {
+if (const auto *VD = dyn_cast(D)) {

1. `getAsFunction()` is not needed, `CXXConstructorDecl` derives from 
`FunctionDecl`
2. A simple loop from `0` to `getNumParams() ` would make it easier to see that 
the code is correct
3. s/i/I/



Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:93
+   << FixItHint::CreateReplacement(
+  CharSourceRange::getTokenRange(CallParensRange.getBegin(),
+ CallParensRange.getBegin()),

`SourceRange` is implicitly constructible from `SourceLocation`, so you need to 
supply the same location twice. Same below.


Repository:
  rL LLVM

https://reviews.llvm.org/D28768



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


[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.

2017-02-09 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

@Pekka, do you think there is something more to be done here or can I close 
this revision now?

Apparently, I won't be able to pass` -target` in all cases because `-cc` has to 
be always the first parameter.

Also I am preparing additional text and some minor corrections in another 
review.


https://reviews.llvm.org/D28080



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


[PATCH] D29661: [clang-tidy] Add -quiet option to suppress extra output

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

LG with one comment.




Comment at: clang-tidy/tool/ClangTidyMain.cpp:194
+printing statistics about ignored warnings,
+check profile data and warnings treated as
+errors if the respective options are specified.

Not sure it's useful to suppress check profile data, since it's off by default 
and if someone turns it on, they mean it.


https://reviews.llvm.org/D29661



___
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 Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

Please also add driver testcase (e.g., to test/Driver/debug-options.c).
Technically clang does accept -g3 as an option, so we could wire it up for 
compatibility. I would still keep the -fmacro-debug driver option though.




Comment at: docs/UsersManual.rst:1692
+
+Debug info for macro increases the size of debug information in the binary.
+Macro debug info generated by Clang can be controlled by the flags listed 
below.

Debug info for C preprocessor macros ...



Comment at: docs/UsersManual.rst:1697
+
+  Generate complete debug info. This flag is discarded when **-g0** is enabled.
+

Generate debug info for preprocessor macros. ...


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] D29768: [TargetInfo] Set 'UseSignedCharForObjCBool' to false by default

2017-02-09 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision.

The target-specific flag 'UseSignedCharForObjCBool' is used to determine the 
type for the Objective-C BOOL type. We should set it to `false` by default so 
that new targets can avoid setting it to `true`.


Repository:
  rL LLVM

https://reviews.llvm.org/D29768

Files:
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets.cpp
  test/Frontend/objc-bool-is-bool.m

Index: test/Frontend/objc-bool-is-bool.m
===
--- test/Frontend/objc-bool-is-bool.m
+++ test/Frontend/objc-bool-is-bool.m
@@ -1,5 +1,22 @@
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7k-apple-watchos %s | FileCheck --check-prefix=BOOL %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7-apple-watchos %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7-apple-ios %s | FileCheck --check-prefix=CHAR %s
+
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=arm64-apple-ios %s | FileCheck --check-prefix=BOOL %s
+
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=i686-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=i686-apple-ios %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=i686-apple-tvos %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=i686-apple-watchos %s | FileCheck --check-prefix=BOOL %s
+
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-ios %s | FileCheck --check-prefix=BOOL %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-tvos %s | FileCheck --check-prefix=BOOL %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-watchos %s | FileCheck --check-prefix=CHAR %s
+
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=ppc32-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=ppc64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+
 // RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
 // RUN: %clang_cc1 -x c++ -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1719,6 +1719,7 @@
 PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726
 LongLongAlign = 32;
 SuitableAlign = 128;
+UseSignedCharForObjCBool = true;
 resetDataLayout("E-m:o-p:32:32-f64:32:64-n32");
   }
   BuiltinVaListKind getBuiltinVaListKind() const override {
@@ -1732,6 +1733,7 @@
   : DarwinTargetInfo(Triple, Opts) {
 HasAlignMac68kSupport = true;
 SuitableAlign = 128;
+UseSignedCharForObjCBool = true;
 resetDataLayout("E-m:o-i64:64-n32:64");
   }
 };
@@ -4335,8 +4337,8 @@
 MaxVectorAlign = 256;
 // The watchOS simulator uses the builtin bool type for Objective-C.
 llvm::Triple T = llvm::Triple(Triple);
-if (T.isWatchOS())
-  UseSignedCharForObjCBool = false;
+if (!T.isWatchOS())
+  UseSignedCharForObjCBool = true;
 SizeType = UnsignedLong;
 IntPtrType = SignedLong;
 resetDataLayout("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128");
@@ -4767,8 +4769,8 @@
 Int64Type = SignedLongLong;
 // The 64-bit iOS simulator uses the builtin bool type for Objective-C.
 llvm::Triple T = llvm::Triple(Triple);
-if (T.isiOS())
-  UseSignedCharForObjCBool = false;
+if (!T.isiOS())
+  UseSignedCharForObjCBool = true;
 resetDataLayout("e-m:o-i64:64-f80:128-n8:16:32:64-S128");
   }
 
@@ -5894,11 +5896,12 @@
   // The 32-bit ABI is silent on what ptrdiff_t should be, but given that
   // size_t is long, it's a bit weird for it to be int.
   PtrDiffType = SignedLong;
-
-  // BOOL should be a real boolean on the new ABI
-  UseSignedCharForObjCBool = false;
-} else
+} else {
   TheCXXABI.set(TargetCXXABI::iOS);
+
+  // BOOL should be a character on the iOS ABI.
+  UseSignedCharForObjCBool = true;
+}
   }
 };
 
@@ -6300,7 +6303,6 @@
   : DarwinTargetInfo(Triple, Opts) {
 Int64Type = SignedLongLong;
 WCharType = SignedInt;
-UseSignedCharForObjCBool = false;
 
 LongDoubleWidth = LongDoubleAlign = SuitableAlign = 64;
 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -72,7 +72,7 @@
   Int64Type = SignedLongLong;
   SigAtomicType = SignedInt;
   ProcessIDType = SignedInt;
-  UseSignedCharForObjCBool = true;
+  UseSignedCharForObjCBool

[PATCH] D28286: [CodeCompletion] Code complete the missing C++11 keywords

2017-02-09 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Ping.


Repository:
  rL LLVM

https://reviews.llvm.org/D28286



___
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 Amjad Aboud via Phabricator via cfe-commits
aaboud updated this revision to Diff 87819.
aaboud marked 2 inline comments as done.
aaboud added a comment.

Added test cases for driver debug info macro flags in 
test/Driver/debug-options.c
Applied some changes to the documentation suggested by Ardian.


https://reviews.llvm.org/D16135

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

Index: lib/CodeGen/ModuleBuilder.cpp
===
--- lib/CodeGen/ModuleBuilder.cpp
+++ lib/CodeGen/ModuleBuilder.cpp
@@ -92,6 +92,10 @@
   return M.get();
 }
 
+CGDebugInfo *getCGDebugInfo() {
+  return Builder->getModuleDebugInfo();
+}
+
 llvm::Module *ReleaseModule() {
   return M.release();
 }
@@ -299,6 +303,10 @@
   return static_cast(this)->ReleaseModule();
 }
 
+CGDebugInfo *CodeGenerator::getCGDebugInfo() {
+  return static_cast(this)->getCGDebugInfo();
+}
+
 const Decl *CodeGenerator::GetDeclForMangledName(llvm::StringRef name) {
   return static_cast(this)->GetDeclForMangledName(name);
 }
Index: lib/CodeGen/MacroPPCallbacks.h
===
--- lib/CodeGen/MacroPPCallbacks.h
+++ lib/CodeGen/MacroPPCallbacks.h
@@ -0,0 +1,118 @@
+//===--- MacroPPCallbacks.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file defines implementation for the macro preprocessors callbacks.
+//
+//===--===//
+
+#include "clang/Lex/PPCallbacks.h"
+
+namespace llvm {
+class DIMacroFile;
+class DIMacroNode;
+}
+namespace clang {
+class Preprocessor;
+class MacroInfo;
+class CodeGenerator;
+
+class MacroPPCallbacks : public PPCallbacks {
+  /// A pointer to code generator, where debug info generator can be found.
+  CodeGenerator *Gen;
+
+  /// Preprocessor.
+  Preprocessor &PP;
+
+  /// Location of recent included file, used for line number.
+  SourceLocation LastHashLoc;
+
+  /// Counts current number of command line included files, which were entered
+  /// and were not exited yet.
+  int EnteredCommandLineIncludeFiles = 0;
+
+  enum FileScopeStatus {
+NoScope = 0,  // Scope is not initialized yet.
+InitializedScope, // Main file scope is initialized but not set yet.
+BuiltinScope, //  and  file scopes.
+CommandLineIncludeScope,  // Included file, from  file, scope.
+MainFileScope // Main file scope.
+  };
+  FileScopeStatus Status;
+
+  /// Parent contains all entered files that were not exited yet according to
+  /// the inclusion order.
+  llvm::SmallVector Scopes;
+
+  /// Get current DIMacroFile scope.
+  /// \return current DIMacroFile scope or nullptr if there is no such scope.
+  llvm::DIMacroFile *getCurrentScope();
+
+  /// Get current line location or invalid location.
+  /// \param Loc current line location.
+  /// \return current line location \p `Loc`, or invalid location if it's in a
+  /// skipped file scope.
+  SourceLocation getCorrectLocation(SourceLocation Loc);
+
+  /// Use the passed preprocessor to write the macro name and value from the
+  /// given macro info and identifier info into the given \p `Name` and \p
+  /// `Value` output streams.
+  ///
+  /// \param II Identifier info, used to get the Macro name.
+  /// \param MI Macro info, used to get the Macro argumets and values.
+  /// \param PP Preprocessor.
+  /// \param [out] Name Place holder for returned macro name and arguments.
+  /// \param [out] Value Place holder for returned macro value.
+  static void writeMacroDefinition(const IdentifierInfo &II,
+   const MacroInfo &MI, Preprocessor &PP,
+   raw_ostream &Name, raw_ostream &Value);
+
+  /// Update current file scope status to next file scope.
+  void updateStatusToNextScope();
+
+  /// Handle the case when entering a file.
+  ///
+  /// \param Loc Indicates the new location.
+  /// \Return true if file scope status should be updated.
+  void FileEntered(SourceLocation Loc);
+
+  /// Handle the case when exiting a file.
+  ///
+  /// \Return true if file scope status should be updated.
+  void FileExited(SourceLocation 

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

2017-02-09 Thread Hiroshi Inoue via Phabricator via cfe-commits
inouehrs updated this revision to Diff 87821.
inouehrs added a comment.

Thank you for the comment.
I added regression tests for PPC in test/Driver/frame-pointer.c as for other 
platforms.


https://reviews.llvm.org/D29750

Files:
  lib/Driver/Tools.cpp
  test/Driver/frame-pointer.c


Index: test/Driver/frame-pointer.c
===
--- test/Driver/frame-pointer.c
+++ test/Driver/frame-pointer.c
@@ -17,6 +17,13 @@
 // RUN: %clang -target s390x-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-64 %s
 // RUN: %clang -target s390x-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-64 %s
 
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O0 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O1 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+
 // RUN: %clang -target mips-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-32 %s
 // RUN: %clang -target mipsel-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-32 %s
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3441,6 +3441,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:


Index: test/Driver/frame-pointer.c
===
--- test/Driver/frame-pointer.c
+++ test/Driver/frame-pointer.c
@@ -17,6 +17,13 @@
 // RUN: %clang -target s390x-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
 // RUN: %clang -target s390x-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
 
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+
 // RUN: %clang -target mips-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
 // RUN: %clang -target mipsel-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3441,6 +3441,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-09 Thread Will Dietz via Phabricator via cfe-commits
dtzWill accepted this revision.
dtzWill added a comment.

I've been bitten when attempting to use existence/nature of casts in the AST to 
reason about the original code, but this looks like it does the right thing in 
all the situations I can think of.

Missing overflows because of a bugged attempt to optimize the -O0 case would be 
unfortunate-- has this been tested and compared on larger codes (test-suite, 
other projects)?

When it comes to C/C++ standards and constructs, it seems there's always some 
extension/language feature/flag that someone (ab)uses that you forgot all about 
when reasoning about these things abstractly...  so it'd be good to see this 
checked out before the next major release.

+1 to suggestion for a more readable name or wrapper for the common pattern of 
'getUnwidenedIntegerType..hasValue()', if you get a chance.

LGTM, thanks!


https://reviews.llvm.org/D29369



___
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 Adrian Prantl via Phabricator via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Could you also add support for -g3? It looks like we are supporting -g0 and 
-g1, so we should probably also mirror -g3.

Thanks a lot for all your work!


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] D28768: [clang-tidy] Add check 'modernize-return-braced-init-list'

2017-02-09 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere updated this revision to Diff 87823.
JDevlieghere marked 11 inline comments as done.
JDevlieghere added a comment.

- Fixed issues raised by @alexfh


Repository:
  rL LLVM

https://reviews.llvm.org/D28768

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/ReturnBracedInitListCheck.cpp
  clang-tidy/modernize/ReturnBracedInitListCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-return-braced-init-list.rst
  test/clang-tidy/modernize-return-braced-init-list.cpp

Index: test/clang-tidy/modernize-return-braced-init-list.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-return-braced-init-list.cpp
@@ -0,0 +1,188 @@
+// RUN: %check_clang_tidy %s modernize-return-braced-init-list %t -- --
+// -std=c++14
+
+namespace std {
+typedef decltype(sizeof(int)) size_t;
+
+// libc++'s implementation
+template 
+class initializer_list {
+  const _E *__begin_;
+  size_t __size_;
+
+  initializer_list(const _E *__b, size_t __s)
+  : __begin_(__b),
+__size_(__s) {}
+
+public:
+  typedef _E value_type;
+  typedef const _E &reference;
+  typedef const _E &const_reference;
+  typedef size_t size_type;
+
+  typedef const _E *iterator;
+  typedef const _E *const_iterator;
+
+  initializer_list() : __begin_(nullptr), __size_(0) {}
+
+  size_t size() const { return __size_; }
+  const _E *begin() const { return __begin_; }
+  const _E *end() const { return __begin_ + __size_; }
+};
+
+template 
+class vector {
+public:
+  vector(T){};
+  vector(std::initializer_list) {}
+};
+}
+
+class Bar {};
+
+Bar b;
+
+class Foo {
+public:
+  Foo(Bar);
+  explicit Foo(Bar, unsigned int);
+  Foo(unsigned int);
+};
+
+class Baz {
+public:
+  Foo m() {
+Bar b;
+return Foo(b);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+// CHECK-FIXES: return {b};
+  }
+};
+
+class Quux : public Foo {
+public:
+  Quux(Bar bar) : Foo(bar){};
+};
+
+Foo f() {
+  Bar b;
+  return Foo(b);
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {b};
+}
+
+Foo f2() {
+  Bar b;
+  return {b};
+}
+
+auto f3() {
+  Bar b;
+  return Foo(b);
+}
+
+#define A(b) Foo(b)
+
+Foo f4() {
+  Bar b;
+  return A(b);
+}
+
+Foo f5() {
+  Bar b;
+  return Quux(b);
+}
+
+Foo f6() {
+  Bar b;
+  return Foo(b, 1);
+}
+
+std::vector f7() {
+  int i = 1;
+  return std::vector(i);
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {i};
+}
+
+Bar f8() {
+  return {};
+}
+
+Bar f9() {
+  return Bar();
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {};
+}
+
+Bar f10() {
+  return Bar{};
+}
+
+Foo f11(Bar b) {
+  return Foo(b);
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {b};
+}
+
+Foo f12() {
+  return f11(Bar());
+}
+
+Foo f13() {
+  return Foo(Bar());
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {Bar()};
+}
+
+Foo f14() {
+  // FIXME: Type narrowing should not occur!
+  return Foo(-1);
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {-1};
+}
+
+Foo f15() {
+  return Foo(f10());
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: to avoid repeating the return type from the declaration, use a braced initializer list instead [modernize-return-braced-init-list]
+  // CHECK-FIXES: return {f10()};
+}
+
+template 
+T f16() {
+  return T();
+}
+
+Bar i1 = f16();
+Baz i2 = f16();
+
+template 
+Foo f17(T t) {
+  return Foo(t);
+}
+
+Foo i3 = f17(b);
+
+template 
+class BazT {
+public:
+  T m() {
+Bar b;
+return T(b);
+  }
+
+  Foo m2(T t) {
+return Foo(t);
+  }
+};
+
+BazT bazFoo;
+Foo i4 = bazFoo.m();
+Foo i5 = bazFoo.m2(b);
+
+BazT bazQuux;
+Foo i6 = bazQuux.m();
+Foo i7 = bazQuux.m2(b);
+
+auto v1 = []() { return std::vector({1, 2}); }();
+auto v2 = []() -> std::vector { return std::vector({1, 2}); }();
Index: docs/clang-tidy/checks/modernize-return-braced-init-list.rst

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

2017-02-09 Thread Will Dietz via Phabricator via cfe-commits
dtzWill requested changes to this revision.
dtzWill added a comment.
This revision now requires changes to proceed.

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

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.

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.

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


https://reviews.llvm.org/D29369



___
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 Sanne Wouda via Phabricator via cfe-commits
sanwou01 created this revision.

Add a test for improved inline assembly diagnostics in llvm.


https://reviews.llvm.org/D29770

Files:
  test/Misc/inline-asm-diags.c


Index: test/Misc/inline-asm-diags.c
===
--- /dev/null
+++ test/Misc/inline-asm-diags.c
@@ -0,0 +1,31 @@
+// RUN: not %clang -c --target=armv7a-arm-none-eabi %s -o /dev/null 2>&1 | 
FileCheck %s
+
+void foo2() {
+   asm(" wibble");
+}
+
+// CHECK: 4:6: error: invalid instruction
+// CHECK:   asm(" wibble");
+// CHECK:   ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  wibble
+// CHECK:  ^~
+
+void foo() {
+   asm(" .word -bar");
+   asm(" .word -foo");
+}
+
+// CHECK: :15:6: error: expected relocatable expression
+// CHECK:  .word -bar
+// CHECK:  ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  .word -bar
+// CHECK:  ^
+
+// CHECK: :16:6: error: expected relocatable expression
+// CHECK:  .word -foo
+// CHECK:  ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  .word -foo
+// CHECK:  ^


Index: test/Misc/inline-asm-diags.c
===
--- /dev/null
+++ test/Misc/inline-asm-diags.c
@@ -0,0 +1,31 @@
+// RUN: not %clang -c --target=armv7a-arm-none-eabi %s -o /dev/null 2>&1 | FileCheck %s
+
+void foo2() {
+	asm(" wibble");
+}
+
+// CHECK: 4:6: error: invalid instruction
+// CHECK:   asm(" wibble");
+// CHECK:   ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  wibble
+// CHECK:  ^~
+
+void foo() {
+	asm(" .word -bar");
+	asm(" .word -foo");
+}
+
+// CHECK: :15:6: error: expected relocatable expression
+// CHECK:  .word -bar
+// CHECK:  ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  .word -bar
+// CHECK:  ^
+
+// CHECK: :16:6: error: expected relocatable expression
+// CHECK:  .word -foo
+// CHECK:  ^
+// CHECK: :1:3: note: instantiated into assembly here
+// CHECK:  .word -foo
+// CHECK:  ^
___
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 Sanne Wouda via Phabricator via cfe-commits
sanwou01 added a comment.

This tests the improved inline asm diagnostics from 
https://reviews.llvm.org/D29769.


https://reviews.llvm.org/D29770



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


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

2017-02-09 Thread Jacob Gravelle via Phabricator via cfe-commits
jgravelle-google added a comment.

https://clang.llvm.org/compatibility.html doesn't mention anything about POSIX, 
only C11 compliance, so I didn't think Clang in general cared about POSIX.
That being said I can definitely agree that Clang shouldn't preclude POSIX. 
I'll open a more-general diff.


https://reviews.llvm.org/D29736



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


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

2017-02-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Test case?




Comment at: lib/Frontend/CompilerInvocation.cpp:1709
+Diags.Report(diag::note_drv_supported_value_with_description)
+  << Std.getName() << Std.getDescription();
+  }

Is it possible to change the diagnostic so that it's easier to tell which part 
is the supported value and which part is the description?

The diagnostic looks like this, and I found it a little hard to tell at a quick 
glance:

"c89 - ISO C 1990" 


https://reviews.llvm.org/D29724



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


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

2017-02-09 Thread Mateusz Mikuła via Phabricator via cfe-commits
mati865 updated this revision to Diff 87827.
mati865 added a comment.

Removed adding GCC includes for all mingw hosts.


https://reviews.llvm.org/D29464

Files:
  lib/Driver/MinGWToolChain.cpp
  test/Driver/mingw.cpp

Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -7,53 +7,41 @@
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"
 // CHECK_MINGW_ORG_TREE: "{{.*}}{{/|}}Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}backward"
-// CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include"
-// CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include-fixed"
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}mingw32{{/|}}include"
 // CHECK_MINGW_ORG_TREE: {{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}include
 
 
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_builds_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_BUILDS_TREE %s
 // CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++"
 // CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}i686-w64-mingw32"
 // CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}backward"
-// CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}lib{{/|}}gcc{{/|}}i686-w64-mingw32{{/|}}4.9.1{{/|}}include"
-// CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}lib{{/|}}gcc{{/|}}i686-w64-mingw32{{/|}}4.9.1{{/|}}include-fixed"
 // CHECK_MINGW_BUILDS_TREE: "{{.*}}/Inputs/mingw_mingw_builds_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include"
 
 
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_msys2_tree/msys64/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_MSYS_TREE %s
 // CHECK_MINGW_MSYS_TREE: "{{.*}}/Inputs/mingw_msys2_tree/msys64{{/|}}mingw32{{/|}}include{{/|}}c++{{/|}}4.9.2"
 // CHECK_MINGW_MSYS_TREE: "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}include{{/|}}c++{{/|}}4.9.2{{/|}}i686-w64-mingw32"
 // CHECK_MINGW_MSYS_TREE: "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}include{{/|}}c++{{/|}}4.9.2{{/|}}backward"
-// CHECK_MINGW_MSYS_TREE:  "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}lib{{/|}}gcc{{/|}}i686-w64-mingw32{{/|}}4.9.2{{/|}}include"
-// CHECK_MINGW_MSYS_TREE:  "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}lib{{/|}}gcc{{/|}}i686-w64-mingw32{{/|}}4.9.2{{/|}}include-fixed"
 // CHECK_MINGW_MSYS_TREE: "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}i686-w64-mingw32{{/|}}include"
 // CHECK_MINGW_MSYS_TREE: "{{.*}}/Inputs/mingw_msys2_tree/msys64/mingw32{{/|}}include"
 
 
 // RUN: %clang -target x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_opensuse_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_OPENSUSE_TREE %s
 // CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}lib64{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.1.0{{/|}}include{{/|}}c++"
 // CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}lib64{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.1.0{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32"
 // CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}lib64{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.1.0{{/|}}include{{/|}}c++{{/|}}backward"
-// CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}lib64{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.1.0{{/|}}include"
 // CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}x86_64-w64-mingw32/sys-root/mingw/include"
-// CHECK_MINGW_OPENSUSE_TREE: "{{.*}}/Inputs/mingw_opensuse_tree/usr{{/|}}lib64{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.1.0{{/|}}include-fixed"
 
 
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_arch_tree/usr %s 2>&1 | FileCheck -check-prefix=CH

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

2017-02-09 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: test/Misc/inline-asm-diags.c:1
+// RUN: not %clang -c --target=armv7a-arm-none-eabi %s -o /dev/null 2>&1 | 
FileCheck %s
+

Use `clang -cc1 -S -o /dev/null -verify` to test this.


https://reviews.llvm.org/D29770



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


[PATCH] D29772: Create msbuild only when using MSVC

2017-02-09 Thread Mateusz Mikuła via Phabricator via cfe-commits
mati865 created this revision.
mati865 added a project: clang-c.
Herald added a subscriber: mgorny.

https://reviews.llvm.org/D29772

Files:
  tools/driver/CMakeLists.txt


Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -61,7 +61,7 @@
 if(NOT CLANG_LINKS_TO_CREATE)
   set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
 
-  if (WIN32)
+  if (MSVC)
 list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
   endif()
 endif()


Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -61,7 +61,7 @@
 if(NOT CLANG_LINKS_TO_CREATE)
   set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
 
-  if (WIN32)
+  if (MSVC)
 list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
   endif()
 endif()
___
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 Mads Ravn via Phabricator via cfe-commits
madsravn updated this revision to Diff 87829.
madsravn added a comment.

Small change to check.
Minor changes to the lit test.


https://reviews.llvm.org/D29726

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


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


Index: test/clang-tidy/readability-delete-null-pointer.cpp
===
--- test/clang-tidy/readability-delete-null-pointer.cpp
+++ test/clang-tidy/readability-delete-null-pointer.cpp
@@ -59,6 +59,16 @@
   } else {
 c2 = c;
   }
+  struct A {
+void foo() {
+  if (mp) // #6
+delete mp;
+  // 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;
+}
+int *mp;
+  };
 }
 
 void g() {
Index: clang-tidy/readability/DeleteNullPointerCheck.h
===
--- clang-tidy/readability/DeleteNullPointerCheck.h
+++ clang-tidy/readability/DeleteNullPointerCheck.h
@@ -16,7 +16,8 @@
 namespace tidy {
 namespace readability {
 
-/// Check whether the 'if' statement is unnecessary before calling 'delete' on a pointer.
+/// Check whether the 'if' statement is unnecessary before calling 'delete' on a
+/// pointer.
 ///
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/readability-delete-null-pointer.html
Index: clang-tidy/readability/DeleteNullPointerCheck.cpp
===
--- clang-tidy/readability/DeleteNullPointerCheck.cpp
+++ clang-tidy/readability/DeleteNullPointerCheck.cpp
@@ -24,19 +24,28 @@
 to(decl(equalsBoundNode("deletedPointer"
   .bind("deleteExpr");
 
-  const auto PointerExpr =
- 

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

2017-02-09 Thread Mads Ravn via Phabricator via cfe-commits
madsravn marked 3 inline comments as done.
madsravn added inline comments.



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

alexfh wrote:
> nit: Will `has(anyOf(DeleteExpr, DeleteMemberExpr))` work?
I could swear that I had tried that. It seems like the obvious way to do it. It 
worked, though.


https://reviews.llvm.org/D29726



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


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

2017-02-09 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta created this revision.
Herald added subscribers: rengolin, aemerson.

This is a followup change to add v7ve support to clang for
gcc compatibility. Armv7ve addition to llvm is currently being
reviewed at https://reviews.llvm.org/D29472 .


https://reviews.llvm.org/D29773

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


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -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: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-acle-6.5.c
+++ 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: test/Preprocessor/arm-acle-6.4.c
===
--- test/Preprocessor/arm-acle-6.4.c
+++ 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: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ 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: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ 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: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-ac

r294604 - [windows] [asan] Add wholearchive flag when including asan_cxx lib.

2017-02-09 Thread Marcos Pividori via cfe-commits
Author: mpividori
Date: Thu Feb  9 12:22:35 2017
New Revision: 294604

URL: http://llvm.org/viewvc/llvm-project?rev=294604&view=rev
Log:
[windows] [asan] Add wholearchive flag when including asan_cxx lib.

We need -wholearchive for asan_cxx, the same than for asan.
Clang Driver will add asan_cxx at the beginning of the arg list that we pass to
the linker. To ensure that all the static libraries are linked to asan_cxx, we
force the linker to include the object files in asan_cxx.

This fixes some linker errors when compiling with address sanitizer for MT and
passing the static library libFuzzer.

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294604&r1=294603&r2=294604&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Feb  9 12:22:35 2017
@@ -11006,13 +11006,14 @@ void visualstudio::Linker::ConstructJob(
 } else if (DLL) {
   CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
 } else {
-  for (const auto &Lib : {"asan", "asan_cxx"})
+  for (const auto &Lib : {"asan", "asan_cxx"}) {
 CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
-  // Make sure the linker consider all object files from the static 
library.
-  // This is necessary because instrumented dlls need access to all the
-  // interface exported by the static lib in the main executable.
-  CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") +
-  TC.getCompilerRT(Args, "asan")));
+// Make sure the linker consider all object files from the static lib.
+// This is necessary because instrumented dlls need access to all the
+// interface exported by the static lib in the main executable.
+CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") +
+TC.getCompilerRT(Args, Lib)));
+  }
 }
   }
 


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


r294606 - [MS] Implement the __fastfail intrinsic as a builtin

2017-02-09 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Feb  9 12:31:06 2017
New Revision: 294606

URL: http://llvm.org/viewvc/llvm-project?rev=294606&view=rev
Log:
[MS] Implement the __fastfail intrinsic as a builtin

__fastfail terminates the process immediately with a special system
call. It does not run any process shutdown code or exception recovery
logic.

Fixes PR31854

Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=294606&r1=294605&r2=294606&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Thu Feb  9 12:31:06 2017
@@ -773,6 +773,7 @@ LANGBUILTIN(_rotr,   "UiUii", "n", A
 LANGBUILTIN(_lrotr,  "ULiULii",   "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotr64, "ULLiULLii", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__va_start,   "vc**.", "nt", ALL_MS_LANGUAGES)
+LANGBUILTIN(__fastfail, "vUi","nr", ALL_MS_LANGUAGES)
 
 // Microsoft library builtins.
 LIBBUILTIN(_setjmpex, "iJ", "fj",   "setjmpex.h", ALL_MS_LANGUAGES)

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=294606&r1=294605&r2=294606&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Feb  9 12:31:06 2017
@@ -482,10 +482,11 @@ enum class CodeGenFunction::MSVCIntrin {
   _InterlockedIncrement,
   _InterlockedOr,
   _InterlockedXor,
+  __fastfail,
 };
 
 Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID,
-  const CallExpr *E) {
+const CallExpr *E) {
   switch (BuiltinID) {
   case MSVCIntrin::_BitScanForward:
   case MSVCIntrin::_BitScanReverse: {
@@ -566,6 +567,37 @@ Value *CodeGenFunction::EmitMSVCBuiltinE
   llvm::AtomicOrdering::SequentiallyConsistent);
 return Builder.CreateAdd(RMWI, ConstantInt::get(IntTy, 1));
   }
+
+  case MSVCIntrin::__fastfail: {
+// Request immediate process termination from the kernel. The instruction
+// sequences to do this are documented on MSDN:
+// https://msdn.microsoft.com/en-us/library/dn774154.aspx
+llvm::Triple::ArchType ISA = getTarget().getTriple().getArch();
+StringRef Asm, Constraints;
+switch (ISA) {
+default:
+  ErrorUnsupported(E, "__fastfail call for this architecture");
+  break;
+case llvm::Triple::x86:
+case llvm::Triple::x86_64:
+  Asm = "int $$0x29";
+  Constraints = "{cx}";
+  break;
+case llvm::Triple::thumb:
+  Asm = "udf #251";
+  Constraints = "{r0}";
+  break;
+}
+llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, {Int32Ty}, 
false);
+llvm::InlineAsm *IA =
+llvm::InlineAsm::get(FTy, Asm, Constraints, /*SideEffects=*/true);
+llvm::AttributeSet NoReturnAttr =
+AttributeSet::get(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
+  llvm::Attribute::NoReturn);
+CallSite CS = Builder.CreateCall(IA, EmitScalarExpr(E->getArg(0)));
+CS.setAttributes(NoReturnAttr);
+return CS.getInstruction();
+  }
   }
   llvm_unreachable("Incorrect MSVC intrinsic!");
 }
@@ -2276,6 +2308,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 break;
   }
 
+  case Builtin::BI__fastfail: {
+return RValue::get(EmitMSVCBuiltinExpr(MSVCIntrin::__fastfail, E));
+break;
+  }
+
   case Builtin::BI__builtin_coro_size: {
 auto & Context = getContext();
 auto SizeTy = Context.getSizeType();

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=294606&r1=294605&r2=294606&view=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Thu Feb  9 12:31:06 2017
@@ -69,7 +69,6 @@ static __inline__
 __int64 __emul(int, int);
 static __inline__
 unsigned __int64 __emulu(unsigned int, unsigned int);
-void __cdecl __fastfail(unsigned int);
 unsigned int __getcallerseflags(void);
 static __inline__
 void __halt(void);

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=294606&r1=294605&r2=294606&view=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Thu Feb  9 12:31:06 2017
@@ -3,7 +3,7 @@
 // RUN: | FileCheck %s -check-prefixes CHECK,CHECK-I386,CHECK-INTEL
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility

[clang-tools-extra] r294607 - [clang-tidy] Add -quiet option to suppress extra output

2017-02-09 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Thu Feb  9 12:32:02 2017
New Revision: 294607

URL: http://llvm.org/viewvc/llvm-project?rev=294607&view=rev
Log:
[clang-tidy] Add -quiet option to suppress extra output

Summary:
This new flag instructs clang-tidy to not output anything
except for errors and warnings.  This makes it easier to
script clang-tidy to run as part of external build systems.

Reviewers: bkramer, alexfh, klimek

Subscribers: JDevlieghere, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
clang-tools-extra/trunk/test/clang-tidy/werrors-diagnostics.cpp
clang-tools-extra/trunk/test/clang-tidy/werrors-plural.cpp
clang-tools-extra/trunk/test/clang-tidy/werrors.cpp

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=294607&r1=294606&r2=294607&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Thu Feb  9 
12:32:02 2017
@@ -188,6 +188,15 @@ code with clang-apply-replacements.
 cl::value_desc("filename"),
 cl::cat(ClangTidyCategory));
 
+static cl::opt Quiet("quiet", cl::desc(R"(
+Run clang-tidy in quiet mode.  This suppresses
+printing statistics about ignored warnings and
+warnings treated as errors if the respective
+options are specified.
+)"),
+   cl::init(false),
+   cl::cat(ClangTidyCategory));
+
 namespace clang {
 namespace tidy {
 
@@ -406,19 +415,23 @@ static int clangTidyMain(int argc, const
 exportReplacements(FilePath.str(), Errors, OS);
   }
 
-  printStats(Stats);
-  if (DisableFixes)
-llvm::errs()
-<< "Found compiler errors, but -fix-errors was not specified.\n"
-   "Fixes have NOT been applied.\n\n";
+  if (!Quiet) {
+printStats(Stats);
+if (DisableFixes)
+  llvm::errs()
+  << "Found compiler errors, but -fix-errors was not specified.\n"
+ "Fixes have NOT been applied.\n\n";
+  }
 
   if (EnableCheckProfile)
 printProfileData(Profile, llvm::errs());
 
   if (WErrorCount) {
-StringRef Plural = WErrorCount == 1 ? "" : "s";
-llvm::errs() << WErrorCount << " warning" << Plural << " treated as error"
- << Plural << "\n";
+if (!Quiet) {
+  StringRef Plural = WErrorCount == 1 ? "" : "s";
+  llvm::errs() << WErrorCount << " warning" << Plural << " treated as 
error"
+   << Plural << "\n";
+}
 return WErrorCount;
   }
 

Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=294607&r1=294606&r2=294607&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Thu Feb  9 
12:32:02 2017
@@ -63,6 +63,8 @@ def main():
   action='append', default=[],
   help='Additional argument to prepend to the compiler '
   'command line.')
+  parser.add_argument('-quiet', action='store_true', default=False,
+  help='Run clang-tidy in quiet mode')
   clang_tidy_args = []
   argv = sys.argv[1:]
   if '--' in argv:
@@ -120,6 +122,8 @@ def main():
 command.append('-fix')
   if args.checks != '':
 command.append('-checks=' + quote + args.checks + quote)
+  if args.quiet:
+command.append('-quiet')
   command.extend(lines_by_file.keys())
   for arg in args.extra_arg:
   command.append('-extra-arg=%s' % arg)

Modified: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py?rev=294607&r1=294606&r2=294607&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py Thu Feb  9 
12:32:02 2017
@@ -59,7 +59,7 @@ def find_compilation_database(path):
 
 
 def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
-header_filter, extra_arg, extra_arg_before):
+header_filter, extra_arg, extra_arg_before, quiet):
   """Gets a command line for clang-tidy."""
   start = [clan

[PATCH] D29661: [clang-tidy] Add -quiet option to suppress extra output

2017-02-09 Thread Ehsan Akhgari via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294607: [clang-tidy] Add -quiet option to suppress extra 
output (authored by ehsan).

Changed prior to commit:
  https://reviews.llvm.org/D29661?vs=87469&id=87842#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29661

Files:
  clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
  clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
  clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
  clang-tools-extra/trunk/test/clang-tidy/werrors-diagnostics.cpp
  clang-tools-extra/trunk/test/clang-tidy/werrors-plural.cpp
  clang-tools-extra/trunk/test/clang-tidy/werrors.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
@@ -1,45 +1,73 @@
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck %s
+// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK-QUIET %s
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK2 %s
+// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK2-QUIET %s
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='header2\.h' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK3 %s
+// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='header2\.h' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK3-QUIET %s
 // FIXME: "-I %S/Inputs/file-filter/system/.." must be redundant.
 //   On Win32, file-filter/system\system-header1.h precedes
 //   file-filter\header*.h due to code order between '/' and '\\'.
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4 %s
+// RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers -quiet %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4-QUIET %s
 
 #include "header1.h"
 // CHECK-NOT: warning:
+// CHECK-QUIET-NOT: warning:
 // CHECK2: header1.h:1:12: warning: single-argument constructors must be marked explicit
+// CHECK2-QUIET: header1.h:1:12: warning: single-argument constructors must be marked explicit
 // CHECK3-NOT: warning:
+// CHECK3-QUIET-NOT: warning:
 // CHECK4: header1.h:1:12: warning: single-argument constructors
+// CHECK4-QUIET: header1.h:1:12: warning: single-argument constructors
 
 #include "header2.h"
 // CHECK-NOT: warning:
+// CHECK-QUIET-NOT: warning:
 // CHECK2: header2.h:1:12: warning: single-argument constructors
+// CHECK2-QUIET: header2.h:1:12: warning: single-argument constructors
 // CHECK3: header2.h:1:12: warning: single-argument constructors
+// CHECK3-QUIET: header2.h:1:12: warning: single-argument constructors
 // CHECK4: header2.h:1:12: warning: single-argument constructors
+// CHECK4-QUIET: header2.h:1:12: warning: single-argument constructors
 
 #include 
 // CHECK-NOT: warning:
+// CHECK-QUIET-NOT: warning:
 // CHECK2-NOT: warning:
+// CHECK2-QUIET-NOT: warning:
 // CHECK3-NOT: warning:
+// CHECK3-QUIET-NOT: warning:
 // CHECK4: system-header.h:1:12: warning: single-argument constructors
+// CHECK4-QUIET: system-header.h:1:12: warning: single-argument constructors
 
 class A { A(int); };
 // CHECK: :[[@LINE-1]]:11: warning: single-argument constructors
-// CHECK2: :[[@LINE-2]]:11: warning: single-argument constructors
-// CHECK3: :[[@LINE-3]]:11: warning: single-argument constructors
-// CHECK4: :[[@LINE-4]]:11: warning: single-argument constructors
+// CHECK-QUIET: :[[@LINE-2]]:11: warning: single-argument constructors
+// CHECK2: :[[@LINE-3]]:11: warning: single-argument constructors
+// CHECK2-QUIET: :[[@LINE-4]]:11: warning: single-argument constructors
+// CHECK3: :[[@LINE-5]]:11: warning: single-argument constructors
+// CHECK3-QUIET: :[[@LINE-6]]:11: warning: single-argument constructors
+// CHECK4: :[[@LINE-7]]:11: warning: single-argument constructors
+// CHECK4-QUIET: :[[@LINE-8]]:11: warning: single-argument constructors
 
 // CHECK-NOT: warning:
+

[libclc] r294608 - math: Add native_rsqrt builtin function

2017-02-09 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Thu Feb  9 12:39:26 2017
New Revision: 294608

URL: http://llvm.org/viewvc/llvm-project?rev=294608&view=rev
Log:
math: Add native_rsqrt builtin function

Trivial define to rsqrt.

Patch by Vedran Miletić 

Added:
libclc/trunk/generic/include/clc/math/native_rsqrt.h
Modified:
libclc/trunk/generic/include/clc/clc.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=294608&r1=294607&r2=294608&view=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Feb  9 12:39:26 2017
@@ -102,6 +102,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* 6.11.2.1 Floating-point macros */

Added: libclc/trunk/generic/include/clc/math/native_rsqrt.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_rsqrt.h?rev=294608&view=auto
==
--- libclc/trunk/generic/include/clc/math/native_rsqrt.h (added)
+++ libclc/trunk/generic/include/clc/math/native_rsqrt.h Thu Feb  9 12:39:26 
2017
@@ -0,0 +1 @@
+#define native_rsqrt rsqrt


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


r294609 - [windows] Fix test for cl driver.

2017-02-09 Thread Marcos Pividori via cfe-commits
Author: mpividori
Date: Thu Feb  9 12:40:52 2017
New Revision: 294609

URL: http://llvm.org/viewvc/llvm-project?rev=294609&view=rev
Log:
[windows] Fix test for cl driver.

cl-link.c test was failing after r294604 because of the change in the order of
parameters.

Modified:
cfe/trunk/test/Driver/cl-link.c

Modified: cfe/trunk/test/Driver/cl-link.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-link.c?rev=294609&r1=294608&r2=294609&view=diff
==
--- cfe/trunk/test/Driver/cl-link.c (original)
+++ cfe/trunk/test/Driver/cl-link.c Thu Feb  9 12:40:52 2017
@@ -14,8 +14,9 @@
 // ASAN: "-debug"
 // ASAN: "-incremental:no"
 // ASAN: "{{[^"]*}}clang_rt.asan-i386.lib"
-// ASAN: "{{.*}}clang_rt.asan_cxx-i386.lib"
 // ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib"
+// ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib"
+// ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib"
 // ASAN: "{{.*}}cl-link{{.*}}.obj"
 
 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -### 
-fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s


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


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

2017-02-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


https://reviews.llvm.org/D29718



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


[libcxx] 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 13:01:22 2017
New Revision: 294612

URL: http://llvm.org/viewvc/llvm-project?rev=294612&view=rev
Log:
Fix PR31916 - std::visit rejects visitors accepting lvalue arguments

A static assertion was misfiring since it checked
is_callable.value)>. 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&r1=294611&r2=294612&view=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&r1=294611&r2=294612&view=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


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

2017-02-09 Thread Eric Fiselier via cfe-commits
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 <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Thu Feb  9 13:01:22 2017
> New Revision: 294612
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294612&view=rev
> Log:
> Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
>
> A static assertion was misfiring since it checked
> is_callable.value)>. 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&r1=294611&r2=294612&view=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&r1=294611&r2=294612&view=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] 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.

The gcc include dirs in mingw contains headers not available esewhere and thus 
can't be removed.
Notable examples,

  omp.h - OpenMP functions
  openacc.h - OpenACC functions
  quadmath.h - QUADMATH functions


https://reviews.llvm.org/D29464



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


r294613 - [c++1z] P0091R3: Basic support for deducing class template arguments via deduction-guides.

2017-02-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Feb  9 13:17:44 2017
New Revision: 294613

URL: http://llvm.org/viewvc/llvm-project?rev=294613&view=rev
Log:
[c++1z] P0091R3: Basic support for deducing class template arguments via 
deduction-guides.

Added:
cfe/trunk/test/CXX/expr/expr.post/expr.type.conv/p1.cpp
cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/

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/AST/ExprCXX.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/test/CXX/temp/temp.deduct.guide/p2.cpp
cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=294613&r1=294612&r2=294613&view=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Feb  9 13:17:44 2017
@@ -1470,7 +1470,8 @@ class CXXTemporaryObjectExpr : public CX
 public:
   CXXTemporaryObjectExpr(const ASTContext &C,
  CXXConstructorDecl *Cons,
- TypeSourceInfo *Type,
+ QualType Type,
+ TypeSourceInfo *TSI,
  ArrayRef Args,
  SourceRange ParenOrBraceRange,
  bool HadMultipleCandidates,

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=294613&r1=294612&r2=294613&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu Feb  9 13:17:44 2017
@@ -4115,7 +4115,10 @@ class DeducedType : public Type {
 protected:
   DeducedType(TypeClass TC, QualType DeducedAsType, bool IsDependent,
   bool IsInstantiationDependent, bool ContainsParameterPack)
-  : Type(TC, DeducedAsType.isNull() ? QualType(this, 0) : DeducedAsType,
+  : Type(TC,
+ // FIXME: Retain the sugared deduced type?
+ DeducedAsType.isNull() ? QualType(this, 0)
+: DeducedAsType.getCanonicalType(),
  IsDependent, IsInstantiationDependent,
  /*VariablyModified=*/false, ContainsParameterPack) {
 if (!DeducedAsType.isNull()) {

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=294613&r1=294612&r2=294613&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb  9 13:17:44 
2017
@@ -1849,8 +1849,8 @@ def warn_cxx98_compat_temp_copy : Warnin
   InGroup, DefaultIgnore;
 def err_selected_explicit_constructor : Error<
   "chosen constructor is explicit in copy-initialization">;
-def note_constructor_declared_here : Note<
-  "constructor declared here">;
+def note_explicit_ctor_deduction_guide_here : Note<
+  "explicit %select{constructor|deduction guide}0 declared here">;
 
 // C++11 decltype
 def err_decltype_in_declarator : Error<
@@ -1961,8 +1961,23 @@ def err_deduced_class_template_compound_
   "cannot %select{form pointer to|form reference to|form array of|"
   "form function returning|use parentheses when declaring variable with}0 "
   "deduced class template specialization type">;
-def err_deduced_class_template_not_supported : Error<
-  "deduction of template arguments for class templates is not yet supported">;
+def err_deduced_non_class_template_specialization_type : Error<
+  "%select{|function template|variable template|alias template|"
+  "template template parameter|template}0 %1 requires template arguments; "
+  "argument deduction only allowed for class templates">;
+def err_deduced_class_template_ctor_ambiguous : Error<
+  "ambiguous deduction for template arguments of %0">;
+def err_deduced_class_template_ctor_no_viable : Error<
+  "no viable constructor or deduction guide for deduction of "
+  "template arguments of %0">;
+def err_deduced_class_template_incomplete : Error<
+  "template %0 has no definition and no %select{|viable }1deduction guides "
+  "for deduction of template arguments">;
+def err_

[PATCH] D29778: Declare lgamma library builtins as never being const

2017-02-09 Thread Jacob Gravelle via Phabricator via cfe-commits
jgravelle-google created this revision.

POSIX requires lgamma writes to an external global variable, signgam.
This prevents annotating lgamma with readnone, which is incorrect on
targets that write to signgam.


https://reviews.llvm.org/D29778

Files:
  include/clang/Basic/Builtins.def
  test/CodeGen/libcall-declarations.c


Index: test/CodeGen/libcall-declarations.c
===
--- test/CodeGen/libcall-declarations.c
+++ test/CodeGen/libcall-declarations.c
@@ -402,9 +402,9 @@
 // CHECK-NOERRNO: declare i32 @ilogb(double) [[NUW]]
 // CHECK-NOERRNO: declare i32 @ilogbf(float) [[NUW]]
 // CHECK-NOERRNO: declare i32 @ilogbl(x86_fp80) [[NUW]]
-// CHECK-NOERRNO: declare double @lgamma(double) [[NUW]]
-// CHECK-NOERRNO: declare float @lgammaf(float) [[NUW]]
-// CHECK-NOERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NUW]]
+// CHECK-NOERRNO: declare double @lgamma(double) [[NONCONST:#[0-9]+]]
+// CHECK-NOERRNO: declare float @lgammaf(float) [[NONCONST]]
+// CHECK-NOERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NONCONST]]
 // CHECK-NOERRNO: declare i64 @llrint(double) [[NUW]]
 // CHECK-NOERRNO: declare i64 @llrintf(float) [[NUW]]
 // CHECK-NOERRNO: declare i64 @llrintl(x86_fp80) [[NUW]]
@@ -554,6 +554,9 @@
 // CHECK-ERRNO: declare double @fmin(double, double) [[NUW]]
 // CHECK-ERRNO: declare float @fminf(float, float) [[NUW]]
 // CHECK-ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[NUW]]
+// CHECK-ERRNO: declare double @lgamma(double) [[NONCONST:#[0-9]+]]
+// CHECK-ERRNO: declare float @lgammaf(float) [[NONCONST]]
+// CHECK-ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NONCONST]]
 // CHECK-ERRNO: declare double @nearbyint(double) [[NUW]]
 // CHECK-ERRNO: declare float @nearbyintf(float) [[NUW]]
 // CHECK-ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[NUW]]
@@ -612,5 +615,11 @@
 // CHECK-ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[NUW]]
 
 // CHECK-NOERRNO: attributes [[NUW]] = { nounwind readnone{{.*}} }
+// CHECK-NOERRNO: attributes [[NONCONST]] = {
+// CHECK-NOERRNO-NOT: readnone
+// CHECK-NOERRNO-SAME: nounwind{{.*}} }
 
+// CHECK-ERRNO: attributes [[NONCONST]] = {
+// CHECK-ERRNO-NOT: readnone
+// CHECK-ERRNO-SAME: nounwind{{.*}} }
 // CHECK-ERRNO: attributes [[NUW]] = { nounwind readnone{{.*}} }
Index: include/clang/Basic/Builtins.def
===
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -1086,9 +1086,9 @@
 LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES)
 
-LIBBUILTIN(lgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
-LIBBUILTIN(lgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
-LIBBUILTIN(lgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(lgamma, "dd", "fn", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(lgammaf, "ff", "fn", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(lgammal, "LdLd", "fn", "math.h", ALL_LANGUAGES)
 
 LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES)


Index: test/CodeGen/libcall-declarations.c
===
--- test/CodeGen/libcall-declarations.c
+++ test/CodeGen/libcall-declarations.c
@@ -402,9 +402,9 @@
 // CHECK-NOERRNO: declare i32 @ilogb(double) [[NUW]]
 // CHECK-NOERRNO: declare i32 @ilogbf(float) [[NUW]]
 // CHECK-NOERRNO: declare i32 @ilogbl(x86_fp80) [[NUW]]
-// CHECK-NOERRNO: declare double @lgamma(double) [[NUW]]
-// CHECK-NOERRNO: declare float @lgammaf(float) [[NUW]]
-// CHECK-NOERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NUW]]
+// CHECK-NOERRNO: declare double @lgamma(double) [[NONCONST:#[0-9]+]]
+// CHECK-NOERRNO: declare float @lgammaf(float) [[NONCONST]]
+// CHECK-NOERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NONCONST]]
 // CHECK-NOERRNO: declare i64 @llrint(double) [[NUW]]
 // CHECK-NOERRNO: declare i64 @llrintf(float) [[NUW]]
 // CHECK-NOERRNO: declare i64 @llrintl(x86_fp80) [[NUW]]
@@ -554,6 +554,9 @@
 // CHECK-ERRNO: declare double @fmin(double, double) [[NUW]]
 // CHECK-ERRNO: declare float @fminf(float, float) [[NUW]]
 // CHECK-ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[NUW]]
+// CHECK-ERRNO: declare double @lgamma(double) [[NONCONST:#[0-9]+]]
+// CHECK-ERRNO: declare float @lgammaf(float) [[NONCONST]]
+// CHECK-ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NONCONST]]
 // CHECK-ERRNO: declare double @nearbyint(double) [[NUW]]
 // CHECK-ERRNO: declare float @nearbyintf(float) [[NUW]]
 // CHECK-ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[NUW]]
@@ -612,5 +615,11 @@
 // CHECK-ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[NUW]]
 
 // CHECK-NOERRNO: attributes [[NUW]] = { nounwind readnone{{.*}} }
+// CHECK-NOERRNO: attributes [[NONCONST]] = {
+// CHECK-NOERRNO-NOT: readnone
+// CHECK-NOERRNO-SAME: nounwind{{.*}} }
 
+// CHECK-ERRNO: attributes [[NONCONST]] = {
+// CHECK-ERRNO-NOT: readnone
+// CHECK-ERRNO-SAME: nounwind{{.*}} 

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

2017-02-09 Thread Mateusz Mikuła via Phabricator via cfe-commits
mati865 marked an inline comment as done.
mati865 added a comment.

@yaron.keren those includes are not available in native Linux Clang:

  float128_ex.cc:2:10: fatal error: 'quadmath.h' file not found
  #include 
   ^

And at least 2 of GCC includes clash with Clang includes:

- limits.h - explained above, guards are preventing including of mingw-w64 
limits.h
- ia32intrin.h - compilation errors, not investigated further as this patch 
fixed it

If those changes are not wanted this Diff can be closed and it will be used as 
local patch for MSYS2 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] 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


[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] 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 RedeclACMis

[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


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&view=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&r1=294621&r2=294622&view=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 &Previous,
-bool IsExplicitSpecialization);
+bool IsMemberSpecialization);
   bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl);
   void CheckMain(FunctionDecl *FD, const DeclSpec &D);
   void CheckMSVCRTEntryPoint(FunctionDecl *FD);
@@ -5918,7 +5918,7 @@ public:
   SourceLocation DeclStartLoc, SourceLocation DeclLoc,
   const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
   ArrayRef ParamLists,
-  bool IsFriend, bool &IsExplicitSpecialization, bool &Invalid);
+  bool IsFriend, bool &IsMemberSpecialization, bool &Invalid);
 
   DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
 SourceLocation KWLoc, CXXScopeSpec &SS,

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294622&r1=294621&r2=294622&view=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);
-isExpli

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&view=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&r1=294622&r2=294623&view=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


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&view=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&r1=294625&r2=294626&view=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


[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


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&view=rev
>> Log:
>> Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
>>
>> A static assertion was misfiring since it checked
>> is_callable.value)>. 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&r1=294611&r2=294612&view=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&r1=294611&r2=294612&view=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] 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


[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 &n; }(); // 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 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 &Code,
- const std::string &Expected,
- const T &AMatcher,
- RefactoringCallback &Callback) {
-  MatchFinder Finder;
+void expectRewritten(const std::string &Code, const std::string &Expected,
+ const T &AMatcher, RefactoringCallback &Callback) {
+  std::map FileToReplace;
+  ASTMatchRefactorer Finder(FileToReplace);
   Finder.addMatcher(AMatcher, &Callback);
   std::unique_ptr Factory(
   tooling::newFrontendActionFactory(&Finder));
   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 = Repl

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&view=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&r1=294636&r2=294637&view=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&r1=294636&r2=294637&view=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&r1=294636&r2=294637&view=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&r1=294636&r2=294637&view=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 m

[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&id=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 &SD);
 
+  /// 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 &II,
+const MacroInfo &MI,
+Preprocessor &PP, raw_ostream &Name,
+raw_ostream &Value) {
+  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 << ',';
+  }
+
+  

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&view=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&r1=294638&r2=294639&view=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&r1=294638&r2=294639&view=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 void f(T);
+template void f(int); // expected-error {{expected '<' after 
'template'}}
+template void f(float); // expected-error {{expected '<' after 'template'}}
+extern template // expected-error {{expected member name or ';'}}
+  void f(double);
+  };
+}

Modified: cfe/trunk/test/Parser/eof.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/eof.cpp?rev=294639&r1=294638&r2=294639&view=diff
==
--- cfe/trunk/test/Parser/eof.cpp (original)
+++ cfe/trunk/test/Parser/eof.cpp Thu Feb  9 16:14:25 2017
@@ -1,6 +1,6 @@
 // RUN: not %clang_cc1 %s -fsyntax-only 2>&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&r1=294638&r2=294639&view=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: cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp?rev=294639&r1=294638&r2=294639&view=diff
=

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&view=rev
Log:
Add C/C++ header locations for the Freescale SDK.

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

With minor modifications, patch by Tobias von Koch!

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

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

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

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

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

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

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

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


So, this is really bad it turns out.

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


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


Can we do something different here?


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&view=auto

==
(empty)

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

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

==
(empty)

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

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

==
(empty)

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

http://llvm.org/v

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

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

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



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

Add period to this sentence.


https://reviews.llvm.org/D25674



___
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 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


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&view=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&r1=294640&r2=294641&view=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&r1=294640&r2=294641&view=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&r1=294640&r2=294641&view=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&r1=294640&r2=294641&view=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 s

[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&view=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&r1=294643&r2=294644&view=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&r1=294643&r2=294644&view=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&r1=294643&r2=294644&view=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'))
  

[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&view=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&r1=294656&r2=294657&view=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


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&view=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&r1=294657&r2=294658&view=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


[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&view=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&r1=294659&r2=294660&view=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


[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&id=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 -targ

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&view=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&r1=294661&r2=294662&view=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&r1=294661&r2=294662&view=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&r1=294661&r2=294662&view=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&r1=294661&r2=294662&view=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 

[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


[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


[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&view=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&r1=294670&r2=294671&view=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


  1   2   >